CAG v5.7.4版本的 MD5 值为:bc57ead76a7a30559f0708e9d60d749f

以下内容为反编译后的 SVGParser.java 源代码,内容仅作参考


package com.caverock.androidsvg;

import android.graphics.Matrix;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Log;
import android.util.Xml;
import androidx.recyclerview.widget.RecyclerView;
import com.caverock.androidsvg.CSSParser;
import com.caverock.androidsvg.PreserveAspectRatio;
import com.caverock.androidsvg.SVG;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.zip.GZIPInputStream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.payloads.DelimitedPayloadTokenFilter;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
public class SVGParser {
    public int f2267d;
    public SVG a = null;
    public SVG.g0 b = null;
    public boolean c = false;
    public boolean f2268e = false;
    public SVGElem f2269f = null;
    public StringBuilder f2270g = null;
    public boolean f2271h = false;
    public StringBuilder f2272i = null;

    public enum SVGAttr {
        CLASS,
        clip,
        clip_path,
        clipPathUnits,
        clip_rule,
        color,
        cx,
        cy,
        direction,
        dx,
        dy,
        fx,
        fy,
        d,
        display,
        fill,
        fill_rule,
        fill_opacity,
        font,
        font_family,
        font_size,
        font_weight,
        font_style,
        gradientTransform,
        gradientUnits,
        height,
        href,
        image_rendering,
        marker,
        marker_start,
        marker_mid,
        marker_end,
        markerHeight,
        markerUnits,
        markerWidth,
        mask,
        maskContentUnits,
        maskUnits,
        media,
        offset,
        opacity,
        orient,
        overflow,
        pathLength,
        patternContentUnits,
        patternTransform,
        patternUnits,
        points,
        preserveAspectRatio,
        r,
        refX,
        refY,
        requiredFeatures,
        requiredExtensions,
        requiredFormats,
        requiredFonts,
        rx,
        ry,
        solid_color,
        solid_opacity,
        spreadMethod,
        startOffset,
        stop_color,
        stop_opacity,
        stroke,
        stroke_dasharray,
        stroke_dashoffset,
        stroke_linecap,
        stroke_linejoin,
        stroke_miterlimit,
        stroke_opacity,
        stroke_width,
        style,
        systemLanguage,
        text_anchor,
        text_decoration,
        transform,
        type,
        vector_effect,
        version,
        viewBox,
        width,
        x,
        y,
        x1,
        y1,
        x2,
        y2,
        viewport_fill,
        viewport_fill_opacity,
        visibility,
        UNSUPPORTED;
        
        public static final Map<String, SVGAttr> f2274i = new HashMap();

        static {
            SVGAttr[] values = values();
            for (int i2 = 0; i2 < 92; i2++) {
                SVGAttr sVGAttr = values[i2];
                if (sVGAttr == CLASS) {
                    f2274i.put("class", sVGAttr);
                } else if (sVGAttr != UNSUPPORTED) {
                    f2274i.put(sVGAttr.name().replace('_', '-'), sVGAttr);
                }
            }
        }

        public static SVGAttr fromString(String str) {
            SVGAttr sVGAttr = f2274i.get(str);
            return sVGAttr != null ? sVGAttr : UNSUPPORTED;
        }
    }

    public enum SVGElem {
        svg,
        a,
        circle,
        clipPath,
        defs,
        desc,
        ellipse,
        g,
        image,
        line,
        linearGradient,
        marker,
        mask,
        path,
        pattern,
        polygon,
        polyline,
        radialGradient,
        rect,
        solidColor,
        stop,
        style,
        SWITCH,
        symbol,
        text,
        textPath,
        title,
        tref,
        tspan,
        use,
        view,
        UNSUPPORTED;
        
        public static final Map<String, SVGElem> f2278i = new HashMap();

        static {
            SVGElem[] values = values();
            for (int i2 = 0; i2 < 32; i2++) {
                SVGElem sVGElem = values[i2];
                if (sVGElem == SWITCH) {
                    f2278i.put("switch", sVGElem);
                } else if (sVGElem != UNSUPPORTED) {
                    f2278i.put(sVGElem.name(), sVGElem);
                }
            }
        }

        public static SVGElem fromString(String str) {
            SVGElem sVGElem = f2278i.get(str);
            return sVGElem != null ? sVGElem : UNSUPPORTED;
        }
    }

    public static class b {
        public static final Map<String, PreserveAspectRatio.Alignment> a;

        static {
            HashMap hashMap = new HashMap(10);
            a = hashMap;
            hashMap.put("none", PreserveAspectRatio.Alignment.none);
            hashMap.put("xMinYMin", PreserveAspectRatio.Alignment.xMinYMin);
            hashMap.put("xMidYMin", PreserveAspectRatio.Alignment.xMidYMin);
            hashMap.put("xMaxYMin", PreserveAspectRatio.Alignment.xMaxYMin);
            hashMap.put("xMinYMid", PreserveAspectRatio.Alignment.xMinYMid);
            hashMap.put("xMidYMid", PreserveAspectRatio.Alignment.xMidYMid);
            hashMap.put("xMaxYMid", PreserveAspectRatio.Alignment.xMaxYMid);
            hashMap.put("xMinYMax", PreserveAspectRatio.Alignment.xMinYMax);
            hashMap.put("xMidYMax", PreserveAspectRatio.Alignment.xMidYMax);
            hashMap.put("xMaxYMax", PreserveAspectRatio.Alignment.xMaxYMax);
        }
    }

    public static class c {
        public static final Map<String, Integer> a;

        static {
            HashMap hashMap = new HashMap(47);
            a = hashMap;
            hashMap.put("aliceblue", -984833);
            hashMap.put("antiquewhite", -332841);
            hashMap.put("aqua", -16711681);
            i.a.b.a.a.X(-8388652, hashMap, "aquamarine", -983041, "azure", -657956, "beige", -6972, "bisque");
            i.a.b.a.a.X(-16777216, hashMap, "black", -5171, "blanchedalmond", -16776961, "blue", -7722014, "blueviolet");
            i.a.b.a.a.X(-5952982, hashMap, "brown", -2180985, "burlywood", -10510688, "cadetblue", -8388864, "chartreuse");
            i.a.b.a.a.X(-2987746, hashMap, "chocolate", -32944, "coral", -10185235, "cornflowerblue", -1828, "cornsilk");
            hashMap.put("crimson", -2354116);
            hashMap.put("cyan", -16711681);
            hashMap.put("darkblue", -16777077);
            hashMap.put("darkcyan", -16741493);
            hashMap.put("darkgoldenrod", -4684277);
            hashMap.put("darkgray", -5658199);
            hashMap.put("darkgreen", -16751616);
            hashMap.put("darkgrey", -5658199);
            hashMap.put("darkkhaki", -4343957);
            i.a.b.a.a.X(-7667573, hashMap, "darkmagenta", -11179217, "darkolivegreen", -29696, "darkorange", -6737204, "darkorchid");
            i.a.b.a.a.X(-7667712, hashMap, "darkred", -1468806, "darksalmon", -7357297, "darkseagreen", -12042869, "darkslateblue");
            hashMap.put("darkslategray", -13676721);
            hashMap.put("darkslategrey", -13676721);
            hashMap.put("darkturquoise", -16724271);
            hashMap.put("darkviolet", -7077677);
            hashMap.put("deeppink", -60269);
            hashMap.put("deepskyblue", -16728065);
            hashMap.put("dimgray", -9868951);
            hashMap.put("dimgrey", -9868951);
            i.a.b.a.a.X(-14774017, hashMap, "dodgerblue", -5103070, "firebrick", -1296, "floralwhite", -14513374, "forestgreen");
            hashMap.put("fuchsia", -65281);
            hashMap.put("gainsboro", -2302756);
            hashMap.put("ghostwhite", -460545);
            hashMap.put("gold", -10496);
            hashMap.put("goldenrod", -2448096);
            hashMap.put("gray", -8355712);
            hashMap.put("green", -16744448);
            hashMap.put("greenyellow", -5374161);
            hashMap.put("grey", -8355712);
            i.a.b.a.a.X(-983056, hashMap, "honeydew", -38476, "hotpink", -3318692, "indianred", -11861886, "indigo");
            i.a.b.a.a.X(-16, hashMap, "ivory", -989556, "khaki", -1644806, "lavender", -3851, "lavenderblush");
            i.a.b.a.a.X(-8586240, hashMap, "lawngreen", -1331, "lemonchiffon", -5383962, "lightblue", -1015680, "lightcoral");
            hashMap.put("lightcyan", -2031617);
            hashMap.put("lightgoldenrodyellow", -329006);
            hashMap.put("lightgray", -2894893);
            hashMap.put("lightgreen", -7278960);
            hashMap.put("lightgrey", -2894893);
            hashMap.put("lightpink", -18751);
            hashMap.put("lightsalmon", -24454);
            hashMap.put("lightseagreen", -14634326);
            hashMap.put("lightskyblue", -7876870);
            hashMap.put("lightslategray", -8943463);
            hashMap.put("lightslategrey", -8943463);
            hashMap.put("lightsteelblue", -5192482);
            hashMap.put("lightyellow", -32);
            hashMap.put("lime", -16711936);
            hashMap.put("limegreen", -13447886);
            hashMap.put("linen", -331546);
            hashMap.put("magenta", -65281);
            hashMap.put("maroon", -8388608);
            hashMap.put("mediumaquamarine", -10039894);
            i.a.b.a.a.X(-16777011, hashMap, "mediumblue", -4565549, "mediumorchid", -7114533, "mediumpurple", -12799119, "mediumseagreen");
            i.a.b.a.a.X(-8689426, hashMap, "mediumslateblue", -16713062, "mediumspringgreen", -12004916, "mediumturquoise", -3730043, "mediumvioletred");
            i.a.b.a.a.X(-15132304, hashMap, "midnightblue", -655366, "mintcream", -6943, "mistyrose", -6987, "moccasin");
            i.a.b.a.a.X(-8531, hashMap, "navajowhite", -16777088, "navy", -133658, "oldlace", -8355840, "olive");
            i.a.b.a.a.X(-9728477, hashMap, "olivedrab", -23296, "orange", -47872, "orangered", -2461482, "orchid");
            i.a.b.a.a.X(-1120086, hashMap, "palegoldenrod", -6751336, "palegreen", -5247250, "paleturquoise", -2396013, "palevioletred");
            i.a.b.a.a.X(-4139, hashMap, "papayawhip", -9543, "peachpuff", -3308225, "peru", -16181, "pink");
            i.a.b.a.a.X(-2252579, hashMap, "plum", -5185306, "powderblue", -8388480, "purple", -10079335, "rebeccapurple");
            i.a.b.a.a.X(-65536, hashMap, "red", -4419697, "rosybrown", -12490271, "royalblue", -7650029, "saddlebrown");
            i.a.b.a.a.X(-360334, hashMap, "salmon", -744352, "sandybrown", -13726889, "seagreen", -2578, "seashell");
            i.a.b.a.a.X(-6270419, hashMap, "sienna", -4144960, "silver", -7876885, "skyblue", -9807155, "slateblue");
            hashMap.put("slategray", -9404272);
            hashMap.put("slategrey", -9404272);
            hashMap.put("snow", -1286);
            hashMap.put("springgreen", -16711809);
            i.a.b.a.a.X(-12156236, hashMap, "steelblue", -2968436, "tan", -16744320, "teal", -2572328, "thistle");
            i.a.b.a.a.X(-40121, hashMap, "tomato", -12525360, "turquoise", -1146130, "violet", -663885, "wheat");
            i.a.b.a.a.X(-1, hashMap, "white", -657931, "whitesmoke", -256, "yellow", -6632142, "yellowgreen");
            hashMap.put("transparent", 0);
        }
    }

    public static class d {
        public static final Map<String, SVG.n> a;

        static {
            HashMap hashMap = new HashMap(9);
            a = hashMap;
            SVG.Unit unit = SVG.Unit.pt;
            hashMap.put("xx-small", new SVG.n(0.694f, unit));
            hashMap.put("x-small", new SVG.n(0.833f, unit));
            hashMap.put("small", new SVG.n(10.0f, unit));
            hashMap.put("medium", new SVG.n(12.0f, unit));
            hashMap.put("large", new SVG.n(14.4f, unit));
            hashMap.put("x-large", new SVG.n(17.3f, unit));
            hashMap.put("xx-large", new SVG.n(20.7f, unit));
            SVG.Unit unit2 = SVG.Unit.percent;
            hashMap.put("smaller", new SVG.n(83.33f, unit2));
            hashMap.put("larger", new SVG.n(120.0f, unit2));
        }
    }

    public static class e {
        public static final Map<String, Integer> a;

        static {
            HashMap hashMap = new HashMap(13);
            a = hashMap;
            hashMap.put("normal", 400);
            hashMap.put("bold", 700);
            i.a.b.a.a.X(1, hashMap, "bolder", -1, "lighter", 100, "100", 200, "200");
            hashMap.put("300", 300);
            hashMap.put("400", 400);
            hashMap.put("500", 500);
            hashMap.put("600", 600);
            hashMap.put("700", 700);
            hashMap.put("800", 800);
            hashMap.put("900", 900);
        }
    }

    public class f extends DefaultHandler2 {
        public f(a aVar) {
        }

        @Override
        public void characters(char[] cArr, int i2, int i3) throws SAXException {
            SVGParser.this.M(new String(cArr, i2, i3));
        }

        @Override
        public void endDocument() throws SAXException {
            Objects.requireNonNull(SVGParser.this);
        }

        @Override
        public void endElement(String str, String str2, String str3) throws SAXException {
            SVGParser.this.c(str, str2, str3);
        }

