package k1;

import e1.AbstractC0453a;
import e1.C0454b;
import java.io.IOException;
import java.util.HashMap;
import l1.C0622e;
import okhttp3.HttpUrl;

/* JADX INFO: renamed from: k1.d, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0586d {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    static C0622e f4794c = C0622e.a();

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    static final boolean f4795d = AbstractC0453a.a("jcifs.smb.client.dfs.strictView", false);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    static final long f4796e = AbstractC0453a.f("jcifs.smb.client.dfs.ttl", 300);

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    static final boolean f4797f = AbstractC0453a.a("jcifs.smb.client.dfs.disabled", false);

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    protected static a f4798g = new a(0);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    protected a f4799a = null;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    protected a f4800b = null;

    /* JADX INFO: renamed from: k1.d$a */
    static class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        long f4801a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        HashMap f4802b;

        a(long j2) {
            this.f4801a = System.currentTimeMillis() + ((j2 == 0 ? C0586d.f4796e : j2) * 1000);
            this.f4802b = new HashMap();
        }
    }

    public e0 a(String str, C0599q c0599q) throws C0602t {
        if (f4797f) {
            return null;
        }
        try {
            C0587e c0587eQ = e0.s(C0454b.e(str, true), 0).q(c0599q, "\\" + str, 1);
            if (c0587eQ != null) {
                C0587e c0587e = c0587eQ;
                do {
                    try {
                        return e0.s(C0454b.d(c0587e.f4816y), 0);
                    } catch (IOException e2) {
                        c0587e = c0587e.f4811Z;
                    }
                } while (c0587e != c0587eQ);
                throw e2;
            }
        } catch (IOException e3) {
            if (C0622e.f5384g >= 3) {
                e3.printStackTrace(f4794c);
            }
            if (f4795d && (e3 instanceof C0602t)) {
                throw ((C0602t) e3);
            }
        }
        return null;
    }

    public C0587e b(e0 e0Var, String str, String str2, String str3, C0599q c0599q) throws C0602t {
        C0587e c0587eQ;
        if (f4797f) {
            return null;
        }
        try {
            String str4 = "\\" + str + "\\" + str2;
            if (str3 != null) {
                str4 = str4 + str3;
            }
            c0587eQ = e0Var.q(c0599q, str4, 0);
        } catch (IOException e2) {
            if (C0622e.f5384g >= 4) {
                e2.printStackTrace(f4794c);
            }
            if (f4795d && (e2 instanceof C0602t)) {
                throw ((C0602t) e2);
            }
        }
        if (c0587eQ != null) {
            return c0587eQ;
        }
        return null;
    }

    public HashMap c(C0599q c0599q) throws C0602t {
        if (!f4797f && c0599q.f4993b != "?") {
            if (this.f4799a != null && System.currentTimeMillis() > this.f4799a.f4801a) {
                this.f4799a = null;
            }
            a aVar = this.f4799a;
            if (aVar != null) {
                return aVar.f4802b;
            }
            try {
                e0 e0VarS = e0.s(C0454b.e(c0599q.f4993b, true), 0);
                a aVar2 = new a(f4796e * 10);
                C0587e c0587eQ = e0VarS.q(c0599q, HttpUrl.FRAGMENT_ENCODE_SET, 0);
                if (c0587eQ != null) {
                    C0587e c0587e = c0587eQ;
                    do {
                        aVar2.f4802b.put(c0587e.f4816y.toLowerCase(), new HashMap());
                        c0587e = c0587e.f4811Z;
                    } while (c0587e != c0587eQ);
                    this.f4799a = aVar2;
                    return aVar2.f4802b;
                }
            } catch (IOException e2) {
                if (C0622e.f5384g >= 3) {
                    e2.printStackTrace(f4794c);
                }
                if (f4795d && (e2 instanceof C0602t)) {
                    throw ((C0602t) e2);
                }
            }
        }
        return null;
    }

    synchronized void d(String str, C0587e c0587e) {
        try {
            if (f4797f) {
                return;
            }
            int iIndexOf = str.indexOf(92, 1);
            int i2 = iIndexOf + 1;
            int iIndexOf2 = str.indexOf(92, i2);
            String strSubstring = str.substring(1, iIndexOf);
            String strSubstring2 = str.substring(i2, iIndexOf2);
            String lowerCase = str.substring(0, c0587e.f4814r).toLowerCase();
            int length = lowerCase.length();
            while (length > 1 && lowerCase.charAt(length - 1) == '\\') {
                length--;
            }
            if (length < lowerCase.length()) {
                lowerCase = lowerCase.substring(0, length);
            }
            c0587e.f4814r -= (strSubstring.length() + 2) + strSubstring2.length();
            if (this.f4800b != null && System.currentTimeMillis() + 10000 > this.f4800b.f4801a) {
                this.f4800b = null;
            }
            if (this.f4800b == null) {
                this.f4800b = new a(0L);
            }
            this.f4800b.f4802b.put(lowerCase, c0587e);
        } catch (Throwable th) {
            throw th;
        }
    }

    public boolean e(String str, C0599q c0599q) throws C0602t {
        HashMap mapC = c(c0599q);
        return (mapC == null || mapC.get(str.toLowerCase()) == null) ? false : true;
    }

    /* JADX WARN: Removed duplicated region for block: B:66:0x0108 A[PHI: r1
      0x0108: PHI (r1v21 k1.e) = (r1v20 k1.e), (r1v26 k1.e) binds: [B:46:0x00b3, B:52:0x00cd] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:78:0x0125 A[Catch: all -> 0x0048, TryCatch #0 {all -> 0x0048, blocks: (B:4:0x0007, B:6:0x0010, B:9:0x001c, B:11:0x0024, B:13:0x0031, B:15:0x003d, B:17:0x0043, B:22:0x004e, B:27:0x0063, B:29:0x0069, B:31:0x007c, B:32:0x0084, B:34:0x008d, B:36:0x0091, B:37:0x0096, B:47:0x00b5, B:49:0x00c1, B:51:0x00c7, B:54:0x00d1, B:62:0x00e8, B:64:0x00ee, B:71:0x0114, B:73:0x0118, B:75:0x011e, B:76:0x0121, B:78:0x0125, B:79:0x012c, B:81:0x014d, B:82:0x015c, B:83:0x016c, B:85:0x0172, B:87:0x0182, B:97:0x01a1, B:88:0x0187, B:90:0x018e, B:92:0x0194, B:40:0x00a1, B:41:0x00a7), top: B:105:0x0007 }] */
    /* JADX WARN: Removed duplicated region for block: B:81:0x014d A[Catch: all -> 0x0048, TryCatch #0 {all -> 0x0048, blocks: (B:4:0x0007, B:6:0x0010, B:9:0x001c, B:11:0x0024, B:13:0x0031, B:15:0x003d, B:17:0x0043, B:22:0x004e, B:27:0x0063, B:29:0x0069, B:31:0x007c, B:32:0x0084, B:34:0x008d, B:36:0x0091, B:37:0x0096, B:47:0x00b5, B:49:0x00c1, B:51:0x00c7, B:54:0x00d1, B:62:0x00e8, B:64:0x00ee, B:71:0x0114, B:73:0x0118, B:75:0x011e, B:76:0x0121, B:78:0x0125, B:79:0x012c, B:81:0x014d, B:82:0x015c, B:83:0x016c, B:85:0x0172, B:87:0x0182, B:97:0x01a1, B:88:0x0187, B:90:0x018e, B:92:0x0194, B:40:0x00a1, B:41:0x00a7), top: B:105:0x0007 }] */
    /* JADX WARN: Removed duplicated region for block: B:85:0x0172 A[Catch: all -> 0x0048, TryCatch #0 {all -> 0x0048, blocks: (B:4:0x0007, B:6:0x0010, B:9:0x001c, B:11:0x0024, B:13:0x0031, B:15:0x003d, B:17:0x0043, B:22:0x004e, B:27:0x0063, B:29:0x0069, B:31:0x007c, B:32:0x0084, B:34:0x008d, B:36:0x0091, B:37:0x0096, B:47:0x00b5, B:49:0x00c1, B:51:0x00c7, B:54:0x00d1, B:62:0x00e8, B:64:0x00ee, B:71:0x0114, B:73:0x0118, B:75:0x011e, B:76:0x0121, B:78:0x0125, B:79:0x012c, B:81:0x014d, B:82:0x015c, B:83:0x016c, B:85:0x0172, B:87:0x0182, B:97:0x01a1, B:88:0x0187, B:90:0x018e, B:92:0x0194, B:40:0x00a1, B:41:0x00a7), top: B:105:0x0007 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public synchronized k1.C0587e f(java.lang.String r18, java.lang.String r19, java.lang.String r20, k1.C0599q r21) {
        /*
            Method dump skipped, instruction units count: 435
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: k1.C0586d.f(java.lang.String, java.lang.String, java.lang.String, k1.q):k1.e");
    }
}
