package defpackage;

import java.io.EOFException;
import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

/* renamed from: ᵤᵢᵺ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3452 implements InterfaceC3226 {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final Inflater f12953;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final C2753 f12954;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public boolean f12955;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public int f12956;

    public C3452(C2753 c2753, Inflater inflater) {
        this.f12954 = c2753;
        this.f12953 = inflater;
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public final void close() throws IOException {
        if (this.f12955) {
            return;
        }
        this.f12953.end();
        this.f12955 = true;
        this.f12954.close();
    }

    @Override // defpackage.InterfaceC3226
    /* renamed from: ᵝᵵᵺ */
    public final C3948 mo2227() {
        return this.f12954.f10637.mo2227();
    }

    @Override // defpackage.InterfaceC3226
    /* renamed from: ᵳٴᵶ */
    public final long mo2229(C0963 c0963, long j) throws DataFormatException, IOException {
        long j2;
        Inflater inflater = this.f12953;
        while (!this.f12955) {
            try {
                C3514 c3514M3279 = c0963.m3279(1);
                int iMin = (int) Math.min(8192L, 8192 - c3514M3279.f13188);
                boolean zNeedsInput = inflater.needsInput();
                C2753 c2753 = this.f12954;
                if (zNeedsInput && !c2753.mo3284()) {
                    C3514 c3514 = c2753.f10636.f4315;
                    int i = c3514.f13188;
                    int i2 = c3514.f13190;
                    int i3 = i - i2;
                    this.f12956 = i3;
                    inflater.setInput(c3514.f13189, i2, i3);
                }
                int iInflate = inflater.inflate(c3514M3279.f13189, c3514M3279.f13188, iMin);
                int i4 = this.f12956;
                if (i4 != 0) {
                    int remaining = i4 - inflater.getRemaining();
                    this.f12956 -= remaining;
                    c2753.skip(remaining);
                }
                if (iInflate > 0) {
                    c3514M3279.f13188 += iInflate;
                    j2 = iInflate;
                    c0963.f4314 += j2;
                } else {
                    if (c3514M3279.f13190 == c3514M3279.f13188) {
                        c0963.f4315 = c3514M3279.m8039();
                        AbstractC3467.m7895(c3514M3279);
                    }
                    j2 = 0;
                }
                if (j2 > 0) {
                    return j2;
                }
                if (inflater.finished() || inflater.needsDictionary()) {
                    return -1L;
                }
                if (c2753.mo3284()) {
                    throw new EOFException("source exhausted prematurely");
                }
            } catch (DataFormatException e) {
                throw new IOException(e);
            }
        }
        ᵹˉᵞ.ᵳٴᵶ("closed");
        return 0L;
    }
}
