package j3;

import j3.f;
import java.util.Iterator;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class k extends p {
    public k(i3.e eVar) {
        super(eVar);
    }

    private void q(f fVar) {
        this.f23956h.f23915k.add(fVar);
        fVar.f23916l.add(this.f23956h);
    }

    @Override // j3.p, j3.d
    public void a(d dVar) {
        i3.a aVar = (i3.a) this.f23950b;
        int r12 = aVar.r1();
        Iterator it = this.f23956h.f23916l.iterator();
        int i10 = 0;
        int i11 = -1;
        while (it.hasNext()) {
            int i12 = ((f) it.next()).f23911g;
            if (i11 == -1 || i12 < i11) {
                i11 = i12;
            }
            if (i10 < i12) {
                i10 = i12;
            }
        }
        if (r12 == 0 || r12 == 2) {
            this.f23956h.d(i11 + aVar.s1());
        } else {
            this.f23956h.d(i10 + aVar.s1());
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // j3.p
    public void d() {
        i3.e eVar = this.f23950b;
        if (eVar instanceof i3.a) {
            this.f23956h.f23906b = true;
            i3.a aVar = (i3.a) eVar;
            int r12 = aVar.r1();
            boolean q12 = aVar.q1();
            int i10 = 0;
            if (r12 == 0) {
                this.f23956h.f23909e = f.a.LEFT;
                while (i10 < aVar.M0) {
                    i3.e eVar2 = aVar.L0[i10];
                    if (q12 || eVar2.T() != 8) {
                        f fVar = eVar2.f22341e.f23956h;
                        fVar.f23915k.add(this.f23956h);
                        this.f23956h.f23916l.add(fVar);
                    }
                    i10++;
                }
                q(this.f23950b.f22341e.f23956h);
                q(this.f23950b.f22341e.f23957i);
                return;
            }
            if (r12 == 1) {
                this.f23956h.f23909e = f.a.RIGHT;
                while (i10 < aVar.M0) {
                    i3.e eVar3 = aVar.L0[i10];
                    if (q12 || eVar3.T() != 8) {
                        f fVar2 = eVar3.f22341e.f23957i;
                        fVar2.f23915k.add(this.f23956h);
                        this.f23956h.f23916l.add(fVar2);
                    }
                    i10++;
                }
                q(this.f23950b.f22341e.f23956h);
                q(this.f23950b.f22341e.f23957i);
                return;
            }
            if (r12 == 2) {
                this.f23956h.f23909e = f.a.TOP;
                while (i10 < aVar.M0) {
                    i3.e eVar4 = aVar.L0[i10];
                    if (q12 || eVar4.T() != 8) {
                        f fVar3 = eVar4.f22343f.f23956h;
                        fVar3.f23915k.add(this.f23956h);
                        this.f23956h.f23916l.add(fVar3);
                    }
                    i10++;
                }
                q(this.f23950b.f22343f.f23956h);
                q(this.f23950b.f22343f.f23957i);
                return;
            }
            if (r12 != 3) {
                return;
            }
            this.f23956h.f23909e = f.a.BOTTOM;
            while (i10 < aVar.M0) {
                i3.e eVar5 = aVar.L0[i10];
                if (q12 || eVar5.T() != 8) {
                    f fVar4 = eVar5.f22343f.f23957i;
                    fVar4.f23915k.add(this.f23956h);
                    this.f23956h.f23916l.add(fVar4);
                }
                i10++;
            }
            q(this.f23950b.f22343f.f23956h);
            q(this.f23950b.f22343f.f23957i);
        }
    }

    @Override // j3.p
    public void e() {
        i3.e eVar = this.f23950b;
        if (eVar instanceof i3.a) {
            int r12 = ((i3.a) eVar).r1();
            if (r12 == 0 || r12 == 1) {
                this.f23950b.i1(this.f23956h.f23911g);
            } else {
                this.f23950b.j1(this.f23956h.f23911g);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // j3.p
    public void f() {
        this.f23951c = null;
        this.f23956h.c();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // j3.p
    public boolean m() {
        return false;
    }
}
