package L1;

import W.C0188b;
import W.InterfaceC0189c;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.SystemClock;
import com.google.android.gms.internal.measurement.C0357c3;
import com.google.android.gms.internal.measurement.C0367e3;
import com.google.android.gms.internal.measurement.C0441t3;
import com.google.android.gms.internal.measurement.C0456w3;
import com.google.android.gms.internal.measurement.I3;
import com.google.android.gms.internal.measurement.P3;
import com.google.android.gms.internal.measurement.R3;
import com.google.android.gms.internal.measurement.Y2;
import com.google.android.gms.internal.measurement.s4;
import com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar;
import i2.C0624a;
import io.flutter.Build;
import io.flutter.embedding.android.AndroidTouchProcessor;
import io.flutter.plugin.editing.FlutterTextUtils;
import io.sentry.C0732k1;
import j1.InterfaceC0796a;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import r4.AbstractC0983h;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class A implements InterfaceC0145w, N2.f, InterfaceC0189c, InterfaceC0796a, k3.p {

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public static A f1275B;

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

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public static final /* synthetic */ A f1276l = new A(0);

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final /* synthetic */ A f1277m = new A(1);

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final /* synthetic */ A f1278n = new A(2);

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final /* synthetic */ A f1279o = new A(3);
    public static final /* synthetic */ A p = new A(4);
    public static final /* synthetic */ A q = new A(5);

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public static final /* synthetic */ A f1280r = new A(6);

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public static final /* synthetic */ A f1281s = new A(7);

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final /* synthetic */ A f1282t = new A(8);

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public static final /* synthetic */ A f1283u = new A(9);

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public static final /* synthetic */ A f1284v = new A(10);

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public static final /* synthetic */ A f1285w = new A(11);

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public static final /* synthetic */ A f1286x = new A(12);

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public static final /* synthetic */ A f1287y = new A(13);

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public static final /* synthetic */ A f1288z = new A(14);

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public static final /* synthetic */ A f1274A = new A(15);

    public /* synthetic */ A(int i) {
        this.f1289k = i;
    }

    public static final void c(X4.d dVar, long j5, boolean z5) {
        X4.d dVar2;
        ReentrantLock reentrantLock = X4.d.f3313h;
        if (X4.d.f3316l == null) {
            X4.d.f3316l = new X4.d();
            A1.g gVar = new A1.g("Okio Watchdog");
            gVar.setDaemon(true);
            gVar.start();
        }
        long jNanoTime = System.nanoTime();
        if (j5 != 0 && z5) {
            dVar.f3319g = Math.min(j5, dVar.c() - jNanoTime) + jNanoTime;
        } else if (j5 != 0) {
            dVar.f3319g = j5 + jNanoTime;
        } else {
            if (!z5) {
                throw new AssertionError();
            }
            dVar.f3319g = dVar.c();
        }
        long j6 = dVar.f3319g - jNanoTime;
        X4.d dVar3 = X4.d.f3316l;
        AbstractC0983h.b(dVar3);
        while (true) {
            dVar2 = dVar3.f3318f;
            if (dVar2 == null || j6 < dVar2.f3319g - jNanoTime) {
                break;
            }
            AbstractC0983h.b(dVar2);
            dVar3 = dVar2;
        }
        dVar.f3318f = dVar2;
        dVar3.f3318f = dVar;
        if (dVar3 == X4.d.f3316l) {
            X4.d.i.signal();
        }
    }

    public static X4.d d() throws InterruptedException {
        X4.d dVar = X4.d.f3316l;
        AbstractC0983h.b(dVar);
        X4.d dVar2 = dVar.f3318f;
        if (dVar2 == null) {
            long jNanoTime = System.nanoTime();
            X4.d.i.await(X4.d.f3314j, TimeUnit.MILLISECONDS);
            X4.d dVar3 = X4.d.f3316l;
            AbstractC0983h.b(dVar3);
            if (dVar3.f3318f != null || System.nanoTime() - jNanoTime < X4.d.f3315k) {
                return null;
            }
            return X4.d.f3316l;
        }
        long jNanoTime2 = dVar2.f3319g - System.nanoTime();
        if (jNanoTime2 > 0) {
            X4.d.i.await(jNanoTime2, TimeUnit.NANOSECONDS);
            return null;
        }
        X4.d dVar4 = X4.d.f3316l;
        AbstractC0983h.b(dVar4);
        dVar4.f3318f = dVar2.f3318f;
        dVar2.f3318f = null;
        dVar2.f3317e = 2;
        return dVar2;
    }

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

    public static A f(Context context, int i) {
        S4.d.c("Cannot create a CalendarItemStyle with a styleResId of 0", i != 0);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(i, Q1.a.f2591k);
        Rect rect = new Rect(typedArrayObtainStyledAttributes.getDimensionPixelOffset(0, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(2, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(1, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(3, 0));
        S4.m.j(context, typedArrayObtainStyledAttributes, 4);
        S4.m.j(context, typedArrayObtainStyledAttributes, 9);
        S4.m.j(context, typedArrayObtainStyledAttributes, 7);
        typedArrayObtainStyledAttributes.getDimensionPixelSize(8, 0);
        i2.k.a(context, typedArrayObtainStyledAttributes.getResourceId(5, 0), typedArrayObtainStyledAttributes.getResourceId(6, 0), new C0624a(0)).a();
        typedArrayObtainStyledAttributes.recycle();
        A a5 = new A(23);
        S4.d.e(rect.left);
        S4.d.e(rect.top);
        S4.d.e(rect.right);
        S4.d.e(rect.bottom);
        return a5;
    }

    public static C0732k1 h(Context context, String[] strArr, String str, com.google.firebase.messaging.w wVar) {
        String[] strArrJ = j(context);
        int length = strArrJ.length;
        int i = 0;
        while (true) {
            ZipFile zipFile = null;
            if (i >= length) {
                return null;
            }
            String str2 = strArrJ[i];
            int i5 = 0;
            while (true) {
                int i6 = i5 + 1;
                if (i5 >= 5) {
                    break;
                }
                try {
                    zipFile = new ZipFile(new File(str2), 1);
                    break;
                } catch (IOException unused) {
                    i5 = i6;
                }
            }
            if (zipFile != null) {
                int i7 = 0;
                while (true) {
                    int i8 = i7 + 1;
                    if (i7 < 5) {
                        for (String str3 : strArr) {
                            StringBuilder sb = new StringBuilder("lib");
                            char c6 = File.separatorChar;
                            sb.append(c6);
                            sb.append(str3);
                            sb.append(c6);
                            sb.append(str);
                            String string = sb.toString();
                            wVar.A("Looking for %s in APK %s...", string, str2);
                            ZipEntry entry = zipFile.getEntry(string);
                            if (entry != null) {
                                C0732k1 c0732k1 = new C0732k1(8, false);
                                c0732k1.f7858l = zipFile;
                                c0732k1.f7859m = entry;
                                return c0732k1;
                            }
                        }
                        i7 = i8;
                    } else {
                        try {
                            zipFile.close();
                            break;
                        } catch (IOException unused2) {
                        }
                    }
                }
            }
            i++;
        }
    }

    public static String[] i(Context context, String str) {
        StringBuilder sb = new StringBuilder("lib");
        char c6 = File.separatorChar;
        sb.append(c6);
        sb.append("([^\\");
        sb.append(c6);
        sb.append("]*)");
        sb.append(c6);
        sb.append(str);
        Pattern patternCompile = Pattern.compile(sb.toString());
        HashSet hashSet = new HashSet();
        for (String str2 : j(context)) {
            try {
                Enumeration<? extends ZipEntry> enumerationEntries = new ZipFile(new File(str2), 1).entries();
                while (enumerationEntries.hasMoreElements()) {
                    Matcher matcher = patternCompile.matcher(enumerationEntries.nextElement().getName());
                    if (matcher.matches()) {
                        hashSet.add(matcher.group(1));
                    }
                }
            } catch (IOException unused) {
            }
        }
        return (String[]) hashSet.toArray(new String[hashSet.size()]);
    }

    public static String[] j(Context context) {
        ApplicationInfo applicationInfo = context.getApplicationInfo();
        String[] strArr = applicationInfo.splitSourceDirs;
        if (strArr == null || strArr.length == 0) {
            return new String[]{applicationInfo.sourceDir};
        }
        String[] strArr2 = new String[strArr.length + 1];
        strArr2[0] = applicationInfo.sourceDir;
        System.arraycopy(strArr, 0, strArr2, 1, strArr.length);
        return strArr2;
    }

    @Override // L1.InterfaceC0145w
    public Object a() {
        switch (this.f1289k) {
            case 0:
                List list = F.f1393a;
                C0357c3.f5048l.get();
                return (String) C0367e3.f5084a0.b();
            case 1:
                List list2 = F.f1393a;
                C0357c3.f5048l.get();
                return (String) C0367e3.f5124w0.b();
            case 2:
                List list3 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5114r0.b()).longValue());
            case 3:
                List list4 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.X.b()).longValue());
            case 4:
                List list5 = F.f1393a;
                C0357c3.f5048l.get();
                Boolean bool = (Boolean) C0367e3.f5087c.b();
                bool.getClass();
                return bool;
            case 5:
                List list6 = F.f1393a;
                Boolean bool2 = (Boolean) C0456w3.f5318b.b();
                bool2.getClass();
                return bool2;
            case 6:
                List list7 = F.f1393a;
                Boolean bool3 = (Boolean) C0456w3.f5319c.b();
                bool3.getClass();
                return bool3;
            case 7:
                List list8 = F.f1393a;
                Boolean bool4 = (Boolean) s4.f5220a.b();
                bool4.getClass();
                return bool4;
            case 8:
                List list9 = F.f1393a;
                Boolean bool5 = (Boolean) C0441t3.f5239b.b();
                bool5.getClass();
                return bool5;
            case AndroidTouchProcessor.PointerChange.PAN_ZOOM_END /* 9 */:
                List list10 = F.f1393a;
                P3.f4935l.get();
                Boolean bool6 = (Boolean) R3.f4963f.b();
                bool6.getClass();
                return bool6;
            case FlutterTextUtils.LINE_FEED /* 10 */:
                List list11 = F.f1393a;
                P3.f4935l.get();
                Boolean bool7 = (Boolean) R3.f4965h.b();
                bool7.getClass();
                return bool7;
            case 11:
                List list12 = F.f1393a;
                P3.f4935l.get();
                Boolean bool8 = (Boolean) R3.f4962e.b();
                bool8.getClass();
                return bool8;
            case 12:
                List list13 = F.f1393a;
                Boolean bool9 = (Boolean) Y2.f5010a.b();
                bool9.getClass();
                return bool9;
            case FlutterTextUtils.CARRIAGE_RETURN /* 13 */:
                List list14 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5108n0.b()).longValue());
            default:
                return new Boolean(((Boolean) I3.f4890a.b()).booleanValue());
        }
    }

    @Override // j1.InterfaceC0796a
    public long b() {
        return SystemClock.elapsedRealtime();
    }

    @Override // N2.f
    public /* synthetic */ Object g(A2.p pVar) {
        return AnalyticsConnectorRegistrar.lambda$getComponents$0(pVar);
    }

    @Override // k3.p
    public Object z() {
        switch (this.f1289k) {
            case Build.API_LEVELS.API_27 /* 27 */:
                return new TreeSet();
            case Build.API_LEVELS.API_28 /* 28 */:
                return new ArrayList();
            default:
                return new TreeMap();
        }
    }

    @Override // W.InterfaceC0189c
    public Object t(C0188b c0188b) throws C0188b {
        throw c0188b;
    }
}
