package B2;

import F2.N;
import F2.f0;
import F2.g0;
import F2.r0;
import L1.A;
import L1.C0146w0;
import L1.InterfaceC0094e1;
import L1.T;
import L1.W1;
import L1.Y1;
import L1.Z;
import a.AbstractC0212a;
import a1.C0221h;
import a1.C0222i;
import a1.C0224k;
import android.app.Activity;
import android.content.ClipDescription;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.Log;
import android.util.TypedValue;
import androidx.fragment.app.RunnableC0268d;
import androidx.lifecycle.AbstractC0309p;
import androidx.lifecycle.S;
import androidx.lifecycle.V;
import androidx.lifecycle.X;
import androidx.lifecycle.Y;
import androidx.lifecycle.a0;
import androidx.lifecycle.c0;
import c1.C0337c;
import c1.InterfaceC0336b;
import c4.InterfaceC0342a;
import com.google.android.gms.internal.measurement.C0348b;
import com.google.android.gms.internal.measurement.I1;
import com.google.crypto.tink.shaded.protobuf.B;
import com.google.crypto.tink.shaded.protobuf.C0485n;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.w;
import e4.AbstractC0566j;
import f1.C0590a;
import f1.InterfaceC0591b;
import f3.C0600e;
import io.flutter.Build;
import io.sentry.C0732k1;
import io.sentry.ILogger;
import io.sentry.S1;
import io.sentry.android.core.EnumC0691v;
import j0.C0795a;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyStore;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.cert.Certificate;
import java.security.spec.AlgorithmParameterSpec;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import m.C0832A;
import m.a1;
import o1.C0925b;
import r4.AbstractC0983h;
import s1.C1009k;
import s1.C1012n;

/* JADX INFO: loaded from: classes.dex */
public class a implements E2.a, InterfaceC0094e1, Z, R.h, InterfaceC0336b, P1.c {

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static a f132o;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ int f133k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public Object f134l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public Object f135m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public Object f136n;

    public /* synthetic */ a(int i, boolean z5) {
        this.f133k = i;
    }

    public static a A(Context context, AttributeSet attributeSet, int[] iArr, int i) {
        return new a(context, context.obtainStyledAttributes(attributeSet, iArr, i, 0));
    }

