package L1;

import java.io.File;
import java.text.ParseException;
import java.util.Locale;
import okhttp3.HttpUrl;

/* JADX INFO: loaded from: classes2.dex */
public class l extends b {
    public l(K1.f fVar) {
        super("(\\S+)\\s+(?:(\\d+)\\s+)?(?:(\\S+)\\s+(\\S+)\\s+)?(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+((\\S+\\s*)+)?");
        d(fVar);
    }

    private boolean k(String str) {
        return str == null || str.isEmpty();
    }

    @Override // K1.j
    public K1.i c(String str) {
        String str2;
        int i2;
        int iLastIndexOf;
        K1.i iVar = new K1.i();
        iVar.k(str);
        if (!g(str)) {
            return null;
        }
        String strF = f(1);
        String strF2 = f(2);
        int i3 = 3;
        if (k(f(3)) && k(f(4))) {
            str2 = HttpUrl.FRAGMENT_ENCODE_SET;
        } else {
            str2 = f(3) + " " + f(4);
        }
        String strF3 = f(5);
        String strF4 = f(6);
        try {
            iVar.m(super.j(str2));
        } catch (ParseException unused) {
        }
        if (!strF3.equalsIgnoreCase("*STMF")) {
            if (!strF3.equalsIgnoreCase("*DIR")) {
                if (strF3.equalsIgnoreCase("*FILE")) {
                    if (strF4 == null || !strF4.toUpperCase(Locale.ROOT).endsWith(".SAVF")) {
                        return null;
                    }
                } else if (!strF3.equalsIgnoreCase("*MEM")) {
                    i2 = 1;
                } else {
                    if (k(strF4) || !k(strF2) || !k(str2)) {
                        return null;
                    }
                    strF4 = strF4.replace('/', File.separatorChar);
                }
                i2 = 0;
            } else {
                if (k(strF2) || k(strF4)) {
                    return null;
                }
                i2 = 1;
            }
            i3 = i2;
        } else {
            if (k(strF2) || k(strF4)) {
                return null;
            }
            i2 = 1;
            i3 = 0;
        }
        iVar.n(i3);
        iVar.o(strF);
        try {
            iVar.l(Long.parseLong(strF2));
        } catch (NumberFormatException unused2) {
        }
        if (strF4.endsWith("/")) {
            strF4 = strF4.substring(0, strF4.length() - 1);
        }
        if (i2 != 0 && (iLastIndexOf = strF4.lastIndexOf(47)) > -1) {
            strF4 = strF4.substring(iLastIndexOf + 1);
        }
        iVar.i(strF4);
        return iVar;
    }

    @Override // L1.b
    protected K1.f i() {
        return new K1.f("OS/400", "yy/MM/dd HH:mm:ss", null);
    }
}
