package o;

import android.content.ClipData;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.BadParcelableException;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.NetworkOnMainThreadException;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import android.util.Pair;
import android.view.ContentInfo;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.gms.common.internal.Preconditions;
import java.io.File;
import java.io.FileInputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Objects;
import java.util.WeakHashMap;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONException;
import org.json.JSONObject;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class OD implements InterfaceC0998dP, AO, B8, Lc0, F2, InterfaceC0082De, KO, InterfaceC1986nm, InterfaceC2176pm, WX, InterfaceC2904xT {
    public static volatile OD n;

    /* renamed from: o, reason: collision with root package name */
    public static final AD f265o = new AD(1);
    public static final BP p = new BP(25);
    public static final Ot0 q = new Ot0();
    public final /* synthetic */ int l;
    public Object m;

    public /* synthetic */ OD(int i, Object obj) {
        this.l = i;
        this.m = obj;
    }

    public static String H(String str, Bundle bundle) throws JSONException {
        JSONObject jSONObject = new JSONObject();
        JSONObject jSONObject2 = new JSONObject();
        for (String str2 : bundle.keySet()) {
            jSONObject2.put(str2, bundle.get(str2));
        }
        jSONObject.put("name", str);
        jSONObject.put("parameters", jSONObject2);
        return jSONObject.toString();
    }

    public void A(C0598Xb c0598Xb, Thread thread, Throwable th) {
        Hw0 hw0D;
        C0324Mn c0324Mn = (C0324Mn) this.m;
        synchronized (c0324Mn) {
            Objects.toString(th);
            thread.getName();
            Log.isLoggable("FirebaseCrashlytics", 3);
            AbstractC1692kh0.I();
            long jCurrentTimeMillis = System.currentTimeMillis();
            ExecutorC0014Ao executorC0014Ao = (ExecutorC0014Ao) c0324Mn.e.m;
            CallableC0273Kn callableC0273Kn = new CallableC0273Kn(c0324Mn, jCurrentTimeMillis, th, thread, c0598Xb);
            synchronized (executorC0014Ao.m) {
                hw0D = executorC0014Ao.n.d(executorC0014Ao.l, new G1(5, callableC0273Kn));
                executorC0014Ao.n = hw0D;
            }
            try {
                AbstractC2453si0.a(hw0D);
            } catch (TimeoutException | Exception unused) {
            }
        }
    }

    public boolean B(int i, int i2, Bundle bundle) {
        return false;
    }

    public JSONObject C() throws Throwable {
        Throwable th;
        FileInputStream fileInputStream;
        JSONObject jSONObject;
        Log.isLoggable("FirebaseCrashlytics", 3);
        FileInputStream fileInputStream2 = null;
        try {
            File file = (File) this.m;
            if (file.exists()) {
                fileInputStream = new FileInputStream(file);
                try {
                    jSONObject = new JSONObject(C1884mi0.L(fileInputStream));
                    fileInputStream2 = fileInputStream;
                } catch (Exception unused) {
                    C1884mi0.p(fileInputStream);
                    return null;
                } catch (Throwable th2) {
                    th = th2;
                    C1884mi0.p(fileInputStream);
                    throw th;
                }
            } else {
                Log.isLoggable("FirebaseCrashlytics", 2);
                jSONObject = null;
            }
            C1884mi0.p(fileInputStream2);
            return jSONObject;
        } catch (Exception unused2) {
            fileInputStream = null;
        } catch (Throwable th3) {
            th = th3;
            fileInputStream = null;
        }
    }

    public void D(C3037yp0 c3037yp0) {
        Wp0 wp0 = (Wp0) this.m;
        Preconditions.checkNotNull(c3037yp0);
        ArrayList arrayList = wp0.d;
        synchronized (arrayList) {
            for (int i = 0; i < arrayList.size(); i++) {
                try {
                    if (c3037yp0.equals(((Pair) arrayList.get(i)).first)) {
                        return;
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
            Sp0 sp0 = new Sp0(c3037yp0);
            arrayList.add(new Pair(c3037yp0, sp0));
            if (wp0.g != null) {
                try {
                    wp0.g.registerOnMeasurementEventListener(sp0);
                    return;
                } catch (BadParcelableException | NetworkOnMainThreadException | RemoteException | IllegalArgumentException | IllegalStateException | NullPointerException | SecurityException | UnsupportedOperationException unused) {
                }
            }
            wp0.a(new Fp0(wp0, sp0, 5));
        }
    }

    public void E() {
        C1479iR c1479iR = (C1479iR) this.m;
        C0991dI c0991dIK = AbstractC0940cn0.K(0, c1479iR.n);
        int i = c0991dIK.l;
        int i2 = c0991dIK.m;
        if (i <= i2) {
            while (true) {
                ((C1796lm) c1479iR.l[i]).b.resumeWith(Oh0.a);
                if (i == i2) {
                    break;
                } else {
                    i++;
                }
            }
        }
        c1479iR.h();
    }

    public void F(float f, long j) {
        InterfaceC2923xg interfaceC2923xgX = ((C3126zm0) this.m).x();
        int i = (int) (j >> 32);
        int i2 = (int) (j & 4294967295L);
        interfaceC2923xgX.j(Float.intBitsToFloat(i), Float.intBitsToFloat(i2));
        interfaceC2923xgX.e(f);
        interfaceC2923xgX.j(-Float.intBitsToFloat(i), -Float.intBitsToFloat(i2));
    }

    public void G(float f, float f2, long j) {
        InterfaceC2923xg interfaceC2923xgX = ((C3126zm0) this.m).x();
        int i = (int) (j >> 32);
        int i2 = (int) (j & 4294967295L);
        interfaceC2923xgX.j(Float.intBitsToFloat(i), Float.intBitsToFloat(i2));
        interfaceC2923xgX.d(f, f2);
        interfaceC2923xgX.j(-Float.intBitsToFloat(i), -Float.intBitsToFloat(i2));
    }

    public void I(float f, float f2) {
        ((C3126zm0) this.m).x().j(f, f2);
    }

    public void J(int i, Object obj, I40 i40) {
        C2832wi c2832wi = (C2832wi) this.m;
        c2832wi.g0(i, 3);
        i40.e((U) obj, c2832wi.j);
        c2832wi.g0(i, 4);
    }

    @Override // o.InterfaceC0998dP
    public void a(CO co, boolean z) {
        if (co instanceof SubMenuC2155pb0) {
            ((SubMenuC2155pb0) co).z.k().c(false);
        }
        InterfaceC0998dP interfaceC0998dP = ((C1444i1) this.m).p;
        if (interfaceC0998dP != null) {
            interfaceC0998dP.a(co, z);
        }
    }

    @Override // o.InterfaceC2176pm
    public ClipData b() {
        return ((ContentInfo) this.m).getClip();
    }

    @Override // o.InterfaceC1986nm
    public C2271qm build() {
        return new C2271qm(new OD(((ContentInfo.Builder) this.m).build()));
    }

    @Override // o.Lc0
    public void c(Drawable drawable) {
        I9 i9 = (I9) this.m;
        i9.k(new C3073z9(drawable != null ? i9.j(drawable) : null));
    }

    @Override // o.KO
    public void d(CO co, MenuItem menuItem) {
        ((ViewOnKeyListenerC0317Mg) this.m).q.removeCallbacksAndMessages(co);
    }

    @Override // o.KO
    public void f(CO co, LO lo) {
        ViewOnKeyListenerC0317Mg viewOnKeyListenerC0317Mg = (ViewOnKeyListenerC0317Mg) this.m;
        Handler handler = viewOnKeyListenerC0317Mg.q;
        handler.removeCallbacksAndMessages(null);
        ArrayList arrayList = viewOnKeyListenerC0317Mg.s;
        int size = arrayList.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                i = -1;
                break;
            } else if (co == ((C0292Lg) arrayList.get(i)).b) {
                break;
            } else {
                i++;
            }
        }
        if (i == -1) {
            return;
        }
        int i2 = i + 1;
        handler.postAtTime(new RunnableC0266Kg(this, i2 < arrayList.size() ? (C0292Lg) arrayList.get(i2) : null, lo, co, 0), co, SystemClock.uptimeMillis() + 200);
    }

    @Override // o.InterfaceC0082De
    public void g(C0402Pn c0402Pn) {
        this.m = c0402Pn;
        Log.isLoggable("FirebaseCrashlytics", 3);
    }

    @Override // o.WX
    public long h(C1086eI c1086eI, long j, EnumC1280gK enumC1280gK, long j2) {
        long j3 = ((C0704aI) ((NC) this.m).a()).a;
        return (AbstractC2001nt0.k(c1086eI.a + ((int) (j3 >> 32)), (int) (j2 >> 32), (int) (j >> 32), enumC1280gK == EnumC1280gK.l) << 32) | (AbstractC2001nt0.k(c1086eI.b + ((int) (j3 & 4294967295L)), (int) (j2 & 4294967295L), (int) (j & 4294967295L), true) & 4294967295L);
    }

    @Override // o.InterfaceC2904xT
    public Kl0 i(View view, Kl0 kl0) {
        Hl0 hl0 = kl0.a;
        CoordinatorLayout coordinatorLayout = (CoordinatorLayout) this.m;
        if (!Objects.equals(coordinatorLayout.y, kl0)) {
            coordinatorLayout.y = kl0;
            boolean z = kl0.d() > 0;
            coordinatorLayout.z = z;
            coordinatorLayout.setWillNotDraw(!z && coordinatorLayout.getBackground() == null);
            if (!hl0.o()) {
                int childCount = coordinatorLayout.getChildCount();
                for (int i = 0; i < childCount; i++) {
                    View childAt = coordinatorLayout.getChildAt(i);
                    WeakHashMap weakHashMap = Oj0.a;
                    if (childAt.getFitsSystemWindows() && ((C0453Rm) childAt.getLayoutParams()).a != null && hl0.o()) {
                        break;
                    }
                }
            }
            coordinatorLayout.requestLayout();
        }
        return kl0;
    }

    @Override // o.InterfaceC2176pm
    public int j() {
        return ((ContentInfo) this.m).getFlags();
    }

    @Override // o.InterfaceC0998dP
    public boolean k(CO co) {
        C1444i1 c1444i1 = (C1444i1) this.m;
        if (co == c1444i1.n) {
            return false;
        }
        ((SubMenuC2155pb0) co).A.getClass();
        c1444i1.getClass();
        InterfaceC0998dP interfaceC0998dP = c1444i1.p;
        if (interfaceC0998dP != null) {
            return interfaceC0998dP.k(co);
        }
        return false;
    }

    @Override // o.AO
    public boolean l(CO co, MenuItem menuItem) {
        boolean zOnMenuItemSelected;
        InterfaceC1728l1 interfaceC1728l1 = ((ActionMenuView) this.m).L;
        if (interfaceC1728l1 != null) {
            Toolbar toolbar = ((Mf0) interfaceC1728l1).l;
            if (toolbar.R.a(menuItem)) {
                zOnMenuItemSelected = true;
            } else {
                Qf0 qf0 = toolbar.T;
                zOnMenuItemSelected = qf0 != null ? ((Sf0) qf0).l.b.onMenuItemSelected(0, menuItem) : false;
            }
            if (zOnMenuItemSelected) {
                return true;
            }
        }
        return false;
    }

    @Override // o.InterfaceC2176pm
    public ContentInfo m() {
        return (ContentInfo) this.m;
    }

    @Override // o.InterfaceC1986nm
    public void o(Uri uri) {
        ((ContentInfo.Builder) this.m).setLinkUri(uri);
    }

    @Override // o.InterfaceC2176pm
    public int p() {
        return ((ContentInfo) this.m).getSource();
    }

    @Override // o.F2
    public void r(String str, Bundle bundle) {
        C0402Pn c0402Pn = (C0402Pn) this.m;
        if (c0402Pn != null) {
            try {
                String str2 = "$A$:" + H(str, bundle);
                C0454Rn c0454Rn = c0402Pn.a;
                ((ExecutorC0014Ao) c0454Rn.f319o.m).a(new RunnableC0428Qn(c0454Rn, System.currentTimeMillis() - c0454Rn.d, str2, 0));
            } catch (JSONException unused) {
            }
        }
    }

    @Override // o.AO
    public void s(CO co) {
        AO ao = ((ActionMenuView) this.m).G;
        if (ao != null) {
            ao.s(co);
        }
    }

    @Override // o.InterfaceC1986nm
    public void setExtras(Bundle bundle) {
        ((ContentInfo.Builder) this.m).setExtras(bundle);
    }

    @Override // o.InterfaceC1986nm
    public void t(int i) {
        ((ContentInfo.Builder) this.m).setFlags(i);
    }

    public String toString() {
        switch (this.l) {
            case 26:
                return "ContentInfoCompat{" + ((ContentInfo) this.m) + "}";
            default:
                return super.toString();
        }
    }

    public void v(CancellationException cancellationException) {
        C1479iR c1479iR = (C1479iR) this.m;
        int i = c1479iR.n;
        InterfaceC2259qg[] interfaceC2259qgArr = new InterfaceC2259qg[i];
        for (int i2 = 0; i2 < i; i2++) {
            interfaceC2259qgArr[i2] = ((C1796lm) c1479iR.l[i2]).b;
        }
        for (int i3 = 0; i3 < i; i3++) {
            interfaceC2259qgArr[i3].k(cancellationException);
        }
        if (c1479iR.n == 0) {
            return;
        }
        AbstractC2417sH.c("uncancelled requests present");
    }

    public H0 w(int i) {
        return null;
    }

    public H0 x(int i) {
        return null;
    }

    public AbstractC0934ck0 y(Class cls) {
        String str;
        C0474Sh c0474ShA = C10.a(cls);
        S60 s60 = (S60) this.m;
        HashMap map = C0474Sh.c;
        Class cls2 = c0474ShA.a;
        String canonicalName = null;
        if (!cls2.isAnonymousClass() && !cls2.isLocalClass()) {
            if (cls2.isArray()) {
                Class<?> componentType = cls2.getComponentType();
                if (componentType.isPrimitive() && (str = (String) map.get(componentType.getName())) != null) {
                    canonicalName = str.concat("Array");
                }
                if (canonicalName == null) {
                    canonicalName = "kotlin.Array";
                }
            } else {
                canonicalName = (String) map.get(cls2.getName());
                if (canonicalName == null) {
                    canonicalName = cls2.getCanonicalName();
                }
            }
        }
        if (canonicalName != null) {
            return s60.i(c0474ShA, "androidx.lifecycle.ViewModelProvider.DefaultKey:".concat(canonicalName));
        }
        throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
    }

    public void z(float f, float f2, float f3, float f4) {
        C3126zm0 c3126zm0 = (C3126zm0) this.m;
        InterfaceC2923xg interfaceC2923xgX = c3126zm0.x();
        float fIntBitsToFloat = Float.intBitsToFloat((int) (c3126zm0.D() >> 32)) - (f3 + f);
        long jFloatToRawIntBits = (Float.floatToRawIntBits(Float.intBitsToFloat((int) (c3126zm0.D() & 4294967295L)) - (f4 + f2)) & 4294967295L) | (Float.floatToRawIntBits(fIntBitsToFloat) << 32);
        if (!(Float.intBitsToFloat((int) (jFloatToRawIntBits >> 32)) >= 0.0f && Float.intBitsToFloat((int) (jFloatToRawIntBits & 4294967295L)) >= 0.0f)) {
            AbstractC2038oH.a("Width and height must be greater than or equal to zero");
        }
        c3126zm0.T(jFloatToRawIntBits);
        interfaceC2923xgX.j(f, f2);
    }

    public OD(C2832wi c2832wi) {
        this.l = 22;
        AbstractC2418sI.a(c2832wi, "output");
        this.m = c2832wi;
        c2832wi.j = this;
    }

    public OD(int i) {
        InterfaceC1761lP interfaceC1761lP;
        this.l = i;
        switch (i) {
            case 1:
                C2530tZ c2530tZ = C2530tZ.c;
                try {
                    interfaceC1761lP = (InterfaceC1761lP) Class.forName("androidx.datastore.preferences.protobuf.DescriptorMessageInfoFactory").getDeclaredMethod("getInstance", null).invoke(null, null);
                } catch (Exception unused) {
                    interfaceC1761lP = f265o;
                }
                InterfaceC1761lP[] interfaceC1761lPArr = {AD.b, interfaceC1761lP};
                C2423sN c2423sN = new C2423sN();
                c2423sN.a = interfaceC1761lPArr;
                Charset charset = AbstractC2418sI.a;
                this.m = c2423sN;
                break;
            case 3:
                C1241fu0 c1241fu0 = C1241fu0.c;
                C1696kj0 c1696kj0 = new C1696kj0(15, new Ut0[]{C0669Zu.e0, q});
                Charset charset2 = Et0.a;
                this.m = c1696kj0;
                break;
            case 4:
                if (Build.VERSION.SDK_INT >= 26) {
                    this.m = new J0(this);
                    break;
                } else {
                    this.m = new I0(this);
                    break;
                }
            case 14:
                this.m = new AtomicInteger(0);
                break;
            case 15:
                this.m = new AtomicReference(null);
                break;
            case 16:
                break;
            case 17:
                this.m = new C1479iR(new C1796lm[16]);
                break;
            case 19:
                this.m = new C1696kj0(7);
                break;
            default:
                this.m = new HashSet();
                break;
        }
    }

    public OD(C1533iy c1533iy) {
        this.l = 18;
        this.m = new File((File) c1533iy.n, "com.crashlytics.settings.json");
    }

    public OD(boolean z) {
        this.l = 13;
        this.m = new AtomicBoolean(z);
    }

    public void e(int i) {
    }

    public void n(int i) {
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x002a A[PHI: r10
      0x002a: PHI (r10v1 int) = (r10v0 int), (r10v3 int), (r10v4 int) binds: [B:5:0x001a, B:10:0x0023, B:12:0x0026] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0033  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public OD(int[] r22, float[] r23, float[][] r24) {
        /*
            r21 = this;
            r0 = r21
            r1 = r23
            r2 = 11
            r0.l = r2
            r0.<init>()
            int r2 = r1.length
            r3 = 1
            int r2 = r2 - r3
            o.U8[][] r4 = new o.U8[r2][]
            r5 = 0
            r7 = r3
            r8 = r7
            r6 = r5
        L14:
            if (r6 >= r2) goto L6b
            r9 = r22[r6]
            r10 = 3
            r11 = 2
            if (r9 == 0) goto L2a
            if (r9 == r3) goto L33
            if (r9 == r11) goto L31
            if (r9 == r10) goto L2c
            r10 = 4
            if (r9 == r10) goto L2a
            r10 = 5
            if (r9 == r10) goto L2a
            r13 = r8
            goto L35
        L2a:
            r13 = r10
            goto L35
        L2c:
            if (r7 != r3) goto L33
            goto L31
        L2f:
            r13 = r7
            goto L35
        L31:
            r7 = r11
            goto L2f
        L33:
            r7 = r3
            goto L2f
        L35:
            r8 = r24[r6]
            int r9 = r6 + 1
            r10 = r24[r9]
            r14 = r1[r6]
            r15 = r1[r9]
            int r12 = r8.length
            int r12 = r12 / r11
            int r3 = r8.length
            int r3 = r3 % r11
            int r3 = r3 + r12
            o.U8[] r11 = new o.U8[r3]
            r12 = r5
        L47:
            if (r12 >= r3) goto L65
            int r16 = r12 * 2
            r17 = r12
            o.U8 r12 = new o.U8
            r18 = r16
            r16 = r8[r18]
            int r19 = r18 + 1
            r20 = r17
            r17 = r8[r19]
            r18 = r10[r18]
            r19 = r10[r19]
            r12.<init>(r13, r14, r15, r16, r17, r18, r19)
            r11[r20] = r12
            int r12 = r20 + 1
            goto L47
        L65:
            r4[r6] = r11
            r6 = r9
            r8 = r13
            r3 = 1
            goto L14
        L6b:
            r0.m = r4
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.OD.<init>(int[], float[], float[][]):void");
    }

    public OD(int i, long j) {
        this.l = 24;
        TimeUnit timeUnit = TimeUnit.MINUTES;
        this.m = new C1715kt(Uc0.i, i, j);
    }

    public OD(C1413hk0 c1413hk0, InterfaceC1221fk0 interfaceC1221fk0) {
        this.l = 2;
        this.m = new S60(c1413hk0, interfaceC1221fk0, C0066Co.b);
    }

    public OD(ContentInfo contentInfo) {
        this.l = 26;
        contentInfo.getClass();
        this.m = Z2.g(contentInfo);
    }

    public OD(ClipData clipData, int i) {
        this.l = 25;
        this.m = Z2.e(clipData, i);
    }

    public void q(int i, float f) {
    }

    public void u(int i, H0 h0, String str, Bundle bundle) {
    }
}