    public static final a C(t2.f fVar, z2.b bVar) throws GeneralSecurityException, IOException {
        byte[] bArr = new byte[0];
        ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) fVar.f9984b;
        try {
            N nA = N.A(byteArrayInputStream, C0485n.a());
            byteArrayInputStream.close();
            if (nA.y().size() == 0) {
                throw new GeneralSecurityException("empty keyset");
            }
            try {
                g0 g0VarE = g0.E(bVar.b(nA.y().f(), bArr), C0485n.a());
                if (g0VarE.z() > 0) {
                    return o(g0VarE);
                }
                throw new GeneralSecurityException("empty keyset");
            } catch (B unused) {
                throw new GeneralSecurityException("invalid keyset, corrupted key material");
            }
        } catch (Throwable th) {
            byteArrayInputStream.close();
            throw th;
        }
    }

    public static final a o(g0 g0Var) throws GeneralSecurityException {
        if (g0Var.z() <= 0) {
            throw new GeneralSecurityException("empty keyset");
        }
        ArrayList arrayList = new ArrayList(g0Var.z());
        for (f0 f0Var : g0Var.A()) {
            f0Var.getClass();
            try {
                try {
                    t2.b bVarA = A2.j.f38b.a(A2.p.i(f0Var.A().B(), f0Var.A().C(), f0Var.A().A(), f0Var.C(), f0Var.C() == r0.RAW ? null : Integer.valueOf(f0Var.B())));
                    int iOrdinal = f0Var.D().ordinal();
                    if (iOrdinal != 1 && iOrdinal != 2 && iOrdinal != 3) {
                        throw new GeneralSecurityException("Unknown key status");
                    }
                    arrayList.add(new t2.h(bVarA));
                } catch (GeneralSecurityException unused) {
                    arrayList.add(null);
                }
            } catch (GeneralSecurityException e2) {
                throw new A2.u("Creating a protokey serialization failed", e2);
            }
        }
        return new a(g0Var, Collections.unmodifiableList(arrayList));
    }

    public void B(Activity activity, I0.l lVar) {
        AbstractC0983h.e("activity", activity);
        ReentrantLock reentrantLock = (ReentrantLock) this.f136n;
        reentrantLock.lock();
        WeakHashMap weakHashMap = (WeakHashMap) this.f134l;
        try {
            if (lVar.equals((I0.l) weakHashMap.get(activity))) {
                return;
            }
            reentrantLock.unlock();
            for (L0.k kVar : ((L0.l) ((g3.c) this.f135m).f6465l).f1273b) {
                if (kVar.f1267a.equals(activity)) {
                    kVar.f1269c = lVar;
                    kVar.f1268b.accept(lVar);
                }
            }
        } finally {
            reentrantLock.unlock();
        }
    }

    public void D() {
        ((TypedArray) this.f136n).recycle();
    }

    public void E(X0.a aVar) {
        c cVar = new c(20);
        C0222i c0222i = (C0222i) this.f135m;
        X0.c cVar2 = (X0.c) this.f136n;
        a1.o oVar = (a1.o) this.f134l;
        X0.d dVar = X0.d.f3254k;
        a aVarA = C0222i.a();
        aVarA.F(c0222i.f3582a);
        aVarA.f134l = dVar;
        aVarA.f136n = c0222i.f3583b;
        C0222i c0222iL = aVarA.l();
        A2.p pVar = new A2.p();
        pVar.f52e = new HashMap();
        pVar.f50c = Long.valueOf(oVar.f3598a.b());
        pVar.f51d = Long.valueOf(oVar.f3599b.b());
        pVar.f48a = "FCM_CLIENT_EVENT_LOGGING";
        C0600e c0600e = aVar.f3250a;
        a aVar2 = com.google.firebase.messaging.s.f5920a;
        aVar2.getClass();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            aVar2.m(byteArrayOutputStream, c0600e);
        } catch (IOException unused) {
        }
        pVar.f49b = new C0224k(cVar2, byteArrayOutputStream.toByteArray());
        pVar.f53f = null;
        C0221h c0221hH = pVar.h();
        C0590a c0590a = (C0590a) oVar.f3600c;
        c0590a.getClass();
        c0590a.f6340b.execute(new RunnableC0268d(c0590a, c0222iL, cVar, c0221hH));
    }

    public void F(String str) {
        if (str == null) {
            throw new NullPointerException("Null backendName");
        }
        this.f135m = str;
    }

    public void G(int i) throws InvalidAlgorithmParameterException {
        if (i != 16 && i != 32) {
            throw new InvalidAlgorithmParameterException(String.format("Invalid key size %d; only 128-bit and 256-bit AES keys are supported", Integer.valueOf(i * 8)));
        }
        this.f134l = Integer.valueOf(i);
    }

    public synchronized void H(int i, int i5, long j5, long j6) {
        ((C0146w0) this.f135m).f2040u.getClass();
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        AtomicLong atomicLong = (AtomicLong) this.f134l;
        if (atomicLong.get() != -1 && jElapsedRealtime - atomicLong.get() <= 1800000) {
            return;
        }
        P1.o oVarC = ((u1.b) this.f136n).c(new C1012n(0, Arrays.asList(new C1009k(36301, i, 0, j5, j6, null, null, 0, i5))));
        T t4 = new T(this, jElapsedRealtime);
        oVarC.getClass();
        oVarC.c(P1.j.f2506a, t4);
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x001a  */
    /* JADX WARN: Removed duplicated region for block: B:13:0x006a  */
    /* JADX WARN: Removed duplicated region for block: B:14:0x006d  */
    @Override // L1.InterfaceC0094e1
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void a(int r9, java.io.IOException r10, byte[] r11) {
        /*
            r8 = this;
            java.lang.Object r11 = r8.f135m
            L1.c1 r11 = (L1.C0088c1) r11
            r11.k()
            java.lang.Object r0 = r8.f134l
            L1.N1 r0 = (L1.N1) r0
            r1 = 200(0xc8, float:2.8E-43)
            if (r9 == r1) goto L18
            r1 = 204(0xcc, float:2.86E-43)
            if (r9 == r1) goto L18
            r1 = 304(0x130, float:4.26E-43)
            if (r9 != r1) goto L33
            r9 = r1
        L18:
            if (r10 != 0) goto L33
            java.lang.Object r9 = r11.f29k
            L1.w0 r9 = (L1.C0146w0) r9
            L1.X r9 = r9.p
            L1.C0146w0.l(r9)
            L1.V r9 = r9.f1631x
            long r1 = r0.f1521k
            java.lang.Long r10 = java.lang.Long.valueOf(r1)
            java.lang.String r1 = "[sgtm] Upload succeeded for row_id"
            r9.c(r1, r10)
            L1.i1 r9 = L1.EnumC0106i1.SUCCESS
            goto L6f
        L33:
            java.lang.Object r1 = r11.f29k
            L1.w0 r1 = (L1.C0146w0) r1
            L1.X r1 = r1.p
            L1.C0146w0.l(r1)
            L1.V r1 = r1.f1626s
            long r2 = r0.f1521k
            java.lang.Long r2 = java.lang.Long.valueOf(r2)
            java.lang.Integer r3 = java.lang.Integer.valueOf(r9)
            java.lang.String r4 = "[sgtm] Upload failed for row_id. response, exception"
            r1.e(r4, r2, r3, r10)
            L1.E r10 = L1.F.f1439u
            r1 = 0
            java.lang.Object r10 = r10.a(r1)
            java.lang.String r10 = (java.lang.String) r10
            java.lang.String r1 = ","
            java.lang.String[] r10 = r10.split(r1)
            java.util.List r10 = java.util.Arrays.asList(r10)
            java.lang.String r9 = java.lang.String.valueOf(r9)
            boolean r9 = r10.contains(r9)
            if (r9 == 0) goto L6d
            L1.i1 r9 = L1.EnumC0106i1.BACKOFF
            goto L6f
        L6d:
            L1.i1 r9 = L1.EnumC0106i1.FAILURE
        L6f:
            java.lang.Object r10 = r8.f136n
            java.util.concurrent.atomic.AtomicReference r10 = (java.util.concurrent.atomic.AtomicReference) r10
            java.lang.Object r1 = r11.f29k
            L1.w0 r1 = (L1.C0146w0) r1
            L1.y1 r1 = r1.o()
            L1.d r2 = new L1.d
            long r4 = r0.f1521k
            int r3 = r9.f1847k
            long r6 = r0.p
            r2.<init>(r3, r4, r6)
            r1.k()
            r1.l()
            r0 = 1
            L1.e2 r0 = r1.A(r0)
            L1.A0 r3 = new L1.A0
            r6 = 7
            r3.<init>(r1, r0, r2, r6)
            r1.y(r3)
            java.lang.Object r11 = r11.f29k
            L1.w0 r11 = (L1.C0146w0) r11
            L1.X r11 = r11.p
            L1.C0146w0.l(r11)
            L1.V r11 = r11.f1631x
            java.lang.Long r0 = java.lang.Long.valueOf(r4)
            java.lang.String r1 = "[sgtm] Updated status for row_id"
            r11.d(r0, r9, r1)
            monitor-enter(r10)
            r10.set(r9)     // Catch: java.lang.Throwable -> Lb7
            r10.notifyAll()     // Catch: java.lang.Throwable -> Lb7
            monitor-exit(r10)     // Catch: java.lang.Throwable -> Lb7
            return
        Lb7:
            r0 = move-exception
            r9 = r0
            monitor-exit(r10)     // Catch: java.lang.Throwable -> Lb7
            throw r9
        */
        throw new UnsupportedOperationException("Method not decompiled: B2.a.a(int, java.io.IOException, byte[]):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0032 A[Catch: all -> 0x0019, TRY_ENTER, TryCatch #0 {all -> 0x0019, blocks: (B:6:0x0016, B:22:0x006b, B:25:0x008f, B:16:0x0032, B:18:0x0058, B:20:0x0063, B:21:0x0067), top: B:32:0x0016 }] */
    /* JADX WARN: Removed duplicated region for block: B:21:0x0067 A[Catch: all -> 0x0019, TryCatch #0 {all -> 0x0019, blocks: (B:6:0x0016, B:22:0x006b, B:25:0x008f, B:16:0x0032, B:18:0x0058, B:20:0x0063, B:21:0x0067), top: B:32:0x0016 }] */
    /* JADX WARN: Removed duplicated region for block: B:24:0x008e  */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // L1.Z
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void b(java.lang.String r8, int r9, java.io.IOException r10, byte[] r11, java.util.Map r12) {
        /*
            Method dump skipped, instruction units count: 202
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: B2.a.b(java.lang.String, int, java.io.IOException, byte[], java.util.Map):void");
    }

    @Override // R.h
    public Object c() {
        return null;
    }

    public /* bridge */ /* synthetic */ Object clone() {
        switch (this.f133k) {
            case 17:
                a aVar = new a(((C0348b) this.f135m).clone());
                Iterator it = ((ArrayList) this.f134l).iterator();
                while (it.hasNext()) {
                    ((ArrayList) aVar.f134l).add(((C0348b) it.next()).clone());
                }
                return aVar;
            default:
                return super.clone();
        }
    }

    @Override // R.h
    public Uri d() {
        return (Uri) this.f135m;
    }

    @Override // P1.c
    public void e(P1.h hVar) {
        C0925b c0925b = (C0925b) this.f135m;
        String str = (String) this.f136n;
        ScheduledFuture scheduledFuture = (ScheduledFuture) this.f134l;
        synchronized (c0925b.f9382a) {
            c0925b.f9382a.remove(str);
        }
        scheduledFuture.cancel(false);
    }

    @Override // R.h
    public Uri g() {
        return (Uri) this.f134l;
    }

    @Override // c4.InterfaceC0342a
    public Object get() {
        switch (this.f133k) {
            case 15:
                return new a1.o(new L1.B(26), new A(26), (InterfaceC0591b) ((F3.e) this.f135m).get(), (g1.j) ((a1) this.f136n).get(), (g1.k) ((w) this.f134l).get());
            default:
                return new g1.d((Context) ((C0337c) this.f135m).f4717k, (h1.d) ((InterfaceC0342a) this.f136n).get(), (g1.b) ((L1.B) this.f134l).get());
        }
    }

    @Override // R.h
    public ClipDescription getDescription() {
        return (ClipDescription) this.f136n;
    }

    @Override // E2.a
    public byte[] h(int i, byte[] bArr) throws GeneralSecurityException {
        byte[] bArrW;
        if (i > 16) {
            throw new InvalidAlgorithmParameterException("outputLength too large, max is 16 bytes");
        }
        if (!s0.c.a(1)) {
            throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
        }
        Cipher cipher = (Cipher) G2.i.f813b.f815a.a("AES/ECB/NoPadding");
        cipher.init(1, (SecretKeySpec) this.f135m);
        int iMax = Math.max(1, (int) Math.ceil(((double) bArr.length) / 16.0d));
        if (iMax * 16 == bArr.length) {
            bArrW = android.support.v4.media.session.b.v((iMax - 1) * 16, 0, 16, bArr, (byte[]) this.f136n);
        } else {
            byte[] bArrCopyOfRange = Arrays.copyOfRange(bArr, (iMax - 1) * 16, bArr.length);
            if (bArrCopyOfRange.length >= 16) {
                throw new IllegalArgumentException("x must be smaller than a block.");
            }
            byte[] bArrCopyOf = Arrays.copyOf(bArrCopyOfRange, 16);
            bArrCopyOf[bArrCopyOfRange.length] = -128;
            bArrW = android.support.v4.media.session.b.w(bArrCopyOf, (byte[]) this.f134l);
        }
        byte[] bArrDoFinal = new byte[16];
        for (int i5 = 0; i5 < iMax - 1; i5++) {
            bArrDoFinal = cipher.doFinal(android.support.v4.media.session.b.v(0, i5 * 16, 16, bArrDoFinal, bArr));
        }
        return Arrays.copyOf(cipher.doFinal(android.support.v4.media.session.b.w(bArrW, bArrDoFinal)), i);
    }

    public b i() throws GeneralSecurityException {
        g3.c cVar;
        H2.a aVarA;
        h hVar = (h) this.f135m;
        if (hVar == null || (cVar = (g3.c) this.f136n) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (hVar.f159b != ((H2.a) cVar.f6465l).f873a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        g gVar = g.f148f;
        g gVar2 = hVar.f161d;
        if (gVar2 != gVar && ((Integer) this.f134l) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (gVar2 == gVar && ((Integer) this.f134l) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (gVar2 == gVar) {
            aVarA = H2.a.a(new byte[0]);
        } else if (gVar2 == g.f147e || gVar2 == g.f146d) {
            aVarA = H2.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f134l).intValue()).array());
        } else {
            if (gVar2 != g.f145c) {
                throw new IllegalStateException("Unknown AesCmacParametersParameters.Variant: " + ((h) this.f135m).f161d);
            }
            aVarA = H2.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f134l).intValue()).array());
        }
        return new b((h) this.f135m, aVarA);
    }

    public h j() throws GeneralSecurityException {
        Integer num = (Integer) this.f134l;
        if (num == null) {
            throw new GeneralSecurityException("key size not set");
        }
        if (((Integer) this.f135m) == null) {
            throw new GeneralSecurityException("tag size not set");
        }
        if (((g) this.f136n) != null) {
            return new h(num.intValue(), ((Integer) this.f135m).intValue(), (g) this.f136n);
        }
        throw new GeneralSecurityException("variant not set");
    }

    public m k() throws GeneralSecurityException {
        g3.c cVar;
        H2.a aVarA;
        o oVar = (o) this.f135m;
        if (oVar == null || (cVar = (g3.c) this.f136n) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (oVar.f171b != ((H2.a) cVar.f6465l).f873a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        g gVar = g.f156o;
        g gVar2 = oVar.f173d;
        if (gVar2 != gVar && ((Integer) this.f134l) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (gVar2 == gVar && ((Integer) this.f134l) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (gVar2 == gVar) {
            aVarA = H2.a.a(new byte[0]);
        } else if (gVar2 == g.f155n || gVar2 == g.f154m) {
            aVarA = H2.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f134l).intValue()).array());
        } else {
            if (gVar2 != g.f153l) {
                throw new IllegalStateException("Unknown HmacParameters.Variant: " + ((o) this.f135m).f173d);
            }
            aVarA = H2.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f134l).intValue()).array());
        }
        return new m((o) this.f135m, aVarA);
    }

    public C0222i l() {
        String strConcat = ((String) this.f135m) == null ? " backendName" : "";
        if (((X0.d) this.f134l) == null) {
            strConcat = strConcat.concat(" priority");
        }
        if (strConcat.isEmpty()) {
            return new C0222i((String) this.f135m, (byte[]) this.f136n, (X0.d) this.f134l);
        }
        throw new IllegalStateException("Missing required properties:".concat(strConcat));
    }

    public void m(ByteArrayOutputStream byteArrayOutputStream, Object obj) {
        HashMap map = (HashMap) this.f136n;
        HashMap map2 = (HashMap) this.f135m;
        V2.f fVar = new V2.f(byteArrayOutputStream, map2, map, (U2.a) this.f134l);
        S2.d dVar = (S2.d) map2.get(obj.getClass());
        if (dVar != null) {
            dVar.a(obj, fVar);
        } else {
            throw new S2.b("No encoder for " + obj.getClass());
        }
    }

    public byte[] n(byte[] bArr) throws BadPaddingException, IllegalBlockSizeException, InvalidKeyException, InvalidAlgorithmParameterException {
        int iV = v();
        byte[] bArr2 = new byte[iV];
        ((SecureRandom) this.f136n).nextBytes(bArr2);
        AlgorithmParameterSpec algorithmParameterSpecW = w(bArr2);
        Key key = (Key) this.f134l;
        Cipher cipher = (Cipher) this.f135m;
        cipher.init(1, key, algorithmParameterSpecW);
        byte[] bArrDoFinal = cipher.doFinal(bArr);
        byte[] bArr3 = new byte[bArrDoFinal.length + iV];
        System.arraycopy(bArr2, 0, bArr3, 0, iV);
        System.arraycopy(bArrDoFinal, 0, bArr3, iV, bArrDoFinal.length);
        return bArr3;
    }

    public X p(Class cls, String str) {
        X xA;
        AbstractC0983h.e("key", str);
        c0 c0Var = (c0) this.f135m;
        c0Var.getClass();
        LinkedHashMap linkedHashMap = c0Var.f4466a;
        X x5 = (X) linkedHashMap.get(str);
        boolean zIsInstance = cls.isInstance(x5);
        a0 a0Var = (a0) this.f136n;
        if (!zIsInstance) {
            j0.c cVar = new j0.c((j0.b) this.f134l);
            cVar.f8555a.put(Y.f4458b, str);
            try {
                xA = a0Var.b(cls, cVar);
            } catch (AbstractMethodError unused) {
                xA = a0Var.a(cls);
            }
            AbstractC0983h.e("viewModel", xA);
            X x6 = (X) linkedHashMap.put(str, xA);
            if (x6 != null) {
                x6.b();
            }
            return xA;
        }
        V v5 = a0Var instanceof V ? (V) a0Var : null;
        if (v5 != null) {
            AbstractC0983h.b(x5);
            AbstractC0309p abstractC0309p = v5.f4450d;
            if (abstractC0309p != null) {
                v0.e eVar = v5.f4451e;
                AbstractC0983h.b(eVar);
                S.a(x5, eVar, abstractC0309p);
            }
        }
        AbstractC0983h.c("null cannot be cast to non-null type T of androidx.lifecycle.ViewModelProvider.get", x5);
        return x5;
    }

    public String q() {
        return "VGhpcyBpcyB0aGUga2V5IGZvciBhIHNlY3VyZSBzdG9yYWdlIEFFUyBLZXkK";
    }

    public Cipher r() {
        return Cipher.getInstance("AES/CBC/PKCS7Padding");
    }

    public ColorStateList s(int i) {
        int resourceId;
        ColorStateList colorStateListC;
        TypedArray typedArray = (TypedArray) this.f136n;
        return (!typedArray.hasValue(i) || (resourceId = typedArray.getResourceId(i, 0)) == 0 || (colorStateListC = E.c.c((Context) this.f135m, resourceId)) == null) ? typedArray.getColorStateList(i) : colorStateListC;
    }

    public Drawable t(int i) {
        int resourceId;
        TypedArray typedArray = (TypedArray) this.f136n;
        return (!typedArray.hasValue(i) || (resourceId = typedArray.getResourceId(i, 0)) == 0) ? typedArray.getDrawable(i) : AbstractC0566j.j((Context) this.f135m, resourceId);
    }

    public String toString() {
        switch (this.f133k) {
            case 24:
                StringBuilder sb = new StringBuilder(32);
                sb.append((String) this.f135m);
                sb.append('{');
                C0732k1 c0732k1 = (C0732k1) ((C0732k1) this.f136n).f7859m;
                String str = "";
                while (c0732k1 != null) {
                    Object obj = c0732k1.f7858l;
                    sb.append(str);
                    if (obj == null || !obj.getClass().isArray()) {
                        sb.append(obj);
                    } else {
                        String strDeepToString = Arrays.deepToString(new Object[]{obj});
                        sb.append((CharSequence) strDeepToString, 1, strDeepToString.length() - 1);
                    }
                    c0732k1 = (C0732k1) c0732k1.f7859m;
                    str = ", ";
                }
                sb.append('}');
                return sb.toString();
            case Build.API_LEVELS.API_27 /* 27 */:
                return t2.o.a((g0) this.f135m).toString();
            default:
                return super.toString();
        }
    }

    public Typeface u(int i, int i5, C0832A c0832a) {
        int resourceId = ((TypedArray) this.f136n).getResourceId(i, 0);
        if (resourceId == 0) {
            return null;
        }
        if (((TypedValue) this.f134l) == null) {
            this.f134l = new TypedValue();
        }
        TypedValue typedValue = (TypedValue) this.f134l;
        ThreadLocal threadLocal = F.l.f603a;
        Context context = (Context) this.f135m;
        if (context.isRestricted()) {
            return null;
        }
        return F.l.b(context, resourceId, typedValue, i5, c0832a, true, false);
    }

    public int v() {
        return 16;
    }

    public AlgorithmParameterSpec w(byte[] bArr) {
        return new IvParameterSpec(bArr);
    }

    /* JADX WARN: Removed duplicated region for block: B:72:0x0169  */
    /* JADX WARN: Removed duplicated region for block: B:73:0x016d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public java.lang.Object x(java.lang.Class r15) throws java.security.GeneralSecurityException {
        /*
            Method dump skipped, instruction units count: 511
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: B2.a.x(java.lang.Class):java.lang.Object");
    }

    public List y(byte[] bArr) {
        List list = (List) ((ConcurrentHashMap) this.f135m).get(new t2.l(bArr));
        return list != null ? list : Collections.EMPTY_LIST;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:101:0x0248  */
    /* JADX WARN: Removed duplicated region for block: B:102:0x024a  */
    /* JADX WARN: Removed duplicated region for block: B:109:0x027b  */
    /* JADX WARN: Removed duplicated region for block: B:112:0x028a  */
    /* JADX WARN: Removed duplicated region for block: B:113:0x0298  */
    /* JADX WARN: Removed duplicated region for block: B:127:0x02d9  */
    /* JADX WARN: Removed duplicated region for block: B:128:0x02db  */
    /* JADX WARN: Removed duplicated region for block: B:145:0x033c  */
    /* JADX WARN: Removed duplicated region for block: B:146:0x033e  */
    /* JADX WARN: Removed duplicated region for block: B:148:0x036c  */
    /* JADX WARN: Removed duplicated region for block: B:154:0x039b  */
    /* JADX WARN: Removed duplicated region for block: B:159:0x03b1  */
    /* JADX WARN: Removed duplicated region for block: B:161:0x03b4  */
    /* JADX WARN: Removed duplicated region for block: B:164:0x03d7  */
    /* JADX WARN: Removed duplicated region for block: B:167:0x03e8  */
    /* JADX WARN: Removed duplicated region for block: B:168:0x03ea  */
    /* JADX WARN: Removed duplicated region for block: B:174:0x0410  */
    /* JADX WARN: Removed duplicated region for block: B:177:0x041e  */
    /* JADX WARN: Removed duplicated region for block: B:178:0x0420  */
    /* JADX WARN: Removed duplicated region for block: B:184:0x044a  */
    /* JADX WARN: Removed duplicated region for block: B:187:0x0458  */
    /* JADX WARN: Removed duplicated region for block: B:188:0x045a  */
    /* JADX WARN: Removed duplicated region for block: B:192:0x0479  */
    /* JADX WARN: Removed duplicated region for block: B:195:0x0485  */
    /* JADX WARN: Removed duplicated region for block: B:198:0x0496  */
    /* JADX WARN: Removed duplicated region for block: B:201:0x04a0  */
    /* JADX WARN: Removed duplicated region for block: B:209:0x04cd  */
    /* JADX WARN: Removed duplicated region for block: B:212:0x04d9  */
    /* JADX WARN: Removed duplicated region for block: B:215:0x04e3  */
    /* JADX WARN: Removed duplicated region for block: B:219:0x04f9  */
    /* JADX WARN: Removed duplicated region for block: B:235:0x0571  */
    /* JADX WARN: Removed duplicated region for block: B:239:0x037c A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:245:0x03a3 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:251:0x050f A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00d5  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x00e4  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x012f  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x013c  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x0147  */
    /* JADX WARN: Removed duplicated region for block: B:98:0x023c  */
    /* JADX WARN: Type inference failed for: r0v105 */
    /* JADX WARN: Type inference failed for: r0v106, types: [int] */
    /* JADX WARN: Type inference failed for: r0v179 */
    /* JADX WARN: Type inference failed for: r0v180 */
    /* JADX WARN: Type inference failed for: r0v181 */
    /* JADX WARN: Type inference failed for: r0v182 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public boolean z() {
        /*
            Method dump skipped, instruction units count: 1420
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: B2.a.z():boolean");
    }

    public /* synthetic */ a(Object obj, Object obj2, Object obj3, int i) {
        this.f133k = i;
        this.f135m = obj;
        this.f136n = obj2;
        this.f134l = obj3;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public a(int i) {
        this(new io.sentry.protocol.t((UUID) null), new S1(), (Object) null, 20);
        this.f133k = i;
        switch (i) {
            case 20:
                break;
            default:
                this.f135m = new C0348b("", 0L, null);
                this.f136n = new C0348b("", 0L, null);
                this.f134l = new ArrayList();
                break;
        }
    }

    public a(W1 w12, String str, Y1 y12) {
        this.f133k = 9;
        this.f135m = str;
        this.f136n = y12;
        Objects.requireNonNull(w12);
        this.f134l = w12;
    }

    public a(W1 w12, String str, ArrayList arrayList) {
        this.f133k = 8;
        this.f135m = str;
        this.f136n = arrayList;
        Objects.requireNonNull(w12);
        this.f134l = w12;
    }

    public a(Context context, C0146w0 c0146w0) {
        this.f133k = 6;
        this.f134l = new AtomicLong(-1L);
        this.f136n = new u1.b(context, u1.b.i, new s1.o("measurement:api"), q1.e.f9544b);
        this.f135m = c0146w0;
    }

    public a(C0348b c0348b) {
        this.f133k = 17;
        this.f135m = c0348b;
        this.f136n = c0348b.clone();
        this.f134l = new ArrayList();
    }

    public a(Context context, C0732k1 c0732k1) throws Exception {
        this.f133k = 26;
        this.f136n = new SecureRandom();
        String strQ = q();
        SharedPreferences sharedPreferences = context.getSharedPreferences("FlutterSecureKeyStorage", 0);
        SharedPreferences.Editor editorEdit = sharedPreferences.edit();
        String string = sharedPreferences.getString(strQ, null);
        this.f135m = r();
        if (string != null) {
            try {
                this.f134l = c0732k1.d0(Base64.decode(string, 0));
                return;
            } catch (Exception e2) {
                Log.e("StorageCipher18Impl", "unwrap key failed", e2);
            }
        }
        byte[] bArr = new byte[16];
        ((SecureRandom) this.f136n).nextBytes(bArr);
        SecretKeySpec secretKeySpec = new SecretKeySpec(bArr, "AES");
        this.f134l = secretKeySpec;
        c0732k1.getClass();
        KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
        keyStore.load(null);
        String str = (String) c0732k1.f7858l;
        Certificate certificate = keyStore.getCertificate(str);
        if (certificate != null) {
            PublicKey publicKey = certificate.getPublicKey();
            if (publicKey != null) {
                Cipher cipherP = c0732k1.P();
                cipherP.init(3, publicKey, c0732k1.M());
                editorEdit.putString(strQ, Base64.encodeToString(cipherP.wrap(secretKeySpec), 0));
                editorEdit.apply();
                return;
            }
            throw new Exception(s0.c.f("No key found under alias: ", str));
        }
        throw new Exception(s0.c.f("No certificate found under alias: ", str));
    }

    @Override // R.h
    public void f() {
    }

    public a(C0222i c0222i, X0.c cVar, c cVar2, a1.o oVar) {
        this.f133k = 14;
        this.f135m = c0222i;
        this.f136n = cVar;
        this.f134l = oVar;
    }

    public a(c0 c0Var, a0 a0Var, j0.b bVar) {
        this.f133k = 16;
        AbstractC0983h.e("store", c0Var);
        AbstractC0983h.e("defaultCreationExtras", bVar);
        this.f135m = c0Var;
        this.f136n = a0Var;
        this.f134l = bVar;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public a(c0 c0Var, a0 a0Var) {
        this(c0Var, a0Var, C0795a.f8554b);
        this.f133k = 16;
        AbstractC0983h.e("store", c0Var);
    }

    public a(FirebaseMessagingService firebaseMessagingService, S.g gVar, ExecutorService executorService) {
        this.f133k = 18;
        this.f135m = executorService;
        this.f136n = firebaseMessagingService;
        this.f134l = gVar;
    }

    public a(byte[] bArr) throws GeneralSecurityException {
        this.f133k = 3;
        G2.o.a(bArr.length);
        SecretKeySpec secretKeySpec = new SecretKeySpec(bArr, "AES");
        this.f135m = secretKeySpec;
        if (s0.c.a(1)) {
            Cipher cipher = (Cipher) G2.i.f813b.f815a.a("AES/ECB/NoPadding");
            cipher.init(1, secretKeySpec);
            byte[] bArrG = AbstractC0212a.g(cipher.doFinal(new byte[16]));
            this.f136n = bArrG;
            this.f134l = AbstractC0212a.g(bArrG);
            return;
        }
        throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
    }

    public a(Context context, TypedArray typedArray) {
        this.f133k = 22;
        this.f135m = context;
        this.f136n = typedArray;
    }

    public a(a aVar) {
        I1 i12;
        this.f133k = 20;
        io.sentry.protocol.t tVar = (io.sentry.protocol.t) aVar.f135m;
        S1 s12 = (S1) aVar.f136n;
        I1 i13 = (I1) aVar.f134l;
        if (i13 != null) {
            i12 = new I1((HashMap) i13.f4888b, i13.f4887a, (ILogger) i13.f4889c);
        } else {
            i12 = null;
        }
        this(tVar, s12, i12, 20);
    }

    public a(String str) {
        this.f133k = 24;
        C0732k1 c0732k1 = new C0732k1(23, false);
        this.f136n = c0732k1;
        this.f134l = c0732k1;
        this.f135m = str;
    }

    public a(ConcurrentHashMap concurrentHashMap, t2.k kVar, D2.a aVar, Class cls) {
        this.f133k = 28;
        this.f135m = concurrentHashMap;
        this.f136n = kVar;
        this.f134l = aVar;
    }

    public a(g3.c cVar) {
        this.f133k = 4;
        this.f135m = cVar;
        this.f136n = new ReentrantLock();
        this.f134l = new WeakHashMap();
    }

    public a(EnumC0691v enumC0691v) {
        this.f133k = 21;
        this.f135m = enumC0691v;
        this.f136n = null;
        this.f134l = null;
    }

    public a(EnumC0691v enumC0691v, byte[] bArr) {
        this.f133k = 21;
        this.f135m = enumC0691v;
        this.f136n = bArr;
        this.f134l = null;
    }

    public a(g0 g0Var, List list) {
        this.f133k = 27;
        this.f135m = g0Var;
        this.f136n = list;
        this.f134l = D2.a.f439b;
    }
}