        @Override
        public void processingInstruction(String str, String str2) throws SAXException {
            SVGParser.this.E(new g(str2));
            Objects.requireNonNull(SVGParser.this);
            str.equals("xml-stylesheet");
        }

        @Override
        public void startDocument() throws SAXException {
            SVGParser sVGParser = SVGParser.this;
            Objects.requireNonNull(sVGParser);
            sVGParser.a = new SVG();
        }

        @Override
        public void startElement(String str, String str2, String str3, Attributes attributes) throws SAXException {
            SVGParser.this.K(str, str2, str3, attributes);
        }
    }

    public static class g {
        public String a;
        public int c;
        public int b = 0;
        public i.e.a.b f2280d = new i.e.a.b();

        public g(String str) {
            this.c = 0;
            String trim = str.trim();
            this.a = trim;
            this.c = trim.length();
        }

        public int a() {
            int i2 = this.b;
            int i3 = this.c;
            if (i2 == i3) {
                return -1;
            }
            int i4 = i2 + 1;
            this.b = i4;
            if (i4 < i3) {
                return this.a.charAt(i4);
            }
            return -1;
        }

        public Boolean b(Object obj) {
            if (obj == null) {
                return null;
            }
            q();
            int i2 = this.b;
            if (i2 == this.c) {
                return null;
            }
            char charAt = this.a.charAt(i2);
            if (charAt == '0' || charAt == '1') {
                this.b++;
                return Boolean.valueOf(charAt == '1');
            }
            return null;
        }

        public float c(float f2) {
            if (Float.isNaN(f2)) {
                return Float.NaN;
            }
            q();
            return i();
        }

        public boolean d(char c) {
            int i2 = this.b;
            boolean z = i2 < this.c && this.a.charAt(i2) == c;
            if (z) {
                this.b++;
            }
            return z;
        }

        public boolean e(String str) {
            int length = str.length();
            int i2 = this.b;
            boolean z = i2 <= this.c - length && this.a.substring(i2, i2 + length).equals(str);
            if (z) {
                this.b += length;
            }
            return z;
        }

        public boolean f() {
            return this.b == this.c;
        }

        public boolean g(int i2) {
            return i2 == 32 || i2 == 10 || i2 == 13 || i2 == 9;
        }

        public Integer h() {
            int i2 = this.b;
            if (i2 == this.c) {
                return null;
            }
            String str = this.a;
            this.b = i2 + 1;
            return Integer.valueOf(str.charAt(i2));
        }

        public float i() {
            float a = this.f2280d.a(this.a, this.b, this.c);
            if (!Float.isNaN(a)) {
                this.b = this.f2280d.a;
            }
            return a;
        }

        public SVG.n j() {
            float i2 = i();
            if (Float.isNaN(i2)) {
                return null;
            }
            SVG.Unit o2 = o();
            if (o2 == null) {
                return new SVG.n(i2, SVG.Unit.px);
            }
            return new SVG.n(i2, o2);
        }

        public String k() {
            if (f()) {
                return null;
            }
            int i2 = this.b;
            char charAt = this.a.charAt(i2);
            if (charAt == '\'' || charAt == '\"') {
                int a = a();
                while (a != -1 && a != charAt) {
                    a = a();
                }
                if (a == -1) {
                    this.b = i2;
                    return null;
                }
                int i3 = this.b + 1;
                this.b = i3;
                return this.a.substring(i2 + 1, i3 - 1);
            }
            return null;
        }

        public String l() {
            return n(' ', false);
        }

        public String m(char c) {
            return n(c, false);
        }

        public String n(char c, boolean z) {
            if (f()) {
                return null;
            }
            char charAt = this.a.charAt(this.b);
            if ((z || !g(charAt)) && charAt != c) {
                int i2 = this.b;
                int a = a();
                while (a != -1 && a != c && (z || !g(a))) {
                    a = a();
                }
                return this.a.substring(i2, this.b);
            }
            return null;
        }

        public SVG.Unit o() {
            if (f()) {
                return null;
            }
            if (this.a.charAt(this.b) == '%') {
                this.b++;
                return SVG.Unit.percent;
            }
            int i2 = this.b;
            if (i2 > this.c - 2) {
                return null;
            }
            try {
                SVG.Unit valueOf = SVG.Unit.valueOf(this.a.substring(i2, i2 + 2).toLowerCase(Locale.US));
                this.b += 2;
                return valueOf;
            } catch (IllegalArgumentException unused) {
                return null;
            }
        }

        public float p() {
            q();
            float a = this.f2280d.a(this.a, this.b, this.c);
            if (!Float.isNaN(a)) {
                this.b = this.f2280d.a;
            }
            return a;
        }

        public boolean q() {
            r();
            int i2 = this.b;
            if (i2 != this.c && this.a.charAt(i2) == ',') {
                this.b++;
                r();
                return true;
            }
            return false;
        }

        public void r() {
            while (true) {
                int i2 = this.b;
                if (i2 >= this.c || !g(this.a.charAt(i2))) {
                    return;
                }
                this.b++;
            }
        }
    }

    public class h implements Attributes {
        public XmlPullParser a;

        public h(SVGParser sVGParser, XmlPullParser xmlPullParser) {
            this.a = xmlPullParser;
        }

        @Override
        public int getIndex(String str) {
            return -1;
        }

        @Override
        public int getIndex(String str, String str2) {
            return -1;
        }

        @Override
        public int getLength() {
            return this.a.getAttributeCount();
        }

        @Override
        public String getLocalName(int i2) {
            return this.a.getAttributeName(i2);
        }

        @Override
        public String getQName(int i2) {
            String attributeName = this.a.getAttributeName(i2);
            if (this.a.getAttributePrefix(i2) != null) {
                return this.a.getAttributePrefix(i2) + ':' + attributeName;
            }
            return attributeName;
        }

        @Override
        public String getType(int i2) {
            return null;
        }

        @Override
        public String getType(String str) {
            return null;
        }

        @Override
        public String getType(String str, String str2) {
            return null;
        }

        @Override
        public String getURI(int i2) {
            return this.a.getAttributeNamespace(i2);
        }

        @Override
        public String getValue(int i2) {
            return this.a.getAttributeValue(i2);
        }

        @Override
        public String getValue(String str) {
            return null;
        }

        @Override
        public String getValue(String str, String str2) {
            return null;
        }
    }

    public static SVG.n A(g gVar) {
        if (gVar.e("auto")) {
            return new SVG.n(0.0f);
        }
        return gVar.j();
    }

    public static Float B(String str) {
        try {
            float t2 = t(str);
            if (t2 < 0.0f) {
                t2 = 0.0f;
            } else if (t2 > 1.0f) {
                t2 = 1.0f;
            }
            return Float.valueOf(t2);
        } catch (SVGParseException unused) {
            return null;
        }
    }

    public static SVG.l0 C(String str) {
        if (str.startsWith("url(")) {
            int indexOf = str.indexOf(")");
            if (indexOf != -1) {
                String trim = str.substring(4, indexOf).trim();
                String trim2 = str.substring(indexOf + 1).trim();
                return new SVG.s(trim, trim2.length() > 0 ? r(trim2) : null);
            }
            return new SVG.s(str.substring(4).trim(), null);
        }
        return r(str);
    }

    public static void D(SVG.m0 m0Var, String str) throws SVGParseException {
        g gVar = new g(str);
        gVar.r();
        String l2 = gVar.l();
        if ("defer".equals(l2)) {
            gVar.r();
            l2 = gVar.l();
        }
        PreserveAspectRatio.Alignment alignment = b.a.get(l2);
        PreserveAspectRatio.Scale scale = null;
        gVar.r();
        if (!gVar.f()) {
            String l3 = gVar.l();
            l3.hashCode();
            if (l3.equals("meet")) {
                scale = PreserveAspectRatio.Scale.meet;
            } else if (l3.equals("slice")) {
                scale = PreserveAspectRatio.Scale.slice;
            } else {
                throw new SVGParseException(i.a.b.a.a.r("Invalid preserveAspectRatio definition: ", str));
            }
        }
        m0Var.f2210n = new PreserveAspectRatio(alignment, scale);
    }

