package C4;

import C0.B;
import C0.J;
import E3.v;
import I0.E0;
import I0.EnumC0312v;
import I0.H;
import I2.C0317a;
import I2.C0334s;
import J2.AbstractC0399a0;
import J2.C0427s;
import J2.E;
import J2.L0;
import J2.V;
import J2.Y;
import L3.k;
import L3.l;
import L3.m;
import L3.n;
import M3.p;
import S3.o;
import T1.q;
import T1.r;
import X0.C0797j;
import X0.C0801n;
import X0.C0802o;
import X0.C0803p;
import X0.InterfaceC0806t;
import X0.W;
import X3.X;
import X3.Z;
import X3.f0;
import X3.g0;
import X3.r0;
import Y3.t;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.LocaleList;
import android.text.TextPaint;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.leanback.widget.C1087t;
import androidx.navigation.C1134i;
import androidx.recyclerview.widget.C1152b;
import androidx.recyclerview.widget.C1175z;
import androidx.recyclerview.widget.RecyclerView;
import b1.C1186a;
import b1.C1187b;
import com.google.crypto.tink.shaded.protobuf.C;
import com.google.crypto.tink.shaded.protobuf.C1267o;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
import java.util.zip.GZIPInputStream;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import k4.AbstractC2396i;
import k4.C2408v;
import k4.h0;
import k4.q0;
import m3.AbstractC2467b;
import m4.C2533p;
import m4.C2536q;
import m4.C2544t;
import m4.EnumC2550v;
import m4.InterfaceC2553w;
import n.C2594v;
import n.N;
import q1.AbstractC2831c;
import q1.C2833e;
import q1.C2837i;

/* JADX INFO: loaded from: classes3.dex */
public class f implements W3.a, InterfaceC2553w {

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

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

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

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

    public /* synthetic */ f(int i6, boolean z6) {
        this.f740a = i6;
    }

