package o;

import android.content.Context;
import android.util.Log;
import java.io.File;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.iy, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1533iy implements InterfaceC3051yx {
    public final Object l;
    public Object m;
    public final Object n;

    /* renamed from: o, reason: collision with root package name */
    public final Object f590o;
    public final Object p;
    public final Object q;
    public Object r;

    public C1533iy() {
        this.l = new AtomicBoolean();
        this.m = null;
        this.n = new HashMap(16, 1.0f);
        this.f590o = new HashMap(16, 1.0f);
        this.p = new HashMap(16, 1.0f);
        this.q = new HashMap(16, 1.0f);
        this.r = null;
    }

    public static synchronized void c(File file) {
        try {
            if (file.exists()) {
                if (file.isDirectory()) {
                    return;
                }
                file.toString();
                Log.isLoggable("FirebaseCrashlytics", 3);
                file.delete();
            }
            if (!file.mkdirs()) {
                file.toString();
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    public static boolean d(File file) {
        File[] fileArrListFiles = file.listFiles();
        if (fileArrListFiles != null) {
            for (File file2 : fileArrListFiles) {
                d(file2);
            }
        }
        return file.delete();
    }

    public static List e(Object[] objArr) {
        return objArr == null ? Collections.EMPTY_LIST : Arrays.asList(objArr);
    }

    public void a(String str) {
        File file = new File((File) this.m, str);
        if (file.exists() && d(file)) {
            file.getPath();
            Log.isLoggable("FirebaseCrashlytics", 3);
        }
    }

    public File b(String str, String str2) {
        File file = new File((File) this.f590o, str);
        file.mkdirs();
        return new File(file, str2);
    }

    @Override // o.CZ
    public Object get() {
        Context context = (Context) ((CZ) this.l).get();
        C2900xP c2900xP = (C2900xP) ((CZ) this.m).get();
        InterfaceC0463Rw interfaceC0463Rw = (InterfaceC0463Rw) ((CZ) this.n).get();
        C3126zm0 c3126zm0 = (C3126zm0) ((C3126zm0) this.f590o).get();
        Executor executor = (Executor) ((CZ) this.p).get();
        InterfaceC0918cc0 interfaceC0918cc0 = (InterfaceC0918cc0) ((CZ) this.q).get();
        C2616uQ c2616uQ = new C2616uQ(25);
        C2616uQ c2616uQ2 = new C2616uQ(23);
        InterfaceC1025di interfaceC1025di = (InterfaceC1025di) ((CZ) this.r).get();
        C0598Xb c0598Xb = new C0598Xb();
        c0598Xb.a = context;
        c0598Xb.b = c2900xP;
        c0598Xb.c = interfaceC0463Rw;
        c0598Xb.d = c3126zm0;
        c0598Xb.e = executor;
        c0598Xb.f = interfaceC0918cc0;
        c0598Xb.g = c2616uQ;
        c0598Xb.h = c2616uQ2;
        c0598Xb.i = interfaceC1025di;
        return c0598Xb;
    }

    public C1533iy(CZ cz, CZ cz2, CZ cz3, C3126zm0 c3126zm0, CZ cz4, CZ cz5, CZ cz6) {
        this.l = cz;
        this.m = cz2;
        this.n = cz3;
        this.f590o = c3126zm0;
        this.p = cz4;
        this.q = cz5;
        this.r = cz6;
    }

    public C1533iy(Context context) throws NoSuchAlgorithmException {
        String string;
        String strReplaceAll;
        String str = ((C3103zb) C0669Zu.R.h(context)).a;
        this.l = str;
        File filesDir = context.getFilesDir();
        this.m = filesDir;
        if (!str.isEmpty()) {
            StringBuilder sb = new StringBuilder(".crashlytics.v3");
            sb.append(File.separator);
            if (str.length() > 40) {
                strReplaceAll = C1884mi0.K(str);
            } else {
                strReplaceAll = str.replaceAll("[^a-zA-Z0-9.]", "_");
            }
            sb.append(strReplaceAll);
            string = sb.toString();
        } else {
            string = ".com.google.firebase.crashlytics.files.v1";
        }
        File file = new File(filesDir, string);
        c(file);
        this.n = file;
        File file2 = new File(file, "open-sessions");
        c(file2);
        this.f590o = file2;
        File file3 = new File(file, "reports");
        c(file3);
        this.p = file3;
        File file4 = new File(file, "priority-reports");
        c(file4);
        this.q = file4;
        File file5 = new File(file, "native-reports");
        c(file5);
        this.r = file5;
    }
}