    public static void J(SVG.Style style, String str, String str2) {
        SVG.n nVar;
        SVG.n j2;
        if (str2.length() == 0 || str2.equals("inherit")) {
            return;
        }
        int ordinal = SVGAttr.fromString(str).ordinal();
        SVG.b bVar = null;
        SVG.Style.LineJoin lineJoin = null;
        SVG.Style.LineCap lineCap = null;
        r2 = null;
        r2 = null;
        r2 = null;
        r2 = null;
        r2 = null;
        SVG.n[] nVarArr = null;
        SVG.Style.RenderQuality renderQuality = null;
        String str3 = null;
        SVG.n nVar2 = null;
        SVG.Style.TextDecoration textDecoration = null;
        SVG.Style.TextAnchor textAnchor = null;
        SVG.Style.VectorEffect vectorEffect = null;
        Boolean bool = null;
        SVG.Style.TextDirection textDirection = null;
        bVar = null;
        bVar = null;
        if (ordinal == 1) {
            if (!"auto".equals(str2) && str2.startsWith("rect(")) {
                g gVar = new g(str2.substring(5));
                gVar.r();
                SVG.n A = A(gVar);
                gVar.q();
                SVG.n A2 = A(gVar);
                gVar.q();
                SVG.n A3 = A(gVar);
                gVar.q();
                SVG.n A4 = A(gVar);
                gVar.r();
                if (gVar.d(')') || gVar.f()) {
                    bVar = new SVG.b(A, A2, A3, A4);
                }
            }
            style.E = bVar;
            if (bVar != null) {
                style.f2129i |= PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED;
            }
        } else if (ordinal == 2) {
            style.M = x(str2);
            style.f2129i |= 268435456;
        } else if (ordinal == 4) {
            style.N = s(str2);
            style.f2129i |= 536870912;
        } else {
            try {
                if (ordinal == 5) {
                    style.f2142v = q(str2);
                    style.f2129i |= PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM;
                } else if (ordinal == 8) {
                    if (str2.equals("ltr")) {
                        textDirection = SVG.Style.TextDirection.LTR;
                    } else if (str2.equals("rtl")) {
                        textDirection = SVG.Style.TextDirection.RTL;
                    }
                    style.B = textDirection;
                    if (textDirection != null) {
                        style.f2129i |= 68719476736L;
                    }
                } else if (ordinal == 35) {
                    style.O = x(str2);
                    style.f2129i |= 1073741824;
                } else if (ordinal == 40) {
                    style.f2141u = B(str2);
                    style.f2129i |= PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH;
                } else {
                    char c2 = 0;
                    if (ordinal == 42) {
                        switch (str2.hashCode()) {
                            case -1217487446:
                                break;
                            case -907680051:
                                if (str2.equals("scroll")) {
                                    c2 = 1;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            case 3005871:
                                if (str2.equals("auto")) {
                                    c2 = 2;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            case 466743410:
                                if (str2.equals("visible")) {
                                    c2 = 3;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            default:
                                c2 = 65535;
                                break;
                        }
                        if (c2 == 0 || c2 == 1) {
                            bool = Boolean.FALSE;
                        } else if (c2 == 2 || c2 == 3) {
                            bool = Boolean.TRUE;
                        }
                        style.D = bool;
                        if (bool != null) {
                            style.f2129i |= PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED;
                        }
                    } else if (ordinal == 78) {
                        if (str2.equals("none")) {
                            vectorEffect = SVG.Style.VectorEffect.None;
                        } else if (str2.equals("non-scaling-stroke")) {
                            vectorEffect = SVG.Style.VectorEffect.NonScalingStroke;
                        }
                        style.T = vectorEffect;
                        if (vectorEffect != null) {
                            style.f2129i |= 34359738368L;
                        }
                    } else if (ordinal == 58) {
                        if (str2.equals("currentColor")) {
                            style.P = SVG.f.f2178i;
                        } else {
                            try {
                                style.P = q(str2);
                            } catch (SVGParseException e2) {
                                Log.w("SVGParser", e2.getMessage());
                                return;
                            }
                        }
                        style.f2129i |= 2147483648L;
                    } else if (ordinal == 59) {
                        style.Q = B(str2);
                        style.f2129i |= 4294967296L;
                    } else if (ordinal == 74) {
                        int hashCode = str2.hashCode();
                        if (hashCode != -1074341483) {
                            if (hashCode != 100571) {
                                if (hashCode == 109757538 && str2.equals("start")) {
                                    c2 = 2;
                                }
                                c2 = 65535;
                            } else {
                                if (str2.equals("end")) {
                                    c2 = 1;
                                }
                                c2 = 65535;
                            }
                        }
                        if (c2 == 0) {
                            textAnchor = SVG.Style.TextAnchor.Middle;
                        } else if (c2 == 1) {
                            textAnchor = SVG.Style.TextAnchor.End;
                        } else if (c2 == 2) {
                            textAnchor = SVG.Style.TextAnchor.Start;
                        }
                        style.C = textAnchor;
                        if (textAnchor != null) {
                            style.f2129i |= PlaybackStateCompat.ACTION_SET_REPEAT_MODE;
                        }
                    } else if (ordinal != 75) {
                        switch (ordinal) {
                            case 14:
                                if (str2.indexOf(124) < 0) {
                                    if ("|inline|block|list-item|run-in|compact|marker|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|none|".contains(DelimitedPayloadTokenFilter.DEFAULT_DELIMITER + str2 + DelimitedPayloadTokenFilter.DEFAULT_DELIMITER)) {
                                        style.I = Boolean.valueOf(!str2.equals("none"));
                                        style.f2129i |= 16777216;
                                        return;
                                    }
                                    return;
                                }
                                return;
                            case 15:
                                SVG.l0 C = C(str2);
                                style.f2130j = C;
                                if (C != null) {
                                    style.f2129i |= 1;
                                    return;
                                }
                                return;
                            case 16:
                                SVG.Style.FillRule s2 = s(str2);
                                style.f2131k = s2;
                                if (s2 != null) {
                                    style.f2129i |= 2;
                                    return;
                                }
                                return;
                            case 17:
                                Float B = B(str2);
                                style.f2132l = B;
                                if (B != null) {
                                    style.f2129i |= 4;
                                    return;
                                }
                                return;
                            case 18:
                                if ("|caption|icon|menu|message-box|small-caption|status-bar|".contains(DelimitedPayloadTokenFilter.DEFAULT_DELIMITER + str2 + DelimitedPayloadTokenFilter.DEFAULT_DELIMITER)) {
                                    g gVar2 = new g(str2);
                                    Integer num = null;
                                    SVG.Style.FontStyle fontStyle = null;
                                    String str4 = null;
                                    while (true) {
                                        String m2 = gVar2.m('/');
                                        gVar2.r();
                                        if (m2 == null) {
                                            return;
                                        }
                                        if (num == null || fontStyle == null) {
                                            if (!m2.equals("normal") && (num != null || (num = e.a.get(m2)) == null)) {
                                                if (fontStyle != null || (fontStyle = w(m2)) == null) {
                                                    if (str4 == null && m2.equals("small-caps")) {
                                                        str4 = m2;
                                                    }
                                                }
                                            }
                                        }
                                        try {
                                            nVar = d.a.get(m2);
                                            if (nVar == null) {
                                                nVar = y(m2);
                                            }
                                        } catch (SVGParseException unused) {
                                            nVar = null;
                                        }
                                        if (gVar2.d('/')) {
                                            gVar2.r();
                                            String l2 = gVar2.l();
                                            if (l2 != null) {
                                                y(l2);
                                            }
                                            gVar2.r();
                                        }
                                        if (!gVar2.f()) {
                                            int i2 = gVar2.b;
                                            gVar2.b = gVar2.c;
                                            str3 = gVar2.a.substring(i2);
                                        }
                                        style.f2143w = v(str3);
                                        style.x = nVar;
                                        style.y = Integer.valueOf(num == null ? 400 : num.intValue());
                                        if (fontStyle == null) {
                                            fontStyle = SVG.Style.FontStyle.Normal;
                                        }
                                        style.z = fontStyle;
                                        style.f2129i |= 122880;
                                        return;
                                    }
                                }
                                return;
                            case 19:
                                List<String> v2 = v(str2);
                                style.f2143w = v2;
                                if (v2 != null) {
                                    style.f2129i |= PlaybackStateCompat.ACTION_PLAY_FROM_URI;
                                    return;
                                }
                                return;
                            case 20:
                                try {
                                    SVG.n nVar3 = d.a.get(str2);
                                    if (nVar3 == null) {
                                        nVar3 = y(str2);
                                    }
                                    nVar2 = nVar3;
                                } catch (SVGParseException unused2) {
                                }
                                style.x = nVar2;
                                if (nVar2 != null) {
                                    style.f2129i |= PlaybackStateCompat.ACTION_PREPARE;
                                    return;
                                }
                                return;
                            case 21:
                                Integer num2 = e.a.get(str2);
                                style.y = num2;
                                if (num2 != null) {
                                    style.f2129i |= PlaybackStateCompat.ACTION_PREPARE_FROM_MEDIA_ID;
                                    return;
                                }
                                return;
                            case 22:
                                SVG.Style.FontStyle w2 = w(str2);
                                style.z = w2;
                                if (w2 != null) {
                                    style.f2129i |= PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH;
                                    return;
                                }
                                return;
                            default:
                                switch (ordinal) {
                                    case 27:
                                        int hashCode2 = str2.hashCode();
                                        if (hashCode2 == -933002398) {
                                            break;
                                        } else if (hashCode2 != 3005871) {
                                            if (hashCode2 == 362741610 && str2.equals("optimizeSpeed")) {
                                                c2 = 2;
                                            }
                                            c2 = 65535;
                                        } else {
                                            if (str2.equals("auto")) {
                                                c2 = 1;
                                            }
                                            c2 = 65535;
                                        }
                                        if (c2 == 0) {
                                            renderQuality = SVG.Style.RenderQuality.optimizeQuality;
                                        } else if (c2 == 1) {
                                            renderQuality = SVG.Style.RenderQuality.auto;
                                        } else if (c2 == 2) {
                                            renderQuality = SVG.Style.RenderQuality.optimizeSpeed;
                                        }
                                        style.U = renderQuality;
                                        if (renderQuality != null) {
                                            style.f2129i |= 137438953472L;
                                            return;
                                        }
                                        return;
                                    case 28:
                                        String x = x(str2);
                                        style.F = x;
                                        style.G = x;
                                        style.H = x;
                                        style.f2129i |= 14680064;
                                        return;
                                    case 29:
                                        style.F = x(str2);
                                        style.f2129i |= PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE;
                                        return;
                                    case 30:
                                        style.G = x(str2);
                                        style.f2129i |= 4194304;
                                        return;
                                    case 31:
                                        style.H = x(str2);
                                        style.f2129i |= 8388608;
                                        return;
                                    default:
                                        switch (ordinal) {
                                            case 62:
                                                if (str2.equals("currentColor")) {
                                                    style.K = SVG.f.f2178i;
                                                } else {
                                                    try {
                                                        style.K = q(str2);
                                                    } catch (SVGParseException e3) {
                                                        Log.w("SVGParser", e3.getMessage());
                                                        return;
                                                    }
                                                }
                                                style.f2129i |= 67108864;
                                                return;
                                            case 63:
                                                style.L = B(str2);
                                                style.f2129i |= 134217728;
                                                return;
                                            case 64:
                                                SVG.l0 C2 = C(str2);
                                                style.f2133m = C2;
                                                if (C2 != null) {
                                                    style.f2129i |= 8;
                                                    return;
                                                }
                                                return;
                                            case 65:
                                                if ("none".equals(str2)) {
                                                    style.f2139s = null;
                                                    style.f2129i |= 512;
                                                    return;
                                                }
                                                g gVar3 = new g(str2);
                                                gVar3.r();
                                                if (!gVar3.f() && (j2 = gVar3.j()) != null && !j2.i()) {
                                                    float f2 = j2.f2211i;
                                                    ArrayList arrayList = new ArrayList();
                                                    arrayList.add(j2);
                                                    while (true) {
                                                        if (!gVar3.f()) {
                                                            gVar3.q();
                                                            SVG.n j3 = gVar3.j();
                                                            if (j3 != null && !j3.i()) {
                                                                arrayList.add(j3);
                                                                f2 += j3.f2211i;
                                                            }
                                                        } else if (f2 != 0.0f) {
                                                            nVarArr = (SVG.n[]) arrayList.toArray(new SVG.n[arrayList.size()]);
                                                        }
                                                    }
                                                }
                                                style.f2139s = nVarArr;
                                                if (nVarArr != null) {
                                                    style.f2129i |= 512;
                                                    return;
                                                }
                                                return;
                                            case 66:
                                                style.f2140t = y(str2);
                                                style.f2129i |= PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
                                                return;
                                            case 67:
                                                if ("butt".equals(str2)) {
                                                    lineCap = SVG.Style.LineCap.Butt;
                                                } else if ("round".equals(str2)) {
                                                    lineCap = SVG.Style.LineCap.Round;
                                                } else if ("square".equals(str2)) {
                                                    lineCap = SVG.Style.LineCap.Square;
                                                }
                                                style.f2136p = lineCap;
                                                if (lineCap != null) {
                                                    style.f2129i |= 64;
                                                    return;
                                                }
                                                return;
                                            case 68:
                                                if ("miter".equals(str2)) {
                                                    lineJoin = SVG.Style.LineJoin.Miter;
                                                } else if ("round".equals(str2)) {
                                                    lineJoin = SVG.Style.LineJoin.Round;
                                                } else if ("bevel".equals(str2)) {
                                                    lineJoin = SVG.Style.LineJoin.Bevel;
                                                }
                                                style.f2137q = lineJoin;
                                                if (lineJoin != null) {
                                                    style.f2129i |= 128;
                                                    return;
                                                }
                                                return;
                                            case 69:
                                                style.f2138r = Float.valueOf(t(str2));
                                                style.f2129i |= 256;
                                                return;
                                            case 70:
                                                Float B2 = B(str2);
                                                style.f2134n = B2;
                                                if (B2 != null) {
                                                    style.f2129i |= 16;
                                                    return;
                                                }
                                                return;
                                            case 71:
                                                style.f2135o = y(str2);
                                                style.f2129i |= 32;
                                                return;
                                            default:
                                                switch (ordinal) {
                                                    case 88:
                                                        if (str2.equals("currentColor")) {
                                                            style.R = SVG.f.f2178i;
                                                        } else {
                                                            try {
                                                                style.R = q(str2);
                                                            } catch (SVGParseException e4) {
                                                                Log.w("SVGParser", e4.getMessage());
                                                                return;
                                                            }
                                                        }
                                                        style.f2129i |= 8589934592L;
                                                        return;
                                                    case 89:
                                                        style.S = B(str2);
                                                        style.f2129i |= 17179869184L;
                                                        return;
                                                    case 90:
                                                        if (str2.indexOf(124) < 0) {
                                                            if ("|visible|hidden|collapse|".contains(DelimitedPayloadTokenFilter.DEFAULT_DELIMITER + str2 + DelimitedPayloadTokenFilter.DEFAULT_DELIMITER)) {
                                                                style.J = Boolean.valueOf(str2.equals("visible"));
                                                                style.f2129i |= 33554432;
                                                                return;
                                                            }
                                                            return;
                                                        }
                                                        return;
                                                    default:
                                                        return;
                                                }
                                        }
                                }
                        }
                    } else {
                        switch (str2.hashCode()) {
                            case -1171789332:
                                break;
                            case -1026963764:
                                if (str2.equals("underline")) {
                                    c2 = 1;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            case 3387192:
                                if (str2.equals("none")) {
                                    c2 = 2;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            case 93826908:
                                if (str2.equals("blink")) {
                                    c2 = 3;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            case 529818312:
                                if (str2.equals("overline")) {
                                    c2 = 4;
                                    break;
                                }
                                c2 = 65535;
                                break;
                            default:
                                c2 = 65535;
                                break;
                        }
                        if (c2 == 0) {
                            textDecoration = SVG.Style.TextDecoration.LineThrough;
                        } else if (c2 == 1) {
                            textDecoration = SVG.Style.TextDecoration.Underline;
                        } else if (c2 == 2) {
                            textDecoration = SVG.Style.TextDecoration.None;
                        } else if (c2 == 3) {
                            textDecoration = SVG.Style.TextDecoration.Blink;
                        } else if (c2 == 4) {
                            textDecoration = SVG.Style.TextDecoration.Overline;
                        }
                        style.A = textDecoration;
                        if (textDecoration != null) {
                            style.f2129i |= PlaybackStateCompat.ACTION_PREPARE_FROM_URI;
                        }
                    }
                }
            } catch (SVGParseException unused3) {
            }
        }
    }

    public static int b(float f2) {
        if (f2 < 0.0f) {
            return 0;
        }
        if (f2 > 255.0f) {
            return 255;
        }
        return Math.round(f2);
    }

    public static int d(float f2, float f3, float f4) {
        int i2 = (f2 > 0.0f ? 1 : (f2 == 0.0f ? 0 : -1));
        float f5 = f2 % 360.0f;
        if (i2 < 0) {
            f5 += 360.0f;
        }
        float f6 = f5 / 60.0f;
        float f7 = f3 / 100.0f;
        float f8 = f4 / 100.0f;
        if (f7 < 0.0f) {
            f7 = 0.0f;
        } else if (f7 > 1.0f) {
            f7 = 1.0f;
        }
        float f9 = f8 >= 0.0f ? f8 > 1.0f ? 1.0f : f8 : 0.0f;
        float f10 = f9 <= 0.5f ? (f7 + 1.0f) * f9 : (f9 + f7) - (f7 * f9);
        float f11 = (f9 * 2.0f) - f10;
        return b(e(f11, f10, f6 - 2.0f) * 256.0f) | (b(e(f11, f10, f6 + 2.0f) * 256.0f) << 16) | (b(e(f11, f10, f6) * 256.0f) << 8);
    }

    public static float e(float f2, float f3, float f4) {
        if (f4 < 0.0f) {
            f4 += 6.0f;
        }
        if (f4 >= 6.0f) {
            f4 -= 6.0f;
        }
        return f4 < 1.0f ? i.a.b.a.a.a(f3, f2, f4, f2) : f4 < 3.0f ? f3 : f4 < 4.0f ? i.a.b.a.a.a(4.0f, f4, f3 - f2, f2) : f2;
    }

    public static SVG.e q(String str) throws SVGParseException {
        long j2;
        int i2;
        if (str.charAt(0) == '#') {
            int length = str.length();
            i.e.a.a aVar = null;
            if (1 < length) {
                long j3 = 0;
                int i3 = 1;
                while (i3 < length) {
                    char charAt = str.charAt(i3);
                    if (charAt < '0' || charAt > '9') {
                        if (charAt >= 'A' && charAt <= 'F') {
                            j2 = j3 * 16;
                            i2 = charAt - 'A';
                        } else if (charAt < 'a' || charAt > 'f') {
                            break;
                        } else {
                            j2 = j3 * 16;
                            i2 = charAt - 'a';
                        }
                        j3 = j2 + i2 + 10;
                    } else {
                        j3 = (j3 * 16) + (charAt - '0');
                    }
                    if (j3 > 4294967295L) {
                        break;
                    }
                    i3++;
                }
                if (i3 != 1) {
                    aVar = new i.e.a.a(j3, i3);
                }
            }
            if (aVar != null) {
                int i4 = aVar.a;
                if (i4 == 4) {
                    int i5 = (int) aVar.b;
                    int i6 = i5 & 3840;
                    int i7 = i5 & 240;
                    int i8 = i5 & 15;
                    return new SVG.e(i8 | (i6 << 8) | (-16777216) | (i6 << 12) | (i7 << 8) | (i7 << 4) | (i8 << 4));
                } else if (i4 != 5) {
                    if (i4 != 7) {
                        if (i4 == 9) {
                            int i9 = (int) aVar.b;
                            return new SVG.e((i9 << 24) | (i9 >>> 8));
                        }
                        throw new SVGParseException(i.a.b.a.a.r("Bad hex colour value: ", str));
                    }
                    return new SVG.e(((int) aVar.b) | (-16777216));
                } else {
                    int i10 = (int) aVar.b;
                    int i11 = 61440 & i10;
                    int i12 = i10 & 3840;
                    int i13 = i10 & 240;
                    int i14 = i10 & 15;
                    return new SVG.e((i14 << 24) | (i14 << 28) | (i11 << 8) | (i11 << 4) | (i12 << 4) | i12 | i13 | (i13 >> 4));
                }
            }
            throw new SVGParseException(i.a.b.a.a.r("Bad hex colour value: ", str));
        }
        String lowerCase = str.toLowerCase(Locale.US);
        boolean startsWith = lowerCase.startsWith("rgba(");
        if (!startsWith && !lowerCase.startsWith("rgb(")) {
            boolean startsWith2 = lowerCase.startsWith("hsla(");
            if (!startsWith2 && !lowerCase.startsWith("hsl(")) {
                Integer num = c.a.get(lowerCase);
                if (num != null) {
                    return new SVG.e(num.intValue());
                }
                throw new SVGParseException(i.a.b.a.a.r("Invalid colour keyword: ", lowerCase));
            }
            g gVar = new g(str.substring(startsWith2 ? 5 : 4));
            gVar.r();
            float i15 = gVar.i();
            float c2 = gVar.c(i15);
            if (!Float.isNaN(c2)) {
                gVar.d('%');
            }
            float c3 = gVar.c(c2);
            if (!Float.isNaN(c3)) {
                gVar.d('%');
            }
            if (startsWith2) {
                float c4 = gVar.c(c3);
                gVar.r();
                if (!Float.isNaN(c4) && gVar.d(')')) {
                    return new SVG.e((b(c4 * 256.0f) << 24) | d(i15, c2, c3));
                }
                throw new SVGParseException(i.a.b.a.a.r("Bad hsla() colour value: ", str));
            }
            gVar.r();
            if (!Float.isNaN(c3) && gVar.d(')')) {
                return new SVG.e(d(i15, c2, c3) | (-16777216));
            }
            throw new SVGParseException(i.a.b.a.a.r("Bad hsl() colour value: ", str));
        }
        g gVar2 = new g(str.substring(startsWith ? 5 : 4));
        gVar2.r();
        float i16 = gVar2.i();
        if (!Float.isNaN(i16) && gVar2.d('%')) {
            i16 = (i16 * 256.0f) / 100.0f;
        }
        float c5 = gVar2.c(i16);
        if (!Float.isNaN(c5) && gVar2.d('%')) {
            c5 = (c5 * 256.0f) / 100.0f;
        }
        float c6 = gVar2.c(c5);
        if (!Float.isNaN(c6) && gVar2.d('%')) {
            c6 = (c6 * 256.0f) / 100.0f;
        }
        if (startsWith) {
            float c7 = gVar2.c(c6);
            gVar2.r();
            if (!Float.isNaN(c7) && gVar2.d(')')) {
                return new SVG.e((b(c7 * 256.0f) << 24) | (b(i16) << 16) | (b(c5) << 8) | b(c6));
            }
            throw new SVGParseException(i.a.b.a.a.r("Bad rgba() colour value: ", str));
        }
        gVar2.r();
        if (!Float.isNaN(c6) && gVar2.d(')')) {
            return new SVG.e((b(i16) << 16) | (-16777216) | (b(c5) << 8) | b(c6));
        }
        throw new SVGParseException(i.a.b.a.a.r("Bad rgb() colour value: ", str));
    }

    public static SVG.l0 r(String str) {
        if (str.equals("none")) {
            return SVG.e.f2171k;
        }
        if (!str.equals("currentColor")) {
            try {
                return q(str);
            } catch (SVGParseException unused) {
                return null;
            }
        }
        return SVG.f.f2178i;
    }

    public static SVG.Style.FillRule s(String str) {
        if ("nonzero".equals(str)) {
            return SVG.Style.FillRule.NonZero;
        }
        if ("evenodd".equals(str)) {
            return SVG.Style.FillRule.EvenOdd;
        }
        return null;
    }

    public static float t(String str) throws SVGParseException {
        int length = str.length();
        if (length != 0) {
            return u(str, 0, length);
        }
        throw new SVGParseException("Invalid float value (empty string)");
    }

    public static float u(String str, int i2, int i3) throws SVGParseException {
        float a2 = new i.e.a.b().a(str, i2, i3);
        if (Float.isNaN(a2)) {
            throw new SVGParseException(i.a.b.a.a.r("Invalid float value: ", str));
        }
        return a2;
    }

    public static List<String> v(String str) {
        g gVar = new g(str);
        ArrayList arrayList = null;
        do {
            String k2 = gVar.k();
            if (k2 == null) {
                k2 = gVar.n(',', true);
            }
            if (k2 == null) {
                break;
            }
            if (arrayList == null) {
                arrayList = new ArrayList();
            }
            arrayList.add(k2);
            gVar.q();
        } while (!gVar.f());
        return arrayList;
    }

    public static SVG.Style.FontStyle w(String str) {
        char c2 = 65535;
        switch (str.hashCode()) {
            case -1657669071:
                if (str.equals("oblique")) {
                    c2 = 0;
                    break;
                }
                break;
            case -1178781136:
                if (str.equals("italic")) {
                    c2 = 1;
                    break;
                }
                break;
            case -1039745817:
                if (str.equals("normal")) {
                    c2 = 2;
                    break;
                }
                break;
        }
        switch (c2) {
            case 0:
                return SVG.Style.FontStyle.Oblique;
            case 1:
                return SVG.Style.FontStyle.Italic;
            case 2:
                return SVG.Style.FontStyle.Normal;
            default:
                return null;
        }
    }

    public static String x(String str) {
        if (!str.equals("none") && str.startsWith("url(")) {
            if (str.endsWith(")")) {
                return str.substring(4, str.length() - 1).trim();
            }
            return str.substring(4).trim();
        }
        return null;
    }

    public static SVG.n y(String str) throws SVGParseException {
        if (str.length() != 0) {
            int length = str.length();
            SVG.Unit unit = SVG.Unit.px;
            char charAt = str.charAt(length - 1);
            if (charAt == '%') {
                length--;
                unit = SVG.Unit.percent;
            } else if (length > 2 && Character.isLetter(charAt) && Character.isLetter(str.charAt(length - 2))) {
                length -= 2;
                try {
                    unit = SVG.Unit.valueOf(str.substring(length).toLowerCase(Locale.US));
                } catch (IllegalArgumentException unused) {
                    throw new SVGParseException(i.a.b.a.a.r("Invalid length unit specifier: ", str));
                }
            }
            try {
                return new SVG.n(u(str, 0, length), unit);
            } catch (NumberFormatException e2) {
                throw new SVGParseException(i.a.b.a.a.r("Invalid length value: ", str), e2);
            }
        }
        throw new SVGParseException("Invalid length value (empty string)");
    }

    public static List<SVG.n> z(String str) throws SVGParseException {
        if (str.length() != 0) {
            ArrayList arrayList = new ArrayList(1);
            g gVar = new g(str);
            gVar.r();
            while (!gVar.f()) {
                float i2 = gVar.i();
                if (Float.isNaN(i2)) {
                    StringBuilder J = i.a.b.a.a.J("Invalid length list value: ");
                    int i3 = gVar.b;
                    while (!gVar.f() && !gVar.g(gVar.a.charAt(gVar.b))) {
                        gVar.b++;
                    }
                    String substring = gVar.a.substring(i3, gVar.b);
                    gVar.b = i3;
                    J.append(substring);
                    throw new SVGParseException(J.toString());
                }
                SVG.Unit o2 = gVar.o();
                if (o2 == null) {
                    o2 = SVG.Unit.px;
                }
                arrayList.add(new SVG.n(i2, o2));
                gVar.q();
            }
            return arrayList;
        }
        throw new SVGParseException("Invalid length list (empty string)");
    }

    public final Map<String, String> E(g gVar) {
        HashMap hashMap = new HashMap();
        gVar.r();
        String m2 = gVar.m('=');
        while (m2 != null) {
            gVar.d('=');
            hashMap.put(m2, gVar.k());
            gVar.r();
            m2 = gVar.m('=');
        }
        return hashMap;
    }

    public final Matrix F(String str) throws SVGParseException {
        Matrix matrix = new Matrix();
        g gVar = new g(str);
        gVar.r();
        while (!gVar.f()) {
            String str2 = null;
            if (!gVar.f()) {
                int i2 = gVar.b;
                int charAt = gVar.a.charAt(i2);
                while (true) {
                    if ((charAt >= 97 && charAt <= 122) || (charAt >= 65 && charAt <= 90)) {
                        charAt = gVar.a();
                    }
                }
                int i3 = gVar.b;
                while (gVar.g(charAt)) {
                    charAt = gVar.a();
                }
                if (charAt == 40) {
                    gVar.b++;
                    str2 = gVar.a.substring(i2, i3);
                } else {
                    gVar.b = i2;
                }
            }
            if (str2 != null) {
                char c2 = 65535;
                switch (str2.hashCode()) {
                    case -1081239615:
                        if (str2.equals("matrix")) {
                            c2 = 0;
                            break;
                        }
                        break;
                    case -925180581:
                        if (str2.equals("rotate")) {
                            c2 = 1;
                            break;
                        }
                        break;
                    case 109250890:
                        if (str2.equals("scale")) {
                            c2 = 2;
                            break;
                        }
                        break;
                    case 109493390:
                        if (str2.equals("skewX")) {
                            c2 = 3;
                            break;
                        }
                        break;
                    case 109493391:
                        if (str2.equals("skewY")) {
                            c2 = 4;
                            break;
                        }
                        break;
                    case 1052832078:
                        if (str2.equals("translate")) {
                            c2 = 5;
                            break;
                        }
                        break;
                }
                switch (c2) {
                    case 0:
                        gVar.r();
                        float i4 = gVar.i();
                        gVar.q();
                        float i5 = gVar.i();
                        gVar.q();
                        float i6 = gVar.i();
                        gVar.q();
                        float i7 = gVar.i();
                        gVar.q();
                        float i8 = gVar.i();
                        gVar.q();
                        float i9 = gVar.i();
                        gVar.r();
                        if (!Float.isNaN(i9) && gVar.d(')')) {
                            Matrix matrix2 = new Matrix();
                            matrix2.setValues(new float[]{i4, i6, i8, i5, i7, i9, 0.0f, 0.0f, 1.0f});
                            matrix.preConcat(matrix2);
                            break;
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                    case 1:
                        gVar.r();
                        float i10 = gVar.i();
                        float p2 = gVar.p();
                        float p3 = gVar.p();
                        gVar.r();
                        if (!Float.isNaN(i10) && gVar.d(')')) {
                            if (Float.isNaN(p2)) {
                                matrix.preRotate(i10);
                                break;
                            } else if (!Float.isNaN(p3)) {
                                matrix.preRotate(i10, p2, p3);
                                break;
                            } else {
                                throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                            }
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                    case 2:
                        gVar.r();
                        float i11 = gVar.i();
                        float p4 = gVar.p();
                        gVar.r();
                        if (!Float.isNaN(i11) && gVar.d(')')) {
                            if (Float.isNaN(p4)) {
                                matrix.preScale(i11, i11);
                                break;
                            } else {
                                matrix.preScale(i11, p4);
                                break;
                            }
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                        break;
                    case 3:
                        gVar.r();
                        float i12 = gVar.i();
                        gVar.r();
                        if (!Float.isNaN(i12) && gVar.d(')')) {
                            matrix.preSkew((float) Math.tan(Math.toRadians(i12)), 0.0f);
                            break;
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                        break;
                    case 4:
                        gVar.r();
                        float i13 = gVar.i();
                        gVar.r();
                        if (!Float.isNaN(i13) && gVar.d(')')) {
                            matrix.preSkew(0.0f, (float) Math.tan(Math.toRadians(i13)));
                            break;
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                        break;
                    case 5:
                        gVar.r();
                        float i14 = gVar.i();
                        float p5 = gVar.p();
                        gVar.r();
                        if (!Float.isNaN(i14) && gVar.d(')')) {
                            if (Float.isNaN(p5)) {
                                matrix.preTranslate(i14, 0.0f);
                                break;
                            } else {
                                matrix.preTranslate(i14, p5);
                                break;
                            }
                        } else {
                            throw new SVGParseException(i.a.b.a.a.r("Invalid transform list: ", str));
                        }
                        break;
                    default:
                        throw new SVGParseException(i.a.b.a.a.s("Invalid transform list fn: ", str2, ")"));
                }
                if (gVar.f()) {
                    return matrix;
                }
                gVar.q();
            } else {
                throw new SVGParseException(i.a.b.a.a.r("Bad transform function encountered in transform list: ", str));
            }
        }
        return matrix;
    }

    public final void G(InputStream inputStream) throws SVGParseException {
        Log.d("SVGParser", "Falling back to SAX parser");
        try {
            SAXParserFactory newInstance = SAXParserFactory.newInstance();
            newInstance.setFeature("http://xml.org/sax/features/external-general-entities", false);
            newInstance.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            XMLReader xMLReader = newInstance.newSAXParser().getXMLReader();
            f fVar = new f(null);
            xMLReader.setContentHandler(fVar);
            xMLReader.setProperty("http://xml.org/sax/properties/lexical-handler", fVar);
            xMLReader.parse(new InputSource(inputStream));
        } catch (IOException e2) {
            throw new SVGParseException("Stream error", e2);
        } catch (ParserConfigurationException e3) {
            throw new SVGParseException("XML parser problem", e3);
        } catch (SAXException e4) {
            throw new SVGParseException("SVG parse error", e4);
        }
    }

    public final void H(InputStream inputStream, boolean z) throws SVGParseException {
        try {
            try {
                XmlPullParser newPullParser = Xml.newPullParser();
                h hVar = new h(this, newPullParser);
                newPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-docdecl", false);
                newPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces", true);
                newPullParser.setInput(inputStream, null);
                for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.nextToken()) {
                    if (eventType == 0) {
                        this.a = new SVG();
                    } else if (eventType == 8) {
                        Log.d("SVGParser", "PROC INSTR: " + newPullParser.getText());
                        g gVar = new g(newPullParser.getText());
                        String l2 = gVar.l();
                        E(gVar);
                        l2.equals("xml-stylesheet");
                    } else if (eventType != 10) {
                        if (eventType == 2) {
                            String name = newPullParser.getName();
                            if (newPullParser.getPrefix() != null) {
                                name = newPullParser.getPrefix() + ':' + name;
                            }
                            K(newPullParser.getNamespace(), newPullParser.getName(), name, hVar);
                        } else if (eventType == 3) {
                            String name2 = newPullParser.getName();
                            if (newPullParser.getPrefix() != null) {
                                name2 = newPullParser.getPrefix() + ':' + name2;
                            }
                            c(newPullParser.getNamespace(), newPullParser.getName(), name2);
                        } else if (eventType == 4) {
                            int[] iArr = new int[2];
                            N(newPullParser.getTextCharacters(iArr), iArr[0], iArr[1]);
                        } else if (eventType == 5) {
                            M(newPullParser.getText());
                        }
                    } else if (z && this.a.a == null && newPullParser.getText().contains("<!ENTITY ")) {
                        try {
                            Log.d("SVGParser", "Switching to SAX parser to process entities");
                            inputStream.reset();
                            G(inputStream);
                            return;
                        } catch (IOException unused) {
                            Log.w("SVGParser", "Detected internal entity definitions, but could not parse them.");
                            return;
                        }
                    }
                }
            } catch (IOException e2) {
                throw new SVGParseException("Stream error", e2);
            }
        } catch (XmlPullParserException e3) {
            throw new SVGParseException("XML parser problem", e3);
        }
    }

    public final void I(Attributes attributes) throws SVGParseException {
        if (this.b != null) {
            SVG.w wVar = new SVG.w();
            wVar.a = this.a;
            wVar.b = this.b;
            j(wVar, attributes);
            m(wVar, attributes);
            i(wVar, attributes);
            p(wVar, attributes);
            for (int i2 = 0; i2 < attributes.getLength(); i2++) {
                String trim = attributes.getValue(i2).trim();
                int T = i.a.b.a.a.T(attributes, i2);
                if (T == 25) {
                    SVG.n y = y(trim);
                    wVar.f2248v = y;
                    if (y.i()) {
                        throw new SVGParseException("Invalid <pattern> element. height cannot be negative");
                    }
                } else if (T != 26) {
                    switch (T) {
                        case 44:
                            if ("objectBoundingBox".equals(trim)) {
                                wVar.f2243q = Boolean.FALSE;
                                continue;
                            } else if ("userSpaceOnUse".equals(trim)) {
                                wVar.f2243q = Boolean.TRUE;
                                break;
                            } else {
                                throw new SVGParseException("Invalid value for attribute patternContentUnits");
                            }
                        case 45:
                            wVar.f2244r = F(trim);
                            continue;
                        case 46:
                            if ("objectBoundingBox".equals(trim)) {
                                wVar.f2242p = Boolean.FALSE;
                                continue;
                            } else if ("userSpaceOnUse".equals(trim)) {
                                wVar.f2242p = Boolean.TRUE;
                                break;
                            } else {
                                throw new SVGParseException("Invalid value for attribute patternUnits");
                            }
                        default:
                            switch (T) {
                                case 81:
                                    SVG.n y2 = y(trim);
                                    wVar.f2247u = y2;
                                    if (y2.i()) {
                                        throw new SVGParseException("Invalid <pattern> element. width cannot be negative");
                                    }
                                    continue;
                                case 82:
                                    wVar.f2245s = y(trim);
                                    continue;
                                case 83:
                                    wVar.f2246t = y(trim);
                                    continue;
                                    continue;
                            }
                    }
                } else if ("".equals(attributes.getURI(i2)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i2))) {
                    wVar.f2249w = trim;
                }
            }
            this.b.c(wVar);
            this.b = wVar;
            return;
        }
        throw new SVGParseException("Invalid document. Root element must be <svg>");
    }

    public final void K(String str, String str2, String str3, Attributes attributes) throws SVGParseException {
        int intValue;
        float i2;
        float c2;
        float f2;
        float f3;
        float f4;
        float f5;
        float f6;
        char charAt;
        boolean z;
        SVGParser sVGParser = this;
        Attributes attributes2 = attributes;
        if (sVGParser.c) {
            sVGParser.f2267d++;
        } else if ("http://www.w3.org/2000/svg".equals(str) || "".equals(str)) {
            SVGElem fromString = SVGElem.fromString(str2.length() > 0 ? str2 : str3);
            float f7 = 0.0f;
            int i3 = 0;
            switch (fromString.ordinal()) {
                case 0:
                    SVG.c0 c0Var = new SVG.c0();
                    c0Var.a = sVGParser.a;
                    c0Var.b = sVGParser.b;
                    sVGParser.j(c0Var, attributes2);
                    sVGParser.m(c0Var, attributes2);
                    sVGParser.i(c0Var, attributes2);
                    sVGParser.p(c0Var, attributes2);
                    for (int i4 = 0; i4 < attributes.getLength(); i4++) {
                        String trim = attributes2.getValue(i4).trim();
                        int T = i.a.b.a.a.T(attributes2, i4);
                        if (T == 25) {
                            SVG.n y = y(trim);
                            c0Var.f2168s = y;
                            if (y.i()) {
                                throw new SVGParseException("Invalid <svg> element. height cannot be negative");
                            }
                        } else if (T != 79) {
                            switch (T) {
                                case 81:
                                    SVG.n y2 = y(trim);
                                    c0Var.f2167r = y2;
                                    if (y2.i()) {
                                        throw new SVGParseException("Invalid <svg> element. width cannot be negative");
                                    }
                                    continue;
                                case 82:
                                    c0Var.f2165p = y(trim);
                                    continue;
                                case 83:
                                    c0Var.f2166q = y(trim);
                                    continue;
                            }
                        } else {
                            continue;
                        }
                    }
                    SVG.g0 g0Var = sVGParser.b;
                    if (g0Var == null) {
                        sVGParser.a.a = c0Var;
                    } else {
                        g0Var.c(c0Var);
                    }
                    sVGParser.b = c0Var;
                    return;
                case 1:
                case 7:
                    if (sVGParser.b != null) {
                        SVG.k kVar = new SVG.k();
                        kVar.a = sVGParser.a;
                        kVar.b = sVGParser.b;
                        sVGParser.j(kVar, attributes2);
                        sVGParser.m(kVar, attributes2);
                        sVGParser.o(kVar, attributes2);
                        sVGParser.i(kVar, attributes2);
                        sVGParser.b.c(kVar);
                        sVGParser.b = kVar;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 2:
                    SVG.g0 g0Var2 = sVGParser.b;
                    if (g0Var2 != null) {
                        SVG.c cVar = new SVG.c();
                        cVar.a = sVGParser.a;
                        cVar.b = g0Var2;
                        sVGParser.j(cVar, attributes2);
                        sVGParser.m(cVar, attributes2);
                        sVGParser.o(cVar, attributes2);
                        sVGParser.i(cVar, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim2 = attributes2.getValue(i3).trim();
                            int T2 = i.a.b.a.a.T(attributes2, i3);
                            if (T2 == 6) {
                                cVar.f2162o = y(trim2);
                            } else if (T2 == 7) {
                                cVar.f2163p = y(trim2);
                            } else if (T2 != 49) {
                                continue;
                            } else {
                                SVG.n y3 = y(trim2);
                                cVar.f2164q = y3;
                                if (y3.i()) {
                                    throw new SVGParseException("Invalid <circle> element. r cannot be negative");
                                }
                            }
                            i3++;
                        }
                        sVGParser.b.c(cVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 3:
                    if (sVGParser.b != null) {
                        SVG.d dVar = new SVG.d();
                        dVar.a = sVGParser.a;
                        dVar.b = sVGParser.b;
                        sVGParser.j(dVar, attributes2);
                        sVGParser.m(dVar, attributes2);
                        sVGParser.o(dVar, attributes2);
                        sVGParser.i(dVar, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim3 = attributes2.getValue(i3).trim();
                            if (i.a.b.a.a.T(attributes2, i3) == 3) {
                                if ("objectBoundingBox".equals(trim3)) {
                                    dVar.f2169o = Boolean.FALSE;
                                } else if ("userSpaceOnUse".equals(trim3)) {
                                    dVar.f2169o = Boolean.TRUE;
                                } else {
                                    throw new SVGParseException("Invalid value for attribute clipPathUnits");
                                }
                            }
                            i3++;
                        }
                        sVGParser.b.c(dVar);
                        sVGParser.b = dVar;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 4:
                    if (sVGParser.b != null) {
                        SVG.g gVar = new SVG.g();
                        gVar.a = sVGParser.a;
                        gVar.b = sVGParser.b;
                        sVGParser.j(gVar, attributes2);
                        sVGParser.m(gVar, attributes2);
                        sVGParser.o(gVar, attributes2);
                        sVGParser.b.c(gVar);
                        sVGParser.b = gVar;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 5:
                case 26:
                    sVGParser.f2268e = true;
                    sVGParser.f2269f = fromString;
                    return;
                case 6:
                    SVG.g0 g0Var3 = sVGParser.b;
                    if (g0Var3 != null) {
                        SVG.h hVar = new SVG.h();
                        hVar.a = sVGParser.a;
                        hVar.b = g0Var3;
                        sVGParser.j(hVar, attributes2);
                        sVGParser.m(hVar, attributes2);
                        sVGParser.o(hVar, attributes2);
                        sVGParser.i(hVar, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim4 = attributes2.getValue(i3).trim();
                            int T3 = i.a.b.a.a.T(attributes2, i3);
                            if (T3 == 6) {
                                hVar.f2184o = y(trim4);
                            } else if (T3 == 7) {
                                hVar.f2185p = y(trim4);
                            } else if (T3 == 56) {
                                SVG.n y4 = y(trim4);
                                hVar.f2186q = y4;
                                if (y4.i()) {
                                    throw new SVGParseException("Invalid <ellipse> element. rx cannot be negative");
                                }
                            } else if (T3 != 57) {
                                continue;
                            } else {
                                SVG.n y5 = y(trim4);
                                hVar.f2187r = y5;
                                if (y5.i()) {
                                    throw new SVGParseException("Invalid <ellipse> element. ry cannot be negative");
                                }
                            }
                            i3++;
                        }
                        sVGParser.b.c(hVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 8:
                    sVGParser.f(attributes2);
                    return;
                case 9:
                    SVG.g0 g0Var4 = sVGParser.b;
                    if (g0Var4 != null) {
                        SVG.o oVar = new SVG.o();
                        oVar.a = sVGParser.a;
                        oVar.b = g0Var4;
                        sVGParser.j(oVar, attributes2);
                        sVGParser.m(oVar, attributes2);
                        sVGParser.o(oVar, attributes2);
                        sVGParser.i(oVar, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim5 = attributes2.getValue(i3).trim();
                            switch (i.a.b.a.a.T(attributes2, i3)) {
                                case 84:
                                    oVar.f2218o = y(trim5);
                                    break;
                                case 85:
                                    oVar.f2219p = y(trim5);
                                    break;
                                case 86:
                                    oVar.f2220q = y(trim5);
                                    break;
                                case 87:
                                    oVar.f2221r = y(trim5);
                                    break;
                            }
                            i3++;
                        }
                        sVGParser.b.c(oVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 10:
                    if (sVGParser.b != null) {
                        SVG.j0 j0Var = new SVG.j0();
                        j0Var.a = sVGParser.a;
                        j0Var.b = sVGParser.b;
                        sVGParser.j(j0Var, attributes2);
                        sVGParser.m(j0Var, attributes2);
                        sVGParser.k(j0Var, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim6 = attributes2.getValue(i3).trim();
                            switch (i.a.b.a.a.T(attributes2, i3)) {
                                case 84:
                                    j0Var.f2199m = y(trim6);
                                    break;
                                case 85:
                                    j0Var.f2200n = y(trim6);
                                    break;
                                case 86:
                                    j0Var.f2201o = y(trim6);
                                    break;
                                case 87:
                                    j0Var.f2202p = y(trim6);
                                    break;
                            }
                            i3++;
                        }
                        sVGParser.b.c(j0Var);
                        sVGParser.b = j0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 11:
                    if (sVGParser.b != null) {
                        SVG.p pVar = new SVG.p();
                        pVar.a = sVGParser.a;
                        pVar.b = sVGParser.b;
                        sVGParser.j(pVar, attributes2);
                        sVGParser.m(pVar, attributes2);
                        sVGParser.i(pVar, attributes2);
                        sVGParser.p(pVar, attributes2);
                        for (int i5 = 0; i5 < attributes.getLength(); i5++) {
                            String trim7 = attributes2.getValue(i5).trim();
                            int T4 = i.a.b.a.a.T(attributes2, i5);
                            if (T4 != 41) {
                                if (T4 == 50) {
                                    pVar.f2224q = y(trim7);
                                } else if (T4 != 51) {
                                    switch (T4) {
                                        case 32:
                                            SVG.n y6 = y(trim7);
                                            pVar.f2227t = y6;
                                            if (y6.i()) {
                                                throw new SVGParseException("Invalid <marker> element. markerHeight cannot be negative");
                                            }
                                            break;
                                        case 33:
                                            if ("strokeWidth".equals(trim7)) {
                                                pVar.f2223p = false;
                                                break;
                                            } else if ("userSpaceOnUse".equals(trim7)) {
                                                pVar.f2223p = true;
                                                break;
                                            } else {
                                                throw new SVGParseException("Invalid value for attribute markerUnits");
                                            }
                                        case 34:
                                            SVG.n y7 = y(trim7);
                                            pVar.f2226s = y7;
                                            if (y7.i()) {
                                                throw new SVGParseException("Invalid <marker> element. markerWidth cannot be negative");
                                            }
                                            break;
                                    }
                                } else {
                                    pVar.f2225r = y(trim7);
                                }
                            } else if ("auto".equals(trim7)) {
                                pVar.f2228u = Float.valueOf(Float.NaN);
                            } else {
                                pVar.f2228u = Float.valueOf(t(trim7));
                            }
                        }
                        sVGParser.b.c(pVar);
                        sVGParser.b = pVar;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 12:
                    sVGParser.g(attributes2);
                    return;
                case 13:
                    SVG.g0 g0Var5 = sVGParser.b;
                    if (g0Var5 != null) {
                        SVG.t tVar = new SVG.t();
                        tVar.a = sVGParser.a;
                        tVar.b = g0Var5;
                        sVGParser.j(tVar, attributes2);
                        sVGParser.m(tVar, attributes2);
                        sVGParser.o(tVar, attributes2);
                        sVGParser.i(tVar, attributes2);
                        int i6 = 0;
                        while (i6 < attributes.getLength()) {
                            String trim8 = attributes2.getValue(i6).trim();
                            int T5 = i.a.b.a.a.T(attributes2, i6);
                            if (T5 == 13) {
                                g gVar2 = new g(trim8);
                                SVG.u uVar = new SVG.u();
                                if (!gVar2.f() && ((intValue = gVar2.h().intValue()) == 77 || intValue == 109)) {
                                    float f8 = 0.0f;
                                    float f9 = 0.0f;
                                    float f10 = 0.0f;
                                    float f11 = 0.0f;
                                    int i7 = intValue;
                                    float f12 = 0.0f;
                                    float f13 = 0.0f;
                                    while (true) {
                                        gVar2.r();
                                        switch (i7) {
                                            case 65:
                                            case 97:
                                                float i8 = gVar2.i();
                                                float c3 = gVar2.c(i8);
                                                float c4 = gVar2.c(c3);
                                                Boolean b2 = gVar2.b(Float.valueOf(c4));
                                                Boolean b3 = gVar2.b(b2);
                                                if (b3 == null) {
                                                    i2 = Float.NaN;
                                                } else {
                                                    gVar2.q();
                                                    i2 = gVar2.i();
                                                }
                                                float c5 = gVar2.c(i2);
                                                if (!Float.isNaN(c5) && i8 >= 0.0f && c3 >= 0.0f) {
                                                    if (i7 == 97) {
                                                        i2 += f8;
                                                        c5 += f10;
                                                    }
                                                    uVar.d(i8, c3, c4, b2.booleanValue(), b3.booleanValue(), i2, c5);
                                                    f8 = i2;
                                                    f9 = f8;
                                                    f10 = c5;
                                                    f11 = f10;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                        break;
                                                    } else {
                                                        int i9 = gVar2.b;
                                                        if (i9 != gVar2.c && (((charAt = gVar2.a.charAt(i9)) >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z'))) {
                                                            i7 = gVar2.h().intValue();
                                                        }
                                                    }
                                                }
                                                break;
                                            case 67:
                                            case 99:
                                                float i10 = gVar2.i();
                                                float c6 = gVar2.c(i10);
                                                float c7 = gVar2.c(c6);
                                                float c8 = gVar2.c(c7);
                                                float c9 = gVar2.c(c8);
                                                c2 = gVar2.c(c9);
                                                if (Float.isNaN(c2)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 99) {
                                                        c9 += f8;
                                                        c2 += f10;
                                                        i10 += f8;
                                                        c6 += f10;
                                                        c7 += f8;
                                                        c8 += f10;
                                                    }
                                                    float f14 = i10;
                                                    f2 = c7;
                                                    float f15 = c8;
                                                    uVar.c(f14, c6, f2, f15, c9, c2);
                                                    f3 = f15;
                                                    f4 = c9;
                                                    f6 = c2;
                                                    f5 = f2;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 72:
                                            case 104:
                                                float i11 = gVar2.i();
                                                if (Float.isNaN(i11)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 104) {
                                                        i11 += f8;
                                                    }
                                                    uVar.e(i11, f10);
                                                    f5 = i11;
                                                    f3 = f11;
                                                    f4 = f5;
                                                    f6 = f10;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 76:
                                            case 108:
                                                float i12 = gVar2.i();
                                                f3 = gVar2.c(i12);
                                                if (Float.isNaN(f3)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 108) {
                                                        i12 += f8;
                                                        f3 += f10;
                                                    }
                                                    f8 = i12;
                                                    uVar.e(f8, f3);
                                                    f9 = f8;
                                                    f6 = f3;
                                                    f5 = f9;
                                                    f4 = f8;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 77:
                                            case 109:
                                                float i13 = gVar2.i();
                                                float c10 = gVar2.c(i13);
                                                if (Float.isNaN(c10)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 109) {
                                                        if (!(uVar.b == 0)) {
                                                            i13 += f8;
                                                            c10 += f10;
                                                        }
                                                    }
                                                    f10 = c10;
                                                    uVar.b(i13, f10);
                                                    i7 = i7 == 109 ? 108 : 76;
                                                    f5 = i13;
                                                    f12 = f5;
                                                    f11 = f10;
                                                    f13 = f11;
                                                    f3 = f11;
                                                    f4 = f5;
                                                    f6 = f10;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 81:
                                            case 113:
                                                float i14 = gVar2.i();
                                                f3 = gVar2.c(i14);
                                                f4 = gVar2.c(f3);
                                                f6 = gVar2.c(f4);
                                                if (Float.isNaN(f6)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 113) {
                                                        f4 += f8;
                                                        f6 += f10;
                                                        i14 += f8;
                                                        f3 += f10;
                                                    }
                                                    f5 = i14;
                                                    uVar.a(f5, f3, f4, f6);
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 83:
                                            case 115:
                                                float f16 = (f8 * 2.0f) - f9;
                                                float f17 = (2.0f * f10) - f11;
                                                float i15 = gVar2.i();
                                                float c11 = gVar2.c(i15);
                                                float c12 = gVar2.c(c11);
                                                c2 = gVar2.c(c12);
                                                if (Float.isNaN(c2)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 115) {
                                                        c12 += f8;
                                                        c2 += f10;
                                                        i15 += f8;
                                                        c11 += f10;
                                                    }
                                                    f2 = i15;
                                                    uVar.c(f16, f17, f2, c11, c12, c2);
                                                    f4 = c12;
                                                    f3 = c11;
                                                    f6 = c2;
                                                    f5 = f2;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 84:
                                            case 116:
                                                f5 = (f8 * 2.0f) - f9;
                                                f3 = (2.0f * f10) - f11;
                                                f4 = gVar2.i();
                                                f6 = gVar2.c(f4);
                                                if (Float.isNaN(f6)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 116) {
                                                        f4 += f8;
                                                        f6 += f10;
                                                    }
                                                    uVar.a(f5, f3, f4, f6);
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 86:
                                            case 118:
                                                f3 = gVar2.i();
                                                if (Float.isNaN(f3)) {
                                                    i.a.b.a.a.l0(i.a.b.a.a.J("Bad path coords for "), (char) i7, " path segment", "SVGParser");
                                                    break;
                                                } else {
                                                    if (i7 == 118) {
                                                        f3 += f10;
                                                    }
                                                    uVar.e(f8, f3);
                                                    f6 = f3;
                                                    f5 = f9;
                                                    f4 = f8;
                                                    f8 = f4;
                                                    f10 = f6;
                                                    f9 = f5;
                                                    f11 = f3;
                                                    gVar2.q();
                                                    if (!gVar2.f()) {
                                                    }
                                                }
                                                break;
                                            case 90:
                                            case 122:
                                                uVar.f((byte) 8);
                                                f8 = f12;
                                                f9 = f8;
                                                f3 = f13;
                                                f6 = f3;
                                                f5 = f9;
                                                f4 = f8;
                                                f8 = f4;
                                                f10 = f6;
                                                f9 = f5;
                                                f11 = f3;
                                                gVar2.q();
                                                if (!gVar2.f()) {
                                                }
                                                break;
                                        }
                                    }
                                }
                                tVar.f2238o = uVar;
                            } else if (T5 == 43) {
                                Float valueOf = Float.valueOf(t(trim8));
                                tVar.f2239p = valueOf;
                                if (valueOf.floatValue() < f7) {
                                    throw new SVGParseException("Invalid <path> element. pathLength cannot be negative");
                                }
                            }
                            i6++;
                            f7 = 0.0f;
                            sVGParser = this;
                            attributes2 = attributes;
                        }
                        sVGParser.b.c(tVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 14:
                    sVGParser.I(attributes2);
                    return;
                case 15:
                    SVG.g0 g0Var6 = sVGParser.b;
                    if (g0Var6 != null) {
                        SVG.y yVar = new SVG.y();
                        yVar.a = sVGParser.a;
                        yVar.b = g0Var6;
                        sVGParser.j(yVar, attributes2);
                        sVGParser.m(yVar, attributes2);
                        sVGParser.o(yVar, attributes2);
                        sVGParser.i(yVar, attributes2);
                        sVGParser.l(yVar, attributes2, "polygon");
                        sVGParser.b.c(yVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 16:
                    SVG.g0 g0Var7 = sVGParser.b;
                    if (g0Var7 != null) {
                        SVG.x xVar = new SVG.x();
                        xVar.a = sVGParser.a;
                        xVar.b = g0Var7;
                        sVGParser.j(xVar, attributes2);
                        sVGParser.m(xVar, attributes2);
                        sVGParser.o(xVar, attributes2);
                        sVGParser.i(xVar, attributes2);
                        sVGParser.l(xVar, attributes2, "polyline");
                        sVGParser.b.c(xVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 17:
                    if (sVGParser.b != null) {
                        SVG.n0 n0Var = new SVG.n0();
                        n0Var.a = sVGParser.a;
                        n0Var.b = sVGParser.b;
                        sVGParser.j(n0Var, attributes2);
                        sVGParser.m(n0Var, attributes2);
                        sVGParser.k(n0Var, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim9 = attributes2.getValue(i3).trim();
                            int T6 = i.a.b.a.a.T(attributes2, i3);
                            if (T6 == 6) {
                                n0Var.f2213m = y(trim9);
                            } else if (T6 == 7) {
                                n0Var.f2214n = y(trim9);
                            } else if (T6 == 11) {
                                n0Var.f2216p = y(trim9);
                            } else if (T6 == 12) {
                                n0Var.f2217q = y(trim9);
                            } else if (T6 != 49) {
                                continue;
                            } else {
                                SVG.n y8 = y(trim9);
                                n0Var.f2215o = y8;
                                if (y8.i()) {
                                    throw new SVGParseException("Invalid <radialGradient> element. r cannot be negative");
                                }
                            }
                            i3++;
                        }
                        sVGParser.b.c(n0Var);
                        sVGParser.b = n0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 18:
                    SVG.g0 g0Var8 = sVGParser.b;
                    if (g0Var8 != null) {
                        SVG.z zVar = new SVG.z();
                        zVar.a = sVGParser.a;
                        zVar.b = g0Var8;
                        sVGParser.j(zVar, attributes2);
                        sVGParser.m(zVar, attributes2);
                        sVGParser.o(zVar, attributes2);
                        sVGParser.i(zVar, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim10 = attributes2.getValue(i3).trim();
                            int T7 = i.a.b.a.a.T(attributes2, i3);
                            if (T7 == 25) {
                                SVG.n y9 = y(trim10);
                                zVar.f2261r = y9;
                                if (y9.i()) {
                                    throw new SVGParseException("Invalid <rect> element. height cannot be negative");
                                }
                            } else if (T7 == 56) {
                                SVG.n y10 = y(trim10);
                                zVar.f2262s = y10;
                                if (y10.i()) {
                                    throw new SVGParseException("Invalid <rect> element. rx cannot be negative");
                                }
                            } else if (T7 != 57) {
                                switch (T7) {
                                    case 81:
                                        SVG.n y11 = y(trim10);
                                        zVar.f2260q = y11;
                                        if (y11.i()) {
                                            throw new SVGParseException("Invalid <rect> element. width cannot be negative");
                                        }
                                        continue;
                                    case 82:
                                        zVar.f2258o = y(trim10);
                                        continue;
                                    case 83:
                                        zVar.f2259p = y(trim10);
                                        continue;
                                }
                            } else {
                                SVG.n y12 = y(trim10);
                                zVar.f2263t = y12;
                                if (y12.i()) {
                                    throw new SVGParseException("Invalid <rect> element. ry cannot be negative");
                                }
                            }
                            i3++;
                        }
                        sVGParser.b.c(zVar);
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 19:
                    SVG.g0 g0Var9 = sVGParser.b;
                    if (g0Var9 != null) {
                        SVG.a0 a0Var = new SVG.a0();
                        a0Var.a = sVGParser.a;
                        a0Var.b = g0Var9;
                        sVGParser.j(a0Var, attributes2);
                        sVGParser.m(a0Var, attributes2);
                        sVGParser.b.c(a0Var);
                        sVGParser.b = a0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 20:
                    SVG.g0 g0Var10 = sVGParser.b;
                    if (g0Var10 != null) {
                        if (g0Var10 instanceof SVG.i) {
                            SVG.b0 b0Var = new SVG.b0();
                            b0Var.a = sVGParser.a;
                            b0Var.b = g0Var10;
                            sVGParser.j(b0Var, attributes2);
                            sVGParser.m(b0Var, attributes2);
                            for (int i16 = 0; i16 < attributes.getLength(); i16++) {
                                String trim11 = attributes2.getValue(i16).trim();
                                if (i.a.b.a.a.T(attributes2, i16) == 39) {
                                    if (trim11.length() != 0) {
                                        int length = trim11.length();
                                        if (trim11.charAt(trim11.length() - 1) == '%') {
                                            length--;
                                            z = true;
                                        } else {
                                            z = false;
                                        }
                                        try {
                                            float u2 = u(trim11, 0, length);
                                            float f18 = 100.0f;
                                            if (z) {
                                                u2 /= 100.0f;
                                            }
                                            if (u2 < 0.0f) {
                                                f18 = 0.0f;
                                            } else if (u2 <= 100.0f) {
                                                f18 = u2;
                                            }
                                            b0Var.f2161h = Float.valueOf(f18);
                                        } catch (NumberFormatException e2) {
                                            throw new SVGParseException(i.a.b.a.a.r("Invalid offset value in <stop>: ", trim11), e2);
                                        }
                                    } else {
                                        throw new SVGParseException("Invalid offset value in <stop> (empty string)");
                                    }
                                }
                            }
                            sVGParser.b.c(b0Var);
                            sVGParser.b = b0Var;
                            return;
                        }
                        throw new SVGParseException("Invalid document. <stop> elements are only valid inside <linearGradient> or <radialGradient> elements.");
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 21:
                    sVGParser.L(attributes2);
                    return;
                case 22:
                    if (sVGParser.b != null) {
                        SVG.p0 p0Var = new SVG.p0();
                        p0Var.a = sVGParser.a;
                        p0Var.b = sVGParser.b;
                        sVGParser.j(p0Var, attributes2);
                        sVGParser.m(p0Var, attributes2);
                        sVGParser.o(p0Var, attributes2);
                        sVGParser.i(p0Var, attributes2);
                        sVGParser.b.c(p0Var);
                        sVGParser.b = p0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 23:
                    if (sVGParser.b != null) {
                        SVG.q0 q0Var = new SVG.q0();
                        q0Var.a = sVGParser.a;
                        q0Var.b = sVGParser.b;
                        sVGParser.j(q0Var, attributes2);
                        sVGParser.m(q0Var, attributes2);
                        sVGParser.i(q0Var, attributes2);
                        sVGParser.p(q0Var, attributes2);
                        sVGParser.b.c(q0Var);
                        sVGParser.b = q0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 24:
                    if (sVGParser.b != null) {
                        SVG.t0 t0Var = new SVG.t0();
                        t0Var.a = sVGParser.a;
                        t0Var.b = sVGParser.b;
                        sVGParser.j(t0Var, attributes2);
                        sVGParser.m(t0Var, attributes2);
                        sVGParser.o(t0Var, attributes2);
                        sVGParser.i(t0Var, attributes2);
                        sVGParser.n(t0Var, attributes2);
                        sVGParser.b.c(t0Var);
                        sVGParser.b = t0Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 25:
                    if (sVGParser.b != null) {
                        SVG.w0 w0Var = new SVG.w0();
                        w0Var.a = sVGParser.a;
                        w0Var.b = sVGParser.b;
                        sVGParser.j(w0Var, attributes2);
                        sVGParser.m(w0Var, attributes2);
                        sVGParser.i(w0Var, attributes2);
                        while (i3 < attributes.getLength()) {
                            String trim12 = attributes2.getValue(i3).trim();
                            int T8 = i.a.b.a.a.T(attributes2, i3);
                            if (T8 != 26) {
                                if (T8 == 61) {
                                    w0Var.f2251o = y(trim12);
                                }
                            } else if ("".equals(attributes2.getURI(i3)) || "http://www.w3.org/1999/xlink".equals(attributes2.getURI(i3))) {
                                w0Var.f2250n = trim12;
                            }
                            i3++;
                        }
                        sVGParser.b.c(w0Var);
                        sVGParser.b = w0Var;
                        SVG.g0 g0Var11 = w0Var.b;
                        if (g0Var11 instanceof SVG.y0) {
                            w0Var.f2252p = (SVG.y0) g0Var11;
                            return;
                        } else {
                            w0Var.f2252p = ((SVG.u0) g0Var11).g();
                            return;
                        }
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 27:
                    SVG.g0 g0Var12 = sVGParser.b;
                    if (g0Var12 != null) {
                        if (g0Var12 instanceof SVG.v0) {
                            SVG.r0 r0Var = new SVG.r0();
                            r0Var.a = sVGParser.a;
                            r0Var.b = sVGParser.b;
                            sVGParser.j(r0Var, attributes2);
                            sVGParser.m(r0Var, attributes2);
                            sVGParser.i(r0Var, attributes2);
                            while (i3 < attributes.getLength()) {
                                String trim13 = attributes2.getValue(i3).trim();
                                if (i.a.b.a.a.T(attributes2, i3) == 26 && ("".equals(attributes2.getURI(i3)) || "http://www.w3.org/1999/xlink".equals(attributes2.getURI(i3)))) {
                                    r0Var.f2233n = trim13;
                                }
                                i3++;
                            }
                            sVGParser.b.c(r0Var);
                            SVG.g0 g0Var13 = r0Var.b;
                            if (g0Var13 instanceof SVG.y0) {
                                r0Var.f2234o = (SVG.y0) g0Var13;
                                return;
                            } else {
                                r0Var.f2234o = ((SVG.u0) g0Var13).g();
                                return;
                            }
                        }
                        throw new SVGParseException("Invalid document. <tref> elements are only valid inside <text> or <tspan> elements.");
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 28:
                    SVG.g0 g0Var14 = sVGParser.b;
                    if (g0Var14 != null) {
                        if (g0Var14 instanceof SVG.v0) {
                            SVG.s0 s0Var = new SVG.s0();
                            s0Var.a = sVGParser.a;
                            s0Var.b = sVGParser.b;
                            sVGParser.j(s0Var, attributes2);
                            sVGParser.m(s0Var, attributes2);
                            sVGParser.i(s0Var, attributes2);
                            sVGParser.n(s0Var, attributes2);
                            sVGParser.b.c(s0Var);
                            sVGParser.b = s0Var;
                            SVG.g0 g0Var15 = s0Var.b;
                            if (g0Var15 instanceof SVG.y0) {
                                s0Var.f2237r = (SVG.y0) g0Var15;
                                return;
                            } else {
                                s0Var.f2237r = ((SVG.u0) g0Var15).g();
                                return;
                            }
                        }
                        throw new SVGParseException("Invalid document. <tspan> elements are only valid inside <text> or other <tspan> elements.");
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 29:
                    if (sVGParser.b != null) {
                        SVG.a1 a1Var = new SVG.a1();
                        a1Var.a = sVGParser.a;
                        a1Var.b = sVGParser.b;
                        sVGParser.j(a1Var, attributes2);
                        sVGParser.m(a1Var, attributes2);
                        sVGParser.o(a1Var, attributes2);
                        sVGParser.i(a1Var, attributes2);
                        for (int i17 = 0; i17 < attributes.getLength(); i17++) {
                            String trim14 = attributes2.getValue(i17).trim();
                            int T9 = i.a.b.a.a.T(attributes2, i17);
                            if (T9 == 25) {
                                SVG.n y13 = y(trim14);
                                a1Var.f2159s = y13;
                                if (y13.i()) {
                                    throw new SVGParseException("Invalid <use> element. height cannot be negative");
                                }
                            } else if (T9 != 26) {
                                switch (T9) {
                                    case 81:
                                        SVG.n y14 = y(trim14);
                                        a1Var.f2158r = y14;
                                        if (y14.i()) {
                                            throw new SVGParseException("Invalid <use> element. width cannot be negative");
                                        }
                                        continue;
                                    case 82:
                                        a1Var.f2156p = y(trim14);
                                        continue;
                                    case 83:
                                        a1Var.f2157q = y(trim14);
                                        continue;
                                }
                            } else if ("".equals(attributes2.getURI(i17)) || "http://www.w3.org/1999/xlink".equals(attributes2.getURI(i17))) {
                                a1Var.f2155o = trim14;
                            }
                        }
                        sVGParser.b.c(a1Var);
                        sVGParser.b = a1Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                case 30:
                    if (sVGParser.b != null) {
                        SVG.b1 b1Var = new SVG.b1();
                        b1Var.a = sVGParser.a;
                        b1Var.b = sVGParser.b;
                        sVGParser.j(b1Var, attributes2);
                        sVGParser.i(b1Var, attributes2);
                        sVGParser.p(b1Var, attributes2);
                        sVGParser.b.c(b1Var);
                        sVGParser.b = b1Var;
                        return;
                    }
                    throw new SVGParseException("Invalid document. Root element must be <svg>");
                default:
                    sVGParser.c = true;
                    sVGParser.f2267d = 1;
                    return;
            }
        }
    }

    public final void L(Attributes attributes) throws SVGParseException {
        if (this.b != null) {
            String str = "all";
            boolean z = true;
            for (int i2 = 0; i2 < attributes.getLength(); i2++) {
                String trim = attributes.getValue(i2).trim();
                int T = i.a.b.a.a.T(attributes, i2);
                if (T == 38) {
                    str = trim;
                } else if (T == 77) {
                    z = trim.equals("text/css");
                }
            }
            if (z) {
                CSSParser.MediaType mediaType = CSSParser.MediaType.screen;
                CSSParser.c cVar = new CSSParser.c(str);
                cVar.r();
                if (CSSParser.b(CSSParser.e(cVar), mediaType)) {
                    this.f2271h = true;
                    return;
                }
            }
            this.c = true;
            this.f2267d = 1;
            return;
        }
        throw new SVGParseException("Invalid document. Root element must be <svg>");
    }

    public final void M(String str) throws SVGParseException {
        if (this.c) {
            return;
        }
        if (this.f2268e) {
            if (this.f2270g == null) {
                this.f2270g = new StringBuilder(str.length());
            }
            this.f2270g.append(str);
        } else if (this.f2271h) {
            if (this.f2272i == null) {
                this.f2272i = new StringBuilder(str.length());
            }
            this.f2272i.append(str);
        } else if (this.b instanceof SVG.v0) {
            a(str);
        }
    }

    public final void N(char[] cArr, int i2, int i3) throws SVGParseException {
        if (this.c) {
            return;
        }
        if (this.f2268e) {
            if (this.f2270g == null) {
                this.f2270g = new StringBuilder(i3);
            }
            this.f2270g.append(cArr, i2, i3);
        } else if (this.f2271h) {
            if (this.f2272i == null) {
                this.f2272i = new StringBuilder(i3);
            }
            this.f2272i.append(cArr, i2, i3);
        } else if (this.b instanceof SVG.v0) {
            a(new String(cArr, i2, i3));
        }
    }

    public final void a(String str) throws SVGParseException {
        SVG.e0 e0Var = (SVG.e0) this.b;
        int size = e0Var.f2173i.size();
        SVG.k0 k0Var = size == 0 ? null : e0Var.f2173i.get(size - 1);
        if (k0Var instanceof SVG.z0) {
            SVG.z0 z0Var = (SVG.z0) k0Var;
            z0Var.c = i.a.b.a.a.A(new StringBuilder(), z0Var.c, str);
            return;
        }
        this.b.c(new SVG.z0(str));
    }

    public final void c(String str, String str2, String str3) throws SVGParseException {
        if (this.c) {
            int i2 = this.f2267d - 1;
            this.f2267d = i2;
            if (i2 == 0) {
                this.c = false;
                return;
            }
        }
        if ("http://www.w3.org/2000/svg".equals(str) || "".equals(str)) {
            if (str2.length() <= 0) {
                str2 = str3;
            }
            switch (SVGElem.fromString(str2).ordinal()) {
                case 0:
                case 3:
                case 4:
                case 7:
                case 8:
                case 10:
                case 11:
                case 12:
                case 14:
                case 17:
                case 19:
                case 20:
                case 22:
                case 23:
                case 24:
                case 25:
                case 28:
                case 29:
                case 30:
                    this.b = ((SVG.k0) this.b).b;
                    return;
                case 1:
                case 2:
                case 6:
                case 9:
                case 13:
                case 15:
                case 16:
                case 18:
                case 27:
                default:
                    return;
                case 5:
                case 26:
                    this.f2268e = false;
                    StringBuilder sb = this.f2270g;
                    if (sb != null) {
                        SVGElem sVGElem = this.f2269f;
                        if (sVGElem == SVGElem.title) {
                            SVG svg = this.a;
                            sb.toString();
                            Objects.requireNonNull(svg);
                        } else if (sVGElem == SVGElem.desc) {
                            SVG svg2 = this.a;
                            sb.toString();
                            Objects.requireNonNull(svg2);
                        }
                        this.f2270g.setLength(0);
                        return;
                    }
                    return;
                case 21:
                    StringBuilder sb2 = this.f2272i;
                    if (sb2 != null) {
                        this.f2271h = false;
                        String sb3 = sb2.toString();
                        CSSParser cSSParser = new CSSParser(CSSParser.MediaType.screen, CSSParser.Source.Document);
                        this.a.b.b(cSSParser.c(sb3));
                        this.f2272i.setLength(0);
                        return;
                    }
                    return;
            }
        }
    }

    public final void f(Attributes attributes) throws SVGParseException {
        if (this.b != null) {
            SVG.m mVar = new SVG.m();
            mVar.a = this.a;
            mVar.b = this.b;
            j(mVar, attributes);
            m(mVar, attributes);
            o(mVar, attributes);
            i(mVar, attributes);
            for (int i2 = 0; i2 < attributes.getLength(); i2++) {
                String trim = attributes.getValue(i2).trim();
                int T = i.a.b.a.a.T(attributes, i2);
                if (T == 25) {
                    SVG.n y = y(trim);
                    mVar.f2208s = y;
                    if (y.i()) {
                        throw new SVGParseException("Invalid <use> element. height cannot be negative");
                    }
                } else if (T != 26) {
                    if (T != 48) {
                        switch (T) {
                            case 81:
                                SVG.n y2 = y(trim);
                                mVar.f2207r = y2;
                                if (y2.i()) {
                                    throw new SVGParseException("Invalid <use> element. width cannot be negative");
                                }
                                continue;
                            case 82:
                                mVar.f2205p = y(trim);
                                continue;
                            case 83:
                                mVar.f2206q = y(trim);
                                continue;
                        }
                    } else {
                        D(mVar, trim);
                    }
                } else if ("".equals(attributes.getURI(i2)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i2))) {
                    mVar.f2204o = trim;
                }
            }
            this.b.c(mVar);
            this.b = mVar;
            return;
        }
        throw new SVGParseException("Invalid document. Root element must be <svg>");
    }

    public final void g(Attributes attributes) throws SVGParseException {
        if (this.b != null) {
            SVG.q qVar = new SVG.q();
            qVar.a = this.a;
            qVar.b = this.b;
            j(qVar, attributes);
            m(qVar, attributes);
            i(qVar, attributes);
            for (int i2 = 0; i2 < attributes.getLength(); i2++) {
                String trim = attributes.getValue(i2).trim();
                int T = i.a.b.a.a.T(attributes, i2);
                if (T == 25) {
                    SVG.n y = y(trim);
                    qVar.f2232q = y;
                    if (y.i()) {
                        throw new SVGParseException("Invalid <mask> element. height cannot be negative");
                    }
                } else if (T != 36) {
                    if (T != 37) {
                        switch (T) {
                            case 81:
                                SVG.n y2 = y(trim);
                                qVar.f2231p = y2;
                                if (y2.i()) {
                                    throw new SVGParseException("Invalid <mask> element. width cannot be negative");
                                }
                                continue;
                            case 82:
                                y(trim);
                                continue;
                            case 83:
                                y(trim);
                                continue;
                        }
                    } else if ("objectBoundingBox".equals(trim)) {
                        qVar.f2229n = Boolean.FALSE;
                    } else if ("userSpaceOnUse".equals(trim)) {
                        qVar.f2229n = Boolean.TRUE;
                    } else {
                        throw new SVGParseException("Invalid value for attribute maskUnits");
                    }
                } else if ("objectBoundingBox".equals(trim)) {
                    qVar.f2230o = Boolean.FALSE;
                } else if ("userSpaceOnUse".equals(trim)) {
                    qVar.f2230o = Boolean.TRUE;
                } else {
                    throw new SVGParseException("Invalid value for attribute maskContentUnits");
                }
            }
            this.b.c(qVar);
            this.b = qVar;
            return;
        }
        throw new SVGParseException("Invalid document. Root element must be <svg>");
    }

    public SVG h(InputStream inputStream, boolean z) throws SVGParseException {
        if (!inputStream.markSupported()) {
            inputStream = new BufferedInputStream(inputStream);
        }
        try {
            inputStream.mark(3);
            int read = inputStream.read() + (inputStream.read() << 8);
            inputStream.reset();
            if (read == 35615) {
                inputStream = new BufferedInputStream(new GZIPInputStream(inputStream));
            }
        } catch (IOException unused) {
        }
        try {
            inputStream.mark(RecyclerView.b0.FLAG_APPEARED_IN_PRE_LAYOUT);
            H(inputStream, z);
            return this.a;
        } finally {
            try {
                inputStream.close();
            } catch (IOException unused2) {
                Log.e("SVGParser", "Exception thrown closing input stream");
            }
        }
    }

    public final void i(SVG.d0 d0Var, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String trim = attributes.getValue(i2).trim();
            int T = i.a.b.a.a.T(attributes, i2);
            if (T != 73) {
                switch (T) {
                    case 52:
                        g gVar = new g(trim);
                        HashSet hashSet = new HashSet();
                        while (!gVar.f()) {
                            String l2 = gVar.l();
                            if (l2.startsWith("http://www.w3.org/TR/SVG11/feature#")) {
                                hashSet.add(l2.substring(35));
                            } else {
                                hashSet.add("UNSUPPORTED");
                            }
                            gVar.r();
                        }
                        d0Var.h(hashSet);
                        continue;
                    case 53:
                        d0Var.i(trim);
                        continue;
                    case 54:
                        g gVar2 = new g(trim);
                        HashSet hashSet2 = new HashSet();
                        while (!gVar2.f()) {
                            hashSet2.add(gVar2.l());
                            gVar2.r();
                        }
                        d0Var.d(hashSet2);
                        continue;
                    case 55:
                        List<String> v2 = v(trim);
                        d0Var.f(v2 != null ? new HashSet<>(v2) : new HashSet<>(0));
                        continue;
                }
            } else {
                g gVar3 = new g(trim);
                HashSet hashSet3 = new HashSet();
                while (!gVar3.f()) {
                    String l3 = gVar3.l();
                    int indexOf = l3.indexOf(45);
                    if (indexOf != -1) {
                        l3 = l3.substring(0, indexOf);
                    }
                    hashSet3.add(new Locale(l3, "", "").getLanguage());
                    gVar3.r();
                }
                d0Var.k(hashSet3);
            }
        }
    }

    public final void j(SVG.i0 i0Var, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String qName = attributes.getQName(i2);
            if (!qName.equals("id") && !qName.equals("xml:id")) {
                if (qName.equals("xml:space")) {
                    String trim = attributes.getValue(i2).trim();
                    if ("default".equals(trim)) {
                        i0Var.f2194d = Boolean.FALSE;
                        return;
                    } else if ("preserve".equals(trim)) {
                        i0Var.f2194d = Boolean.TRUE;
                        return;
                    } else {
                        throw new SVGParseException(i.a.b.a.a.r("Invalid value for \"xml:space\" attribute: ", trim));
                    }
                }
            } else {
                i0Var.c = attributes.getValue(i2).trim();
                return;
            }
        }
    }

    public final void k(SVG.i iVar, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String trim = attributes.getValue(i2).trim();
            int T = i.a.b.a.a.T(attributes, i2);
            if (T == 23) {
                iVar.f2191j = F(trim);
            } else if (T != 24) {
                if (T != 26) {
                    if (T != 60) {
                        continue;
                    } else {
                        try {
                            iVar.f2192k = SVG.GradientSpread.valueOf(trim);
                        } catch (IllegalArgumentException unused) {
                            throw new SVGParseException(i.a.b.a.a.s("Invalid spreadMethod attribute. \"", trim, "\" is not a valid value."));
                        }
                    }
                } else if ("".equals(attributes.getURI(i2)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i2))) {
                    iVar.f2193l = trim;
                }
            } else if ("objectBoundingBox".equals(trim)) {
                iVar.f2190i = Boolean.FALSE;
            } else if ("userSpaceOnUse".equals(trim)) {
                iVar.f2190i = Boolean.TRUE;
            } else {
                throw new SVGParseException("Invalid value for attribute gradientUnits");
            }
        }
    }

    public final void l(SVG.x xVar, Attributes attributes, String str) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            if (SVGAttr.fromString(attributes.getLocalName(i2)) == SVGAttr.points) {
                g gVar = new g(attributes.getValue(i2));
                ArrayList arrayList = new ArrayList();
                gVar.r();
                while (!gVar.f()) {
                    float i3 = gVar.i();
                    if (!Float.isNaN(i3)) {
                        gVar.q();
                        float i4 = gVar.i();
                        if (!Float.isNaN(i4)) {
                            gVar.q();
                            arrayList.add(Float.valueOf(i3));
                            arrayList.add(Float.valueOf(i4));
                        } else {
                            throw new SVGParseException(i.a.b.a.a.s("Invalid <", str, "> points attribute. There should be an even number of coordinates."));
                        }
                    } else {
                        throw new SVGParseException(i.a.b.a.a.s("Invalid <", str, "> points attribute. Non-coordinate content found in list."));
                    }
                }
                xVar.f2253o = new float[arrayList.size()];
                Iterator it = arrayList.iterator();
                int i5 = 0;
                while (it.hasNext()) {
                    xVar.f2253o[i5] = ((Float) it.next()).floatValue();
                    i5++;
                }
            }
        }
    }

    public final void m(SVG.i0 i0Var, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String trim = attributes.getValue(i2).trim();
            if (trim.length() != 0) {
                int T = i.a.b.a.a.T(attributes, i2);
                if (T == 0) {
                    CSSParser.c cVar = new CSSParser.c(trim);
                    ArrayList arrayList = null;
                    while (!cVar.f()) {
                        String l2 = cVar.l();
                        if (l2 != null) {
                            if (arrayList == null) {
                                arrayList = new ArrayList();
                            }
                            arrayList.add(l2);
                            cVar.r();
                        }
                    }
                    i0Var.f2197g = arrayList;
                } else if (T != 72) {
                    if (i0Var.f2195e == null) {
                        i0Var.f2195e = new SVG.Style();
                    }
                    J(i0Var.f2195e, attributes.getLocalName(i2), attributes.getValue(i2).trim());
                } else {
                    g gVar = new g(trim.replaceAll("/\\*.*?\\*/", ""));
                    while (true) {
                        String m2 = gVar.m(':');
                        gVar.r();
                        if (!gVar.d(':')) {
                            break;
                        }
                        gVar.r();
                        String n2 = gVar.n(';', true);
                        if (n2 == null) {
                            break;
                        }
                        gVar.r();
                        if (gVar.f() || gVar.d(';')) {
                            if (i0Var.f2196f == null) {
                                i0Var.f2196f = new SVG.Style();
                            }
                            J(i0Var.f2196f, m2, n2);
                            gVar.r();
                        }
                    }
                }
            }
        }
    }

    public final void n(SVG.x0 x0Var, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String trim = attributes.getValue(i2).trim();
            int T = i.a.b.a.a.T(attributes, i2);
            if (T == 9) {
                x0Var.f2256p = z(trim);
            } else if (T == 10) {
                x0Var.f2257q = z(trim);
            } else if (T == 82) {
                x0Var.f2254n = z(trim);
            } else if (T == 83) {
                x0Var.f2255o = z(trim);
            }
        }
    }

    public final void o(SVG.l lVar, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            if (SVGAttr.fromString(attributes.getLocalName(i2)) == SVGAttr.transform) {
                lVar.j(F(attributes.getValue(i2)));
            }
        }
    }

    public final void p(SVG.o0 o0Var, Attributes attributes) throws SVGParseException {
        for (int i2 = 0; i2 < attributes.getLength(); i2++) {
            String trim = attributes.getValue(i2).trim();
            int T = i.a.b.a.a.T(attributes, i2);
            if (T == 48) {
                D(o0Var, trim);
            } else if (T != 80) {
                continue;
            } else {
                g gVar = new g(trim);
                gVar.r();
                float i3 = gVar.i();
                gVar.q();
                float i4 = gVar.i();
                gVar.q();
                float i5 = gVar.i();
                gVar.q();
                float i6 = gVar.i();
                if (Float.isNaN(i3) || Float.isNaN(i4) || Float.isNaN(i5) || Float.isNaN(i6)) {
                    throw new SVGParseException("Invalid viewBox definition - should have four numbers");
                }
                if (i5 < 0.0f) {
                    throw new SVGParseException("Invalid viewBox. width cannot be negative");
                }
                if (i6 >= 0.0f) {
                    o0Var.f2222o = new SVG.a(i3, i4, i5, i6);
                } else {
                    throw new SVGParseException("Invalid viewBox. height cannot be negative");
                }
            }
        }
    }
}