    public static void L(f fVar, InterfaceC0806t interfaceC0806t, C3.j jVar, Object obj) {
        fVar.getClass();
        jVar.getClass();
        C0802o c0802o = new C0802o(interfaceC0806t);
        synchronized (((C1134i) fVar.f743d)) {
            try {
                if (obj == null) {
                    ((N) fVar.f742c).l(c0802o, new C0801n(null));
                } else {
                    ((C2594v) fVar.f741b).put(c0802o, new C0801n(obj));
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public static final f M(L3.f fVar, R3.c cVar) throws GeneralSecurityException, IOException {
        byte[] bArr = new byte[0];
        ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) fVar.f4173b;
        try {
            X3.N nZ = X3.N.z(byteArrayInputStream, C1267o.a());
            byteArrayInputStream.close();
            if (nZ.x().size() == 0) {
                throw new GeneralSecurityException("empty keyset");
            }
            try {
                g0 g0VarD = g0.D(cVar.b(nZ.x().k(), bArr), C1267o.a());
                if (g0VarD.y() > 0) {
                    return s(g0VarD);
                }
                throw new GeneralSecurityException("empty keyset");
            } catch (C unused) {
                throw new GeneralSecurityException("invalid keyset, corrupted key material");
            }
        } catch (Throwable th) {
            byteArrayInputStream.close();
            throw th;
        }
    }

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

    /* JADX WARN: Multi-variable type inference failed */
    public static AbstractC0399a0 x(Y y6, String str) {
        AbstractC0399a0 abstractC0399a0X;
        AbstractC0399a0 abstractC0399a0 = (AbstractC0399a0) y6;
        if (str.equals(abstractC0399a0.f3358c)) {
            return abstractC0399a0;
        }
        for (Object obj : y6.getChildren()) {
            if (obj instanceof AbstractC0399a0) {
                AbstractC0399a0 abstractC0399a02 = (AbstractC0399a0) obj;
                if (str.equals(abstractC0399a02.f3358c)) {
                    return abstractC0399a02;
                }
                if ((obj instanceof Y) && (abstractC0399a0X = x((Y) obj, str)) != null) {
                    return abstractC0399a0X;
                }
            }
        }
        return null;
    }

    public static f y(InputStream inputStream) {
        L0 l02 = new L0();
        l02.f3286a = null;
        l02.f3287b = null;
        l02.f3288c = false;
        l02.f3290e = false;
        l02.f3291f = null;
        l02.f3292g = null;
        l02.f3293h = false;
        l02.f3294i = null;
        if (!inputStream.markSupported()) {
            inputStream = new BufferedInputStream(inputStream);
        }
        try {
            inputStream.mark(3);
            int i6 = inputStream.read() + (inputStream.read() << 8);
            inputStream.reset();
            if (i6 == 35615) {
                inputStream = new BufferedInputStream(new GZIPInputStream(inputStream));
            }
        } catch (IOException unused) {
        }
        try {
            inputStream.mark(4096);
            l02.B(inputStream);
            return l02.f3286a;
        } finally {
            try {
                inputStream.close();
            } catch (IOException unused2) {
                Log.e("SVGParser", "Exception thrown closing input stream");
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:67:0x0140  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x0144  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object A(Class cls) throws GeneralSecurityException {
        Class clsA;
        Object objC;
        Object objB;
        AtomicReference atomicReference = n.f4186a;
        try {
            clsA = S3.h.f6229b.a(cls);
        } catch (GeneralSecurityException unused) {
            clsA = null;
        }
        if (clsA == null) {
            throw new GeneralSecurityException("No wrapper found for ".concat(cls.getName()));
        }
        int i6 = L3.o.f4190a;
        g0 g0Var = (g0) this.f741b;
        int iA = g0Var.A();
        Iterator it = g0Var.z().iterator();
        boolean z6 = true;
        int i7 = 0;
        boolean z7 = false;
        while (true) {
            boolean zHasNext = it.hasNext();
            Z z8 = Z.ENABLED;
            if (!zHasNext) {
                if (i7 == 0) {
                    throw new GeneralSecurityException("keyset must contain at least one ENABLED key");
                }
                if (!z7 && !z6) {
                    throw new GeneralSecurityException("keyset doesn't contain a valid primary key");
                }
                J j4 = new J(clsA);
                if (((ConcurrentHashMap) j4.f534c) == null) {
                    throw new IllegalStateException("setAnnotations cannot be called after build");
                }
                j4.f536e = (V3.a) this.f743d;
                for (int i8 = 0; i8 < g0Var.y(); i8++) {
                    f0 f0VarX = g0Var.x(i8);
                    if (f0VarX.C().equals(z8)) {
                        try {
                            X3.Y yZ = f0VarX.z();
                            AtomicReference atomicReference2 = n.f4186a;
                            objC = n.c(yZ.A(), yZ.B(), clsA);
                        } catch (GeneralSecurityException e6) {
                            if (!e6.getMessage().contains("No key manager found for key type ") && !e6.getMessage().contains(" not supported by key manager of type ")) {
                                throw e6;
                            }
                            objC = null;
                        }
                        List list = (List) this.f742c;
                        if (list.get(i8) != null) {
                            try {
                                objB = n.b(((L3.h) list.get(i8)).f4175a, clsA);
                            } catch (GeneralSecurityException unused2) {
                                objB = null;
                            }
                            if (f0VarX.A() != g0Var.A()) {
                                j4.a(objB, objC, f0VarX, true);
                            } else {
                                j4.a(objB, objC, f0VarX, false);
                            }
                        } else {
                            objB = null;
                            if (f0VarX.A() != g0Var.A()) {
                            }
                        }
                    }
                }
                ConcurrentHashMap concurrentHashMap = (ConcurrentHashMap) j4.f534c;
                if (concurrentHashMap == null) {
                    throw new IllegalStateException("build cannot be called twice");
                }
                k kVar = (k) j4.f535d;
                V3.a aVar = (V3.a) j4.f536e;
                Class cls2 = (Class) j4.f533b;
                f fVar = new f(concurrentHashMap, kVar, aVar, cls2);
                j4.f534c = null;
                AtomicReference atomicReference3 = n.f4186a;
                HashMap map = ((S3.n) S3.h.f6229b.f6230a.get()).f6240b;
                if (!map.containsKey(cls)) {
                    throw new GeneralSecurityException("No wrapper found for " + cls);
                }
                m mVar = (m) map.get(cls);
                if (cls2.equals(mVar.a()) && mVar.a().equals(cls2)) {
                    return mVar.c(fVar);
                }
                throw new GeneralSecurityException("Input primitive type of the wrapper doesn't match the type of primitives in the provided PrimitiveSet");
            }
            f0 f0Var = (f0) it.next();
            if (f0Var.C() == z8) {
                if (!f0Var.D()) {
                    throw new GeneralSecurityException(String.format("key %d has no key data", Integer.valueOf(f0Var.A())));
                }
                if (f0Var.B() == r0.UNKNOWN_PREFIX) {
                    throw new GeneralSecurityException(String.format("key %d has unknown prefix", Integer.valueOf(f0Var.A())));
                }
                if (f0Var.C() == Z.UNKNOWN_STATUS) {
                    throw new GeneralSecurityException(String.format("key %d has unknown status", Integer.valueOf(f0Var.A())));
                }
                if (f0Var.A() == iA) {
                    if (z7) {
                        throw new GeneralSecurityException("keyset contains multiple primary keys");
                    }
                    z7 = true;
                }
                if (f0Var.z().z() != X.ASYMMETRIC_PUBLIC) {
                    z6 = false;
                }
                i7++;
            }
        }
    }

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

    public View C(int i6) {
        return ((C1175z) this.f741b).f13194a.getChildAt(i6);
    }

    public int D() {
        return ((C1175z) this.f741b).f13194a.getChildCount();
    }

    public boolean E(CharSequence charSequence, int i6, int i7, r rVar) {
        if ((rVar.f6620c & 3) == 0) {
            T1.d dVar = (T1.d) this.f743d;
            U1.a aVarB = rVar.b();
            int iA = aVarB.a(8);
            if (iA != 0) {
                ((ByteBuffer) aVarB.f6864d).getShort(iA + aVarB.f6861a);
            }
            dVar.getClass();
            ThreadLocal threadLocal = T1.d.f6577b;
            if (threadLocal.get() == null) {
                threadLocal.set(new StringBuilder());
            }
            StringBuilder sb = (StringBuilder) threadLocal.get();
            sb.setLength(0);
            while (i6 < i7) {
                sb.append(charSequence.charAt(i6));
                i6++;
            }
            TextPaint textPaint = dVar.f6578a;
            String string = sb.toString();
            int i8 = z1.c.f26273a;
            boolean zHasGlyph = textPaint.hasGlyph(string);
            int i9 = rVar.f6620c & 4;
            rVar.f6620c = zHasGlyph ? i9 | 2 : i9 | 1;
        }
        return (rVar.f6620c & 3) == 2;
    }

    public void F(View view) {
        ((ArrayList) this.f743d).add(view);
        C1175z c1175z = (C1175z) this.f741b;
        androidx.recyclerview.widget.Z zG = RecyclerView.G(view);
        if (zG != null) {
            zG.onEnteredHiddenState(c1175z.f13194a);
        }
    }

    public int G(View view) {
        int iIndexOfChild = ((C1175z) this.f741b).f13194a.indexOfChild(view);
        if (iIndexOfChild == -1) {
            return -1;
        }
        C1152b c1152b = (C1152b) this.f742c;
        if (c1152b.e(iIndexOfChild)) {
            return -1;
        }
        return iIndexOfChild - c1152b.c(iIndexOfChild);
    }

    public boolean H() {
        return !(((E0) ((B) this.f741b).f506b).isEmpty() && ((E0) ((B) this.f743d).f506b).isEmpty() && ((E0) ((B) this.f742c).f506b).isEmpty());
    }

    public boolean I() {
        if (((W) this.f741b).getValue() != this.f743d) {
            return true;
        }
        f fVar = (f) this.f742c;
        return fVar != null && fVar.I();
    }

    public void J(Activity activity, B2.l lVar) {
        kotlin.jvm.internal.o.h(activity, "activity");
        ReentrantLock reentrantLock = (ReentrantLock) this.f742c;
        reentrantLock.lock();
        WeakHashMap weakHashMap = (WeakHashMap) this.f743d;
        try {
            if (lVar.equals((B2.l) weakHashMap.get(activity))) {
                return;
            }
            reentrantLock.unlock();
            Iterator it = ((E2.l) ((B) this.f741b).f506b).f1137b.iterator();
            kotlin.jvm.internal.o.g(it, "iterator(...)");
            while (it.hasNext()) {
                E2.k kVar = (E2.k) it.next();
                if (kVar.f1131a.equals(activity)) {
                    kVar.f1133c = lVar;
                    kVar.f1132b.accept(lVar);
                }
            }
        } finally {
            reentrantLock.unlock();
        }
    }

    public Object K(CharSequence charSequence, int i6, int i7, int i8, boolean z6, T1.l lVar) {
        int i9;
        char c6;
        T1.n nVar = new T1.n((q) ((J) this.f742c).f535d);
        int iCodePointAt = Character.codePointAt(charSequence, i6);
        boolean zD = true;
        int i10 = 0;
        int iCharCount = i6;
        loop0: while (true) {
            i9 = iCharCount;
            while (iCharCount < i7 && i10 < i8 && zD) {
                SparseArray sparseArray = ((q) nVar.f6604e).f6615a;
                q qVar = sparseArray == null ? null : (q) sparseArray.get(iCodePointAt);
                if (nVar.f6600a == 2) {
                    if (qVar != null) {
                        nVar.f6604e = qVar;
                        nVar.f6602c++;
                    } else {
                        if (iCodePointAt == 65038) {
                            nVar.b();
                        } else if (iCodePointAt != 65039) {
                            q qVar2 = (q) nVar.f6604e;
                            if (qVar2.f6616b != null) {
                                if (nVar.f6602c != 1) {
                                    nVar.f6605f = qVar2;
                                    nVar.b();
                                } else if (nVar.c()) {
                                    nVar.f6605f = (q) nVar.f6604e;
                                    nVar.b();
                                } else {
                                    nVar.b();
                                }
                                c6 = 3;
                            } else {
                                nVar.b();
                            }
                        }
                        c6 = 1;
                    }
                    c6 = 2;
                } else if (qVar == null) {
                    nVar.b();
                    c6 = 1;
                } else {
                    nVar.f6600a = 2;
                    nVar.f6604e = qVar;
                    nVar.f6602c = 1;
                    c6 = 2;
                }
                nVar.f6601b = iCodePointAt;
                if (c6 == 1) {
                    iCharCount = Character.charCount(Character.codePointAt(charSequence, i9)) + i9;
                    if (iCharCount < i7) {
                        iCodePointAt = Character.codePointAt(charSequence, iCharCount);
                    }
                } else if (c6 == 2) {
                    int iCharCount2 = Character.charCount(iCodePointAt) + iCharCount;
                    if (iCharCount2 < i7) {
                        iCodePointAt = Character.codePointAt(charSequence, iCharCount2);
                    }
                    iCharCount = iCharCount2;
                } else if (c6 == 3) {
                    if (z6 || !E(charSequence, i9, iCharCount, ((q) nVar.f6605f).f6616b)) {
                        zD = lVar.d(charSequence, i9, iCharCount, ((q) nVar.f6605f).f6616b);
                        i10++;
                    }
                }
            }
            break loop0;
        }
        if (nVar.f6600a == 2 && ((q) nVar.f6604e).f6616b != null && ((nVar.f6602c > 1 || nVar.c()) && i10 < i8 && zD && (z6 || !E(charSequence, i9, iCharCount, ((q) nVar.f6604e).f6616b)))) {
            lVar.d(charSequence, i9, iCharCount, ((q) nVar.f6604e).f6616b);
        }
        return lVar.e();
    }

    public AbstractC0399a0 N(String str) {
        String strSubstring;
        if (str != null) {
            if (str.startsWith("\"") && str.endsWith("\"")) {
                str = str.substring(1, str.length() - 1).replace("\\\"", "\"");
            } else if (str.startsWith("'") && str.endsWith("'")) {
                str = str.substring(1, str.length() - 1).replace("\\'", "'");
            }
            String strReplace = str.replace("\\\n", "").replace("\\A", "\n");
            if (strReplace.length() > 1 && strReplace.startsWith("#") && (strSubstring = strReplace.substring(1)) != null && strSubstring.length() != 0) {
                if (strSubstring.equals(((V) this.f741b).f3358c)) {
                    return (V) this.f741b;
                }
                HashMap map = (HashMap) this.f743d;
                if (map.containsKey(strSubstring)) {
                    return (AbstractC0399a0) map.get(strSubstring);
                }
                AbstractC0399a0 abstractC0399a0X = x((V) this.f741b, strSubstring);
                map.put(strSubstring, abstractC0399a0X);
                return abstractC0399a0X;
            }
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object O(InterfaceC0806t interfaceC0806t, C3.j jVar, C0797j c0797j, c cVar) {
        C0803p c0803p;
        C0802o c0802o;
        if (cVar instanceof C0803p) {
            c0803p = (C0803p) cVar;
            int i6 = c0803p.f8518d;
            if ((i6 & Integer.MIN_VALUE) != 0) {
                c0803p.f8518d = i6 - Integer.MIN_VALUE;
            } else {
                c0803p = new C0803p(this, cVar);
            }
        }
        Object obj = c0803p.f8516b;
        Object obj2 = B4.a.f492a;
        int i7 = c0803p.f8518d;
        if (i7 == 0) {
            AbstractC2467b.l(obj);
            jVar.getClass();
            C0802o c0802o2 = new C0802o(interfaceC0806t);
            synchronized (((C1134i) this.f743d)) {
                try {
                    C0801n c0801n = (C0801n) ((C2594v) this.f741b).get(c0802o2);
                    if (c0801n == null) {
                        c0801n = (C0801n) ((N) this.f742c).d(c0802o2);
                    }
                    if (c0801n != null) {
                        return c0801n.f8513a;
                    }
                    c0803p.f8515a = c0802o2;
                    c0803p.f8518d = 1;
                    Object objInvoke = c0797j.invoke(c0803p);
                    if (objInvoke == obj2) {
                        return obj2;
                    }
                    obj = objInvoke;
                    c0802o = c0802o2;
                } catch (Throwable th) {
                    throw th;
                }
            }
        } else {
            if (i7 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            c0802o = c0803p.f8515a;
            AbstractC2467b.l(obj);
        }
        synchronized (((C1134i) this.f743d)) {
            try {
                if (obj == null) {
                    ((N) this.f742c).l(c0802o, new C0801n(null));
                } else {
                    ((C2594v) this.f741b).put(c0802o, new C0801n(obj));
                }
            } finally {
            }
        }
        return obj;
    }

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

    public void Q(View view) {
        if (((ArrayList) this.f743d).remove(view)) {
            C1175z c1175z = (C1175z) this.f741b;
            androidx.recyclerview.widget.Z zG = RecyclerView.G(view);
            if (zG != null) {
                zG.onLeftHiddenState(c1175z.f13194a);
            }
        }
    }

    @Override // m4.InterfaceC2553w
    public void a(l2.c cVar) {
        C2544t c2544t = (C2544t) this.f743d;
        u4.b.c();
        try {
            u4.c cVar2 = c2544t.f21154b;
            u4.b.a();
            u4.b.b();
            c2544t.f21155c.execute(new C2533p(this, cVar));
            u4.b.f24588a.getClass();
        } catch (Throwable th) {
            try {
                u4.b.f24588a.getClass();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    @Override // m4.InterfaceC2553w
    public void b(k4.r0 r0Var, EnumC2550v enumC2550v, k4.g0 g0Var) {
        u4.b.c();
        try {
            u4.c cVar = ((C2544t) this.f743d).f21154b;
            u4.b.a();
            p(r0Var, g0Var);
            u4.b.f24588a.getClass();
        } catch (Throwable th) {
            try {
                u4.b.f24588a.getClass();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    @Override // W3.a
    public byte[] c(byte[] bArr, int i6) throws GeneralSecurityException {
        byte[] bArrT;
        if (i6 > 16) {
            throw new InvalidAlgorithmParameterException("outputLength too large, max is 16 bytes");
        }
        if (!A0.a.a(1)) {
            throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
        }
        Cipher cipher = (Cipher) Y3.o.f8838b.f8841a.a("AES/ECB/NoPadding");
        cipher.init(1, (SecretKeySpec) this.f741b);
        int iMax = Math.max(1, (int) Math.ceil(((double) bArr.length) / 16.0d));
        if (iMax * 16 == bArr.length) {
            bArrT = Y3.j.s(bArr, (iMax - 1) * 16, 0, (byte[]) this.f742c, 16);
        } 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;
            bArrT = Y3.j.t(bArrCopyOf, (byte[]) this.f743d);
        }
        byte[] bArrDoFinal = new byte[16];
        for (int i7 = 0; i7 < iMax - 1; i7++) {
            bArrDoFinal = cipher.doFinal(Y3.j.s(bArrDoFinal, 0, i7 * 16, bArr, 16));
        }
        return Arrays.copyOf(cipher.doFinal(Y3.j.t(bArrT, bArrDoFinal)), i6);
    }

    @Override // m4.InterfaceC2553w
    public void d() {
        C2544t c2544t = (C2544t) this.f743d;
        h0 h0Var = c2544t.f21153a.f19878a;
        h0Var.getClass();
        if (h0Var == h0.f19874a || h0Var == h0.f19875b) {
            return;
        }
        u4.b.c();
        try {
            u4.b.a();
            u4.b.b();
            c2544t.f21155c.execute(new m4.r(this));
            u4.b.f24588a.getClass();
        } catch (Throwable th) {
            try {
                u4.b.f24588a.getClass();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    @Override // m4.InterfaceC2553w
    public void e(k4.g0 g0Var) {
        C2544t c2544t = (C2544t) this.f743d;
        u4.b.c();
        try {
            u4.c cVar = c2544t.f21154b;
            u4.b.a();
            u4.b.b();
            c2544t.f21155c.execute(new C2533p(this, g0Var));
            u4.b.f24588a.getClass();
        } catch (Throwable th) {
            try {
                u4.b.f24588a.getClass();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    public void f(H h5, EnumC0312v enumC0312v) {
        int iOrdinal = enumC0312v.ordinal();
        B b5 = (B) this.f741b;
        B b6 = (B) this.f743d;
        if (iOrdinal == 0) {
            b5.b(h5);
            b6.b(h5);
            return;
        }
        B b7 = (B) this.f742c;
        if (iOrdinal == 1) {
            b7.b(h5);
            b6.b(h5);
            return;
        }
        if (iOrdinal == 2) {
            if (h5.l != null) {
                b6.b(h5);
                return;
            } else {
                b5.b(h5);
                return;
            }
        }
        if (iOrdinal != 3) {
            throw new v();
        }
        if (h5.l != null) {
            b6.b(h5);
        } else {
            b7.b(h5);
        }
    }

    public void g(View view, int i6, boolean z6) {
        RecyclerView recyclerView = ((C1175z) this.f741b).f13194a;
        int childCount = i6 < 0 ? recyclerView.getChildCount() : z(i6);
        ((C1152b) this.f742c).f(childCount, z6);
        if (z6) {
            F(view);
        }
        recyclerView.addView(view, childCount);
        androidx.recyclerview.widget.Z zG = RecyclerView.G(view);
        androidx.recyclerview.widget.B b5 = recyclerView.f12944p;
        if (b5 == null || zG == null) {
            return;
        }
        b5.onViewAttachedToWindow(zG);
    }

    public AbstractC2831c h() {
        h1.f fVar = (h1.f) this.f741b;
        if (fVar != null) {
            return new C2833e(fVar.f16618a);
        }
        String str = (String) this.f742c;
        if (str != null) {
            return C2837i.n(str);
        }
        Log.e("CCL", "DimensionDescription: Null value & symbol for " + ((String) this.f743d) + ". Using WrapContent.");
        return C2837i.n("wrap");
    }

    public void i(View view, int i6, ViewGroup.LayoutParams layoutParams, boolean z6) {
        RecyclerView recyclerView = ((C1175z) this.f741b).f13194a;
        int childCount = i6 < 0 ? recyclerView.getChildCount() : z(i6);
        ((C1152b) this.f742c).f(childCount, z6);
        if (z6) {
            F(view);
        }
        androidx.recyclerview.widget.Z zG = RecyclerView.G(view);
        if (zG != null) {
            if (!zG.isTmpDetached() && !zG.shouldIgnore()) {
                throw new IllegalArgumentException("Called attach on a child which is not detached: " + zG + recyclerView.w());
            }
            zG.clearTmpDetachFlag();
        }
        recyclerView.attachViewToParent(view, childCount, layoutParams);
    }

    public M3.i j() throws GeneralSecurityException {
        B b5;
        M3.k kVar = (M3.k) this.f741b;
        if (kVar == null || (b5 = (B) this.f742c) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (kVar.f5078b != ((Z3.a) b5.f506b).f9150a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        M3.j jVar = M3.j.f5064e;
        M3.j jVar2 = kVar.f5081e;
        if (jVar2 != jVar && ((Integer) this.f743d) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f743d) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            Z3.a.a(new byte[0]);
        } else if (jVar2 == M3.j.f5063d) {
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f743d).intValue()).array());
        } else {
            if (jVar2 != M3.j.f5062c) {
                throw new IllegalStateException("Unknown AesEaxParameters.Variant: " + ((M3.k) this.f741b).f5081e);
            }
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f743d).intValue()).array());
        }
        return new M3.i();
    }

    public M3.m k() throws GeneralSecurityException {
        B b5;
        M3.n nVar = (M3.n) this.f741b;
        if (nVar == null || (b5 = (B) this.f742c) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (nVar.f5086b != ((Z3.a) b5.f506b).f9150a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        M3.j jVar = M3.j.f5067h;
        M3.j jVar2 = nVar.f5089e;
        if (jVar2 != jVar && ((Integer) this.f743d) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f743d) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            Z3.a.a(new byte[0]);
        } else if (jVar2 == M3.j.f5066g) {
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f743d).intValue()).array());
        } else {
            if (jVar2 != M3.j.f5065f) {
                throw new IllegalStateException("Unknown AesGcmParameters.Variant: " + ((M3.n) this.f741b).f5089e);
            }
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f743d).intValue()).array());
        }
        return new M3.m();
    }

    public p l() throws GeneralSecurityException {
        B b5;
        M3.q qVar = (M3.q) this.f741b;
        if (qVar == null || (b5 = (B) this.f742c) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (qVar.f5094b != ((Z3.a) b5.f506b).f9150a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        M3.j jVar = M3.j.f5070k;
        M3.j jVar2 = qVar.f5095c;
        if (jVar2 != jVar && ((Integer) this.f743d) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (jVar2 == jVar && ((Integer) this.f743d) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (jVar2 == jVar) {
            Z3.a.a(new byte[0]);
        } else if (jVar2 == M3.j.f5069j) {
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f743d).intValue()).array());
        } else {
            if (jVar2 != M3.j.f5068i) {
                throw new IllegalStateException("Unknown AesGcmSivParameters.Variant: " + ((M3.q) this.f741b).f5095c);
            }
            Z3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f743d).intValue()).array());
        }
        return new p();
    }

    public T3.a m() throws GeneralSecurityException {
        B b5;
        Z3.a aVarA;
        T3.e eVar = (T3.e) this.f741b;
        if (eVar == null || (b5 = (B) this.f742c) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (eVar.f6685b != ((Z3.a) b5.f506b).f9150a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        T3.d dVar = T3.d.f6674f;
        T3.d dVar2 = eVar.f6687d;
        if (dVar2 != dVar && ((Integer) this.f743d) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (dVar2 == dVar && ((Integer) this.f743d) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (dVar2 == dVar) {
            aVarA = Z3.a.a(new byte[0]);
        } else if (dVar2 == T3.d.f6673e || dVar2 == T3.d.f6672d) {
            aVarA = Z3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f743d).intValue()).array());
        } else {
            if (dVar2 != T3.d.f6671c) {
                throw new IllegalStateException("Unknown AesCmacParametersParameters.Variant: " + ((T3.e) this.f741b).f6687d);
            }
            aVarA = Z3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f743d).intValue()).array());
        }
        return new T3.a((T3.e) this.f741b, aVarA);
    }

    public T3.e n() {
        Integer num = (Integer) this.f741b;
        if (num == null) {
            throw new GeneralSecurityException("key size not set");
        }
        if (((Integer) this.f742c) == null) {
            throw new GeneralSecurityException("tag size not set");
        }
        if (((T3.d) this.f743d) != null) {
            return new T3.e(num.intValue(), ((Integer) this.f742c).intValue(), (T3.d) this.f743d);
        }
        throw new GeneralSecurityException("variant not set");
    }

    public T3.j o() throws GeneralSecurityException {
        B b5;
        Z3.a aVarA;
        T3.k kVar = (T3.k) this.f741b;
        if (kVar == null || (b5 = (B) this.f742c) == null) {
            throw new GeneralSecurityException("Cannot build without parameters and/or key material");
        }
        if (kVar.f6695b != ((Z3.a) b5.f506b).f9150a.length) {
            throw new GeneralSecurityException("Key size mismatch");
        }
        T3.d dVar = T3.d.f6682o;
        T3.d dVar2 = kVar.f6697d;
        if (dVar2 != dVar && ((Integer) this.f743d) == null) {
            throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
        }
        if (dVar2 == dVar && ((Integer) this.f743d) != null) {
            throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
        }
        if (dVar2 == dVar) {
            aVarA = Z3.a.a(new byte[0]);
        } else if (dVar2 == T3.d.f6681n || dVar2 == T3.d.f6680m) {
            aVarA = Z3.a.a(ByteBuffer.allocate(5).put((byte) 0).putInt(((Integer) this.f743d).intValue()).array());
        } else {
            if (dVar2 != T3.d.l) {
                throw new IllegalStateException("Unknown HmacParameters.Variant: " + ((T3.k) this.f741b).f6697d);
            }
            aVarA = Z3.a.a(ByteBuffer.allocate(5).put((byte) 1).putInt(((Integer) this.f743d).intValue()).array());
        }
        return new T3.j((T3.k) this.f741b, aVarA);
    }

    public void p(k4.r0 r0Var, k4.g0 g0Var) {
        C2544t c2544t = (C2544t) this.f743d;
        C2408v c2408v = c2544t.f21161i.f19858a;
        c2544t.f21158f.getClass();
        if (c2408v == null) {
            c2408v = null;
        }
        if (r0Var.f19949a == q0.CANCELLED && c2408v != null && c2408v.a()) {
            C0334s c0334s = new C0334s(3, (byte) 0);
            c2544t.f21162j.e(c0334s);
            r0Var = k4.r0.f19941h.a("ClientCall was cancelled at or after deadline. " + c0334s);
            g0Var = new k4.g0();
        }
        u4.b.b();
        c2544t.f21155c.execute(new C2536q(this, r0Var, g0Var));
    }

    public boolean q(H h5) {
        return !(h5.l == null) && (((E0) ((B) this.f741b).f506b).contains(h5) || ((E0) ((B) this.f742c).f506b).contains(h5));
    }

    public void r(int i6) {
        androidx.recyclerview.widget.Z zG;
        int iZ = z(i6);
        ((C1152b) this.f742c).h(iZ);
        RecyclerView recyclerView = ((C1175z) this.f741b).f13194a;
        View childAt = recyclerView.getChildAt(iZ);
        if (childAt != null && (zG = RecyclerView.G(childAt)) != null) {
            if (zG.isTmpDetached() && !zG.shouldIgnore()) {
                throw new IllegalArgumentException("called detach on an already detached child " + zG + recyclerView.w());
            }
            zG.addFlags(256);
        }
        recyclerView.detachViewFromParent(iZ);
    }

    public View t(int i6) {
        return ((C1175z) this.f741b).f13194a.getChildAt(z(i6));
    }

    public String toString() {
        switch (this.f740a) {
            case 6:
                return L3.o.a((g0) this.f741b).toString();
            case 20:
                StringBuilder sb = new StringBuilder("NavDeepLinkRequest{");
                Uri uri = (Uri) this.f741b;
                if (uri != null) {
                    sb.append(" uri=");
                    sb.append(String.valueOf(uri));
                }
                String str = (String) this.f742c;
                if (str != null) {
                    sb.append(" action=");
                    sb.append(str);
                }
                String str2 = (String) this.f743d;
                if (str2 != null) {
                    sb.append(" mimetype=");
                    sb.append(str2);
                }
                sb.append(" }");
                String string = sb.toString();
                kotlin.jvm.internal.o.g(string, "sb.toString()");
                return string;
            case 21:
                return ((C1152b) this.f742c).toString() + ", hidden list:" + ((ArrayList) this.f743d).size();
            default:
                return super.toString();
        }
    }

    public int u() {
        return ((C1175z) this.f741b).f13194a.getChildCount() - ((ArrayList) this.f743d).size();
    }

    public C1187b v() {
        LocaleList localeList = LocaleList.getDefault();
        synchronized (((C1134i) this.f743d)) {
            try {
                C1187b c1187b = (C1187b) this.f742c;
                if (c1187b != null && localeList == ((LocaleList) this.f741b)) {
                    return c1187b;
                }
                int size = localeList.size();
                ArrayList arrayList = new ArrayList(size);
                for (int i6 = 0; i6 < size; i6++) {
                    arrayList.add(new C1186a(localeList.get(i6)));
                }
                C1187b c1187b2 = new C1187b(arrayList);
                this.f741b = localeList;
                this.f742c = c1187b2;
                return c1187b2;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public C0427s w() {
        int i6;
        float fC;
        int i7;
        V v3 = (V) this.f741b;
        E e6 = v3.f3351r;
        E e7 = v3.f3352s;
        if (e6 == null || e6.h() || (i6 = e6.f3168b) == 9 || i6 == 2 || i6 == 3) {
            return new C0427s(-1.0f, -1.0f, -1.0f, -1.0f);
        }
        float fC2 = e6.c();
        if (e7 == null) {
            C0427s c0427s = ((V) this.f741b).f3387o;
            fC = c0427s != null ? (c0427s.f3447e * fC2) / c0427s.f3446d : fC2;
        } else {
            if (e7.h() || (i7 = e7.f3168b) == 9 || i7 == 2 || i7 == 3) {
                return new C0427s(-1.0f, -1.0f, -1.0f, -1.0f);
            }
            fC = e7.c();
        }
        return new C0427s(0.0f, 0.0f, fC2, fC);
    }

    public int z(int i6) {
        if (i6 < 0) {
            return -1;
        }
        int childCount = ((C1175z) this.f741b).f13194a.getChildCount();
        int i7 = i6;
        while (i7 < childCount) {
            C1152b c1152b = (C1152b) this.f742c;
            int iC = i6 - (i7 - c1152b.c(i7));
            if (iC == 0) {
                while (c1152b.e(i7)) {
                    i7++;
                }
                return i7;
            }
            i7 += iC;
        }
        return -1;
    }

    public /* synthetic */ f(Object obj, Object obj2, Object obj3, int i6) {
        this.f740a = i6;
        this.f741b = obj;
        this.f742c = obj2;
        this.f743d = obj3;
    }

    public f(C1175z c1175z) {
        this.f740a = 21;
        this.f741b = c1175z;
        this.f742c = new C1152b();
        this.f743d = new ArrayList();
    }

    public f(Intent intent) {
        this.f740a = 20;
        Uri data = intent.getData();
        String action = intent.getAction();
        String type = intent.getType();
        this.f741b = data;
        this.f742c = action;
        this.f743d = type;
    }

    public f(byte[] bArr) throws GeneralSecurityException {
        this.f740a = 17;
        t.a(bArr.length);
        SecretKeySpec secretKeySpec = new SecretKeySpec(bArr, "AES");
        this.f741b = secretKeySpec;
        if (A0.a.a(1)) {
            Cipher cipher = (Cipher) Y3.o.f8838b.f8841a.a("AES/ECB/NoPadding");
            cipher.init(1, secretKeySpec);
            byte[] bArrB = A4.g.B(cipher.doFinal(new byte[16]));
            this.f742c = bArrB;
            this.f743d = A4.g.B(bArrB);
            return;
        }
        throw new GeneralSecurityException("Can not use AES-CMAC in FIPS-mode.");
    }

    public f(View view) {
        this.f740a = 18;
        this.f741b = view;
        this.f742c = m1.g.j(w4.i.f25467c, new B0.b(this, 10));
        this.f743d = new B(view);
    }

    public f(f fVar) {
        this.f740a = 16;
        this.f741b = Arrays.copyOf((long[]) fVar.f741b, 10);
        this.f742c = Arrays.copyOf((long[]) fVar.f742c, 10);
        this.f743d = Arrays.copyOf((long[]) fVar.f743d, 10);
    }

    public f(J j4, u4.c cVar, T1.d dVar, Set set) {
        this.f740a = 11;
        this.f741b = cVar;
        this.f742c = j4;
        this.f743d = dVar;
        if (set.isEmpty()) {
            return;
        }
        Iterator it = set.iterator();
        while (it.hasNext()) {
            int[] iArr = (int[]) it.next();
            String str = new String(iArr, 0, iArr.length);
            K(str, 0, str.length(), 1, true, new C0317a(str, 3));
        }
    }

    public f(W w6, f fVar) {
        this.f740a = 23;
        this.f741b = w6;
        this.f742c = fVar;
        this.f743d = w6.getValue();
    }

    public f(ConcurrentHashMap concurrentHashMap, k kVar, V3.a aVar, Class cls) {
        this.f740a = 7;
        this.f741b = concurrentHashMap;
        this.f742c = kVar;
        this.f743d = aVar;
    }

    public f(int i6) {
        int i7 = 16;
        int i8 = 1;
        this.f740a = i6;
        switch (i6) {
            case 4:
                this.f741b = new B(9);
                this.f742c = new B(9);
                this.f743d = new B(9);
                break;
            case 15:
                this.f741b = new C2594v(16);
                long[] jArr = n.Y.f21386a;
                this.f742c = new N();
                this.f743d = new C1134i(i8);
                break;
            case 16:
                this(new long[10], new long[10], new long[10], i7);
                break;
            case 19:
                this.f741b = new C1087t(1);
                C1087t c1087t = new C1087t(0);
                this.f742c = c1087t;
                this.f743d = c1087t;
                break;
            case 22:
                this.f743d = new C1134i(i8);
                break;
            case 24:
                this.f741b = new WeakHashMap();
                this.f742c = new WeakHashMap();
                this.f743d = new WeakHashMap();
                break;
            default:
                long[] jArr2 = n.Y.f21386a;
                this.f741b = new N();
                break;
        }
    }

    public f(B b5) {
        this.f740a = 1;
        this.f741b = b5;
        this.f742c = new ReentrantLock();
        this.f743d = new WeakHashMap();
    }

    public f(C2544t c2544t, AbstractC2396i abstractC2396i) {
        this.f740a = 26;
        this.f743d = c2544t;
        A4.g.o(abstractC2396i, "observer");
        this.f741b = abstractC2396i;
    }

    public f(g0 g0Var, List list) {
        this.f740a = 6;
        this.f741b = g0Var;
        this.f742c = list;
        this.f743d = V3.a.f8217b;
    }
}
