得物.apk(点击下载) / b.java


package com.caverock.androidsvg;

import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.DashPathEffect;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.Typeface;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Base64;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.ViewCompat;
import com.caverock.androidsvg.CSSParser;
import com.caverock.androidsvg.PreserveAspectRatio;
import com.caverock.androidsvg.SVG;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Stack;

/* compiled from: SVGAndroidRenderer */
public class b {
    private static HashSet<String> supportedFeatures;

    /* renamed from: a  reason: collision with root package name */
    public Canvas f4079a;
    public SVG b;

    /* renamed from: c  reason: collision with root package name */
    public h f4080c;
    public Stack<h> d;
    public Stack<SVG.SvgContainer> e;
    public Stack<Matrix> f;

    /* compiled from: SVGAndroidRenderer */
    public static /* synthetic */ class a {

        /* renamed from: a  reason: collision with root package name */
        public static final /* synthetic */ int[] f4081a;
        public static final /* synthetic */ int[] b;

        /* renamed from: c  reason: collision with root package name */
        public static final /* synthetic */ int[] f4082c;

        /* JADX WARNING: Can't wrap try/catch for region: R(32:0|(2:1|2)|3|(2:5|6)|7|9|10|11|13|14|15|16|17|18|19|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|38) */
        /* JADX WARNING: Can't wrap try/catch for region: R(33:0|1|2|3|(2:5|6)|7|9|10|11|13|14|15|16|17|18|19|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|38) */
        /* JADX WARNING: Can't wrap try/catch for region: R(34:0|1|2|3|5|6|7|9|10|11|13|14|15|16|17|18|19|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|38) */
        /* JADX WARNING: Code restructure failed: missing block: B:39:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:15:0x0039 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:17:0x0043 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:23:0x005e */
        /* JADX WARNING: Missing exception handler attribute for start block: B:25:0x0068 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:27:0x0072 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:29:0x007d */
        /* JADX WARNING: Missing exception handler attribute for start block: B:31:0x0088 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:33:0x0093 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:35:0x009e */
        static {
            int[] iArr = new int[SVG.Style.LineJoin.values().length];
            f4082c = iArr;
            try {
                iArr[SVG.Style.LineJoin.Miter.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f4082c[SVG.Style.LineJoin.Round.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f4082c[SVG.Style.LineJoin.Bevel.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            int[] iArr2 = new int[SVG.Style.LineCap.values().length];
            b = iArr2;
            iArr2[SVG.Style.LineCap.Butt.ordinal()] = 1;
            b[SVG.Style.LineCap.Round.ordinal()] = 2;
            b[SVG.Style.LineCap.Square.ordinal()] = 3;
            int[] iArr3 = new int[PreserveAspectRatio.Alignment.values().length];
            f4081a = iArr3;
            iArr3[PreserveAspectRatio.Alignment.xMidYMin.ordinal()] = 1;
            f4081a[PreserveAspectRatio.Alignment.xMidYMid.ordinal()] = 2;
            f4081a[PreserveAspectRatio.Alignment.xMidYMax.ordinal()] = 3;
            f4081a[PreserveAspectRatio.Alignment.xMaxYMin.ordinal()] = 4;
            f4081a[PreserveAspectRatio.Alignment.xMaxYMid.ordinal()] = 5;
            f4081a[PreserveAspectRatio.Alignment.xMaxYMax.ordinal()] = 6;
            f4081a[PreserveAspectRatio.Alignment.xMinYMid.ordinal()] = 7;
            f4081a[PreserveAspectRatio.Alignment.xMinYMax.ordinal()] = 8;
        }
    }

    /* renamed from: com.caverock.androidsvg.b$b  reason: collision with other inner class name */
    /* compiled from: SVGAndroidRenderer */
    public class C0101b implements SVG.PathInterface {

        /* renamed from: a  reason: collision with root package name */
        public List<c> f4083a = new ArrayList();
        public float b;

        /* renamed from: c  reason: collision with root package name */
        public float f4084c;
        public c d = null;
        public boolean e = false;
        public boolean f = true;

        /* renamed from: g  reason: collision with root package name */
        public int f4085g = -1;

        /* renamed from: h  reason: collision with root package name */
        public boolean f4086h;

        public C0101b(SVG.t tVar) {
            if (tVar != null) {
                tVar.c(this);
                if (this.f4086h) {
                    this.d.b(this.f4083a.get(this.f4085g));
                    this.f4083a.set(this.f4085g, this.d);
                    this.f4086h = false;
                }
                c cVar = this.d;
                if (cVar != null) {
                    this.f4083a.add(cVar);
                }
            }
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void arcTo(float f12, float f13, float f14, boolean z, boolean z4, float f15, float f16) {
            this.e = true;
            this.f = false;
            c cVar = this.d;
            b.a(cVar.f4087a, cVar.b, f12, f13, f14, z, z4, f15, f16, this);
            this.f = true;
            this.f4086h = false;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void close() {
            this.f4083a.add(this.d);
            lineTo(this.b, this.f4084c);
            this.f4086h = true;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void cubicTo(float f12, float f13, float f14, float f15, float f16, float f17) {
            if (this.f || this.e) {
                this.d.a(f12, f13);
                this.f4083a.add(this.d);
                this.e = false;
            }
            this.d = new c(b.this, f16, f17, f16 - f14, f17 - f15);
            this.f4086h = false;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void lineTo(float f12, float f13) {
            this.d.a(f12, f13);
            this.f4083a.add(this.d);
            b bVar = b.this;
            c cVar = this.d;
            this.d = new c(bVar, f12, f13, f12 - cVar.f4087a, f13 - cVar.b);
            this.f4086h = false;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void moveTo(float f12, float f13) {
            if (this.f4086h) {
                this.d.b(this.f4083a.get(this.f4085g));
                this.f4083a.set(this.f4085g, this.d);
                this.f4086h = false;
            }
            c cVar = this.d;
            if (cVar != null) {
                this.f4083a.add(cVar);
            }
            this.b = f12;
            this.f4084c = f13;
            this.d = new c(b.this, f12, f13, o5.i.f36333a, o5.i.f36333a);
            this.f4085g = this.f4083a.size();
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void quadTo(float f12, float f13, float f14, float f15) {
            this.d.a(f12, f13);
            this.f4083a.add(this.d);
            this.d = new c(b.this, f14, f15, f14 - f12, f15 - f13);
            this.f4086h = false;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class c {

        /* renamed from: a  reason: collision with root package name */
        public float f4087a;
        public float b;

        /* renamed from: c  reason: collision with root package name */
        public float f4088c;
        public float d;
        public boolean e;

        public c(b bVar, float f, float f12, float f13, float f14) {
            this.f4087a = f;
            this.b = f12;
            double sqrt = Math.sqrt((double) ((f14 * f14) + (f13 * f13)));
            if (sqrt != 0.0d) {
                this.f4088c = (float) (((double) f13) / sqrt);
                this.d = (float) (((double) f14) / sqrt);
            }
        }

        public void a(float f, float f12) {
            float f13 = f - this.f4087a;
            float f14 = f12 - this.b;
            double sqrt = Math.sqrt((double) ((f14 * f14) + (f13 * f13)));
            if (sqrt != 0.0d) {
                f13 = (float) (((double) f13) / sqrt);
                f14 = (float) (((double) f14) / sqrt);
            }
            float f15 = this.f4088c;
            if (f13 == (-f15) && f14 == (-this.d)) {
                this.e = true;
                this.f4088c = -f14;
                this.d = f13;
                return;
            }
            this.f4088c = f15 + f13;
            this.d += f14;
        }

        public void b(c cVar) {
            float f = cVar.f4088c;
            float f12 = this.f4088c;
            if (f == (-f12)) {
                float f13 = cVar.d;
                if (f13 == (-this.d)) {
                    this.e = true;
                    this.f4088c = -f13;
                    this.d = cVar.f4088c;
                    return;
                }
            }
            this.f4088c = f12 + f;
            this.d += cVar.d;
        }

        public String toString() {
            StringBuilder h12 = a.f.h("(");
            h12.append(this.f4087a);
            h12.append(",");
            h12.append(this.b);
            h12.append(" ");
            h12.append(this.f4088c);
            h12.append(",");
            return h.a.m(h12, this.d, ")");
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class d implements SVG.PathInterface {

        /* renamed from: a  reason: collision with root package name */
        public Path f4089a = new Path();
        public float b;

        /* renamed from: c  reason: collision with root package name */
        public float f4090c;

        public d(b bVar, SVG.t tVar) {
            if (tVar != null) {
                tVar.c(this);
            }
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void arcTo(float f, float f12, float f13, boolean z, boolean z4, float f14, float f15) {
            b.a(this.b, this.f4090c, f, f12, f13, z, z4, f14, f15, this);
            this.b = f14;
            this.f4090c = f15;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void close() {
            this.f4089a.close();
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void cubicTo(float f, float f12, float f13, float f14, float f15, float f16) {
            this.f4089a.cubicTo(f, f12, f13, f14, f15, f16);
            this.b = f15;
            this.f4090c = f16;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void lineTo(float f, float f12) {
            this.f4089a.lineTo(f, f12);
            this.b = f;
            this.f4090c = f12;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void moveTo(float f, float f12) {
            this.f4089a.moveTo(f, f12);
            this.b = f;
            this.f4090c = f12;
        }

        @Override // com.caverock.androidsvg.SVG.PathInterface
        public void quadTo(float f, float f12, float f13, float f14) {
            this.f4089a.quadTo(f, f12, f13, f14);
            this.b = f13;
            this.f4090c = f14;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class e extends f {
        public Path d;

        public e(Path path, float f, float f12) {
            super(f, f12);
            this.d = path;
        }

        @Override // com.caverock.androidsvg.b.f, com.caverock.androidsvg.b.j
        public void b(String str) {
            if (b.this.Y()) {
                b bVar = b.this;
                h hVar = bVar.f4080c;
                if (hVar.b) {
                    bVar.f4079a.drawTextOnPath(str, this.d, this.f4091a, this.b, hVar.d);
                }
                b bVar2 = b.this;
                h hVar2 = bVar2.f4080c;
                if (hVar2.f4096c) {
                    bVar2.f4079a.drawTextOnPath(str, this.d, this.f4091a, this.b, hVar2.e);
                }
            }
            this.f4091a = b.this.f4080c.d.measureText(str) + this.f4091a;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class f extends j {

        /* renamed from: a  reason: collision with root package name */
        public float f4091a;
        public float b;

        public f(float f, float f12) {
            super(b.this, null);
            this.f4091a = f;
            this.b = f12;
        }

        @Override // com.caverock.androidsvg.b.j
        public void b(String str) {
            if (b.this.Y()) {
                b bVar = b.this;
                h hVar = bVar.f4080c;
                if (hVar.b) {
                    bVar.f4079a.drawText(str, this.f4091a, this.b, hVar.d);
                }
                b bVar2 = b.this;
                h hVar2 = bVar2.f4080c;
                if (hVar2.f4096c) {
                    bVar2.f4079a.drawText(str, this.f4091a, this.b, hVar2.e);
                }
            }
            this.f4091a = b.this.f4080c.d.measureText(str) + this.f4091a;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class g extends j {

        /* renamed from: a  reason: collision with root package name */
        public float f4093a;
        public float b;

        /* renamed from: c  reason: collision with root package name */
        public Path f4094c;

        public g(float f, float f12, Path path) {
            super(b.this, null);
            this.f4093a = f;
            this.b = f12;
            this.f4094c = path;
        }

        @Override // com.caverock.androidsvg.b.j
        public boolean a(SVG.q0 q0Var) {
            if (!(q0Var instanceof SVG.r0)) {
                return true;
            }
            String.format("Using <textPath> elements in a clip path is not supported.", new Object[0]);
            return false;
        }

        @Override // com.caverock.androidsvg.b.j
        public void b(String str) {
            if (b.this.Y()) {
                Path path = new Path();
                b.this.f4080c.d.getTextPath(str, 0, str.length(), this.f4093a, this.b, path);
                this.f4094c.addPath(path);
            }
            this.f4093a = b.this.f4080c.d.measureText(str) + this.f4093a;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public class i extends j {

        /* renamed from: a  reason: collision with root package name */
        public float f4099a;
        public float b;

        /* renamed from: c  reason: collision with root package name */
        public RectF f4100c = new RectF();

        public i(float f, float f12) {
            super(b.this, null);
            this.f4099a = f;
            this.b = f12;
        }

        @Override // com.caverock.androidsvg.b.j
        public boolean a(SVG.q0 q0Var) {
            if (!(q0Var instanceof SVG.r0)) {
                return true;
            }
            SVG.r0 r0Var = (SVG.r0) q0Var;
            SVG.g0 g3 = q0Var.f4027a.g(r0Var.o);
            if (g3 == null) {
                String.format("TextPath path reference '%s' not found", r0Var.o);
                return false;
            }
            SVG.s sVar = (SVG.s) g3;
            Path path = new d(b.this, sVar.o).f4089a;
            Matrix matrix = sVar.n;
            if (matrix != null) {
                path.transform(matrix);
            }
            RectF rectF = new RectF();
            path.computeBounds(rectF, true);
            this.f4100c.union(rectF);
            return false;
        }

        @Override // com.caverock.androidsvg.b.j
        public void b(String str) {
            if (b.this.Y()) {
                Rect rect = new Rect();
                b.this.f4080c.d.getTextBounds(str, 0, str.length(), rect);
                RectF rectF = new RectF(rect);
                rectF.offset(this.f4099a, this.b);
                this.f4100c.union(rectF);
            }
            this.f4099a = b.this.f4080c.d.measureText(str) + this.f4099a;
        }
    }

    /* compiled from: SVGAndroidRenderer */
    public abstract class j {
        public j(b bVar, a aVar) {
        }

        public boolean a(SVG.q0 q0Var) {
            return true;
        }

        public abstract void b(String str);
    }

    /* compiled from: SVGAndroidRenderer */
    public class k extends j {

        /* renamed from: a  reason: collision with root package name */
        public float f4101a;

        public k(a aVar) {
            super(b.this, null);
        }

        @Override // com.caverock.androidsvg.b.j
        public void b(String str) {
            this.f4101a = b.this.f4080c.d.measureText(str) + this.f4101a;
        }
    }

    public b(Canvas canvas, float f12) {
        this.f4079a = canvas;
    }

    public static void a(float f12, float f13, float f14, float f15, float f16, boolean z, boolean z4, float f17, float f18, SVG.PathInterface pathInterface) {
        if (!(f12 == f17 && f13 == f18)) {
            if (f14 == o5.i.f36333a || f15 == o5.i.f36333a) {
                pathInterface.lineTo(f17, f18);
                return;
            }
            float abs = Math.abs(f14);
            float abs2 = Math.abs(f15);
            double radians = Math.toRadians(((double) f16) % 360.0d);
            double cos = Math.cos(radians);
            double sin = Math.sin(radians);
            double d12 = ((double) (f12 - f17)) / 2.0d;
            double d13 = ((double) (f13 - f18)) / 2.0d;
            double d14 = (sin * d13) + (cos * d12);
            double d15 = (d13 * cos) + ((-sin) * d12);
            double d16 = (double) (abs * abs);
            double d17 = (double) (abs2 * abs2);
            double d18 = d14 * d14;
            double d19 = d15 * d15;
            double d22 = (d19 / d17) + (d18 / d16);
            if (d22 > 0.99999d) {
                double sqrt = Math.sqrt(d22) * 1.00001d;
                abs = (float) (((double) abs) * sqrt);
                abs2 = (float) (sqrt * ((double) abs2));
                d16 = (double) (abs * abs);
                d17 = (double) (abs2 * abs2);
            }
            double d23 = z == z4 ? -1.0d : 1.0d;
            double d24 = d16 * d17;
            double d25 = d16 * d19;
            double d26 = d17 * d18;
            double d27 = ((d24 - d25) - d26) / (d25 + d26);
            if (d27 < 0.0d) {
                d27 = 0.0d;
            }
            double sqrt2 = Math.sqrt(d27) * d23;
            double d28 = (double) abs;
            double d29 = (double) abs2;
            double d32 = ((d28 * d15) / d29) * sqrt2;
            double d33 = sqrt2 * (-((d29 * d14) / d28));
            double d34 = ((cos * d32) - (sin * d33)) + (((double) (f12 + f17)) / 2.0d);
            double d35 = (cos * d33) + (sin * d32) + (((double) (f13 + f18)) / 2.0d);
            double d36 = (d14 - d32) / d28;
            double d37 = (d15 - d33) / d29;
            double d38 = ((-d14) - d32) / d28;
            double d39 = ((-d15) - d33) / d29;
            double d42 = (d37 * d37) + (d36 * d36);
            double acos = Math.acos(d36 / Math.sqrt(d42)) * (d37 < 0.0d ? -1.0d : 1.0d);
            double sqrt3 = ((d37 * d39) + (d36 * d38)) / Math.sqrt(((d39 * d39) + (d38 * d38)) * d42);
            double acos2 = ((d36 * d39) - (d37 * d38) < 0.0d ? -1.0d : 1.0d) * (sqrt3 < -1.0d ? 3.141592653589793d : sqrt3 > 1.0d ? 0.0d : Math.acos(sqrt3));
            if (!z4 && acos2 > 0.0d) {
                acos2 -= 6.283185307179586d;
            } else if (z4 && acos2 < 0.0d) {
                acos2 += 6.283185307179586d;
            }
            double d43 = acos2 % 6.283185307179586d;
            double d44 = acos % 6.283185307179586d;
            int ceil = (int) Math.ceil((Math.abs(d43) * 2.0d) / 3.141592653589793d);
            double d45 = d43 / ((double) ceil);
            double d46 = d45 / 2.0d;
            double sin2 = (Math.sin(d46) * 1.3333333333333333d) / (Math.cos(d46) + 1.0d);
            int i3 = ceil * 6;
            float[] fArr = new float[i3];
            int i12 = 0;
            int i13 = 0;
            while (i12 < ceil) {
                double d47 = (((double) i12) * d45) + d44;
                double cos2 = Math.cos(d47);
                double sin3 = Math.sin(d47);
                int i14 = i13 + 1;
                fArr[i13] = (float) (cos2 - (sin2 * sin3));
                int i15 = i14 + 1;
                fArr[i14] = (float) ((cos2 * sin2) + sin3);
                double d48 = d47 + d45;
                double cos3 = Math.cos(d48);
                double sin4 = Math.sin(d48);
                int i16 = i15 + 1;
                fArr[i15] = (float) ((sin2 * sin4) + cos3);
                int i17 = i16 + 1;
                fArr[i16] = (float) (sin4 - (sin2 * cos3));
                int i18 = i17 + 1;
                fArr[i17] = (float) cos3;
                i13 = i18 + 1;
                fArr[i18] = (float) sin4;
                i12++;
                d35 = d35;
                i3 = i3;
                d44 = d44;
                ceil = ceil;
                d45 = d45;
            }
            Matrix matrix = new Matrix();
            matrix.postScale(abs, abs2);
            matrix.postRotate(f16);
            matrix.postTranslate((float) d34, (float) d35);
            matrix.mapPoints(fArr);
            fArr[i3 - 2] = f17;
            fArr[i3 - 1] = f18;
            for (int i19 = 0; i19 < i3; i19 += 6) {
                pathInterface.cubicTo(fArr[i19], fArr[i19 + 1], fArr[i19 + 2], fArr[i19 + 3], fArr[i19 + 4], fArr[i19 + 5]);
            }
        }
    }

    public static int j(float f12) {
        int i3 = (int) (f12 * 256.0f);
        if (i3 < 0) {
            return 0;
        }
        return i3 > 255 ? MotionEventCompat.ACTION_MASK : i3;
    }

    public static int k(int i3, float f12) {
        int i12 = MotionEventCompat.ACTION_MASK;
        int round = Math.round(((float) ((i3 >> 24) & MotionEventCompat.ACTION_MASK)) * f12);
        if (round < 0) {
            i12 = 0;
        } else if (round <= 255) {
            i12 = round;
        }
        return (i3 & ViewCompat.MEASURED_SIZE_MASK) | (i12 << 24);
    }

    public final Path A(SVG.d dVar) {
        SVG.n nVar = dVar.o;
        float f12 = o5.i.f36333a;
        float d12 = nVar != null ? nVar.d(this) : o5.i.f36333a;
        SVG.n nVar2 = dVar.p;
        if (nVar2 != null) {
            f12 = nVar2.e(this);
        }
        float b2 = dVar.f4022q.b(this);
        float f13 = d12 - b2;
        float f14 = f12 - b2;
        float f15 = d12 + b2;
        float f16 = f12 + b2;
        if (dVar.f4023h == null) {
            float f17 = 2.0f * b2;
            dVar.f4023h = new SVG.b(f13, f14, f17, f17);
        }
        float f18 = 0.5522848f * b2;
        Path path = new Path();
        path.moveTo(d12, f14);
        float f19 = d12 + f18;
        float f22 = f12 - f18;
        path.cubicTo(f19, f14, f15, f22, f15, f12);
        float f23 = f12 + f18;
        path.cubicTo(f15, f23, f19, f16, d12, f16);
        float f24 = d12 - f18;
        path.cubicTo(f24, f16, f13, f23, f13, f12);
        path.cubicTo(f13, f22, f24, f14, d12, f14);
        path.close();
        return path;
    }

    public final Path B(SVG.i iVar) {
        SVG.n nVar = iVar.o;
        float f12 = o5.i.f36333a;
        float d12 = nVar != null ? nVar.d(this) : o5.i.f36333a;
        SVG.n nVar2 = iVar.p;
        if (nVar2 != null) {
            f12 = nVar2.e(this);
        }
        float d13 = iVar.f4028q.d(this);
        float e6 = iVar.r.e(this);
        float f13 = d12 - d13;
        float f14 = f12 - e6;
        float f15 = d12 + d13;
        float f16 = f12 + e6;
        if (iVar.f4023h == null) {
            iVar.f4023h = new SVG.b(f13, f14, d13 * 2.0f, 2.0f * e6);
        }
        float f17 = d13 * 0.5522848f;
        float f18 = 0.5522848f * e6;
        Path path = new Path();
        path.moveTo(d12, f14);
        float f19 = d12 + f17;
        float f22 = f12 - f18;
        path.cubicTo(f19, f14, f15, f22, f15, f12);
        float f23 = f18 + f12;
        path.cubicTo(f15, f23, f19, f16, d12, f16);
        float f24 = d12 - f17;
        path.cubicTo(f24, f16, f13, f23, f13, f12);
        path.cubicTo(f13, f22, f24, f14, d12, f14);
        path.close();
        return path;
    }

    public final Path C(SVG.v vVar) {
        Path path = new Path();
        float[] fArr = vVar.o;
        path.moveTo(fArr[0], fArr[1]);
        int i3 = 2;
        while (true) {
            float[] fArr2 = vVar.o;
            if (i3 >= fArr2.length) {
                break;
            }
            path.lineTo(fArr2[i3], fArr2[i3 + 1]);
            i3 += 2;
        }
        if (vVar instanceof SVG.w) {
            path.close();
        }
        if (vVar.f4023h == null) {
            vVar.f4023h = c(path);
        }
        return path;
    }

    public final Path D(SVG.x xVar) {
        float f12;
        float f13;
        Path path;
        SVG.n nVar = xVar.s;
        if (nVar == null && xVar.t == null) {
            f13 = o5.i.f36333a;
            f12 = o5.i.f36333a;
        } else {
            if (nVar == null) {
                f13 = xVar.t.e(this);
            } else if (xVar.t == null) {
                f13 = nVar.d(this);
            } else {
                f13 = nVar.d(this);
                f12 = xVar.t.e(this);
            }
            f12 = f13;
        }
        float min = Math.min(f13, xVar.f4049q.d(this) / 2.0f);
        float min2 = Math.min(f12, xVar.r.e(this) / 2.0f);
        SVG.n nVar2 = xVar.o;
        float d12 = nVar2 != null ? nVar2.d(this) : o5.i.f36333a;
        SVG.n nVar3 = xVar.p;
        float e6 = nVar3 != null ? nVar3.e(this) : o5.i.f36333a;
        float d13 = xVar.f4049q.d(this);
        float e12 = xVar.r.e(this);
        if (xVar.f4023h == null) {
            xVar.f4023h = new SVG.b(d12, e6, d13, e12);
        }
        float f14 = d12 + d13;
        float f15 = e6 + e12;
        Path path2 = new Path();
        if (min == o5.i.f36333a || min2 == o5.i.f36333a) {
            path = path2;
            path.moveTo(d12, e6);
            path.lineTo(f14, e6);
            path.lineTo(f14, f15);
            path.lineTo(d12, f15);
            path.lineTo(d12, e6);
        } else {
            float f16 = min * 0.5522848f;
            float f17 = 0.5522848f * min2;
            float f18 = e6 + min2;
            path2.moveTo(d12, f18);
            float f19 = f18 - f17;
            float f22 = d12 + min;
            float f23 = f22 - f16;
            path2.cubicTo(d12, f19, f23, e6, f22, e6);
            float f24 = f14 - min;
            path2.lineTo(f24, e6);
            float f25 = f24 + f16;
            path2.cubicTo(f25, e6, f14, f19, f14, f18);
            float f26 = f15 - min2;
            path2.lineTo(f14, f26);
            float f27 = f26 + f17;
            path = path2;
            path2.cubicTo(f14, f27, f25, f15, f24, f15);
            path.lineTo(f22, f15);
            path.cubicTo(f23, f15, d12, f27, d12, f26);
            path.lineTo(d12, f18);
        }
        path.close();
        return path;
    }

    public final SVG.b E(SVG.n nVar, SVG.n nVar2, SVG.n nVar3, SVG.n nVar4) {
        float f12 = o5.i.f36333a;
        float d12 = nVar != null ? nVar.d(this) : o5.i.f36333a;
        if (nVar2 != null) {
            f12 = nVar2.e(this);
        }
        SVG.b y = y();
        return new SVG.b(d12, f12, nVar3 != null ? nVar3.d(this) : y.f4019c, nVar4 != null ? nVar4.e(this) : y.d);
    }

    @TargetApi(19)
    public final Path F(SVG.d0 d0Var, boolean z) {
        Path path;
        Path b2;
        this.d.push(this.f4080c);
        h hVar = new h(this, this.f4080c);
        this.f4080c = hVar;
        W(hVar, d0Var);
        if (!m() || !Y()) {
            this.f4080c = this.d.pop();
            return null;
        }
        if (d0Var instanceof SVG.u0) {
            if (!z) {
                String.format("<use> elements inside a <clipPath> cannot reference another <use>", new Object[0]);
            }
            SVG.u0 u0Var = (SVG.u0) d0Var;
            SVG.g0 g3 = d0Var.f4027a.g(u0Var.p);
            if (g3 == null) {
                String.format("Use reference '%s' not found", u0Var.p);
                this.f4080c = this.d.pop();
                return null;
            } else if (!(g3 instanceof SVG.d0)) {
                this.f4080c = this.d.pop();
                return null;
            } else {
                path = F((SVG.d0) g3, false);
                if (path == null) {
                    return null;
                }
                if (u0Var.f4023h == null) {
                    u0Var.f4023h = c(path);
                }
                Matrix matrix = u0Var.o;
                if (matrix != null) {
                    path.transform(matrix);
                }
            }
        } else if (d0Var instanceof SVG.k) {
            SVG.k kVar = (SVG.k) d0Var;
            if (d0Var instanceof SVG.s) {
                path = new d(this, ((SVG.s) d0Var).o).f4089a;
                if (d0Var.f4023h == null) {
                    d0Var.f4023h = c(path);
                }
            } else {
                path = d0Var instanceof SVG.x ? D((SVG.x) d0Var) : d0Var instanceof SVG.d ? A((SVG.d) d0Var) : d0Var instanceof SVG.i ? B((SVG.i) d0Var) : d0Var instanceof SVG.v ? C((SVG.v) d0Var) : null;
            }
            if (path == null) {
                return null;
            }
            if (kVar.f4023h == null) {
                kVar.f4023h = c(path);
            }
            Matrix matrix2 = kVar.n;
            if (matrix2 != null) {
                path.transform(matrix2);
            }
            path.setFillType(x());
        } else if (d0Var instanceof SVG.p0) {
            SVG.p0 p0Var = (SVG.p0) d0Var;
            List<SVG.n> list = p0Var.o;
            float f12 = o5.i.f36333a;
            float d12 = (list == null || list.size() == 0) ? o5.i.f36333a : p0Var.o.get(0).d(this);
            List<SVG.n> list2 = p0Var.p;
            float e6 = (list2 == null || list2.size() == 0) ? o5.i.f36333a : p0Var.p.get(0).e(this);
            List<SVG.n> list3 = p0Var.f4041q;
            float d13 = (list3 == null || list3.size() == 0) ? o5.i.f36333a : p0Var.f4041q.get(0).d(this);
            List<SVG.n> list4 = p0Var.r;
            if (!(list4 == null || list4.size() == 0)) {
                f12 = p0Var.r.get(0).e(this);
            }
            if (this.f4080c.f4095a.f4007v != SVG.Style.TextAnchor.Start) {
                float d14 = d(p0Var);
                if (this.f4080c.f4095a.f4007v == SVG.Style.TextAnchor.Middle) {
                    d14 /= 2.0f;
                }
                d12 -= d14;
            }
            if (p0Var.f4023h == null) {
                i iVar = new i(d12, e6);
                p(p0Var, iVar);
                RectF rectF = iVar.f4100c;
                p0Var.f4023h = new SVG.b(rectF.left, rectF.top, rectF.width(), iVar.f4100c.height());
            }
            Path path2 = new Path();
            p(p0Var, new g(d12 + d13, e6 + f12, path2));
            Matrix matrix3 = p0Var.s;
            if (matrix3 != null) {
                path2.transform(matrix3);
            }
            path2.setFillType(x());
            path = path2;
        } else {
            String.format("Invalid %s element found in clipPath definition", d0Var.a());
            return null;
        }
        if (!(this.f4080c.f4095a.F == null || (b2 = b(d0Var, d0Var.f4023h)) == null)) {
            path.op(b2, Path.Op.INTERSECT);
        }
        this.f4080c = this.d.pop();
        return path;
    }

    public final void G(SVG.d0 d0Var) {
        H(d0Var, d0Var.f4023h);
    }

    public final void H(SVG.d0 d0Var, SVG.b bVar) {
        if (this.f4080c.f4095a.H != null) {
            Paint paint = new Paint();
            paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
            this.f4079a.saveLayer(null, paint, 31);
            Paint paint2 = new Paint();
            paint2.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix(new float[]{o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, o5.i.f36333a, 0.2127f, 0.7151f, 0.0722f, o5.i.f36333a, o5.i.f36333a})));
            this.f4079a.saveLayer(null, paint2, 31);
            SVG.q qVar = (SVG.q) this.b.g(this.f4080c.f4095a.H);
            O(qVar, d0Var, bVar);
            this.f4079a.restore();
            Paint paint3 = new Paint();
            paint3.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
            this.f4079a.saveLayer(null, paint3, 31);
            O(qVar, d0Var, bVar);
            this.f4079a.restore();
            this.f4079a.restore();
        }
        R();
    }

    public final boolean I() {
        SVG.g0 g3;
        if (!(this.f4080c.f4095a.n.floatValue() < 1.0f || this.f4080c.f4095a.H != null)) {
            return false;
        }
        this.f4079a.saveLayerAlpha(null, j(this.f4080c.f4095a.n.floatValue()), 31);
        this.d.push(this.f4080c);
        h hVar = new h(this, this.f4080c);
        this.f4080c = hVar;
        String str = hVar.f4095a.H;
        if (str != null && ((g3 = this.b.g(str)) == null || !(g3 instanceof SVG.q))) {
            String.format("Mask reference '%s' not found", this.f4080c.f4095a.H);
            this.f4080c.f4095a.H = null;
        }
        return true;
    }

    public final void J(SVG.a0 a0Var, SVG.b bVar, SVG.b bVar2, PreserveAspectRatio preserveAspectRatio) {
        if (bVar.f4019c != o5.i.f36333a && bVar.d != o5.i.f36333a) {
            if (preserveAspectRatio == null && (preserveAspectRatio = a0Var.o) == null) {
                preserveAspectRatio = PreserveAspectRatio.d;
            }
            W(this.f4080c, a0Var);
            if (m()) {
                h hVar = this.f4080c;
                hVar.f = bVar;
                if (!hVar.f4095a.w.booleanValue()) {
                    SVG.b bVar3 = this.f4080c.f;
                    P(bVar3.f4018a, bVar3.b, bVar3.f4019c, bVar3.d);
                }
                f(a0Var, this.f4080c.f);
                if (bVar2 != null) {
                    this.f4079a.concat(e(this.f4080c.f, bVar2, preserveAspectRatio));
                    this.f4080c.f4097g = a0Var.p;
                } else {
                    Canvas canvas = this.f4079a;
                    SVG.b bVar4 = this.f4080c.f;
                    canvas.translate(bVar4.f4018a, bVar4.b);
                }
                boolean I = I();
                X();
                L(a0Var, true);
                if (I) {
                    H(a0Var, a0Var.f4023h);
                }
                U(a0Var);
            }
        }
    }

    public final void K(SVG.g0 g0Var) {
        Path.FillType fillType;
        Path.FillType fillType2;
        SVG.n nVar;
        String str;
        int indexOf;
        Set<String> systemLanguage;
        SVG.n nVar2;
        if (!(g0Var instanceof SVG.NotDirectlyRendered)) {
            S();
            i(g0Var);
            if (g0Var instanceof SVG.a0) {
                SVG.a0 a0Var = (SVG.a0) g0Var;
                J(a0Var, E(a0Var.f4017q, a0Var.r, a0Var.s, a0Var.t), a0Var.p, a0Var.o);
            } else {
                boolean z = g0Var instanceof SVG.u0;
                Bitmap bitmap = null;
                int i3 = 0;
                float f12 = o5.i.f36333a;
                if (z) {
                    SVG.u0 u0Var = (SVG.u0) g0Var;
                    SVG.n nVar3 = u0Var.s;
                    if ((nVar3 == null || !nVar3.g()) && ((nVar2 = u0Var.t) == null || !nVar2.g())) {
                        W(this.f4080c, u0Var);
                        if (m()) {
                            SVG.g0 g3 = u0Var.f4027a.g(u0Var.p);
                            if (g3 == null) {
                                String.format("Use reference '%s' not found", u0Var.p);
                            } else {
                                Matrix matrix = u0Var.o;
                                if (matrix != null) {
                                    this.f4079a.concat(matrix);
                                }
                                SVG.n nVar4 = u0Var.f4048q;
                                float d12 = nVar4 != null ? nVar4.d(this) : o5.i.f36333a;
                                SVG.n nVar5 = u0Var.r;
                                this.f4079a.translate(d12, nVar5 != null ? nVar5.e(this) : o5.i.f36333a);
                                f(u0Var, u0Var.f4023h);
                                boolean I = I();
                                this.e.push(u0Var);
                                this.f.push(this.f4079a.getMatrix());
                                if (g3 instanceof SVG.a0) {
                                    SVG.a0 a0Var2 = (SVG.a0) g3;
                                    SVG.b E = E(null, null, u0Var.s, u0Var.t);
                                    S();
                                    J(a0Var2, E, a0Var2.p, a0Var2.o);
                                    R();
                                } else if (g3 instanceof SVG.m0) {
                                    SVG.n nVar6 = u0Var.s;
                                    if (nVar6 == null) {
                                        nVar6 = new SVG.n(100.0f, SVG.Unit.percent);
                                    }
                                    SVG.n nVar7 = u0Var.t;
                                    if (nVar7 == null) {
                                        nVar7 = new SVG.n(100.0f, SVG.Unit.percent);
                                    }
                                    SVG.b E2 = E(null, null, nVar6, nVar7);
                                    S();
                                    SVG.m0 m0Var = (SVG.m0) g3;
                                    if (!(E2.f4019c == o5.i.f36333a || E2.d == o5.i.f36333a)) {
                                        PreserveAspectRatio preserveAspectRatio = m0Var.o;
                                        if (preserveAspectRatio == null) {
                                            preserveAspectRatio = PreserveAspectRatio.d;
                                        }
                                        W(this.f4080c, m0Var);
                                        h hVar = this.f4080c;
                                        hVar.f = E2;
                                        if (!hVar.f4095a.w.booleanValue()) {
                                            SVG.b bVar = this.f4080c.f;
                                            P(bVar.f4018a, bVar.b, bVar.f4019c, bVar.d);
                                        }
                                        SVG.b bVar2 = m0Var.p;
                                        if (bVar2 != null) {
                                            this.f4079a.concat(e(this.f4080c.f, bVar2, preserveAspectRatio));
                                            this.f4080c.f4097g = m0Var.p;
                                        } else {
                                            Canvas canvas = this.f4079a;
                                            SVG.b bVar3 = this.f4080c.f;
                                            canvas.translate(bVar3.f4018a, bVar3.b);
                                        }
                                        boolean I2 = I();
                                        L(m0Var, true);
                                        if (I2) {
                                            G(m0Var);
                                        }
                                        U(m0Var);
                                    }
                                    R();
                                } else {
                                    K(g3);
                                }
                                this.e.pop();
                                this.f.pop();
                                if (I) {
                                    G(u0Var);
                                }
                                U(u0Var);
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.l0) {
                    SVG.l0 l0Var = (SVG.l0) g0Var;
                    W(this.f4080c, l0Var);
                    if (m()) {
                        Matrix matrix2 = l0Var.o;
                        if (matrix2 != null) {
                            this.f4079a.concat(matrix2);
                        }
                        f(l0Var, l0Var.f4023h);
                        boolean I3 = I();
                        String language = Locale.getDefault().getLanguage();
                        Iterator<SVG.g0> it2 = l0Var.i.iterator();
                        while (true) {
                            if (!it2.hasNext()) {
                                break;
                            }
                            SVG.g0 next = it2.next();
                            if (next instanceof SVG.SvgConditional) {
                                SVG.SvgConditional svgConditional = (SVG.SvgConditional) next;
                                if (svgConditional.getRequiredExtensions() == null && ((systemLanguage = svgConditional.getSystemLanguage()) == null || (!systemLanguage.isEmpty() && systemLanguage.contains(language)))) {
                                    Set<String> requiredFeatures = svgConditional.getRequiredFeatures();
                                    if (requiredFeatures != null) {
                                        if (supportedFeatures == null) {
                                            synchronized (b.class) {
                                                HashSet<String> hashSet = new HashSet<>();
                                                supportedFeatures = hashSet;
                                                hashSet.add("Structure");
                                                supportedFeatures.add("BasicStructure");
                                                supportedFeatures.add("ConditionalProcessing");
                                                supportedFeatures.add("Image");
                                                supportedFeatures.add("Style");
                                                supportedFeatures.add("ViewportAttribute");
                                                supportedFeatures.add("Shape");
                                                supportedFeatures.add("BasicText");
                                                supportedFeatures.add("PaintAttribute");
                                                supportedFeatures.add("BasicPaintAttribute");
                                                supportedFeatures.add("OpacityAttribute");
                                                supportedFeatures.add("BasicGraphicsAttribute");
                                                supportedFeatures.add("Marker");
                                                supportedFeatures.add("Gradient");
                                                supportedFeatures.add("Pattern");
                                                supportedFeatures.add("Clip");
                                                supportedFeatures.add("BasicClip");
                                                supportedFeatures.add("Mask");
                                                supportedFeatures.add("View");
                                            }
                                        }
                                        if (requiredFeatures.isEmpty()) {
                                            continue;
                                        } else if (!supportedFeatures.containsAll(requiredFeatures)) {
                                            continue;
                                        }
                                    }
                                    Set<String> requiredFormats = svgConditional.getRequiredFormats();
                                    if (requiredFormats == null) {
                                        Set<String> requiredFonts = svgConditional.getRequiredFonts();
                                        if (requiredFonts == null) {
                                            K(next);
                                            break;
                                        }
                                        requiredFonts.isEmpty();
                                    } else {
                                        requiredFormats.isEmpty();
                                    }
                                }
                            }
                        }
                        if (I3) {
                            G(l0Var);
                        }
                        U(l0Var);
                    }
                } else if (g0Var instanceof SVG.l) {
                    SVG.l lVar = (SVG.l) g0Var;
                    W(this.f4080c, lVar);
                    if (m()) {
                        Matrix matrix3 = lVar.o;
                        if (matrix3 != null) {
                            this.f4079a.concat(matrix3);
                        }
                        f(lVar, lVar.f4023h);
                        boolean I4 = I();
                        L(lVar, true);
                        if (I4) {
                            G(lVar);
                        }
                        U(lVar);
                    }
                } else if (g0Var instanceof SVG.m) {
                    SVG.m mVar = (SVG.m) g0Var;
                    SVG.n nVar8 = mVar.s;
                    if (!(nVar8 == null || nVar8.g() || (nVar = mVar.t) == null || nVar.g() || (str = mVar.p) == null)) {
                        PreserveAspectRatio preserveAspectRatio2 = mVar.o;
                        if (preserveAspectRatio2 == null) {
                            preserveAspectRatio2 = PreserveAspectRatio.d;
                        }
                        if (str.startsWith("data:") && str.length() >= 14 && (indexOf = str.indexOf(44)) >= 12 && ";base64".equals(str.substring(indexOf - 7, indexOf))) {
                            try {
                                byte[] decode = Base64.decode(str.substring(indexOf + 1), 0);
                                bitmap = BitmapFactory.decodeByteArray(decode, 0, decode.length);
                            } catch (Exception unused) {
                            }
                        }
                        if (bitmap != null) {
                            SVG.b bVar4 = new SVG.b(o5.i.f36333a, o5.i.f36333a, (float) bitmap.getWidth(), (float) bitmap.getHeight());
                            W(this.f4080c, mVar);
                            if (m() && Y()) {
                                Matrix matrix4 = mVar.f4032u;
                                if (matrix4 != null) {
                                    this.f4079a.concat(matrix4);
                                }
                                SVG.n nVar9 = mVar.f4031q;
                                float d13 = nVar9 != null ? nVar9.d(this) : o5.i.f36333a;
                                SVG.n nVar10 = mVar.r;
                                float e6 = nVar10 != null ? nVar10.e(this) : o5.i.f36333a;
                                float d14 = mVar.s.d(this);
                                float d15 = mVar.t.d(this);
                                h hVar2 = this.f4080c;
                                hVar2.f = new SVG.b(d13, e6, d14, d15);
                                if (!hVar2.f4095a.w.booleanValue()) {
                                    SVG.b bVar5 = this.f4080c.f;
                                    P(bVar5.f4018a, bVar5.b, bVar5.f4019c, bVar5.d);
                                }
                                mVar.f4023h = this.f4080c.f;
                                U(mVar);
                                f(mVar, mVar.f4023h);
                                boolean I5 = I();
                                X();
                                this.f4079a.save();
                                this.f4079a.concat(e(this.f4080c.f, bVar4, preserveAspectRatio2));
                                if (this.f4080c.f4095a.N != SVG.Style.RenderQuality.optimizeSpeed) {
                                    i3 = 2;
                                }
                                this.f4079a.drawBitmap(bitmap, o5.i.f36333a, o5.i.f36333a, new Paint(i3));
                                this.f4079a.restore();
                                if (I5) {
                                    G(mVar);
                                }
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.s) {
                    SVG.s sVar = (SVG.s) g0Var;
                    if (sVar.o != null) {
                        W(this.f4080c, sVar);
                        if (m() && Y()) {
                            h hVar3 = this.f4080c;
                            if (hVar3.f4096c || hVar3.b) {
                                Matrix matrix5 = sVar.n;
                                if (matrix5 != null) {
                                    this.f4079a.concat(matrix5);
                                }
                                Path path = new d(this, sVar.o).f4089a;
                                if (sVar.f4023h == null) {
                                    sVar.f4023h = c(path);
                                }
                                U(sVar);
                                g(sVar);
                                f(sVar, sVar.f4023h);
                                boolean I6 = I();
                                h hVar4 = this.f4080c;
                                if (hVar4.b) {
                                    SVG.Style.FillRule fillRule = hVar4.f4095a.d;
                                    if (fillRule == null || fillRule != SVG.Style.FillRule.EvenOdd) {
                                        fillType2 = Path.FillType.WINDING;
                                    } else {
                                        fillType2 = Path.FillType.EVEN_ODD;
                                    }
                                    path.setFillType(fillType2);
                                    n(sVar, path);
                                }
                                if (this.f4080c.f4096c) {
                                    o(path);
                                }
                                N(sVar);
                                if (I6) {
                                    G(sVar);
                                }
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.x) {
                    SVG.x xVar = (SVG.x) g0Var;
                    SVG.n nVar11 = xVar.f4049q;
                    if (nVar11 != null && xVar.r != null && !nVar11.g() && !xVar.r.g()) {
                        W(this.f4080c, xVar);
                        if (m() && Y()) {
                            Matrix matrix6 = xVar.n;
                            if (matrix6 != null) {
                                this.f4079a.concat(matrix6);
                            }
                            Path D = D(xVar);
                            U(xVar);
                            g(xVar);
                            f(xVar, xVar.f4023h);
                            boolean I7 = I();
                            if (this.f4080c.b) {
                                n(xVar, D);
                            }
                            if (this.f4080c.f4096c) {
                                o(D);
                            }
                            if (I7) {
                                G(xVar);
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.d) {
                    SVG.d dVar = (SVG.d) g0Var;
                    SVG.n nVar12 = dVar.f4022q;
                    if (nVar12 != null && !nVar12.g()) {
                        W(this.f4080c, dVar);
                        if (m() && Y()) {
                            Matrix matrix7 = dVar.n;
                            if (matrix7 != null) {
                                this.f4079a.concat(matrix7);
                            }
                            Path A = A(dVar);
                            U(dVar);
                            g(dVar);
                            f(dVar, dVar.f4023h);
                            boolean I8 = I();
                            if (this.f4080c.b) {
                                n(dVar, A);
                            }
                            if (this.f4080c.f4096c) {
                                o(A);
                            }
                            if (I8) {
                                G(dVar);
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.i) {
                    SVG.i iVar = (SVG.i) g0Var;
                    SVG.n nVar13 = iVar.f4028q;
                    if (nVar13 != null && iVar.r != null && !nVar13.g() && !iVar.r.g()) {
                        W(this.f4080c, iVar);
                        if (m() && Y()) {
                            Matrix matrix8 = iVar.n;
                            if (matrix8 != null) {
                                this.f4079a.concat(matrix8);
                            }
                            Path B = B(iVar);
                            U(iVar);
                            g(iVar);
                            f(iVar, iVar.f4023h);
                            boolean I9 = I();
                            if (this.f4080c.b) {
                                n(iVar, B);
                            }
                            if (this.f4080c.f4096c) {
                                o(B);
                            }
                            if (I9) {
                                G(iVar);
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.o) {
                    SVG.o oVar = (SVG.o) g0Var;
                    W(this.f4080c, oVar);
                    if (m() && Y() && this.f4080c.f4096c) {
                        Matrix matrix9 = oVar.n;
                        if (matrix9 != null) {
                            this.f4079a.concat(matrix9);
                        }
                        SVG.n nVar14 = oVar.o;
                        float d16 = nVar14 == null ? o5.i.f36333a : nVar14.d(this);
                        SVG.n nVar15 = oVar.p;
                        float e12 = nVar15 == null ? o5.i.f36333a : nVar15.e(this);
                        SVG.n nVar16 = oVar.f4034q;
                        float d17 = nVar16 == null ? o5.i.f36333a : nVar16.d(this);
                        SVG.n nVar17 = oVar.r;
                        if (nVar17 != null) {
                            f12 = nVar17.e(this);
                        }
                        if (oVar.f4023h == null) {
                            oVar.f4023h = new SVG.b(Math.min(d16, d17), Math.min(e12, f12), Math.abs(d17 - d16), Math.abs(f12 - e12));
                        }
                        Path path2 = new Path();
                        path2.moveTo(d16, e12);
                        path2.lineTo(d17, f12);
                        U(oVar);
                        g(oVar);
                        f(oVar, oVar.f4023h);
                        boolean I10 = I();
                        o(path2);
                        N(oVar);
                        if (I10) {
                            G(oVar);
                        }
                    }
                } else if (g0Var instanceof SVG.w) {
                    SVG.v vVar = (SVG.w) g0Var;
                    W(this.f4080c, vVar);
                    if (m() && Y()) {
                        h hVar5 = this.f4080c;
                        if (hVar5.f4096c || hVar5.b) {
                            Matrix matrix10 = vVar.n;
                            if (matrix10 != null) {
                                this.f4079a.concat(matrix10);
                            }
                            if (vVar.o.length >= 2) {
                                Path C = C(vVar);
                                U(vVar);
                                g(vVar);
                                f(vVar, vVar.f4023h);
                                boolean I11 = I();
                                if (this.f4080c.b) {
                                    n(vVar, C);
                                }
                                if (this.f4080c.f4096c) {
                                    o(C);
                                }
                                N(vVar);
                                if (I11) {
                                    G(vVar);
                                }
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.v) {
                    SVG.v vVar2 = (SVG.v) g0Var;
                    W(this.f4080c, vVar2);
                    if (m() && Y()) {
                        h hVar6 = this.f4080c;
                        if (hVar6.f4096c || hVar6.b) {
                            Matrix matrix11 = vVar2.n;
                            if (matrix11 != null) {
                                this.f4079a.concat(matrix11);
                            }
                            if (vVar2.o.length >= 2) {
                                Path C2 = C(vVar2);
                                U(vVar2);
                                SVG.Style.FillRule fillRule2 = this.f4080c.f4095a.d;
                                if (fillRule2 == null || fillRule2 != SVG.Style.FillRule.EvenOdd) {
                                    fillType = Path.FillType.WINDING;
                                } else {
                                    fillType = Path.FillType.EVEN_ODD;
                                }
                                C2.setFillType(fillType);
                                g(vVar2);
                                f(vVar2, vVar2.f4023h);
                                boolean I12 = I();
                                if (this.f4080c.b) {
                                    n(vVar2, C2);
                                }
                                if (this.f4080c.f4096c) {
                                    o(C2);
                                }
                                N(vVar2);
                                if (I12) {
                                    G(vVar2);
                                }
                            }
                        }
                    }
                } else if (g0Var instanceof SVG.p0) {
                    SVG.p0 p0Var = (SVG.p0) g0Var;
                    W(this.f4080c, p0Var);
                    if (m()) {
                        Matrix matrix12 = p0Var.s;
                        if (matrix12 != null) {
                            this.f4079a.concat(matrix12);
                        }
                        List<SVG.n> list = p0Var.o;
                        float d18 = (list == null || list.size() == 0) ? o5.i.f36333a : p0Var.o.get(0).d(this);
                        List<SVG.n> list2 = p0Var.p;
                        float e13 = (list2 == null || list2.size() == 0) ? o5.i.f36333a : p0Var.p.get(0).e(this);
                        List<SVG.n> list3 = p0Var.f4041q;
                        float d19 = (list3 == null || list3.size() == 0) ? o5.i.f36333a : p0Var.f4041q.get(0).d(this);
                        List<SVG.n> list4 = p0Var.r;
                        if (!(list4 == null || list4.size() == 0)) {
                            f12 = p0Var.r.get(0).e(this);
                        }
                        SVG.Style.TextAnchor w = w();
                        if (w != SVG.Style.TextAnchor.Start) {
                            float d22 = d(p0Var);
                            if (w == SVG.Style.TextAnchor.Middle) {
                                d22 /= 2.0f;
                            }
                            d18 -= d22;
                        }
                        if (p0Var.f4023h == null) {
                            i iVar2 = new i(d18, e13);
                            p(p0Var, iVar2);
                            RectF rectF = iVar2.f4100c;
                            p0Var.f4023h = new SVG.b(rectF.left, rectF.top, rectF.width(), iVar2.f4100c.height());
                        }
                        U(p0Var);
                        g(p0Var);
                        f(p0Var, p0Var.f4023h);
                        boolean I13 = I();
                        p(p0Var, new f(d18 + d19, e13 + f12));
                        if (I13) {
                            G(p0Var);
                        }
                    }
                }
            }
            R();
        }
    }

    public final void L(SVG.SvgContainer svgContainer, boolean z) {
        if (z) {
            this.e.push(svgContainer);
            this.f.push(this.f4079a.getMatrix());
        }
        for (SVG.g0 g0Var : ((SVG.b0) svgContainer).i) {
            K(g0Var);
        }
        if (z) {
            this.e.pop();
            this.f.pop();
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:59:0x00fe, code lost:
        if (r7 != 8) goto L_0x0108;
     */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x0038  */
    /* JADX WARNING: Removed duplicated region for block: B:14:0x003b  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0063  */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x0068  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x006d  */
    /* JADX WARNING: Removed duplicated region for block: B:22:0x0072  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x0079  */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x007e  */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x0084  */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x008c  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x0114  */
    /* JADX WARNING: Removed duplicated region for block: B:67:0x0123  */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x0146  */
    public final void M(SVG.p pVar, c cVar) {
        float f12;
        SVG.n nVar;
        SVG.b bVar;
        boolean I;
        float f13;
        float f14;
        float f15;
        S();
        Float f16 = pVar.f4037v;
        float f17 = o5.i.f36333a;
        if (f16 != null) {
            if (Float.isNaN(f16.floatValue())) {
                float f18 = cVar.f4088c;
                if (!(f18 == o5.i.f36333a && cVar.d == o5.i.f36333a)) {
                    f12 = (float) Math.toDegrees(Math.atan2((double) cVar.d, (double) f18));
                }
            } else {
                f12 = pVar.f4037v.floatValue();
            }
            float a5 = !pVar.f4035q ? 1.0f : this.f4080c.f4095a.f4004h.a(96.0f);
            this.f4080c = u(pVar);
            Matrix matrix = new Matrix();
            matrix.preTranslate(cVar.f4087a, cVar.b);
            matrix.preRotate(f12);
            matrix.preScale(a5, a5);
            SVG.n nVar2 = pVar.r;
            float d12 = nVar2 == null ? nVar2.d(this) : o5.i.f36333a;
            SVG.n nVar3 = pVar.s;
            float e6 = nVar3 == null ? nVar3.e(this) : o5.i.f36333a;
            SVG.n nVar4 = pVar.t;
            float f19 = 3.0f;
            float d13 = nVar4 == null ? nVar4.d(this) : 3.0f;
            nVar = pVar.f4036u;
            if (nVar != null) {
                f19 = nVar.e(this);
            }
            bVar = pVar.p;
            if (bVar == null) {
                float f22 = d13 / bVar.f4019c;
                float f23 = f19 / bVar.d;
                PreserveAspectRatio preserveAspectRatio = pVar.o;
                if (preserveAspectRatio == null) {
                    preserveAspectRatio = PreserveAspectRatio.d;
                }
                if (!preserveAspectRatio.equals(PreserveAspectRatio.f3998c)) {
                    f22 = preserveAspectRatio.b == PreserveAspectRatio.Scale.slice ? Math.max(f22, f23) : Math.min(f22, f23);
                    f23 = f22;
                }
                matrix.preTranslate((-d12) * f22, (-e6) * f23);
                this.f4079a.concat(matrix);
                SVG.b bVar2 = pVar.p;
                float f24 = bVar2.f4019c * f22;
                float f25 = bVar2.d * f23;
                int[] iArr = a.f4081a;
                switch (iArr[preserveAspectRatio.f3999a.ordinal()]) {
                    case 1:
                    case 2:
                    case 3:
                        f15 = (d13 - f24) / 2.0f;
                        f13 = o5.i.f36333a - f15;
                        break;
                    case 4:
                    case 5:
                    case 6:
                        f15 = d13 - f24;
                        f13 = o5.i.f36333a - f15;
                        break;
                    default:
                        f13 = o5.i.f36333a;
                        break;
                }
                int i3 = iArr[preserveAspectRatio.f3999a.ordinal()];
                if (i3 != 2) {
                    if (i3 != 3) {
                        if (i3 != 5) {
                            if (i3 != 6) {
                                if (i3 != 7) {
                                }
                            }
                        }
                    }
                    f14 = f19 - f25;
                    f17 = o5.i.f36333a - f14;
                    if (!this.f4080c.f4095a.w.booleanValue()) {
                        P(f13, f17, d13, f19);
                    }
                    matrix.reset();
                    matrix.preScale(f22, f23);
                    this.f4079a.concat(matrix);
                }
                f14 = (f19 - f25) / 2.0f;
                f17 = o5.i.f36333a - f14;
                if (!this.f4080c.f4095a.w.booleanValue()) {
                }
                matrix.reset();
                matrix.preScale(f22, f23);
                this.f4079a.concat(matrix);
            } else {
                matrix.preTranslate(-d12, -e6);
                this.f4079a.concat(matrix);
                if (!this.f4080c.f4095a.w.booleanValue()) {
                    P(o5.i.f36333a, o5.i.f36333a, d13, f19);
                }
            }
            I = I();
            L(pVar, false);
            if (I) {
                H(pVar, pVar.f4023h);
            }
            R();
        }
        f12 = o5.i.f36333a;
        if (!pVar.f4035q) {
        }
        this.f4080c = u(pVar);
        Matrix matrix2 = new Matrix();
        matrix2.preTranslate(cVar.f4087a, cVar.b);
        matrix2.preRotate(f12);
        matrix2.preScale(a5, a5);
        SVG.n nVar22 = pVar.r;
        if (nVar22 == null) {
        }
        SVG.n nVar32 = pVar.s;
        if (nVar32 == null) {
        }
        SVG.n nVar42 = pVar.t;
        float f192 = 3.0f;
        if (nVar42 == null) {
        }
        nVar = pVar.f4036u;
        if (nVar != null) {
        }
        bVar = pVar.p;
        if (bVar == null) {
        }
        I = I();
        L(pVar, false);
        if (I) {
        }
        R();
    }

    /* JADX WARNING: Removed duplicated region for block: B:104:? A[RETURN, SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x003d  */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x005f  */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x007e  */
    /* JADX WARNING: Removed duplicated region for block: B:31:0x008b  */
    /* JADX WARNING: Removed duplicated region for block: B:66:0x0181 A[ADDED_TO_REGION, RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:67:0x0182  */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x0196  */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x01bd  */
    /* JADX WARNING: Removed duplicated region for block: B:95:0x020e  */
    public final void N(SVG.k kVar) {
        SVG.p pVar;
        String str;
        SVG.p pVar2;
        String str2;
        SVG.p pVar3;
        List<c> list;
        int size;
        int i3;
        SVG.Style style = this.f4080c.f4095a;
        String str3 = style.y;
        if (str3 != null || style.z != null || style.A != null) {
            if (str3 != null) {
                SVG.g0 g3 = kVar.f4027a.g(str3);
                if (g3 != null) {
                    pVar = (SVG.p) g3;
                    str = this.f4080c.f4095a.z;
                    if (str != null) {
                        SVG.g0 g6 = kVar.f4027a.g(str);
                        if (g6 != null) {
                            pVar2 = (SVG.p) g6;
                            str2 = this.f4080c.f4095a.A;
                            if (str2 != null) {
                                SVG.g0 g12 = kVar.f4027a.g(str2);
                                if (g12 != null) {
                                    pVar3 = (SVG.p) g12;
                                    if (!(kVar instanceof SVG.s)) {
                                        list = new C0101b(((SVG.s) kVar).o).f4083a;
                                    } else if (kVar instanceof SVG.o) {
                                        SVG.o oVar = (SVG.o) kVar;
                                        SVG.n nVar = oVar.o;
                                        float d12 = nVar != null ? nVar.d(this) : o5.i.f36333a;
                                        SVG.n nVar2 = oVar.p;
                                        float e6 = nVar2 != null ? nVar2.e(this) : o5.i.f36333a;
                                        SVG.n nVar3 = oVar.f4034q;
                                        float d13 = nVar3 != null ? nVar3.d(this) : o5.i.f36333a;
                                        SVG.n nVar4 = oVar.r;
                                        float e12 = nVar4 != null ? nVar4.e(this) : o5.i.f36333a;
                                        ArrayList arrayList = new ArrayList(2);
                                        float f12 = d13 - d12;
                                        float f13 = e12 - e6;
                                        arrayList.add(new c(this, d12, e6, f12, f13));
                                        arrayList.add(new c(this, d13, e12, f12, f13));
                                        list = arrayList;
                                    } else {
                                        SVG.v vVar = (SVG.v) kVar;
                                        int length = vVar.o.length;
                                        if (length < 2) {
                                            list = null;
                                        } else {
                                            ArrayList arrayList2 = new ArrayList();
                                            float[] fArr = vVar.o;
                                            c cVar = new c(this, fArr[0], fArr[1], o5.i.f36333a, o5.i.f36333a);
                                            float f14 = o5.i.f36333a;
                                            float f15 = o5.i.f36333a;
                                            int i12 = 2;
                                            while (i12 < length) {
                                                float[] fArr2 = vVar.o;
                                                float f16 = fArr2[i12];
                                                float f17 = fArr2[i12 + 1];
                                                cVar.a(f16, f17);
                                                arrayList2.add(cVar);
                                                cVar = new c(this, f16, f17, f16 - cVar.f4087a, f17 - cVar.b);
                                                i12 += 2;
                                                f15 = f17;
                                                f14 = f16;
                                            }
                                            if (vVar instanceof SVG.w) {
                                                float[] fArr3 = vVar.o;
                                                if (!(f14 == fArr3[0] || f15 == fArr3[1])) {
                                                    float f18 = fArr3[0];
                                                    float f19 = fArr3[1];
                                                    cVar.a(f18, f19);
                                                    arrayList2.add(cVar);
                                                    c cVar2 = new c(this, f18, f19, f18 - cVar.f4087a, f19 - cVar.b);
                                                    cVar2.b((c) arrayList2.get(0));
                                                    arrayList2.add(cVar2);
                                                    arrayList2.set(0, cVar2);
                                                }
                                            } else {
                                                arrayList2.add(cVar);
                                            }
                                            list = arrayList2;
                                        }
                                    }
                                    if (list != null && (size = list.size()) != 0) {
                                        SVG.Style style2 = this.f4080c.f4095a;
                                        style2.A = null;
                                        style2.z = null;
                                        style2.y = null;
                                        if (pVar != null) {
                                            M(pVar, list.get(0));
                                        }
                                        if (pVar2 != null && list.size() > 2) {
                                            c cVar3 = list.get(1);
                                            i3 = 1;
                                            c cVar4 = list.get(0);
                                            c cVar5 = cVar3;
                                            while (i3 < size - 1) {
                                                i3++;
                                                c cVar6 = list.get(i3);
                                                if (cVar5.e) {
                                                    float f22 = cVar5.f4088c;
                                                    float f23 = cVar5.d;
                                                    float f24 = cVar5.f4087a;
                                                    float f25 = cVar5.b;
                                                    float f26 = ((f25 - cVar4.b) * f23) + ((f24 - cVar4.f4087a) * f22);
                                                    if (f26 == o5.i.f36333a) {
                                                        f26 = ((cVar6.f4087a - f24) * f22) + ((cVar6.b - f25) * f23);
                                                    }
                                                    int i13 = (f26 > o5.i.f36333a ? 1 : (f26 == o5.i.f36333a ? 0 : -1));
                                                    if (i13 <= 0 && (i13 != 0 || (f22 <= o5.i.f36333a && f23 < o5.i.f36333a))) {
                                                        cVar5.f4088c = -f22;
                                                        cVar5.d = -f23;
                                                    }
                                                }
                                                M(pVar2, cVar5);
                                                cVar4 = cVar5;
                                                cVar5 = cVar6;
                                            }
                                        }
                                        if (pVar3 == null) {
                                            M(pVar3, list.get(size - 1));
                                            return;
                                        }
                                        return;
                                    }
                                    return;
                                }
                                String.format("Marker reference '%s' not found", this.f4080c.f4095a.A);
                            }
                            pVar3 = null;
                            if (!(kVar instanceof SVG.s)) {
                            }
                            if (list != null) {
                                SVG.Style style22 = this.f4080c.f4095a;
                                style22.A = null;
                                style22.z = null;
                                style22.y = null;
                                if (pVar != null) {
                                }
                                c cVar32 = list.get(1);
                                i3 = 1;
                                c cVar42 = list.get(0);
                                c cVar52 = cVar32;
                                while (i3 < size - 1) {
                                }
                                if (pVar3 == null) {
                                }
                            } else {
                                return;
                            }
                        } else {
                            String.format("Marker reference '%s' not found", this.f4080c.f4095a.z);
                        }
                    }
                    pVar2 = null;
                    str2 = this.f4080c.f4095a.A;
                    if (str2 != null) {
                    }
                    pVar3 = null;
                    if (!(kVar instanceof SVG.s)) {
                    }
                    if (list != null) {
                    }
                } else {
                    String.format("Marker reference '%s' not found", this.f4080c.f4095a.y);
                }
            }
            pVar = null;
            str = this.f4080c.f4095a.z;
            if (str != null) {
            }
            pVar2 = null;
            str2 = this.f4080c.f4095a.A;
            if (str2 != null) {
            }
            pVar3 = null;
            if (!(kVar instanceof SVG.s)) {
            }
            if (list != null) {
            }
        }
    }

    public final void O(SVG.q qVar, SVG.d0 d0Var, SVG.b bVar) {
        float f12;
        float f13;
        Boolean bool = qVar.o;
        boolean z = true;
        if (bool != null && bool.booleanValue()) {
            SVG.n nVar = qVar.f4038q;
            f13 = nVar != null ? nVar.d(this) : bVar.f4019c;
            SVG.n nVar2 = qVar.r;
            f12 = nVar2 != null ? nVar2.e(this) : bVar.d;
        } else {
            SVG.n nVar3 = qVar.f4038q;
            float f14 = 1.2f;
            float c5 = nVar3 != null ? nVar3.c(this, 1.0f) : 1.2f;
            SVG.n nVar4 = qVar.r;
            if (nVar4 != null) {
                f14 = nVar4.c(this, 1.0f);
            }
            f13 = c5 * bVar.f4019c;
            f12 = f14 * bVar.d;
        }
        if (f13 != o5.i.f36333a && f12 != o5.i.f36333a) {
            S();
            h u4 = u(qVar);
            this.f4080c = u4;
            u4.f4095a.n = Float.valueOf(1.0f);
            boolean I = I();
            this.f4079a.save();
            Boolean bool2 = qVar.p;
            if (bool2 != null && !bool2.booleanValue()) {
                z = false;
            }
            if (!z) {
                this.f4079a.translate(bVar.f4018a, bVar.b);
                this.f4079a.scale(bVar.f4019c, bVar.d);
            }
            L(qVar, false);
            this.f4079a.restore();
            if (I) {
                H(d0Var, bVar);
            }
            R();
        }
    }

    public final void P(float f12, float f13, float f14, float f15) {
        float f16 = f14 + f12;
        float f17 = f15 + f13;
        SVG.c cVar = this.f4080c.f4095a.x;
        if (cVar != null) {
            f12 += cVar.d.d(this);
            f13 += this.f4080c.f4095a.x.f4020a.e(this);
            f16 -= this.f4080c.f4095a.x.b.d(this);
            f17 -= this.f4080c.f4095a.x.f4021c.e(this);
        }
        this.f4079a.clipRect(f12, f13, f16, f17);
    }

    public final void Q(h hVar, boolean z, SVG.h0 h0Var) {
        int i3;
        SVG.Style style = hVar.f4095a;
        float floatValue = (z ? style.e : style.f4003g).floatValue();
        if (h0Var instanceof SVG.f) {
            i3 = ((SVG.f) h0Var).b;
        } else if (h0Var instanceof SVG.g) {
            i3 = hVar.f4095a.o.b;
        } else {
            return;
        }
        int k6 = k(i3, floatValue);
        if (z) {
            hVar.d.setColor(k6);
        } else {
            hVar.e.setColor(k6);
        }
    }

    public final void R() {
        this.f4079a.restore();
        this.f4080c = this.d.pop();
    }

    public final void S() {
        this.f4079a.save();
        this.d.push(this.f4080c);
        this.f4080c = new h(this, this.f4080c);
    }

    public final String T(String str, boolean z, boolean z4) {
        if (this.f4080c.f4098h) {
            return str.replaceAll("[\\n\\t]", " ");
        }
        String replaceAll = str.replaceAll("\\n", "").replaceAll("\\t", " ");
        if (z) {
            replaceAll = replaceAll.replaceAll("^\\s+", "");
        }
        if (z4) {
            replaceAll = replaceAll.replaceAll("\\s+$", "");
        }
        return replaceAll.replaceAll("\\s{2,}", " ");
    }

    public final void U(SVG.d0 d0Var) {
        if (!(d0Var.b == null || d0Var.f4023h == null)) {
            Matrix matrix = new Matrix();
            if (this.f.peek().invert(matrix)) {
                SVG.b bVar = d0Var.f4023h;
                SVG.b bVar2 = d0Var.f4023h;
                SVG.b bVar3 = d0Var.f4023h;
                float[] fArr = {bVar.f4018a, bVar.b, bVar.a(), bVar2.b, bVar2.a(), d0Var.f4023h.b(), bVar3.f4018a, bVar3.b()};
                matrix.preConcat(this.f4079a.getMatrix());
                matrix.mapPoints(fArr);
                RectF rectF = new RectF(fArr[0], fArr[1], fArr[0], fArr[1]);
                for (int i3 = 2; i3 <= 6; i3 += 2) {
                    if (fArr[i3] < rectF.left) {
                        rectF.left = fArr[i3];
                    }
                    if (fArr[i3] > rectF.right) {
                        rectF.right = fArr[i3];
                    }
                    int i12 = i3 + 1;
                    if (fArr[i12] < rectF.top) {
                        rectF.top = fArr[i12];
                    }
                    if (fArr[i12] > rectF.bottom) {
                        rectF.bottom = fArr[i12];
                    }
                }
                SVG.d0 d0Var2 = (SVG.d0) this.e.peek();
                SVG.b bVar4 = d0Var2.f4023h;
                if (bVar4 == null) {
                    float f12 = rectF.left;
                    float f13 = rectF.top;
                    d0Var2.f4023h = new SVG.b(f12, f13, rectF.right - f12, rectF.bottom - f13);
                    return;
                }
                float f14 = rectF.left;
                float f15 = rectF.top;
                float f16 = rectF.right - f14;
                float f17 = rectF.bottom - f15;
                if (f14 < bVar4.f4018a) {
                    bVar4.f4018a = f14;
                }
                if (f15 < bVar4.b) {
                    bVar4.b = f15;
                }
                float f18 = f14 + f16;
                if (f18 > bVar4.a()) {
                    bVar4.f4019c = f18 - bVar4.f4018a;
                }
                float f19 = f15 + f17;
                if (f19 > bVar4.b()) {
                    bVar4.d = f19 - bVar4.b;
                }
            }
        }
    }

    public final void V(h hVar, SVG.Style style) {
        if (z(style, 4096)) {
            hVar.f4095a.o = style.o;
        }
        if (z(style, 2048)) {
            hVar.f4095a.n = style.n;
        }
        boolean z = false;
        if (z(style, 1)) {
            hVar.f4095a.f4002c = style.f4002c;
            SVG.h0 h0Var = style.f4002c;
            hVar.b = (h0Var == null || h0Var == SVG.f.d) ? false : true;
        }
        if (z(style, 4)) {
            hVar.f4095a.e = style.e;
        }
        if (z(style, 6149)) {
            Q(hVar, true, hVar.f4095a.f4002c);
        }
        if (z(style, 2)) {
            hVar.f4095a.d = style.d;
        }
        if (z(style, 8)) {
            hVar.f4095a.f = style.f;
            SVG.h0 h0Var2 = style.f;
            hVar.f4096c = (h0Var2 == null || h0Var2 == SVG.f.d) ? false : true;
        }
        if (z(style, 16)) {
            hVar.f4095a.f4003g = style.f4003g;
        }
        if (z(style, 6168)) {
            Q(hVar, false, hVar.f4095a.f);
        }
        if (z(style, 34359738368L)) {
            hVar.f4095a.M = style.M;
        }
        if (z(style, 32)) {
            SVG.Style style2 = hVar.f4095a;
            SVG.n nVar = style.f4004h;
            style2.f4004h = nVar;
            hVar.e.setStrokeWidth(nVar.b(this));
        }
        if (z(style, 64)) {
            hVar.f4095a.i = style.i;
            int i3 = a.b[style.i.ordinal()];
            if (i3 == 1) {
                hVar.e.setStrokeCap(Paint.Cap.BUTT);
            } else if (i3 == 2) {
                hVar.e.setStrokeCap(Paint.Cap.ROUND);
            } else if (i3 == 3) {
                hVar.e.setStrokeCap(Paint.Cap.SQUARE);
            }
        }
        if (z(style, 128)) {
            hVar.f4095a.j = style.j;
            int i12 = a.f4082c[style.j.ordinal()];
            if (i12 == 1) {
                hVar.e.setStrokeJoin(Paint.Join.MITER);
            } else if (i12 == 2) {
                hVar.e.setStrokeJoin(Paint.Join.ROUND);
            } else if (i12 == 3) {
                hVar.e.setStrokeJoin(Paint.Join.BEVEL);
            }
        }
        if (z(style, 256)) {
            hVar.f4095a.k = style.k;
            hVar.e.setStrokeMiter(style.k.floatValue());
        }
        if (z(style, 512)) {
            hVar.f4095a.l = style.l;
        }
        if (z(style, 1024)) {
            hVar.f4095a.m = style.m;
        }
        Typeface typeface = null;
        if (z(style, 1536)) {
            SVG.n[] nVarArr = hVar.f4095a.l;
            if (nVarArr == null) {
                hVar.e.setPathEffect(null);
            } else {
                int length = nVarArr.length;
                int i13 = length % 2 == 0 ? length : length * 2;
                float[] fArr = new float[i13];
                float f12 = o5.i.f36333a;
                for (int i14 = 0; i14 < i13; i14++) {
                    fArr[i14] = hVar.f4095a.l[i14 % length].b(this);
                    f12 += fArr[i14];
                }
                if (f12 == o5.i.f36333a) {
                    hVar.e.setPathEffect(null);
                } else {
                    float b2 = hVar.f4095a.m.b(this);
                    if (b2 < o5.i.f36333a) {
                        b2 = (b2 % f12) + f12;
                    }
                    hVar.e.setPathEffect(new DashPathEffect(fArr, b2));
                }
            }
        }
        if (z(style, 16384)) {
            float textSize = this.f4080c.d.getTextSize();
            hVar.f4095a.f4005q = style.f4005q;
            hVar.d.setTextSize(style.f4005q.c(this, textSize));
            hVar.e.setTextSize(style.f4005q.c(this, textSize));
        }
        if (z(style, 8192)) {
            hVar.f4095a.p = style.p;
        }
        if (z(style, 32768)) {
            if (style.r.intValue() == -1 && hVar.f4095a.r.intValue() > 100) {
                SVG.Style style3 = hVar.f4095a;
                style3.r = Integer.valueOf(style3.r.intValue() - 100);
            } else if (style.r.intValue() != 1 || hVar.f4095a.r.intValue() >= 900) {
                hVar.f4095a.r = style.r;
            } else {
                SVG.Style style4 = hVar.f4095a;
                style4.r = h.a.h(style4.r, 100);
            }
        }
        if (z(style, 65536)) {
            hVar.f4095a.s = style.s;
        }
        if (z(style, 106496)) {
            List<String> list = hVar.f4095a.p;
            if (list != null && this.b != null) {
                for (String str : list) {
                    SVG.Style style5 = hVar.f4095a;
                    typeface = h(str, style5.r, style5.s);
                    if (typeface != null) {
                        break;
                    }
                }
            }
            if (typeface == null) {
                SVG.Style style6 = hVar.f4095a;
                typeface = h("serif", style6.r, style6.s);
            }
            hVar.d.setTypeface(typeface);
            hVar.e.setTypeface(typeface);
        }
        if (z(style, 131072)) {
            hVar.f4095a.t = style.t;
            Paint paint = hVar.d;
            SVG.Style.TextDecoration textDecoration = style.t;
            SVG.Style.TextDecoration textDecoration2 = SVG.Style.TextDecoration.LineThrough;
            paint.setStrikeThruText(textDecoration == textDecoration2);
            Paint paint2 = hVar.d;
            SVG.Style.TextDecoration textDecoration3 = style.t;
            SVG.Style.TextDecoration textDecoration4 = SVG.Style.TextDecoration.Underline;
            paint2.setUnderlineText(textDecoration3 == textDecoration4);
            hVar.e.setStrikeThruText(style.t == textDecoration2);
            Paint paint3 = hVar.e;
            if (style.t == textDecoration4) {
                z = true;
            }
            paint3.setUnderlineText(z);
        }
        if (z(style, 68719476736L)) {
            hVar.f4095a.f4006u = style.f4006u;
        }
        if (z(style, 262144)) {
            hVar.f4095a.f4007v = style.f4007v;
        }
        if (z(style, PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED)) {
            hVar.f4095a.w = style.w;
        }
        if (z(style, 2097152)) {
            hVar.f4095a.y = style.y;
        }
        if (z(style, 4194304)) {
            hVar.f4095a.z = style.z;
        }
        if (z(style, 8388608)) {
            hVar.f4095a.A = style.A;
        }
        if (z(style, 16777216)) {
            hVar.f4095a.B = style.B;
        }
        if (z(style, 33554432)) {
            hVar.f4095a.C = style.C;
        }
        if (z(style, 1048576)) {
            hVar.f4095a.x = style.x;
        }
        if (z(style, 268435456)) {
            hVar.f4095a.F = style.F;
        }
        if (z(style, 536870912)) {
            hVar.f4095a.G = style.G;
        }
        if (z(style, 1073741824)) {
            hVar.f4095a.H = style.H;
        }
        if (z(style, 67108864)) {
            hVar.f4095a.D = style.D;
        }
        if (z(style, 134217728)) {
            hVar.f4095a.E = style.E;
        }
        if (z(style, 8589934592L)) {
            hVar.f4095a.K = style.K;
        }
        if (z(style, 17179869184L)) {
            hVar.f4095a.L = style.L;
        }
        if (z(style, 137438953472L)) {
            hVar.f4095a.N = style.N;
        }
    }

    public final void W(h hVar, SVG.e0 e0Var) {
        boolean z = false;
        boolean z4 = e0Var.b == null;
        SVG.Style style = hVar.f4095a;
        Boolean bool = Boolean.TRUE;
        style.B = bool;
        if (!z4) {
            bool = Boolean.FALSE;
        }
        style.w = bool;
        style.x = null;
        style.F = null;
        style.n = Float.valueOf(1.0f);
        style.D = SVG.f.f4026c;
        style.E = Float.valueOf(1.0f);
        style.H = null;
        style.I = null;
        style.J = Float.valueOf(1.0f);
        style.K = null;
        style.L = Float.valueOf(1.0f);
        style.M = SVG.Style.VectorEffect.None;
        SVG.Style style2 = e0Var.e;
        if (style2 != null) {
            V(hVar, style2);
        }
        List<CSSParser.k> list = this.b.b.f3994a;
        if (list == null || list.isEmpty()) {
            z = true;
        }
        if (!z) {
            for (CSSParser.k kVar : this.b.b.f3994a) {
                if (CSSParser.i(null, kVar.f3992a, e0Var)) {
                    V(hVar, kVar.b);
                }
            }
        }
        SVG.Style style3 = e0Var.f;
        if (style3 != null) {
            V(hVar, style3);
        }
    }

    public final void X() {
        int i3;
        SVG.Style style = this.f4080c.f4095a;
        SVG.h0 h0Var = style.K;
        if (h0Var instanceof SVG.f) {
            i3 = ((SVG.f) h0Var).b;
        } else if (h0Var instanceof SVG.g) {
            i3 = style.o.b;
        } else {
            return;
        }
        Float f12 = style.L;
        if (f12 != null) {
            i3 = k(i3, f12.floatValue());
        }
        this.f4079a.drawColor(i3);
    }

    public boolean Y() {
        Boolean bool = this.f4080c.f4095a.C;
        if (bool != null) {
            return bool.booleanValue();
        }
        return true;
    }

    @TargetApi(19)
    public final Path b(SVG.d0 d0Var, SVG.b bVar) {
        Path F;
        SVG.g0 g3 = d0Var.f4027a.g(this.f4080c.f4095a.F);
        boolean z = false;
        if (g3 == null) {
            String.format("ClipPath reference '%s' not found", this.f4080c.f4095a.F);
            return null;
        }
        SVG.e eVar = (SVG.e) g3;
        this.d.push(this.f4080c);
        this.f4080c = u(eVar);
        Boolean bool = eVar.p;
        if (bool == null || bool.booleanValue()) {
            z = true;
        }
        Matrix matrix = new Matrix();
        if (!z) {
            matrix.preTranslate(bVar.f4018a, bVar.b);
            matrix.preScale(bVar.f4019c, bVar.d);
        }
        Matrix matrix2 = eVar.o;
        if (matrix2 != null) {
            matrix.preConcat(matrix2);
        }
        Path path = new Path();
        for (SVG.g0 g0Var : eVar.i) {
            if ((g0Var instanceof SVG.d0) && (F = F((SVG.d0) g0Var, true)) != null) {
                path.op(F, Path.Op.UNION);
            }
        }
        if (this.f4080c.f4095a.F != null) {
            if (eVar.f4023h == null) {
                eVar.f4023h = c(path);
            }
            Path b2 = b(eVar, eVar.f4023h);
            if (b2 != null) {
                path.op(b2, Path.Op.INTERSECT);
            }
        }
        path.transform(matrix);
        this.f4080c = this.d.pop();
        return path;
    }

    public final SVG.b c(Path path) {
        RectF rectF = new RectF();
        path.computeBounds(rectF, true);
        return new SVG.b(rectF.left, rectF.top, rectF.width(), rectF.height());
    }

    public final float d(SVG.q0 q0Var) {
        k kVar = new k(null);
        p(q0Var, kVar);
        return kVar.f4101a;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:28:0x007a, code lost:
        if (r12 != 8) goto L_0x0086;
     */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x006c  */
    public final Matrix e(SVG.b bVar, SVG.b bVar2, PreserveAspectRatio preserveAspectRatio) {
        int i3;
        float f12;
        float f13;
        Matrix matrix = new Matrix();
        if (!(preserveAspectRatio == null || preserveAspectRatio.f3999a == null)) {
            float f14 = bVar.f4019c / bVar2.f4019c;
            float f15 = bVar.d / bVar2.d;
            float f16 = -bVar2.f4018a;
            float f17 = -bVar2.b;
            if (!preserveAspectRatio.equals(PreserveAspectRatio.f3998c)) {
                float max = preserveAspectRatio.b == PreserveAspectRatio.Scale.slice ? Math.max(f14, f15) : Math.min(f14, f15);
                float f18 = bVar.f4019c / max;
                float f19 = bVar.d / max;
                int[] iArr = a.f4081a;
                switch (iArr[preserveAspectRatio.f3999a.ordinal()]) {
                    case 1:
                    case 2:
                    case 3:
                        f13 = (bVar2.f4019c - f18) / 2.0f;
                        f16 -= f13;
                        i3 = iArr[preserveAspectRatio.f3999a.ordinal()];
                        if (i3 != 2) {
                            if (i3 != 3) {
                                if (i3 != 5) {
                                    if (i3 != 6) {
                                        if (i3 != 7) {
                                            break;
                                        }
                                    }
                                }
                            }
                            f12 = bVar2.d - f19;
                            f17 -= f12;
                            matrix.preTranslate(bVar.f4018a, bVar.b);
                            matrix.preScale(max, max);
                            matrix.preTranslate(f16, f17);
                            break;
                        }
                        f12 = (bVar2.d - f19) / 2.0f;
                        f17 -= f12;
                        matrix.preTranslate(bVar.f4018a, bVar.b);
                        matrix.preScale(max, max);
                        matrix.preTranslate(f16, f17);
                    case 4:
                    case 5:
                    case 6:
                        f13 = bVar2.f4019c - f18;
                        f16 -= f13;
                        i3 = iArr[preserveAspectRatio.f3999a.ordinal()];
                        if (i3 != 2) {
                        }
                        f12 = (bVar2.d - f19) / 2.0f;
                        f17 -= f12;
                        matrix.preTranslate(bVar.f4018a, bVar.b);
                        matrix.preScale(max, max);
                        matrix.preTranslate(f16, f17);
                        break;
                    default:
                        i3 = iArr[preserveAspectRatio.f3999a.ordinal()];
                        if (i3 != 2) {
                        }
                        f12 = (bVar2.d - f19) / 2.0f;
                        f17 -= f12;
                        matrix.preTranslate(bVar.f4018a, bVar.b);
                        matrix.preScale(max, max);
                        matrix.preTranslate(f16, f17);
                        break;
                }
            } else {
                matrix.preTranslate(bVar.f4018a, bVar.b);
                matrix.preScale(f14, f15);
                matrix.preTranslate(f16, f17);
                return matrix;
            }
        }
        return matrix;
    }

    public final void f(SVG.d0 d0Var, SVG.b bVar) {
        Path b2;
        if (this.f4080c.f4095a.F != null && (b2 = b(d0Var, bVar)) != null) {
            this.f4079a.clipPath(b2);
        }
    }

    public final void g(SVG.d0 d0Var) {
        SVG.h0 h0Var = this.f4080c.f4095a.f4002c;
        if (h0Var instanceof SVG.r) {
            l(true, d0Var.f4023h, (SVG.r) h0Var);
        }
        SVG.h0 h0Var2 = this.f4080c.f4095a.f;
        if (h0Var2 instanceof SVG.r) {
            l(false, d0Var.f4023h, (SVG.r) h0Var2);
        }
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARNING: Code restructure failed: missing block: B:25:0x004f, code lost:
        if (r6.equals("monospace") == false) goto L_0x0026;
     */
    public final Typeface h(String str, Integer num, SVG.Style.FontStyle fontStyle) {
        char c5 = 1;
        boolean z = fontStyle == SVG.Style.FontStyle.Italic;
        int i3 = num.intValue() > 500 ? z ? 3 : 1 : z ? 2 : 0;
        switch (str.hashCode()) {
            case -1536685117:
                if (str.equals("sans-serif")) {
                    c5 = 0;
                    break;
                }
                c5 = 65535;
                break;
            case -1431958525:
                break;
            case -1081737434:
                if (str.equals("fantasy")) {
                    c5 = 2;
                    break;
                }
                c5 = 65535;
                break;
            case 109326717:
                if (str.equals("serif")) {
                    c5 = 3;
                    break;
                }
                c5 = 65535;
                break;
            case 1126973893:
                if (str.equals("cursive")) {
                    c5 = 4;
                    break;
                }
                c5 = 65535;
                break;
            default:
                c5 = 65535;
                break;
        }
        switch (c5) {
            case 0:
                return Typeface.create(Typeface.SANS_SERIF, i3);
            case 1:
                return Typeface.create(Typeface.MONOSPACE, i3);
            case 2:
                return Typeface.create(Typeface.SANS_SERIF, i3);
            case 3:
                return Typeface.create(Typeface.SERIF, i3);
            case 4:
                return Typeface.create(Typeface.SANS_SERIF, i3);
            default:
                return null;
        }
    }

    public final void i(SVG.g0 g0Var) {
        Boolean bool;
        if ((g0Var instanceof SVG.e0) && (bool = ((SVG.e0) g0Var).d) != null) {
            this.f4080c.f4098h = bool.booleanValue();
        }
    }

    public final void l(boolean z, SVG.b bVar, SVG.r rVar) {
        float f12;
        float f13;
        float f14;
        float f15;
        float f16;
        float f17;
        float f18;
        SVG.g0 g3 = this.b.g(rVar.b);
        boolean z4 = true;
        int i3 = 0;
        if (g3 == null) {
            Object[] objArr = new Object[2];
            objArr[0] = z ? "Fill" : "Stroke";
            objArr[1] = rVar.b;
            String.format("%s reference '%s' not found", objArr);
            SVG.h0 h0Var = rVar.f4039c;
            if (h0Var != null) {
                Q(this.f4080c, z, h0Var);
            } else if (z) {
                this.f4080c.b = false;
            } else {
                this.f4080c.f4096c = false;
            }
        } else {
            float f19 = -1.0f;
            if (g3 instanceof SVG.f0) {
                SVG.f0 f0Var = (SVG.f0) g3;
                String str = f0Var.l;
                if (str != null) {
                    r(f0Var, str);
                }
                Boolean bool = f0Var.i;
                boolean z5 = bool != null && bool.booleanValue();
                h hVar = this.f4080c;
                Paint paint = z ? hVar.d : hVar.e;
                if (z5) {
                    SVG.b y = y();
                    SVG.n nVar = f0Var.m;
                    float d12 = nVar != null ? nVar.d(this) : o5.i.f36333a;
                    SVG.n nVar2 = f0Var.n;
                    float e6 = nVar2 != null ? nVar2.e(this) : o5.i.f36333a;
                    SVG.n nVar3 = f0Var.o;
                    float d13 = nVar3 != null ? nVar3.d(this) : y.f4019c;
                    SVG.n nVar4 = f0Var.p;
                    f16 = d13;
                    f18 = d12;
                    f17 = e6;
                    f15 = nVar4 != null ? nVar4.e(this) : o5.i.f36333a;
                } else {
                    SVG.n nVar5 = f0Var.m;
                    float c5 = nVar5 != null ? nVar5.c(this, 1.0f) : o5.i.f36333a;
                    SVG.n nVar6 = f0Var.n;
                    float c12 = nVar6 != null ? nVar6.c(this, 1.0f) : o5.i.f36333a;
                    SVG.n nVar7 = f0Var.o;
                    float c13 = nVar7 != null ? nVar7.c(this, 1.0f) : 1.0f;
                    SVG.n nVar8 = f0Var.p;
                    f15 = nVar8 != null ? nVar8.c(this, 1.0f) : o5.i.f36333a;
                    f18 = c5;
                    f17 = c12;
                    f16 = c13;
                }
                S();
                this.f4080c = u(f0Var);
                Matrix matrix = new Matrix();
                if (!z5) {
                    matrix.preTranslate(bVar.f4018a, bVar.b);
                    matrix.preScale(bVar.f4019c, bVar.d);
                }
                Matrix matrix2 = f0Var.j;
                if (matrix2 != null) {
                    matrix.preConcat(matrix2);
                }
                int size = f0Var.f4029h.size();
                if (size == 0) {
                    R();
                    if (z) {
                        this.f4080c.b = false;
                    } else {
                        this.f4080c.f4096c = false;
                    }
                } else {
                    int[] iArr = new int[size];
                    float[] fArr = new float[size];
                    Iterator<SVG.g0> it2 = f0Var.f4029h.iterator();
                    while (it2.hasNext()) {
                        SVG.z zVar = (SVG.z) it2.next();
                        Float f22 = zVar.f4050h;
                        float floatValue = f22 != null ? f22.floatValue() : o5.i.f36333a;
                        if (i3 == 0 || floatValue >= f19) {
                            fArr[i3] = floatValue;
                            f19 = floatValue;
                        } else {
                            fArr[i3] = f19;
                        }
                        S();
                        W(this.f4080c, zVar);
                        SVG.Style style = this.f4080c.f4095a;
                        SVG.f fVar = (SVG.f) style.D;
                        if (fVar == null) {
                            fVar = SVG.f.f4026c;
                        }
                        iArr[i3] = k(fVar.b, style.E.floatValue());
                        i3++;
                        R();
                    }
                    if ((f18 == f16 && f17 == f15) || size == 1) {
                        R();
                        paint.setColor(iArr[size - 1]);
                        return;
                    }
                    Shader.TileMode tileMode = Shader.TileMode.CLAMP;
                    SVG.GradientSpread gradientSpread = f0Var.k;
                    if (gradientSpread != null) {
                        if (gradientSpread == SVG.GradientSpread.reflect) {
                            tileMode = Shader.TileMode.MIRROR;
                        } else if (gradientSpread == SVG.GradientSpread.repeat) {
                            tileMode = Shader.TileMode.REPEAT;
                        }
                    }
                    R();
                    LinearGradient linearGradient = new LinearGradient(f18, f17, f16, f15, iArr, fArr, tileMode);
                    linearGradient.setLocalMatrix(matrix);
                    paint.setShader(linearGradient);
                    paint.setAlpha(j(this.f4080c.f4095a.e.floatValue()));
                }
            } else if (g3 instanceof SVG.j0) {
                SVG.j0 j0Var = (SVG.j0) g3;
                String str2 = j0Var.l;
                if (str2 != null) {
                    r(j0Var, str2);
                }
                Boolean bool2 = j0Var.i;
                boolean z12 = bool2 != null && bool2.booleanValue();
                h hVar2 = this.f4080c;
                Paint paint2 = z ? hVar2.d : hVar2.e;
                if (z12) {
                    SVG.n nVar9 = new SVG.n(50.0f, SVG.Unit.percent);
                    SVG.n nVar10 = j0Var.m;
                    float d14 = nVar10 != null ? nVar10.d(this) : nVar9.d(this);
                    SVG.n nVar11 = j0Var.n;
                    float e12 = nVar11 != null ? nVar11.e(this) : nVar9.e(this);
                    SVG.n nVar12 = j0Var.o;
                    f12 = nVar12 != null ? nVar12.b(this) : nVar9.b(this);
                    f14 = d14;
                    f13 = e12;
                } else {
                    SVG.n nVar13 = j0Var.m;
                    float c14 = nVar13 != null ? nVar13.c(this, 1.0f) : 0.5f;
                    SVG.n nVar14 = j0Var.n;
                    float c15 = nVar14 != null ? nVar14.c(this, 1.0f) : 0.5f;
                    SVG.n nVar15 = j0Var.o;
                    f12 = nVar15 != null ? nVar15.c(this, 1.0f) : 0.5f;
                    f14 = c14;
                    f13 = c15;
                }
                S();
                this.f4080c = u(j0Var);
                Matrix matrix3 = new Matrix();
                if (!z12) {
                    matrix3.preTranslate(bVar.f4018a, bVar.b);
                    matrix3.preScale(bVar.f4019c, bVar.d);
                }
                Matrix matrix4 = j0Var.j;
                if (matrix4 != null) {
                    matrix3.preConcat(matrix4);
                }
                int size2 = j0Var.f4029h.size();
                if (size2 == 0) {
                    R();
                    if (z) {
                        this.f4080c.b = false;
                    } else {
                        this.f4080c.f4096c = false;
                    }
                } else {
                    int[] iArr2 = new int[size2];
                    float[] fArr2 = new float[size2];
                    Iterator<SVG.g0> it3 = j0Var.f4029h.iterator();
                    while (it3.hasNext()) {
                        SVG.z zVar2 = (SVG.z) it3.next();
                        Float f23 = zVar2.f4050h;
                        float floatValue2 = f23 != null ? f23.floatValue() : o5.i.f36333a;
                        if (i3 == 0 || floatValue2 >= f19) {
                            fArr2[i3] = floatValue2;
                            f19 = floatValue2;
                        } else {
                            fArr2[i3] = f19;
                        }
                        S();
                        W(this.f4080c, zVar2);
                        SVG.Style style2 = this.f4080c.f4095a;
                        SVG.f fVar2 = (SVG.f) style2.D;
                        if (fVar2 == null) {
                            fVar2 = SVG.f.f4026c;
                        }
                        iArr2[i3] = k(fVar2.b, style2.E.floatValue());
                        i3++;
                        R();
                    }
                    if (f12 == o5.i.f36333a || size2 == 1) {
                        R();
                        paint2.setColor(iArr2[size2 - 1]);
                        return;
                    }
                    Shader.TileMode tileMode2 = Shader.TileMode.CLAMP;
                    SVG.GradientSpread gradientSpread2 = j0Var.k;
                    if (gradientSpread2 != null) {
                        if (gradientSpread2 == SVG.GradientSpread.reflect) {
                            tileMode2 = Shader.TileMode.MIRROR;
                        } else if (gradientSpread2 == SVG.GradientSpread.repeat) {
                            tileMode2 = Shader.TileMode.REPEAT;
                        }
                    }
                    R();
                    RadialGradient radialGradient = new RadialGradient(f14, f13, f12, iArr2, fArr2, tileMode2);
                    radialGradient.setLocalMatrix(matrix3);
                    paint2.setShader(radialGradient);
                    paint2.setAlpha(j(this.f4080c.f4095a.e.floatValue()));
                }
            } else if (g3 instanceof SVG.y) {
                SVG.y yVar = (SVG.y) g3;
                if (z) {
                    if (z(yVar.e, 2147483648L)) {
                        h hVar3 = this.f4080c;
                        SVG.Style style3 = hVar3.f4095a;
                        SVG.h0 h0Var2 = yVar.e.I;
                        style3.f4002c = h0Var2;
                        if (h0Var2 == null) {
                            z4 = false;
                        }
                        hVar3.b = z4;
                    }
                    if (z(yVar.e, 4294967296L)) {
                        this.f4080c.f4095a.e = yVar.e.J;
                    }
                    if (z(yVar.e, 6442450944L)) {
                        h hVar4 = this.f4080c;
                        Q(hVar4, z, hVar4.f4095a.f4002c);
                        return;
                    }
                    return;
                }
                if (z(yVar.e, 2147483648L)) {
                    h hVar5 = this.f4080c;
                    SVG.Style style4 = hVar5.f4095a;
                    SVG.h0 h0Var3 = yVar.e.I;
                    style4.f = h0Var3;
                    if (h0Var3 == null) {
                        z4 = false;
                    }
                    hVar5.f4096c = z4;
                }
                if (z(yVar.e, 4294967296L)) {
                    this.f4080c.f4095a.f4003g = yVar.e.J;
                }
                if (z(yVar.e, 6442450944L)) {
                    h hVar6 = this.f4080c;
                    Q(hVar6, z, hVar6.f4095a.f);
                }
            }
        }
    }

    public final boolean m() {
        Boolean bool = this.f4080c.f4095a.B;
        if (bool != null) {
            return bool.booleanValue();
        }
        return true;
    }

    public final void n(SVG.d0 d0Var, Path path) {
        float f12;
        float f13;
        float f14;
        float f15;
        float f16;
        SVG.h0 h0Var = this.f4080c.f4095a.f4002c;
        if (h0Var instanceof SVG.r) {
            SVG.g0 g3 = this.b.g(((SVG.r) h0Var).b);
            if (g3 instanceof SVG.u) {
                SVG.u uVar = (SVG.u) g3;
                Boolean bool = uVar.f4045q;
                boolean z = bool != null && bool.booleanValue();
                String str = uVar.x;
                if (str != null) {
                    t(uVar, str);
                }
                if (z) {
                    SVG.n nVar = uVar.t;
                    f15 = nVar != null ? nVar.d(this) : o5.i.f36333a;
                    SVG.n nVar2 = uVar.f4046u;
                    f14 = nVar2 != null ? nVar2.e(this) : o5.i.f36333a;
                    SVG.n nVar3 = uVar.f4047v;
                    f13 = nVar3 != null ? nVar3.d(this) : o5.i.f36333a;
                    SVG.n nVar4 = uVar.w;
                    f12 = nVar4 != null ? nVar4.e(this) : o5.i.f36333a;
                } else {
                    SVG.n nVar5 = uVar.t;
                    float c5 = nVar5 != null ? nVar5.c(this, 1.0f) : o5.i.f36333a;
                    SVG.n nVar6 = uVar.f4046u;
                    float c12 = nVar6 != null ? nVar6.c(this, 1.0f) : o5.i.f36333a;
                    SVG.n nVar7 = uVar.f4047v;
                    float c13 = nVar7 != null ? nVar7.c(this, 1.0f) : o5.i.f36333a;
                    SVG.n nVar8 = uVar.w;
                    float c14 = nVar8 != null ? nVar8.c(this, 1.0f) : o5.i.f36333a;
                    SVG.b bVar = d0Var.f4023h;
                    float f17 = bVar.f4018a;
                    float f18 = bVar.f4019c;
                    f15 = (c5 * f18) + f17;
                    float f19 = bVar.b;
                    float f22 = bVar.d;
                    float f23 = c13 * f18;
                    f12 = c14 * f22;
                    f14 = (c12 * f22) + f19;
                    f13 = f23;
                }
                if (!(f13 == o5.i.f36333a || f12 == o5.i.f36333a)) {
                    PreserveAspectRatio preserveAspectRatio = uVar.o;
                    if (preserveAspectRatio == null) {
                        preserveAspectRatio = PreserveAspectRatio.d;
                    }
                    S();
                    this.f4079a.clipPath(path);
                    h hVar = new h(this);
                    V(hVar, SVG.Style.a());
                    hVar.f4095a.w = Boolean.FALSE;
                    v(uVar, hVar);
                    this.f4080c = hVar;
                    SVG.b bVar2 = d0Var.f4023h;
                    Matrix matrix = uVar.s;
                    if (matrix != null) {
                        this.f4079a.concat(matrix);
                        Matrix matrix2 = new Matrix();
                        if (uVar.s.invert(matrix2)) {
                            SVG.b bVar3 = d0Var.f4023h;
                            SVG.b bVar4 = d0Var.f4023h;
                            SVG.b bVar5 = d0Var.f4023h;
                            float[] fArr = {bVar3.f4018a, bVar3.b, bVar3.a(), bVar4.b, bVar4.a(), d0Var.f4023h.b(), bVar5.f4018a, bVar5.b()};
                            matrix2.mapPoints(fArr);
                            RectF rectF = new RectF(fArr[0], fArr[1], fArr[0], fArr[1]);
                            for (int i3 = 2; i3 <= 6; i3 += 2) {
                                if (fArr[i3] < rectF.left) {
                                    rectF.left = fArr[i3];
                                }
                                if (fArr[i3] > rectF.right) {
                                    rectF.right = fArr[i3];
                                }
                                int i12 = i3 + 1;
                                if (fArr[i12] < rectF.top) {
                                    rectF.top = fArr[i12];
                                }
                                if (fArr[i12] > rectF.bottom) {
                                    rectF.bottom = fArr[i12];
                                }
                            }
                            float f24 = rectF.left;
                            float f25 = rectF.top;
                            bVar2 = new SVG.b(f24, f25, rectF.right - f24, rectF.bottom - f25);
                        }
                    }
                    float floor = (((float) Math.floor((double) ((bVar2.f4018a - f15) / f13))) * f13) + f15;
                    float a5 = bVar2.a();
                    float b2 = bVar2.b();
                    SVG.b bVar6 = new SVG.b(o5.i.f36333a, o5.i.f36333a, f13, f12);
                    boolean I = I();
                    for (float floor2 = (((float) Math.floor((double) ((bVar2.b - f14) / f12))) * f12) + f14; floor2 < b2; floor2 += f12) {
                        float f26 = floor;
                        while (f26 < a5) {
                            bVar6.f4018a = f26;
                            bVar6.b = floor2;
                            S();
                            if (!this.f4080c.f4095a.w.booleanValue()) {
                                f16 = b2;
                                P(bVar6.f4018a, bVar6.b, bVar6.f4019c, bVar6.d);
                            } else {
                                f16 = b2;
                            }
                            SVG.b bVar7 = uVar.p;
                            if (bVar7 != null) {
                                this.f4079a.concat(e(bVar6, bVar7, preserveAspectRatio));
                            } else {
                                Boolean bool2 = uVar.r;
                                boolean z4 = bool2 == null || bool2.booleanValue();
                                this.f4079a.translate(f26, floor2);
                                if (!z4) {
                                    Canvas canvas = this.f4079a;
                                    SVG.b bVar8 = d0Var.f4023h;
                                    canvas.scale(bVar8.f4019c, bVar8.d);
                                }
                            }
                            for (SVG.g0 g0Var : uVar.i) {
                                K(g0Var);
                            }
                            R();
                            f26 += f13;
                            b2 = f16;
                        }
                    }
                    if (I) {
                        H(uVar, uVar.f4023h);
                    }
                    R();
                    return;
                }
                return;
            }
        }
        this.f4079a.drawPath(path, this.f4080c.d);
    }

    public final void o(Path path) {
        h hVar = this.f4080c;
        if (hVar.f4095a.M == SVG.Style.VectorEffect.NonScalingStroke) {
            Matrix matrix = this.f4079a.getMatrix();
            Path path2 = new Path();
            path.transform(matrix, path2);
            this.f4079a.setMatrix(new Matrix());
            Shader shader = this.f4080c.e.getShader();
            Matrix matrix2 = new Matrix();
            if (shader != null) {
                shader.getLocalMatrix(matrix2);
                Matrix matrix3 = new Matrix(matrix2);
                matrix3.postConcat(matrix);
                shader.setLocalMatrix(matrix3);
            }
            this.f4079a.drawPath(path2, this.f4080c.e);
            this.f4079a.setMatrix(matrix);
            if (shader != null) {
                shader.setLocalMatrix(matrix2);
                return;
            }
            return;
        }
        this.f4079a.drawPath(path, hVar.e);
    }

    public final void p(SVG.q0 q0Var, j jVar) {
        float f12;
        float f13;
        float f14;
        SVG.Style.TextAnchor w;
        if (m()) {
            Iterator<SVG.g0> it2 = q0Var.i.iterator();
            boolean z = true;
            while (it2.hasNext()) {
                SVG.g0 next = it2.next();
                if (next instanceof SVG.t0) {
                    jVar.b(T(((SVG.t0) next).f4044c, z, !it2.hasNext()));
                } else if (jVar.a((SVG.q0) next)) {
                    boolean z4 = next instanceof SVG.r0;
                    float f15 = o5.i.f36333a;
                    if (z4) {
                        S();
                        SVG.r0 r0Var = (SVG.r0) next;
                        W(this.f4080c, r0Var);
                        if (m() && Y()) {
                            SVG.g0 g3 = r0Var.f4027a.g(r0Var.o);
                            if (g3 == null) {
                                String.format("TextPath reference '%s' not found", r0Var.o);
                            } else {
                                SVG.s sVar = (SVG.s) g3;
                                Path path = new d(this, sVar.o).f4089a;
                                Matrix matrix = sVar.n;
                                if (matrix != null) {
                                    path.transform(matrix);
                                }
                                PathMeasure pathMeasure = new PathMeasure(path, false);
                                SVG.n nVar = r0Var.p;
                                float c5 = nVar != null ? nVar.c(this, pathMeasure.getLength()) : o5.i.f36333a;
                                SVG.Style.TextAnchor w4 = w();
                                if (w4 != SVG.Style.TextAnchor.Start) {
                                    float d12 = d(r0Var);
                                    if (w4 == SVG.Style.TextAnchor.Middle) {
                                        d12 /= 2.0f;
                                    }
                                    c5 -= d12;
                                }
                                g((SVG.d0) r0Var.f4040q);
                                boolean I = I();
                                p(r0Var, new e(path, c5, o5.i.f36333a));
                                if (I) {
                                    H(r0Var, r0Var.f4023h);
                                }
                            }
                        }
                        R();
                    } else if (next instanceof SVG.o0) {
                        S();
                        SVG.o0 o0Var = (SVG.o0) next;
                        W(this.f4080c, o0Var);
                        if (m()) {
                            List<SVG.n> list = o0Var.o;
                            boolean z5 = list != null && list.size() > 0;
                            boolean z12 = jVar instanceof f;
                            if (z12) {
                                f14 = !z5 ? ((f) jVar).f4091a : o0Var.o.get(0).d(this);
                                List<SVG.n> list2 = o0Var.p;
                                f13 = (list2 == null || list2.size() == 0) ? ((f) jVar).b : o0Var.p.get(0).e(this);
                                List<SVG.n> list3 = o0Var.f4041q;
                                f12 = (list3 == null || list3.size() == 0) ? o5.i.f36333a : o0Var.f4041q.get(0).d(this);
                                List<SVG.n> list4 = o0Var.r;
                                if (!(list4 == null || list4.size() == 0)) {
                                    f15 = o0Var.r.get(0).e(this);
                                }
                            } else {
                                f14 = o5.i.f36333a;
                                f13 = o5.i.f36333a;
                                f12 = o5.i.f36333a;
                            }
                            if (z5 && (w = w()) != SVG.Style.TextAnchor.Start) {
                                float d13 = d(o0Var);
                                if (w == SVG.Style.TextAnchor.Middle) {
                                    d13 /= 2.0f;
                                }
                                f14 -= d13;
                            }
                            g((SVG.d0) o0Var.s);
                            if (z12) {
                                f fVar = (f) jVar;
                                fVar.f4091a = f14 + f12;
                                fVar.b = f13 + f15;
                            }
                            boolean I2 = I();
                            p(o0Var, jVar);
                            if (I2) {
                                H(o0Var, o0Var.f4023h);
                            }
                        }
                        R();
                    } else if (next instanceof SVG.n0) {
                        S();
                        SVG.n0 n0Var = (SVG.n0) next;
                        W(this.f4080c, n0Var);
                        if (m()) {
                            g((SVG.d0) n0Var.p);
                            SVG.g0 g6 = next.f4027a.g(n0Var.o);
                            if (g6 == null || !(g6 instanceof SVG.q0)) {
                                String.format("Tref reference '%s' not found", n0Var.o);
                            } else {
                                StringBuilder sb2 = new StringBuilder();
                                q((SVG.q0) g6, sb2);
                                if (sb2.length() > 0) {
                                    jVar.b(sb2.toString());
                                }
                            }
                        }
                        R();
                    }
                }
                z = false;
            }
        }
    }

    public final void q(SVG.q0 q0Var, StringBuilder sb2) {
        Iterator<SVG.g0> it2 = q0Var.i.iterator();
        boolean z = true;
        while (it2.hasNext()) {
            SVG.g0 next = it2.next();
            if (next instanceof SVG.q0) {
                q((SVG.q0) next, sb2);
            } else if (next instanceof SVG.t0) {
                sb2.append(T(((SVG.t0) next).f4044c, z, !it2.hasNext()));
            }
            z = false;
        }
    }

    public final void r(SVG.j jVar, String str) {
        SVG.g0 g3 = jVar.f4027a.g(str);
        if (g3 == null) {
            String.format("Gradient reference '%s' not found", str);
        } else if (!(g3 instanceof SVG.j)) {
            String.format("Gradient href attributes must point to other gradient elements", new Object[0]);
        } else if (g3 == jVar) {
            String.format("Circular reference in gradient href attribute '%s'", str);
        } else {
            SVG.j jVar2 = (SVG.j) g3;
            if (jVar.i == null) {
                jVar.i = jVar2.i;
            }
            if (jVar.j == null) {
                jVar.j = jVar2.j;
            }
            if (jVar.k == null) {
                jVar.k = jVar2.k;
            }
            if (jVar.f4029h.isEmpty()) {
                jVar.f4029h = jVar2.f4029h;
            }
            try {
                if (jVar instanceof SVG.f0) {
                    SVG.f0 f0Var = (SVG.f0) jVar;
                    SVG.f0 f0Var2 = (SVG.f0) g3;
                    if (f0Var.m == null) {
                        f0Var.m = f0Var2.m;
                    }
                    if (f0Var.n == null) {
                        f0Var.n = f0Var2.n;
                    }
                    if (f0Var.o == null) {
                        f0Var.o = f0Var2.o;
                    }
                    if (f0Var.p == null) {
                        f0Var.p = f0Var2.p;
                    }
                } else {
                    s((SVG.j0) jVar, (SVG.j0) g3);
                }
            } catch (ClassCastException unused) {
            }
            String str2 = jVar2.l;
            if (str2 != null) {
                r(jVar, str2);
            }
        }
    }

    public final void s(SVG.j0 j0Var, SVG.j0 j0Var2) {
        if (j0Var.m == null) {
            j0Var.m = j0Var2.m;
        }
        if (j0Var.n == null) {
            j0Var.n = j0Var2.n;
        }
        if (j0Var.o == null) {
            j0Var.o = j0Var2.o;
        }
        if (j0Var.p == null) {
            j0Var.p = j0Var2.p;
        }
        if (j0Var.f4030q == null) {
            j0Var.f4030q = j0Var2.f4030q;
        }
    }

    public final void t(SVG.u uVar, String str) {
        SVG.g0 g3 = uVar.f4027a.g(str);
        if (g3 == null) {
            String.format("Pattern reference '%s' not found", str);
        } else if (!(g3 instanceof SVG.u)) {
            String.format("Pattern href attributes must point to other pattern elements", new Object[0]);
        } else if (g3 == uVar) {
            String.format("Circular reference in pattern href attribute '%s'", str);
        } else {
            SVG.u uVar2 = (SVG.u) g3;
            if (uVar.f4045q == null) {
                uVar.f4045q = uVar2.f4045q;
            }
            if (uVar.r == null) {
                uVar.r = uVar2.r;
            }
            if (uVar.s == null) {
                uVar.s = uVar2.s;
            }
            if (uVar.t == null) {
                uVar.t = uVar2.t;
            }
            if (uVar.f4046u == null) {
                uVar.f4046u = uVar2.f4046u;
            }
            if (uVar.f4047v == null) {
                uVar.f4047v = uVar2.f4047v;
            }
            if (uVar.w == null) {
                uVar.w = uVar2.w;
            }
            if (uVar.i.isEmpty()) {
                uVar.i = uVar2.i;
            }
            if (uVar.p == null) {
                uVar.p = uVar2.p;
            }
            if (uVar.o == null) {
                uVar.o = uVar2.o;
            }
            String str2 = uVar2.x;
            if (str2 != null) {
                t(uVar, str2);
            }
        }
    }

    public final h u(SVG.g0 g0Var) {
        h hVar = new h(this);
        V(hVar, SVG.Style.a());
        v(g0Var, hVar);
        return hVar;
    }

    public final h v(SVG.g0 g0Var, h hVar) {
        ArrayList arrayList = new ArrayList();
        while (true) {
            if (g0Var instanceof SVG.e0) {
                arrayList.add(0, (SVG.e0) g0Var);
            }
            SVG.SvgContainer svgContainer = g0Var.b;
            if (svgContainer == null) {
                break;
            }
            g0Var = (SVG.g0) svgContainer;
        }
        Iterator it2 = arrayList.iterator();
        while (it2.hasNext()) {
            W(hVar, (SVG.e0) it2.next());
        }
        h hVar2 = this.f4080c;
        hVar.f4097g = hVar2.f4097g;
        hVar.f = hVar2.f;
        return hVar;
    }

    public final SVG.Style.TextAnchor w() {
        SVG.Style.TextAnchor textAnchor;
        SVG.Style style = this.f4080c.f4095a;
        if (style.f4006u == SVG.Style.TextDirection.LTR || (textAnchor = style.f4007v) == SVG.Style.TextAnchor.Middle) {
            return style.f4007v;
        }
        SVG.Style.TextAnchor textAnchor2 = SVG.Style.TextAnchor.Start;
        return textAnchor == textAnchor2 ? SVG.Style.TextAnchor.End : textAnchor2;
    }

    public final Path.FillType x() {
        SVG.Style.FillRule fillRule = this.f4080c.f4095a.G;
        if (fillRule == null || fillRule != SVG.Style.FillRule.EvenOdd) {
            return Path.FillType.WINDING;
        }
        return Path.FillType.EVEN_ODD;
    }

    public SVG.b y() {
        h hVar = this.f4080c;
        SVG.b bVar = hVar.f4097g;
        if (bVar != null) {
            return bVar;
        }
        return hVar.f;
    }

    public final boolean z(SVG.Style style, long j12) {
        return (style.b & j12) != 0;
    }

    /* compiled from: SVGAndroidRenderer */
    public class h {

        /* renamed from: a  reason: collision with root package name */
        public SVG.Style f4095a;
        public boolean b;

        /* renamed from: c  reason: collision with root package name */
        public boolean f4096c;
        public Paint d;
        public Paint e;
        public SVG.b f;

        /* renamed from: g  reason: collision with root package name */
        public SVG.b f4097g;

        /* renamed from: h  reason: collision with root package name */
        public boolean f4098h;

        public h(b bVar) {
            Paint paint = new Paint();
            this.d = paint;
            paint.setFlags(193);
            this.d.setHinting(0);
            this.d.setStyle(Paint.Style.FILL);
            this.d.setTypeface(Typeface.DEFAULT);
            Paint paint2 = new Paint();
            this.e = paint2;
            paint2.setFlags(193);
            this.e.setHinting(0);
            this.e.setStyle(Paint.Style.STROKE);
            this.e.setTypeface(Typeface.DEFAULT);
            this.f4095a = SVG.Style.a();
        }

        public h(b bVar, h hVar) {
            this.b = hVar.b;
            this.f4096c = hVar.f4096c;
            this.d = new Paint(hVar.d);
            this.e = new Paint(hVar.e);
            SVG.b bVar2 = hVar.f;
            if (bVar2 != null) {
                this.f = new SVG.b(bVar2);
            }
            SVG.b bVar3 = hVar.f4097g;
            if (bVar3 != null) {
                this.f4097g = new SVG.b(bVar3);
            }
            this.f4098h = hVar.f4098h;
            try {
                this.f4095a = (SVG.Style) hVar.f4095a.clone();
            } catch (CloneNotSupportedException unused) {
                this.f4095a = SVG.Style.a();
            }
        }
    }
}