package o; import o.C1230Yni; import o.C17026tNn; /* loaded from: classes.dex */ public abstract class Bgk implements rZk { protected C17026tNn.LWm d; ysb h; public int i; public C17026tNn l; public FgJ e = new FgJ(this); public int f = 0; public boolean j = false; /* renamed from: o, reason: collision with root package name */ public KMk f8108o = new KMk(this); public KMk c = new KMk(this); protected RVV g = RVV.NONE; /* loaded from: classes.dex */ enum RVV { NONE, START, END, CENTER } /* JADX INFO: Access modifiers changed from: package-private */ public abstract void a(); public abstract void c(); public abstract boolean d(); /* JADX INFO: Access modifiers changed from: package-private */ public abstract void e(); @Override // o.rZk public void g() { } public Bgk(C17026tNn c17026tNn) { this.l = c17026tNn; } /* JADX INFO: Access modifiers changed from: protected */ public static KMk c(C1230Yni c1230Yni) { if (c1230Yni.f == null) { return null; } C17026tNn c17026tNn = c1230Yni.f.i; int i = AnonymousClass2.b[c1230Yni.f.j.ordinal()]; if (i == 1) { return c17026tNn.h.f8108o; } if (i == 2) { return c17026tNn.h.c; } if (i == 3) { return c17026tNn.ak.f8108o; } if (i == 4) { return c17026tNn.ak.b; } if (i != 5) { return null; } return c17026tNn.ak.c; } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.Bgk$2, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass2 { static final int[] b; static { int[] iArr = new int[C1230Yni.HBt.values().length]; b = iArr; try { iArr[C1230Yni.HBt.LEFT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { b[C1230Yni.HBt.RIGHT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { b[C1230Yni.HBt.TOP.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { b[C1230Yni.HBt.BASELINE.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { b[C1230Yni.HBt.BOTTOM.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } } } /* JADX INFO: Access modifiers changed from: protected */ public final void a(C1230Yni c1230Yni, C1230Yni c1230Yni2, int i) { float f; int i2; int i3; KMk c = c(c1230Yni); KMk c2 = c(c1230Yni2); if (c.j && c2.j) { int e = c.l + c1230Yni.e(); int e2 = c2.l - c1230Yni2.e(); int i4 = e2 - e; if (!this.e.j && this.d == C17026tNn.LWm.MATCH_CONSTRAINT) { int i5 = this.i; if (i5 == 0) { i2 = i4; } else if (i5 == 1) { this.e.d(Math.min(c(this.e.k, i), i4)); } else if (i5 != 2) { if (i5 == 3 && (this.l.h.d != C17026tNn.LWm.MATCH_CONSTRAINT || this.l.h.i != 3 || this.l.ak.d != C17026tNn.LWm.MATCH_CONSTRAINT || this.l.ak.i != 3)) { C17026tNn c17026tNn = this.l; if ((i == 0 ? c17026tNn.ak : c17026tNn.h).e.j) { float f2 = this.l.s; if (i == 1) { i3 = (int) ((r3.e.l / f2) + 0.5f); } else { i3 = (int) ((f2 * r3.e.l) + 0.5f); } this.e.d(i3); } } } else { C17026tNn c17026tNn2 = this.l.S; if (c17026tNn2 != null) { if ((i == 0 ? c17026tNn2.h : c17026tNn2.ak).e.j) { C17026tNn c17026tNn3 = this.l; i2 = (int) ((r3.e.l * (i == 0 ? c17026tNn3.M : c17026tNn3.K)) + 0.5f); } } } this.e.d(c(i2, i)); } if (this.e.j) { if (this.e.l == i4) { this.f8108o.d(e); this.c.d(e2); return; } C17026tNn c17026tNn4 = this.l; if (i == 0) { f = c17026tNn4.u; } else { f = c17026tNn4.T; } if (c == c2) { e = c.l; e2 = c2.l; f = 0.5f; } this.f8108o.d((int) (e + 0.5f + (((e2 - e) - this.e.l) * f))); this.c.d(this.f8108o.l + this.e.l); } } } /* JADX INFO: Access modifiers changed from: protected */ public final int c(int i, int i2) { int max; if (i2 == 0) { int i3 = this.l.E; max = Math.max(this.l.L, i); if (i3 > 0) { max = Math.min(i3, i); } if (max == i) { return i; } } else { int i4 = this.l.F; max = Math.max(this.l.N, i); if (i4 > 0) { max = Math.min(i4, i); } if (max == i) { return i; } } return max; } /* JADX INFO: Access modifiers changed from: protected */ public static KMk b(C1230Yni c1230Yni, int i) { if (c1230Yni.f == null) { return null; } C17026tNn c17026tNn = c1230Yni.f.i; Bgk bgk = i == 0 ? c17026tNn.h : c17026tNn.ak; int i2 = AnonymousClass2.b[c1230Yni.f.j.ordinal()]; if (i2 != 1) { if (i2 != 2) { if (i2 != 3) { if (i2 != 5) { return null; } } } return bgk.c; } return bgk.f8108o; } /* JADX INFO: Access modifiers changed from: protected */ public final void d(KMk kMk, KMk kMk2, int i, FgJ fgJ) { kMk.i.add(kMk2); kMk.i.add(this.e); kMk.e = i; kMk.b = fgJ; kMk2.d.add(kMk); fgJ.d.add(kMk); } public long b() { if (this.e.j) { return this.e.l; } return 0L; } }