package x7;

import f6.C0966a;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.GregorianCalendar;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.zip.Inflater;

/* JADX INFO: loaded from: classes.dex */
public final class K extends m {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final x f18744e;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final x f18745b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final m f18746c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final LinkedHashMap f18747d;

    static {
        String str = x.f18797r;
        f18744e = d3.C.j("/", false);
    }

    public K(x xVar, m mVar, LinkedHashMap linkedHashMap) {
        this.f18745b = xVar;
        this.f18746c = mVar;
        this.f18747d = linkedHashMap;
    }

    @Override // x7.m
    public final void b(x xVar) throws IOException {
        throw new IOException("zip file systems are read-only");
    }

    @Override // x7.m
    public final void c(x xVar) throws IOException {
        P6.g.e(xVar, "path");
        throw new IOException("zip file systems are read-only");
    }

    @Override // x7.m
    public final List f(x xVar) throws IOException {
        P6.g.e(xVar, "dir");
        x xVar2 = f18744e;
        xVar2.getClass();
        y7.f fVar = (y7.f) this.f18747d.get(y7.c.b(xVar2, xVar, true));
        if (fVar != null) {
            return B6.k.x0(fVar.f19068q);
        }
        throw new IOException("not a directory: " + xVar);
    }

    /* JADX WARN: Removed duplicated region for block: B:63:0x0117  */
    /* JADX WARN: Removed duplicated region for block: B:65:0x0125  */
    @Override // x7.m
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C0966a h(x xVar) throws Throwable {
        Long lValueOf;
        long j8;
        Long l8;
        Long lValueOf2;
        Long l9;
        Long l10;
        Long lValueOf3;
        Throwable th;
        Throwable th2;
        y7.f fVarF;
        P6.g.e(xVar, "path");
        x xVar2 = f18744e;
        xVar2.getClass();
        y7.f fVar = (y7.f) this.f18747d.get(y7.c.b(xVar2, xVar, true));
        if (fVar == null) {
            return null;
        }
        long j9 = fVar.f19060h;
        if (j9 != -1) {
            s sVarI = this.f18746c.i(this.f18745b);
            try {
                B bC = s7.l.c(sVarI.g(j9));
                try {
                    fVarF = y7.b.f(bC, fVar);
                    P6.g.b(fVarF);
                    try {
                        bC.close();
                        th2 = null;
                    } catch (Throwable th3) {
                        th2 = th3;
                    }
                } catch (Throwable th4) {
                    try {
                        bC.close();
                    } catch (Throwable th5) {
                        android.support.v4.media.session.a.a(th4, th5);
                    }
                    th2 = th4;
                    fVarF = null;
                }
                if (th2 != null) {
                    throw th2;
                }
                try {
                    sVarI.close();
                    th = null;
                } catch (Throwable th6) {
                    th = th6;
                }
                th = th;
                fVar = fVarF;
            } catch (Throwable th7) {
                th = th7;
                if (sVarI != null) {
                    try {
                        sVarI.close();
                    } catch (Throwable th8) {
                        android.support.v4.media.session.a.a(th, th8);
                    }
                }
                fVar = null;
            }
            if (th != null) {
                throw th;
            }
        }
        boolean z8 = fVar.f19054b;
        boolean z9 = !z8;
        Long lValueOf4 = z8 ? null : Long.valueOf(fVar.f19058f);
        Long l11 = fVar.f19064m;
        if (l11 != null) {
            lValueOf = Long.valueOf((l11.longValue() / ((long) 10000)) - 11644473600000L);
        } else {
            Integer num = fVar.f19067p;
            lValueOf = num != null ? Long.valueOf(((long) num.intValue()) * 1000) : null;
        }
        Long l12 = fVar.f19062k;
        if (l12 != null) {
            j8 = 11644473600000L;
            lValueOf2 = Long.valueOf((l12.longValue() / ((long) 10000)) - 11644473600000L);
        } else {
            j8 = 11644473600000L;
            Integer num2 = fVar.f19065n;
            if (num2 != null) {
                lValueOf2 = Long.valueOf(((long) num2.intValue()) * 1000);
            } else {
                int i = fVar.f19061j;
                if (i == -1 || i == -1) {
                    l8 = null;
                    l9 = fVar.f19063l;
                    if (l9 == null) {
                        lValueOf3 = Long.valueOf((l9.longValue() / ((long) 10000)) - j8);
                    } else {
                        Integer num3 = fVar.f19066o;
                        if (num3 == null) {
                            l10 = null;
                            return new C0966a(z9, z8, null, lValueOf4, lValueOf, l8, l10);
                        }
                        lValueOf3 = Long.valueOf(((long) num3.intValue()) * 1000);
                    }
                    l10 = lValueOf3;
                    return new C0966a(z9, z8, null, lValueOf4, lValueOf, l8, l10);
                }
                int i5 = fVar.i;
                int i8 = (i5 >> 5) & 15;
                GregorianCalendar gregorianCalendar = new GregorianCalendar();
                gregorianCalendar.set(14, 0);
                gregorianCalendar.set(((i5 >> 9) & 127) + 1980, i8 - 1, i5 & 31, (i >> 11) & 31, (i >> 5) & 63, (i & 31) << 1);
                lValueOf2 = Long.valueOf(gregorianCalendar.getTime().getTime());
            }
        }
        l8 = lValueOf2;
        l9 = fVar.f19063l;
        if (l9 == null) {
        }
        l10 = lValueOf3;
        return new C0966a(z9, z8, null, lValueOf4, lValueOf, l8, l10);
    }

    @Override // x7.m
    public final s i(x xVar) {
        throw new UnsupportedOperationException("not implemented yet!");
    }

    @Override // x7.m
    public final F j(x xVar) throws IOException {
        P6.g.e(xVar, "file");
        throw new IOException("zip file systems are read-only");
    }

    @Override // x7.m
    public final H k(x xVar) throws Throwable {
        Throwable th;
        B bC;
        P6.g.e(xVar, "file");
        x xVar2 = f18744e;
        xVar2.getClass();
        y7.f fVar = (y7.f) this.f18747d.get(y7.c.b(xVar2, xVar, true));
        if (fVar == null) {
            throw new FileNotFoundException("no such file: " + xVar);
        }
        s sVarI = this.f18746c.i(this.f18745b);
        try {
            bC = s7.l.c(sVarI.g(fVar.f19060h));
            try {
                sVarI.close();
                th = null;
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            if (sVarI != null) {
                try {
                    sVarI.close();
                } catch (Throwable th4) {
                    android.support.v4.media.session.a.a(th3, th4);
                }
            }
            th = th3;
            bC = null;
        }
        if (th != null) {
            throw th;
        }
        P6.g.e(bC, "<this>");
        y7.b.f(bC, null);
        int i = fVar.f19059g;
        long j8 = fVar.f19058f;
        if (i == 0) {
            return new y7.d(bC, j8, true);
        }
        return new y7.d(new r(s7.l.c(new y7.d(bC, fVar.f19057e, true)), new Inflater(true)), j8, false);
    }
}
