package J2;

import I2.C0325i;
import I2.C0334s;
import android.graphics.Matrix;
import android.util.Log;
import android.util.Xml;
import androidx.media3.container.MdtaMetadataEntry;
import androidx.media3.extractor.metadata.dvbsi.AppInfoTableDecoder;
import androidx.media3.extractor.text.ttml.TtmlNode;
import androidx.media3.extractor.ts.PsExtractor;
import androidx.media3.extractor.ts.TsExtractor;
import com.google.android.gms.fido.u2f.api.common.RegisterRequest;
import com.google.android.gms.location.LocationRequest;
import com.google.firebase.firestore.index.FirestoreIndexValueWriter;
import com.revenuecat.purchases.common.networking.RCHTTPStatusCodes;
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.Locale;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* JADX INFO: loaded from: classes.dex */
public final class L0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public C4.f f3286a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Y f3287b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f3288c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f3289d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f3290e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public J0 f3291f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public StringBuilder f3292g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public boolean f3293h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public StringBuilder f3294i;

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:149:0x0270  */
    /* JADX WARN: Removed duplicated region for block: B:173:0x02b2  */
    /* JADX WARN: Removed duplicated region for block: B:234:0x037d  */
    /* JADX WARN: Removed duplicated region for block: B:310:0x0491  */
    /* JADX WARN: Removed duplicated region for block: B:344:0x04eb  */
    /* JADX WARN: Removed duplicated region for block: B:389:0x058a  */
    /* JADX WARN: Removed duplicated region for block: B:444:0x0654  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void D(U u6, String str, String str2) {
        C0.J j4;
        Boolean bool;
        int i6;
        int i7;
        E eS;
        String strSubstring;
        E eS2;
        int i8;
        int i9;
        E eA;
        E[] eArr;
        int i10 = 1;
        if (str2.length() == 0 || str2.equals("inherit")) {
            return;
        }
        int iOrdinal = I0.a(str).ordinal();
        if (iOrdinal == 1) {
            if (!TtmlNode.TEXT_EMPHASIS_AUTO.equals(str2) && str2.startsWith("rect(")) {
                L l = new L(str2.substring(5));
                l.J();
                E eU = u(l);
                l.I();
                E eU2 = u(l);
                l.I();
                E eU3 = u(l);
                l.I();
                E eU4 = u(l);
                l.J();
                if (l.k(')') || l.n()) {
                    j4 = new C0.J(i10, false);
                    j4.f533b = eU;
                    j4.f534c = eU2;
                    j4.f535d = eU3;
                    j4.f536e = eU4;
                } else {
                    j4 = null;
                }
            }
            u6.f3341s = j4;
            if (j4 != null) {
                u6.f3327a |= 1048576;
                return;
            }
            return;
        }
        if (iOrdinal == 2) {
            u6.f3311A = r(str2);
            u6.f3327a |= 268435456;
            return;
        }
        if (iOrdinal == 4) {
            u6.f3324N = "nonzero".equals(str2) ? 1 : "evenodd".equals(str2) ? 2 : 0;
            u6.f3327a |= 536870912;
        }
        try {
            if (iOrdinal == 5) {
                u6.f3336n = n(str2);
                u6.f3327a |= 4096;
                return;
            }
            if (iOrdinal == 8) {
                int i11 = !str2.equals("ltr") ? !str2.equals("rtl") ? 0 : 2 : 1;
                u6.f3322L = i11;
                if (i11 != 0) {
                    u6.f3327a |= 68719476736L;
                    return;
                }
                return;
            }
            if (iOrdinal == 35) {
                u6.f3312B = r(str2);
                u6.f3327a |= 1073741824;
                return;
            }
            if (iOrdinal == 40) {
                u6.f3335m = v(str2);
                u6.f3327a |= 2048;
                return;
            }
            if (iOrdinal == 42) {
                switch (str2) {
                    case "hidden":
                    case "scroll":
                        bool = Boolean.FALSE;
                        break;
                    case "auto":
                    case "visible":
                        bool = Boolean.TRUE;
                        break;
                    default:
                        bool = null;
                        break;
                }
                u6.f3340r = bool;
                if (bool != null) {
                    u6.f3327a |= 524288;
                    return;
                }
                return;
            }
            if (iOrdinal == 78) {
                int i12 = !str2.equals("none") ? !str2.equals("non-scaling-stroke") ? 0 : 2 : 1;
                u6.f3325O = i12;
                if (i12 != 0) {
                    u6.f3327a |= 34359738368L;
                    return;
                }
                return;
            }
            C0431w c0431w = C0431w.f3471a;
            if (iOrdinal == 58) {
                if (str2.equals("currentColor")) {
                    u6.f3313C = c0431w;
                } else {
                    try {
                        u6.f3313C = n(str2);
                    } catch (C0 e6) {
                        Log.w("SVGParser", e6.getMessage());
                        return;
                    }
                }
                u6.f3327a |= 2147483648L;
                return;
            }
            if (iOrdinal == 59) {
                u6.f3314D = v(str2);
                u6.f3327a |= 4294967296L;
                return;
            }
            if (iOrdinal == 74) {
                switch (str2) {
                    case "middle":
                        i6 = 2;
                        break;
                    case "end":
                        i6 = 3;
                        break;
                    case "start":
                        i6 = 1;
                        break;
                    default:
                        i6 = 0;
                        break;
                }
                u6.f3323M = i6;
                if (i6 != 0) {
                    u6.f3327a |= 262144;
                    return;
                }
                return;
            }
            if (iOrdinal == 75) {
                switch (str2) {
                    case "line-through":
                        i7 = 4;
                        break;
                    case "underline":
                        i7 = 2;
                        break;
                    case "none":
                        i7 = 1;
                        break;
                    case "blink":
                        i7 = 5;
                        break;
                    case "overline":
                        i7 = 3;
                        break;
                    default:
                        i7 = 0;
                        break;
                }
                u6.f3321K = i7;
                if (i7 != 0) {
                    u6.f3327a |= 131072;
                    return;
                }
                return;
            }
            switch (iOrdinal) {
                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("|" + str2 + '|')) {
                            u6.f3345w = Boolean.valueOf(!str2.equals("none"));
                            u6.f3327a |= 16777216;
                            break;
                        }
                    }
                    break;
                case 15:
                    AbstractC0405d0 abstractC0405d0W = w(str2);
                    u6.f3328b = abstractC0405d0W;
                    if (abstractC0405d0W != null) {
                        u6.f3327a |= 1;
                    }
                    break;
                case 16:
                    int i13 = "nonzero".equals(str2) ? 1 : "evenodd".equals(str2) ? 2 : 0;
                    u6.f3317G = i13;
                    if (i13 != 0) {
                        u6.f3327a |= 2;
                    }
                    break;
                case 17:
                    Float fV = v(str2);
                    u6.f3329c = fV;
                    if (fV != null) {
                        u6.f3327a |= 4;
                    }
                    break;
                case 18:
                    if ("|caption|icon|menu|message-box|small-caption|status-bar|".contains("|" + str2 + '|')) {
                        L l6 = new L(str2);
                        Integer num = null;
                        String str3 = null;
                        int i14 = 0;
                        while (true) {
                            String strD = l6.D('/', false);
                            l6.J();
                            if (strD != null) {
                                if (num == null || i14 == 0) {
                                    if (!strD.equals("normal") && (num != null || (num = (Integer) G0.f3181a.get(strD)) == null)) {
                                        if (i14 == 0) {
                                            switch (strD) {
                                                case "oblique":
                                                    i14 = 3;
                                                    break;
                                                case "italic":
                                                    i14 = 2;
                                                    break;
                                                case "normal":
                                                    i14 = 1;
                                                    break;
                                                default:
                                                    i14 = 0;
                                                    break;
                                            }
                                            if (i14 != 0) {
                                                continue;
                                            }
                                        }
                                        if (str3 == null && strD.equals("small-caps")) {
                                            str3 = strD;
                                        }
                                    }
                                }
                                try {
                                    eS = (E) F0.f3174a.get(strD);
                                    if (eS == null) {
                                        eS = s(strD);
                                    }
                                } catch (C0 unused) {
                                    eS = null;
                                }
                                if (l6.k('/')) {
                                    l6.J();
                                    String strC = l6.C();
                                    if (strC != null) {
                                        s(strC);
                                    }
                                    l6.J();
                                }
                                if (l6.n()) {
                                    strSubstring = null;
                                } else {
                                    int i15 = l6.f3282b;
                                    l6.f3282b = l6.f3283c;
                                    strSubstring = ((String) l6.f3284d).substring(i15);
                                }
                                u6.f3337o = q(strSubstring);
                                u6.f3338p = eS;
                                u6.f3339q = Integer.valueOf(num == null ? RCHTTPStatusCodes.BAD_REQUEST : num.intValue());
                                u6.f3320J = i14 == 0 ? 1 : i14;
                                u6.f3327a |= 122880;
                                break;
                            }
                            break;
                        }
                    }
                    break;
                case 19:
                    ArrayList arrayListQ = q(str2);
                    u6.f3337o = arrayListQ;
                    if (arrayListQ != null) {
                        u6.f3327a |= 8192;
                    }
                    break;
                case 20:
                    try {
                        E e7 = (E) F0.f3174a.get(str2);
                        eS2 = e7 == null ? s(str2) : e7;
                    } catch (C0 unused2) {
                        eS2 = null;
                    }
                    u6.f3338p = eS2;
                    if (eS2 != null) {
                        u6.f3327a |= 16384;
                    }
                    break;
                case 21:
                    Integer num2 = (Integer) G0.f3181a.get(str2);
                    u6.f3339q = num2;
                    if (num2 != null) {
                        u6.f3327a |= 32768;
                    }
                    break;
                case 22:
                    switch (str2) {
                        case "oblique":
                            i8 = 3;
                            break;
                        case "italic":
                            i8 = 2;
                            break;
                        case "normal":
                            i8 = 1;
                            break;
                        default:
                            i8 = 0;
                            break;
                    }
                    u6.f3320J = i8;
                    if (i8 != 0) {
                        u6.f3327a |= 65536;
                    }
                    break;
                default:
                    switch (iOrdinal) {
                        case 27:
                            switch (str2) {
                                case "optimizeQuality":
                                    i9 = 2;
                                    break;
                                case "auto":
                                    i9 = 1;
                                    break;
                                case "optimizeSpeed":
                                    i9 = 3;
                                    break;
                                default:
                                    i9 = 0;
                                    break;
                            }
                            u6.f3326P = i9;
                            if (i9 != 0) {
                                u6.f3327a |= 137438953472L;
                            }
                            break;
                        case 28:
                            String strR = r(str2);
                            u6.f3342t = strR;
                            u6.f3343u = strR;
                            u6.f3344v = strR;
                            u6.f3327a |= 14680064;
                            break;
                        case 29:
                            u6.f3342t = r(str2);
                            u6.f3327a |= 2097152;
                            break;
                        case 30:
                            u6.f3343u = r(str2);
                            u6.f3327a |= 4194304;
                            break;
                        case 31:
                            u6.f3344v = r(str2);
                            u6.f3327a |= 8388608;
                            break;
                        default:
                            switch (iOrdinal) {
                                case 62:
                                    if (str2.equals("currentColor")) {
                                        u6.f3347y = c0431w;
                                    } else {
                                        try {
                                            u6.f3347y = n(str2);
                                        } catch (C0 e8) {
                                            Log.w("SVGParser", e8.getMessage());
                                            return;
                                        }
                                    }
                                    u6.f3327a |= 67108864;
                                    break;
                                case 63:
                                    u6.f3348z = v(str2);
                                    u6.f3327a |= 134217728;
                                    break;
                                case 64:
                                    AbstractC0405d0 abstractC0405d0W2 = w(str2);
                                    u6.f3330d = abstractC0405d0W2;
                                    if (abstractC0405d0W2 != null) {
                                        u6.f3327a |= 8;
                                    }
                                    break;
                                case RegisterRequest.U2F_V1_CHALLENGE_BYTE_LENGTH /* 65 */:
                                    if (!"none".equals(str2)) {
                                        L l7 = new L(str2);
                                        l7.J();
                                        if (l7.n() || (eA = l7.A()) == null || eA.f()) {
                                            eArr = null;
                                        } else {
                                            ArrayList arrayList = new ArrayList();
                                            arrayList.add(eA);
                                            float f6 = eA.f3167a;
                                            while (true) {
                                                if (!l7.n()) {
                                                    l7.I();
                                                    E eA2 = l7.A();
                                                    if (eA2 != null && !eA2.f()) {
                                                        arrayList.add(eA2);
                                                        f6 += eA2.f3167a;
                                                    }
                                                } else if (f6 != 0.0f) {
                                                    eArr = (E[]) arrayList.toArray(new E[arrayList.size()]);
                                                }
                                            }
                                            eArr = null;
                                        }
                                        u6.f3334k = eArr;
                                        if (eArr != null) {
                                            u6.f3327a |= 512;
                                        }
                                    } else {
                                        u6.f3334k = null;
                                        u6.f3327a |= 512;
                                    }
                                    break;
                                case 66:
                                    u6.l = s(str2);
                                    u6.f3327a |= 1024;
                                    break;
                                case MdtaMetadataEntry.TYPE_INDICATOR_INT32 /* 67 */:
                                    int i16 = "butt".equals(str2) ? 1 : "round".equals(str2) ? 2 : "square".equals(str2) ? 3 : 0;
                                    u6.f3318H = i16;
                                    if (i16 != 0) {
                                        u6.f3327a |= 64;
                                    }
                                    break;
                                case 68:
                                    int i17 = "miter".equals(str2) ? 1 : "round".equals(str2) ? 2 : "bevel".equals(str2) ? 3 : 0;
                                    u6.f3319I = i17;
                                    if (i17 != 0) {
                                        u6.f3327a |= 128;
                                    }
                                    break;
                                case 69:
                                    u6.f3333j = Float.valueOf(p(str2));
                                    u6.f3327a |= 256;
                                    break;
                                case 70:
                                    Float fV2 = v(str2);
                                    u6.f3331e = fV2;
                                    if (fV2 != null) {
                                        u6.f3327a |= 16;
                                    }
                                    break;
                                case TsExtractor.TS_SYNC_BYTE /* 71 */:
                                    u6.f3332f = s(str2);
                                    u6.f3327a |= 32;
                                    break;
                                default:
                                    switch (iOrdinal) {
                                        case 88:
                                            if (str2.equals("currentColor")) {
                                                u6.f3315E = c0431w;
                                            } else {
                                                try {
                                                    u6.f3315E = n(str2);
                                                } catch (C0 e9) {
                                                    Log.w("SVGParser", e9.getMessage());
                                                    return;
                                                }
                                            }
                                            u6.f3327a |= 8589934592L;
                                            break;
                                        case TsExtractor.TS_STREAM_TYPE_DVBSUBS /* 89 */:
                                            u6.f3316F = v(str2);
                                            u6.f3327a |= 17179869184L;
                                            break;
                                        case 90:
                                            if (str2.indexOf(124) < 0) {
                                                if ("|visible|hidden|collapse|".contains("|" + str2 + '|')) {
                                                    u6.f3346x = Boolean.valueOf(str2.equals("visible"));
                                                    u6.f3327a |= 33554432;
                                                    break;
                                                }
                                            }
                                            break;
                                    }
                                    break;
                            }
                            break;
                    }
                    break;
            }
        } catch (C0 unused3) {
        }
    }

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

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

    public static float e(float f6, float f7, float f8) {
        if (f8 < 0.0f) {
            f8 += 6.0f;
        }
        if (f8 >= 6.0f) {
            f8 -= 6.0f;
        }
        return f8 < 1.0f ? com.google.android.recaptcha.internal.a.a(f7, f6, f8, f6) : f8 < 3.0f ? f7 : f8 < 4.0f ? com.google.android.recaptcha.internal.a.a(4.0f, f8, f7 - f6, f6) : f6;
    }

    public static void f(W w6, Attributes attributes) {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String strTrim = attributes.getValue(i6).trim();
            int iE = A0.a.e(attributes, i6);
            if (iE != 73) {
                switch (iE) {
                    case 52:
                        L l = new L(strTrim);
                        HashSet hashSet = new HashSet();
                        while (!l.n()) {
                            String strC = l.C();
                            if (strC.startsWith("http://www.w3.org/TR/SVG11/feature#")) {
                                hashSet.add(strC.substring(35));
                            } else {
                                hashSet.add("UNSUPPORTED");
                            }
                            l.J();
                        }
                        w6.d(hashSet);
                        break;
                    case FirestoreIndexValueWriter.INDEX_TYPE_VECTOR /* 53 */:
                        w6.g(strTrim);
                        break;
                    case 54:
                        L l6 = new L(strTrim);
                        HashSet hashSet2 = new HashSet();
                        while (!l6.n()) {
                            hashSet2.add(l6.C());
                            l6.J();
                        }
                        w6.h(hashSet2);
                        break;
                    case FirestoreIndexValueWriter.INDEX_TYPE_MAP /* 55 */:
                        ArrayList arrayListQ = q(strTrim);
                        w6.f(arrayListQ != null ? new HashSet(arrayListQ) : new HashSet(0));
                        break;
                }
            } else {
                L l7 = new L(strTrim);
                HashSet hashSet3 = new HashSet();
                while (!l7.n()) {
                    String strC2 = l7.C();
                    int iIndexOf = strC2.indexOf(45);
                    if (iIndexOf != -1) {
                        strC2 = strC2.substring(0, iIndexOf);
                    }
                    hashSet3.add(new Locale(strC2, "", "").getLanguage());
                    l7.J();
                }
                w6.i(hashSet3);
            }
        }
    }

    public static void g(AbstractC0399a0 abstractC0399a0, Attributes attributes) throws C0 {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String qName = attributes.getQName(i6);
            if (qName.equals("id") || qName.equals("xml:id")) {
                abstractC0399a0.f3358c = attributes.getValue(i6).trim();
                return;
            }
            if (qName.equals("xml:space")) {
                String strTrim = attributes.getValue(i6).trim();
                if ("default".equals(strTrim)) {
                    abstractC0399a0.f3359d = Boolean.FALSE;
                    return;
                } else {
                    if (!"preserve".equals(strTrim)) {
                        throw new C0(A0.a.n("Invalid value for \"xml:space\" attribute: ", strTrim));
                    }
                    abstractC0399a0.f3359d = Boolean.TRUE;
                    return;
                }
            }
        }
    }

    public static void h(AbstractC0434z abstractC0434z, Attributes attributes) throws C0 {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String strTrim = attributes.getValue(i6).trim();
            int iE = A0.a.e(attributes, i6);
            if (iE == 23) {
                abstractC0434z.f3486j = z(strTrim);
            } else if (iE != 24) {
                if (iE != 26) {
                    if (iE != 60) {
                        continue;
                    } else {
                        try {
                            abstractC0434z.f3487k = A0.a.y(strTrim);
                        } catch (IllegalArgumentException unused) {
                            throw new C0(Z0.o.o("Invalid spreadMethod attribute. \"", strTrim, "\" is not a valid value."));
                        }
                    }
                } else if ("".equals(attributes.getURI(i6)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i6))) {
                    abstractC0434z.l = strTrim;
                }
            } else if ("objectBoundingBox".equals(strTrim)) {
                abstractC0434z.f3485i = Boolean.FALSE;
            } else {
                if (!"userSpaceOnUse".equals(strTrim)) {
                    throw new C0("Invalid value for attribute gradientUnits");
                }
                abstractC0434z.f3485i = Boolean.TRUE;
            }
        }
    }

    public static void i(O o6, Attributes attributes, String str) throws C0 {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            if (I0.a(attributes.getLocalName(i6)) == I0.Y) {
                L l = new L(attributes.getValue(i6));
                ArrayList arrayList = new ArrayList();
                l.J();
                while (!l.n()) {
                    float fZ = l.z();
                    if (Float.isNaN(fZ)) {
                        throw new C0(Z0.o.o("Invalid <", str, "> points attribute. Non-coordinate content found in list."));
                    }
                    l.I();
                    float fZ2 = l.z();
                    if (Float.isNaN(fZ2)) {
                        throw new C0(Z0.o.o("Invalid <", str, "> points attribute. There should be an even number of coordinates."));
                    }
                    l.I();
                    arrayList.add(Float.valueOf(fZ));
                    arrayList.add(Float.valueOf(fZ2));
                }
                o6.f3303o = new float[arrayList.size()];
                Iterator it = arrayList.iterator();
                int i7 = 0;
                while (it.hasNext()) {
                    o6.f3303o[i7] = ((Float) it.next()).floatValue();
                    i7++;
                }
            }
        }
    }

    public static void j(AbstractC0399a0 abstractC0399a0, Attributes attributes) {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String strTrim = attributes.getValue(i6).trim();
            if (strTrim.length() != 0) {
                int iE = A0.a.e(attributes, i6);
                if (iE == 0) {
                    C0402c c0402c = new C0402c(strTrim);
                    ArrayList arrayList = null;
                    while (!c0402c.n()) {
                        String strC = c0402c.C();
                        if (strC != null) {
                            if (arrayList == null) {
                                arrayList = new ArrayList();
                            }
                            arrayList.add(strC);
                            c0402c.J();
                        }
                    }
                    abstractC0399a0.f3362g = arrayList;
                } else if (iE != 72) {
                    if (abstractC0399a0.f3360e == null) {
                        abstractC0399a0.f3360e = new U();
                    }
                    D(abstractC0399a0.f3360e, attributes.getLocalName(i6), attributes.getValue(i6).trim());
                } else {
                    L l = new L(strTrim.replaceAll("/\\*.*?\\*/", ""));
                    while (true) {
                        String strD = l.D(':', false);
                        l.J();
                        if (!l.k(':')) {
                            break;
                        }
                        l.J();
                        String strD2 = l.D(';', true);
                        if (strD2 == null) {
                            break;
                        }
                        l.J();
                        if (l.n() || l.k(';')) {
                            if (abstractC0399a0.f3361f == null) {
                                abstractC0399a0.f3361f = new U();
                            }
                            D(abstractC0399a0.f3361f, strD, strD2);
                            l.J();
                        }
                    }
                }
            }
        }
    }

    public static void k(p0 p0Var, Attributes attributes) {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String strTrim = attributes.getValue(i6).trim();
            int iE = A0.a.e(attributes, i6);
            if (iE == 9) {
                p0Var.f3421p = t(strTrim);
            } else if (iE == 10) {
                p0Var.f3422q = t(strTrim);
            } else if (iE == 82) {
                p0Var.f3419n = t(strTrim);
            } else if (iE == 83) {
                p0Var.f3420o = t(strTrim);
            }
        }
    }

    public static void l(C c6, Attributes attributes) {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            if (I0.a(attributes.getLocalName(i6)) == I0.f3190B0) {
                c6.j(z(attributes.getValue(i6)));
            }
        }
    }

    public static void m(AbstractC0411g0 abstractC0411g0, Attributes attributes) throws C0 {
        for (int i6 = 0; i6 < attributes.getLength(); i6++) {
            String strTrim = attributes.getValue(i6).trim();
            int iE = A0.a.e(attributes, i6);
            if (iE == 48) {
                x(abstractC0411g0, strTrim);
            } else if (iE != 80) {
                continue;
            } else {
                L l = new L(strTrim);
                l.J();
                float fZ = l.z();
                l.I();
                float fZ2 = l.z();
                l.I();
                float fZ3 = l.z();
                l.I();
                float fZ4 = l.z();
                if (Float.isNaN(fZ) || Float.isNaN(fZ2) || Float.isNaN(fZ3) || Float.isNaN(fZ4)) {
                    throw new C0("Invalid viewBox definition - should have four numbers");
                }
                if (fZ3 < 0.0f) {
                    throw new C0("Invalid viewBox. width cannot be negative");
                }
                if (fZ4 < 0.0f) {
                    throw new C0("Invalid viewBox. height cannot be negative");
                }
                abstractC0411g0.f3387o = new C0427s(fZ, fZ2, fZ3, fZ4);
            }
        }
    }

    public static C0430v n(String str) throws C0 {
        long j4;
        int i6;
        if (str.charAt(0) == '#') {
            int length = str.length();
            C0424o c0424o = null;
            if (1 < length) {
                long j6 = 0;
                int i7 = 1;
                while (i7 < length) {
                    char cCharAt = str.charAt(i7);
                    if (cCharAt < '0' || cCharAt > '9') {
                        if (cCharAt >= 'A' && cCharAt <= 'F') {
                            j4 = j6 * 16;
                            i6 = cCharAt - 'A';
                        } else {
                            if (cCharAt < 'a' || cCharAt > 'f') {
                                break;
                            }
                            j4 = j6 * 16;
                            i6 = cCharAt - 'a';
                        }
                        j6 = j4 + ((long) i6) + 10;
                    } else {
                        j6 = (j6 * 16) + ((long) (cCharAt - '0'));
                    }
                    if (j6 > 4294967295L) {
                        break;
                    }
                    i7++;
                }
                if (i7 != 1) {
                    c0424o = new C0424o(j6, i7);
                }
            }
            if (c0424o == null) {
                throw new C0("Bad hex colour value: ".concat(str));
            }
            long j7 = c0424o.f3412b;
            int i8 = c0424o.f3411a;
            if (i8 == 4) {
                int i9 = (int) j7;
                int i10 = i9 & 3840;
                int i11 = i9 & PsExtractor.VIDEO_STREAM_MASK;
                int i12 = i9 & 15;
                return new C0430v(i12 | (i10 << 8) | (-16777216) | (i10 << 12) | (i11 << 8) | (i11 << 4) | (i12 << 4));
            }
            if (i8 != 5) {
                if (i8 == 7) {
                    return new C0430v(((int) j7) | (-16777216));
                }
                if (i8 != 9) {
                    throw new C0("Bad hex colour value: ".concat(str));
                }
                int i13 = (int) j7;
                return new C0430v((i13 >>> 8) | (i13 << 24));
            }
            int i14 = (int) j7;
            int i15 = 61440 & i14;
            int i16 = i14 & 3840;
            int i17 = i14 & PsExtractor.VIDEO_STREAM_MASK;
            int i18 = i14 & 15;
            return new C0430v((i18 << 24) | (i18 << 28) | (i15 << 8) | (i15 << 4) | (i16 << 4) | i16 | i17 | (i17 >> 4));
        }
        String lowerCase = str.toLowerCase(Locale.US);
        boolean zStartsWith = lowerCase.startsWith("rgba(");
        if (zStartsWith || lowerCase.startsWith("rgb(")) {
            L l = new L(str.substring(zStartsWith ? 5 : 4));
            l.J();
            float fZ = l.z();
            if (!Float.isNaN(fZ) && l.k('%')) {
                fZ = (fZ * 256.0f) / 100.0f;
            }
            float fJ = l.j(fZ);
            if (!Float.isNaN(fJ) && l.k('%')) {
                fJ = (fJ * 256.0f) / 100.0f;
            }
            float fJ2 = l.j(fJ);
            if (!Float.isNaN(fJ2) && l.k('%')) {
                fJ2 = (fJ2 * 256.0f) / 100.0f;
            }
            if (!zStartsWith) {
                l.J();
                if (Float.isNaN(fJ2) || !l.k(')')) {
                    throw new C0("Bad rgb() colour value: ".concat(str));
                }
                return new C0430v((b(fZ) << 16) | (-16777216) | (b(fJ) << 8) | b(fJ2));
            }
            float fJ3 = l.j(fJ2);
            l.J();
            if (Float.isNaN(fJ3) || !l.k(')')) {
                throw new C0("Bad rgba() colour value: ".concat(str));
            }
            return new C0430v((b(fJ3 * 256.0f) << 24) | (b(fZ) << 16) | (b(fJ) << 8) | b(fJ2));
        }
        boolean zStartsWith2 = lowerCase.startsWith("hsla(");
        if (!zStartsWith2 && !lowerCase.startsWith("hsl(")) {
            Integer num = (Integer) E0.f3169a.get(lowerCase);
            if (num != null) {
                return new C0430v(num.intValue());
            }
            throw new C0("Invalid colour keyword: ".concat(lowerCase));
        }
        L l6 = new L(str.substring(zStartsWith2 ? 5 : 4));
        l6.J();
        float fZ2 = l6.z();
        float fJ4 = l6.j(fZ2);
        if (!Float.isNaN(fJ4)) {
            l6.k('%');
        }
        float fJ5 = l6.j(fJ4);
        if (!Float.isNaN(fJ5)) {
            l6.k('%');
        }
        if (!zStartsWith2) {
            l6.J();
            if (Float.isNaN(fJ5) || !l6.k(')')) {
                throw new C0("Bad hsl() colour value: ".concat(str));
            }
            return new C0430v(d(fZ2, fJ4, fJ5) | (-16777216));
        }
        float fJ6 = l6.j(fJ5);
        l6.J();
        if (Float.isNaN(fJ6) || !l6.k(')')) {
            throw new C0("Bad hsla() colour value: ".concat(str));
        }
        return new C0430v((b(fJ6 * 256.0f) << 24) | d(fZ2, fJ4, fJ5));
    }

    public static float o(int i6, String str) throws C0 {
        float fA = new C0425p().a(0, i6, str);
        if (Float.isNaN(fA)) {
            throw new C0(A0.a.n("Invalid float value: ", str));
        }
        return fA;
    }

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

    public static ArrayList q(String str) {
        L l = new L(str);
        ArrayList arrayList = null;
        do {
            String strB = l.B();
            if (strB == null) {
                strB = l.D(',', true);
            }
            if (strB == null) {
                return arrayList;
            }
            if (arrayList == null) {
                arrayList = new ArrayList();
            }
            arrayList.add(strB);
            l.I();
        } while (!l.n());
        return arrayList;
    }

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

    public static E s(String str) throws C0 {
        int iZ;
        if (str.length() == 0) {
            throw new C0("Invalid length value (empty string)");
        }
        int length = str.length();
        char cCharAt = str.charAt(length - 1);
        if (cCharAt == '%') {
            length--;
            iZ = 9;
        } else if (length > 2 && Character.isLetter(cCharAt) && Character.isLetter(str.charAt(length - 2))) {
            length -= 2;
            try {
                iZ = A0.a.z(str.substring(length).toLowerCase(Locale.US));
            } catch (IllegalArgumentException unused) {
                throw new C0("Invalid length unit specifier: ".concat(str));
            }
        } else {
            iZ = 1;
        }
        try {
            return new E(o(length, str), iZ);
        } catch (NumberFormatException e6) {
            throw new C0("Invalid length value: ".concat(str), e6);
        }
    }

    public static ArrayList t(String str) throws C0 {
        String str2;
        if (str.length() == 0) {
            throw new C0("Invalid length list (empty string)");
        }
        ArrayList arrayList = new ArrayList(1);
        L l = new L(str);
        l.J();
        while (!l.n()) {
            float fZ = l.z();
            if (Float.isNaN(fZ)) {
                StringBuilder sb = new StringBuilder("Invalid length list value: ");
                int i6 = l.f3282b;
                while (true) {
                    boolean zN = l.n();
                    str2 = (String) l.f3284d;
                    if (zN || L.w(str2.charAt(l.f3282b))) {
                        break;
                    }
                    l.f3282b++;
                }
                String strSubstring = str2.substring(i6, l.f3282b);
                l.f3282b = i6;
                sb.append(strSubstring);
                throw new C0(sb.toString());
            }
            int iE = l.E();
            if (iE == 0) {
                iE = 1;
            }
            arrayList.add(new E(fZ, iE));
            l.I();
        }
        return arrayList;
    }

    public static E u(L l) {
        return l.l(TtmlNode.TEXT_EMPHASIS_AUTO) ? new E(0.0f) : l.A();
    }

    public static Float v(String str) {
        try {
            float fP = p(str);
            float f6 = 0.0f;
            if (fP < 0.0f) {
                fP = f6;
            } else {
                f6 = 1.0f;
                if (fP > 1.0f) {
                    fP = f6;
                }
            }
            return Float.valueOf(fP);
        } catch (C0 unused) {
            return null;
        }
    }

    public static AbstractC0405d0 w(String str) {
        boolean zStartsWith = str.startsWith("url(");
        AbstractC0405d0 abstractC0405d0N = C0430v.f3466c;
        C0431w c0431w = C0431w.f3471a;
        AbstractC0405d0 abstractC0405d0 = null;
        if (!zStartsWith) {
            if (str.equals("none")) {
                return abstractC0405d0N;
            }
            if (str.equals("currentColor")) {
                return c0431w;
            }
            try {
                return n(str);
            } catch (C0 unused) {
                return null;
            }
        }
        int iIndexOf = str.indexOf(")");
        if (iIndexOf == -1) {
            return new J(str.substring(4).trim(), null);
        }
        String strTrim = str.substring(4, iIndexOf).trim();
        String strTrim2 = str.substring(iIndexOf + 1).trim();
        if (strTrim2.length() > 0) {
            if (!strTrim2.equals("none")) {
                if (strTrim2.equals("currentColor")) {
                    abstractC0405d0N = c0431w;
                } else {
                    try {
                        abstractC0405d0N = n(strTrim2);
                    } catch (C0 unused2) {
                        abstractC0405d0N = null;
                    }
                }
            }
            abstractC0405d0 = abstractC0405d0N;
        }
        return new J(strTrim, abstractC0405d0);
    }

    public static void x(AbstractC0407e0 abstractC0407e0, String str) throws C0 {
        int i6;
        L l = new L(str);
        l.J();
        String strC = l.C();
        if ("defer".equals(strC)) {
            l.J();
            strC = l.C();
        }
        EnumC0426q enumC0426q = (EnumC0426q) D0.f3166a.get(strC);
        l.J();
        if (l.n()) {
            i6 = 0;
        } else {
            String strC2 = l.C();
            strC2.getClass();
            if (strC2.equals("meet")) {
                i6 = 1;
            } else {
                if (!strC2.equals("slice")) {
                    throw new C0("Invalid preserveAspectRatio definition: ".concat(str));
                }
                i6 = 2;
            }
        }
        abstractC0407e0.f3375n = new r(enumC0426q, i6);
    }

    public static HashMap y(L l) {
        HashMap map = new HashMap();
        l.J();
        String strD = l.D('=', false);
        while (strD != null) {
            l.k('=');
            map.put(strD, l.B());
            l.J();
            strD = l.D('=', false);
        }
        return map;
    }

    public static Matrix z(String str) throws C0 {
        Matrix matrix = new Matrix();
        L l = new L(str);
        l.J();
        while (!l.n()) {
            String strSubstring = null;
            if (!l.n()) {
                int i6 = l.f3282b;
                String str2 = (String) l.f3284d;
                int iCharAt = str2.charAt(i6);
                while (true) {
                    if ((iCharAt >= 97 && iCharAt <= 122) || (iCharAt >= 65 && iCharAt <= 90)) {
                        iCharAt = l.g();
                    }
                }
                int i7 = l.f3282b;
                while (L.w(iCharAt)) {
                    iCharAt = l.g();
                }
                if (iCharAt == 40) {
                    l.f3282b++;
                    strSubstring = str2.substring(i6, i7);
                } else {
                    l.f3282b = i6;
                }
            }
            if (strSubstring == null) {
                throw new C0("Bad transform function encountered in transform list: ".concat(str));
            }
            switch (strSubstring) {
                case "matrix":
                    l.J();
                    float fZ = l.z();
                    l.I();
                    float fZ2 = l.z();
                    l.I();
                    float fZ3 = l.z();
                    l.I();
                    float fZ4 = l.z();
                    l.I();
                    float fZ5 = l.z();
                    l.I();
                    float fZ6 = l.z();
                    l.J();
                    if (Float.isNaN(fZ6) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    Matrix matrix2 = new Matrix();
                    matrix2.setValues(new float[]{fZ, fZ3, fZ5, fZ2, fZ4, fZ6, 0.0f, 0.0f, 1.0f});
                    matrix.preConcat(matrix2);
                    break;
                    break;
                case "rotate":
                    l.J();
                    float fZ7 = l.z();
                    float F5 = l.F();
                    float F6 = l.F();
                    l.J();
                    if (Float.isNaN(fZ7) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    if (Float.isNaN(F5)) {
                        matrix.preRotate(fZ7);
                    } else {
                        if (Float.isNaN(F6)) {
                            throw new C0("Invalid transform list: ".concat(str));
                        }
                        matrix.preRotate(fZ7, F5, F6);
                    }
                    break;
                    break;
                case "scale":
                    l.J();
                    float fZ8 = l.z();
                    float F7 = l.F();
                    l.J();
                    if (Float.isNaN(fZ8) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    if (!Float.isNaN(F7)) {
                        matrix.preScale(fZ8, F7);
                    } else {
                        matrix.preScale(fZ8, fZ8);
                    }
                    break;
                    break;
                case "skewX":
                    l.J();
                    float fZ9 = l.z();
                    l.J();
                    if (Float.isNaN(fZ9) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    matrix.preSkew((float) Math.tan(Math.toRadians(fZ9)), 0.0f);
                    break;
                    break;
                case "skewY":
                    l.J();
                    float fZ10 = l.z();
                    l.J();
                    if (Float.isNaN(fZ10) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    matrix.preSkew(0.0f, (float) Math.tan(Math.toRadians(fZ10)));
                    break;
                    break;
                case "translate":
                    l.J();
                    float fZ11 = l.z();
                    float F8 = l.F();
                    l.J();
                    if (Float.isNaN(fZ11) || !l.k(')')) {
                        throw new C0("Invalid transform list: ".concat(str));
                    }
                    if (!Float.isNaN(F8)) {
                        matrix.preTranslate(fZ11, F8);
                    } else {
                        matrix.preTranslate(fZ11, 0.0f);
                    }
                    break;
                    break;
                default:
                    throw new C0(Z0.o.o("Invalid transform list fn: ", strSubstring, ")"));
            }
            if (l.n()) {
                return matrix;
            }
            l.I();
        }
        return matrix;
    }

    public final void A(InputStream inputStream) throws C0 {
        Log.d("SVGParser", "Falling back to SAX parser");
        try {
            SAXParserFactory sAXParserFactoryNewInstance = SAXParserFactory.newInstance();
            sAXParserFactoryNewInstance.setFeature("http://xml.org/sax/features/external-general-entities", false);
            sAXParserFactoryNewInstance.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            XMLReader xMLReader = sAXParserFactoryNewInstance.newSAXParser().getXMLReader();
            H0 h0 = new H0(this);
            xMLReader.setContentHandler(h0);
            xMLReader.setProperty("http://xml.org/sax/properties/lexical-handler", h0);
            xMLReader.parse(new InputSource(inputStream));
        } catch (IOException e6) {
            throw new C0("Stream error", e6);
        } catch (ParserConfigurationException e7) {
            throw new C0("XML parser problem", e7);
        } catch (SAXException e8) {
            throw new C0("SVG parse error", e8);
        }
    }

    public final void B(InputStream inputStream) throws C0 {
        try {
            try {
                XmlPullParser xmlPullParserNewPullParser = Xml.newPullParser();
                K0 k02 = new K0();
                k02.f3280a = xmlPullParserNewPullParser;
                xmlPullParserNewPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-docdecl", false);
                xmlPullParserNewPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces", true);
                xmlPullParserNewPullParser.setInput(inputStream, null);
                for (int eventType = xmlPullParserNewPullParser.getEventType(); eventType != 1; eventType = xmlPullParserNewPullParser.nextToken()) {
                    if (eventType == 0) {
                        E();
                    } else if (eventType == 8) {
                        Log.d("SVGParser", "PROC INSTR: " + xmlPullParserNewPullParser.getText());
                        L l = new L(xmlPullParserNewPullParser.getText());
                        String strC = l.C();
                        y(l);
                        strC.equals("xml-stylesheet");
                    } else if (eventType == 10) {
                        if (((V) this.f3286a.f741b) == null && xmlPullParserNewPullParser.getText().contains("<!ENTITY ")) {
                            try {
                                Log.d("SVGParser", "Switching to SAX parser to process entities");
                                inputStream.reset();
                                A(inputStream);
                                return;
                            } catch (IOException unused) {
                                Log.w("SVGParser", "Detected internal entity definitions, but could not parse them.");
                                return;
                            }
                        }
                    } else if (eventType == 2) {
                        String name = xmlPullParserNewPullParser.getName();
                        if (xmlPullParserNewPullParser.getPrefix() != null) {
                            name = xmlPullParserNewPullParser.getPrefix() + ':' + name;
                        }
                        F(xmlPullParserNewPullParser.getNamespace(), xmlPullParserNewPullParser.getName(), name, k02);
                    } else if (eventType == 3) {
                        String name2 = xmlPullParserNewPullParser.getName();
                        if (xmlPullParserNewPullParser.getPrefix() != null) {
                            name2 = xmlPullParserNewPullParser.getPrefix() + ':' + name2;
                        }
                        c(xmlPullParserNewPullParser.getNamespace(), xmlPullParserNewPullParser.getName(), name2);
                    } else if (eventType == 4) {
                        int[] iArr = new int[2];
                        H(xmlPullParserNewPullParser.getTextCharacters(iArr), iArr[0], iArr[1]);
                    } else if (eventType == 5) {
                        G(xmlPullParserNewPullParser.getText());
                    }
                }
            } catch (XmlPullParserException e6) {
                throw new C0("XML parser problem", e6);
            }
        } catch (IOException e7) {
            throw new C0("Stream error", e7);
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:125:0x0329, code lost:
    
        android.util.Log.e("SVGParser", "Bad path coords for " + ((char) r5) + " path segment");
     */
    /* JADX WARN: Removed duplicated region for block: B:112:0x02f9  */
    /* JADX WARN: Removed duplicated region for block: B:149:0x033c A[SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void C(Attributes attributes) throws C0 {
        int iIntValue;
        float fZ;
        float f6;
        float f7;
        float f8;
        float f9;
        char cCharAt;
        Attributes attributes2 = attributes;
        Y y6 = this.f3287b;
        if (y6 == null) {
            throw new C0("Invalid document. Root element must be <svg>");
        }
        K k6 = new K();
        k6.f3370a = this.f3286a;
        k6.f3371b = y6;
        g(k6, attributes2);
        j(k6, attributes2);
        l(k6, attributes2);
        f(k6, attributes2);
        int i6 = 0;
        int i7 = 0;
        while (i7 < attributes2.getLength()) {
            String strTrim = attributes2.getValue(i7).trim();
            int iE = A0.a.e(attributes2, i7);
            float f10 = 0.0f;
            if (iE == 13) {
                L l = new L(strTrim);
                L l6 = new L(0);
                l6.f3282b = i6;
                l6.f3283c = i6;
                l6.f3284d = new byte[8];
                l6.f3285e = new float[16];
                if (!l.n() && ((iIntValue = l.y().intValue()) == 77 || iIntValue == 109)) {
                    float f11 = 0.0f;
                    float fZ2 = 0.0f;
                    float f12 = 0.0f;
                    float fJ = 0.0f;
                    float f13 = 0.0f;
                    float f14 = 0.0f;
                    while (true) {
                        l.J();
                        float f15 = f10;
                        switch (iIntValue) {
                            case RegisterRequest.U2F_V1_CHALLENGE_BYTE_LENGTH /* 65 */:
                            case 97:
                                float fZ3 = l.z();
                                float fJ2 = l.j(fZ3);
                                float f16 = f12;
                                float fJ3 = l.j(fJ2);
                                Boolean boolI = l.i(Float.valueOf(fJ3));
                                Boolean boolI2 = l.i(boolI);
                                if (boolI2 == null) {
                                    fZ = Float.NaN;
                                } else {
                                    l.I();
                                    fZ = l.z();
                                }
                                float f17 = fZ;
                                float fJ4 = l.j(f17);
                                if (!Float.isNaN(fJ4) && fZ3 >= f15 && fJ2 >= f15) {
                                    if (iIntValue == 97) {
                                        f6 = f17 + f11;
                                        fJ4 += f16;
                                    } else {
                                        f6 = f17;
                                    }
                                    boolean zBooleanValue = boolI.booleanValue();
                                    boolean zBooleanValue2 = boolI2.booleanValue();
                                    float f18 = f6;
                                    float f19 = fJ4;
                                    l6.d(fZ3, fJ2, fJ3, zBooleanValue, zBooleanValue2, f18, f19);
                                    f11 = f18;
                                    fZ2 = f11;
                                    f12 = f19;
                                    fJ = f12;
                                    l.I();
                                    if (l.n()) {
                                        int i8 = l.f3282b;
                                        if (i8 != l.f3283c && (((cCharAt = ((String) l.f3284d).charAt(i8)) >= 'a' && cCharAt <= 'z') || (cCharAt >= 'A' && cCharAt <= 'Z'))) {
                                            iIntValue = l.y().intValue();
                                        }
                                        f10 = f15;
                                    }
                                }
                                break;
                            case MdtaMetadataEntry.TYPE_INDICATOR_INT32 /* 67 */:
                            case 99:
                                float fZ4 = l.z();
                                float fJ5 = l.j(fZ4);
                                float fJ6 = l.j(fJ5);
                                float fJ7 = l.j(fJ6);
                                float fJ8 = l.j(fJ7);
                                float fJ9 = l.j(fJ8);
                                if (Float.isNaN(fJ9)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 99) {
                                        fJ8 += f11;
                                        fJ9 += f12;
                                        fZ4 += f11;
                                        fJ5 += f12;
                                        fJ6 += f11;
                                        fJ7 += f12;
                                    }
                                    float f20 = fZ4;
                                    float f21 = fJ5;
                                    f7 = fJ6;
                                    fJ = fJ7;
                                    f8 = fJ9;
                                    f9 = fJ8;
                                    l6.c(f20, f21, f7, fJ, f9, f8);
                                    fZ2 = f7;
                                    f11 = f9;
                                    f12 = f8;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 72:
                            case LocationRequest.PRIORITY_LOW_POWER /* 104 */:
                                float fZ5 = l.z();
                                if (Float.isNaN(fZ5)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 104) {
                                        fZ5 += f11;
                                    }
                                    f11 = fZ5;
                                    l6.e(f11, f12);
                                    fZ2 = f11;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 76:
                            case 108:
                                float fZ6 = l.z();
                                float fJ10 = l.j(fZ6);
                                if (Float.isNaN(fJ10)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 108) {
                                        fZ6 += f11;
                                        fJ10 += f12;
                                    }
                                    f11 = fZ6;
                                    f12 = fJ10;
                                    l6.e(f11, f12);
                                    fZ2 = f11;
                                    fJ = f12;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 77:
                            case 109:
                                float fZ7 = l.z();
                                float fJ11 = l.j(fZ7);
                                if (Float.isNaN(fJ11)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 109 && l6.f3282b != 0) {
                                        fZ7 += f11;
                                        fJ11 += f12;
                                    }
                                    f11 = fZ7;
                                    f12 = fJ11;
                                    l6.b(f11, f12);
                                    fZ2 = f11;
                                    f13 = fZ2;
                                    fJ = f12;
                                    f14 = fJ;
                                    iIntValue = iIntValue != 109 ? 76 : 108;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 81:
                            case 113:
                                fZ2 = l.z();
                                fJ = l.j(fZ2);
                                float fJ12 = l.j(fJ);
                                float fJ13 = l.j(fJ12);
                                if (Float.isNaN(fJ13)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 113) {
                                        fJ12 += f11;
                                        fJ13 += f12;
                                        fZ2 += f11;
                                        fJ += f12;
                                    }
                                    f11 = fJ12;
                                    f12 = fJ13;
                                    l6.a(fZ2, fJ, f11, f12);
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 83:
                            case 115:
                                float f22 = (f11 * 2.0f) - fZ2;
                                float f23 = (2.0f * f12) - fJ;
                                float fZ8 = l.z();
                                float fJ14 = l.j(fZ8);
                                float fJ15 = l.j(fJ14);
                                float fJ16 = l.j(fJ15);
                                if (Float.isNaN(fJ16)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 115) {
                                        fJ15 += f11;
                                        fJ16 += f12;
                                        fZ8 += f11;
                                        fJ14 += f12;
                                    }
                                    f7 = fZ8;
                                    fJ = fJ14;
                                    f8 = fJ16;
                                    f9 = fJ15;
                                    l6.c(f22, f23, f7, fJ, f9, f8);
                                    fZ2 = f7;
                                    f11 = f9;
                                    f12 = f8;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 84:
                            case AppInfoTableDecoder.APPLICATION_INFORMATION_TABLE_ID /* 116 */:
                                fZ2 = (f11 * 2.0f) - fZ2;
                                fJ = (2.0f * f12) - fJ;
                                float fZ9 = l.z();
                                float fJ17 = l.j(fZ9);
                                if (Float.isNaN(fJ17)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 116) {
                                        fZ9 += f11;
                                        fJ17 += f12;
                                    }
                                    f11 = fZ9;
                                    f12 = fJ17;
                                    l6.a(fZ2, fJ, f11, f12);
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 86:
                            case 118:
                                float fZ10 = l.z();
                                if (Float.isNaN(fZ10)) {
                                    Log.e("SVGParser", "Bad path coords for " + ((char) iIntValue) + " path segment");
                                    break;
                                } else {
                                    if (iIntValue == 118) {
                                        fZ10 += f12;
                                    }
                                    f12 = fZ10;
                                    l6.e(f11, f12);
                                    fJ = f12;
                                    l.I();
                                    if (l.n()) {
                                    }
                                }
                                break;
                            case 90:
                            case 122:
                                l6.close();
                                f11 = f13;
                                fZ2 = f11;
                                f12 = f14;
                                fJ = f12;
                                l.I();
                                if (l.n()) {
                                }
                                break;
                        }
                    }
                }
                k6.f3279o = l6;
            } else if (iE == 43 && p(strTrim) < 0.0f) {
                throw new C0("Invalid <path> element. pathLength cannot be negative");
            }
            i7++;
            attributes2 = attributes;
            i6 = 0;
        }
        this.f3287b.e(k6);
    }

    public final void E() {
        C4.f fVar = new C4.f(5, false);
        fVar.f741b = null;
        fVar.f742c = new C0334s(1, (byte) 0);
        fVar.f743d = new HashMap();
        this.f3286a = fVar;
    }

    /* JADX WARN: Code restructure failed: missing block: B:626:0x00fe, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:657:0x0479, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:684:0x0631, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:698:0x06ed, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:733:0x0910, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:761:0x0b40, code lost:
    
        continue;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void F(String str, String str2, String str3, Attributes attributes) throws C0 {
        boolean z6;
        if (this.f3288c) {
            this.f3289d++;
            return;
        }
        if ("http://www.w3.org/2000/svg".equals(str) || "".equals(str)) {
            J0 j02 = (J0) J0.f3277e.get(str2.length() > 0 ? str2 : str3);
            if (j02 == null) {
                j02 = J0.f3276d;
            }
            switch (j02.ordinal()) {
                case 0:
                    V v3 = new V();
                    v3.f3370a = this.f3286a;
                    v3.f3371b = this.f3287b;
                    g(v3, attributes);
                    j(v3, attributes);
                    f(v3, attributes);
                    m(v3, attributes);
                    for (int i6 = 0; i6 < attributes.getLength(); i6++) {
                        String strTrim = attributes.getValue(i6).trim();
                        int iE = A0.a.e(attributes, i6);
                        if (iE == 25) {
                            E eS = s(strTrim);
                            v3.f3352s = eS;
                            if (eS.f()) {
                                throw new C0("Invalid <svg> element. height cannot be negative");
                            }
                        } else if (iE != 79) {
                            switch (iE) {
                                case 81:
                                    E eS2 = s(strTrim);
                                    v3.f3351r = eS2;
                                    if (eS2.f()) {
                                        throw new C0("Invalid <svg> element. width cannot be negative");
                                    }
                                    break;
                                    break;
                                case 82:
                                    v3.f3349p = s(strTrim);
                                    break;
                                case 83:
                                    v3.f3350q = s(strTrim);
                                    break;
                            }
                        } else {
                            continue;
                        }
                    }
                    Y y6 = this.f3287b;
                    if (y6 == null) {
                        this.f3286a.f741b = v3;
                    } else {
                        y6.e(v3);
                    }
                    this.f3287b = v3;
                    return;
                case 1:
                case 7:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    B b5 = new B();
                    b5.f3370a = this.f3286a;
                    b5.f3371b = this.f3287b;
                    g(b5, attributes);
                    j(b5, attributes);
                    l(b5, attributes);
                    f(b5, attributes);
                    this.f3287b.e(b5);
                    this.f3287b = b5;
                    return;
                case 2:
                    Y y7 = this.f3287b;
                    if (y7 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0428t c0428t = new C0428t();
                    c0428t.f3370a = this.f3286a;
                    c0428t.f3371b = y7;
                    g(c0428t, attributes);
                    j(c0428t, attributes);
                    l(c0428t, attributes);
                    f(c0428t, attributes);
                    for (int i7 = 0; i7 < attributes.getLength(); i7++) {
                        String strTrim2 = attributes.getValue(i7).trim();
                        int iE2 = A0.a.e(attributes, i7);
                        if (iE2 == 6) {
                            c0428t.f3448o = s(strTrim2);
                        } else if (iE2 == 7) {
                            c0428t.f3449p = s(strTrim2);
                        } else if (iE2 != 49) {
                            continue;
                        } else {
                            E eS3 = s(strTrim2);
                            c0428t.f3450q = eS3;
                            if (eS3.f()) {
                                throw new C0("Invalid <circle> element. r cannot be negative");
                            }
                        }
                    }
                    this.f3287b.e(c0428t);
                    return;
                case 3:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0429u c0429u = new C0429u();
                    c0429u.f3370a = this.f3286a;
                    c0429u.f3371b = this.f3287b;
                    g(c0429u, attributes);
                    j(c0429u, attributes);
                    l(c0429u, attributes);
                    f(c0429u, attributes);
                    for (int i8 = 0; i8 < attributes.getLength(); i8++) {
                        String strTrim3 = attributes.getValue(i8).trim();
                        if (A0.a.e(attributes, i8) == 3) {
                            if ("objectBoundingBox".equals(strTrim3)) {
                                c0429u.f3459o = Boolean.FALSE;
                            } else {
                                if (!"userSpaceOnUse".equals(strTrim3)) {
                                    throw new C0("Invalid value for attribute clipPathUnits");
                                }
                                c0429u.f3459o = Boolean.TRUE;
                            }
                        }
                    }
                    this.f3287b.e(c0429u);
                    this.f3287b = c0429u;
                    return;
                case 4:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0432x c0432x = new C0432x();
                    c0432x.f3370a = this.f3286a;
                    c0432x.f3371b = this.f3287b;
                    g(c0432x, attributes);
                    j(c0432x, attributes);
                    l(c0432x, attributes);
                    this.f3287b.e(c0432x);
                    this.f3287b = c0432x;
                    return;
                case 5:
                case 26:
                    this.f3290e = true;
                    this.f3291f = j02;
                    return;
                case 6:
                    Y y8 = this.f3287b;
                    if (y8 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0433y c0433y = new C0433y();
                    c0433y.f3370a = this.f3286a;
                    c0433y.f3371b = y8;
                    g(c0433y, attributes);
                    j(c0433y, attributes);
                    l(c0433y, attributes);
                    f(c0433y, attributes);
                    for (int i9 = 0; i9 < attributes.getLength(); i9++) {
                        String strTrim4 = attributes.getValue(i9).trim();
                        int iE3 = A0.a.e(attributes, i9);
                        if (iE3 == 6) {
                            c0433y.f3476o = s(strTrim4);
                        } else if (iE3 == 7) {
                            c0433y.f3477p = s(strTrim4);
                        } else if (iE3 == 56) {
                            E eS4 = s(strTrim4);
                            c0433y.f3478q = eS4;
                            if (eS4.f()) {
                                throw new C0("Invalid <ellipse> element. rx cannot be negative");
                            }
                        } else if (iE3 != 57) {
                            continue;
                        } else {
                            E eS5 = s(strTrim4);
                            c0433y.f3479r = eS5;
                            if (eS5.f()) {
                                throw new C0("Invalid <ellipse> element. ry cannot be negative");
                            }
                        }
                    }
                    this.f3287b.e(c0433y);
                    return;
                case 8:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    D d6 = new D();
                    d6.f3370a = this.f3286a;
                    d6.f3371b = this.f3287b;
                    g(d6, attributes);
                    j(d6, attributes);
                    l(d6, attributes);
                    f(d6, attributes);
                    for (int i10 = 0; i10 < attributes.getLength(); i10++) {
                        String strTrim5 = attributes.getValue(i10).trim();
                        int iE4 = A0.a.e(attributes, i10);
                        if (iE4 == 25) {
                            E eS6 = s(strTrim5);
                            d6.f3164s = eS6;
                            if (eS6.f()) {
                                throw new C0("Invalid <use> element. height cannot be negative");
                            }
                        } else if (iE4 != 26) {
                            if (iE4 != 48) {
                                switch (iE4) {
                                    case 81:
                                        E eS7 = s(strTrim5);
                                        d6.f3163r = eS7;
                                        if (eS7.f()) {
                                            throw new C0("Invalid <use> element. width cannot be negative");
                                        }
                                        break;
                                        break;
                                    case 82:
                                        d6.f3161p = s(strTrim5);
                                        break;
                                    case 83:
                                        d6.f3162q = s(strTrim5);
                                        break;
                                }
                            } else {
                                x(d6, strTrim5);
                            }
                        } else if ("".equals(attributes.getURI(i10)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i10))) {
                            d6.f3160o = strTrim5;
                        }
                    }
                    this.f3287b.e(d6);
                    this.f3287b = d6;
                    return;
                case 9:
                    Y y9 = this.f3287b;
                    if (y9 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    F f6 = new F();
                    f6.f3370a = this.f3286a;
                    f6.f3371b = y9;
                    g(f6, attributes);
                    j(f6, attributes);
                    l(f6, attributes);
                    f(f6, attributes);
                    for (int i11 = 0; i11 < attributes.getLength(); i11++) {
                        String strTrim6 = attributes.getValue(i11).trim();
                        switch (A0.a.e(attributes, i11)) {
                            case 84:
                                f6.f3170o = s(strTrim6);
                                break;
                            case 85:
                                f6.f3171p = s(strTrim6);
                                break;
                            case 86:
                                f6.f3172q = s(strTrim6);
                                break;
                            case 87:
                                f6.f3173r = s(strTrim6);
                                break;
                        }
                    }
                    this.f3287b.e(f6);
                    return;
                case 10:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0401b0 c0401b0 = new C0401b0();
                    c0401b0.f3370a = this.f3286a;
                    c0401b0.f3371b = this.f3287b;
                    g(c0401b0, attributes);
                    j(c0401b0, attributes);
                    h(c0401b0, attributes);
                    for (int i12 = 0; i12 < attributes.getLength(); i12++) {
                        String strTrim7 = attributes.getValue(i12).trim();
                        switch (A0.a.e(attributes, i12)) {
                            case 84:
                                c0401b0.f3366m = s(strTrim7);
                                break;
                            case 85:
                                c0401b0.f3367n = s(strTrim7);
                                break;
                            case 86:
                                c0401b0.f3368o = s(strTrim7);
                                break;
                            case 87:
                                c0401b0.f3369p = s(strTrim7);
                                break;
                        }
                    }
                    this.f3287b.e(c0401b0);
                    this.f3287b = c0401b0;
                    return;
                case 11:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    G g6 = new G();
                    g6.f3370a = this.f3286a;
                    g6.f3371b = this.f3287b;
                    g(g6, attributes);
                    j(g6, attributes);
                    f(g6, attributes);
                    m(g6, attributes);
                    for (int i13 = 0; i13 < attributes.getLength(); i13++) {
                        String strTrim8 = attributes.getValue(i13).trim();
                        int iE5 = A0.a.e(attributes, i13);
                        if (iE5 != 41) {
                            if (iE5 == 50) {
                                g6.f3176q = s(strTrim8);
                            } else if (iE5 != 51) {
                                switch (iE5) {
                                    case 32:
                                        E eS8 = s(strTrim8);
                                        g6.f3179t = eS8;
                                        if (eS8.f()) {
                                            throw new C0("Invalid <marker> element. markerHeight cannot be negative");
                                        }
                                        continue;
                                        break;
                                    case 33:
                                        if (!"strokeWidth".equals(strTrim8)) {
                                            if (!"userSpaceOnUse".equals(strTrim8)) {
                                                throw new C0("Invalid value for attribute markerUnits");
                                            }
                                            g6.f3175p = true;
                                        } else {
                                            g6.f3175p = false;
                                            continue;
                                        }
                                        break;
                                    case 34:
                                        E eS9 = s(strTrim8);
                                        g6.f3178s = eS9;
                                        if (eS9.f()) {
                                            throw new C0("Invalid <marker> element. markerWidth cannot be negative");
                                        }
                                        break;
                                }
                            } else {
                                g6.f3177r = s(strTrim8);
                            }
                        } else if (TtmlNode.TEXT_EMPHASIS_AUTO.equals(strTrim8)) {
                            g6.f3180u = Float.valueOf(Float.NaN);
                        } else {
                            g6.f3180u = Float.valueOf(p(strTrim8));
                        }
                    }
                    this.f3287b.e(g6);
                    this.f3287b = g6;
                    return;
                case 12:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    H h5 = new H();
                    h5.f3370a = this.f3286a;
                    h5.f3371b = this.f3287b;
                    g(h5, attributes);
                    j(h5, attributes);
                    f(h5, attributes);
                    for (int i14 = 0; i14 < attributes.getLength(); i14++) {
                        String strTrim9 = attributes.getValue(i14).trim();
                        int iE6 = A0.a.e(attributes, i14);
                        if (iE6 == 25) {
                            E eS10 = s(strTrim9);
                            h5.f3185q = eS10;
                            if (eS10.f()) {
                                throw new C0("Invalid <mask> element. height cannot be negative");
                            }
                        } else if (iE6 != 36) {
                            if (iE6 != 37) {
                                switch (iE6) {
                                    case 81:
                                        E eS11 = s(strTrim9);
                                        h5.f3184p = eS11;
                                        if (eS11.f()) {
                                            throw new C0("Invalid <mask> element. width cannot be negative");
                                        }
                                        break;
                                        break;
                                    case 82:
                                        s(strTrim9);
                                        break;
                                    case 83:
                                        s(strTrim9);
                                        break;
                                }
                            } else if ("objectBoundingBox".equals(strTrim9)) {
                                h5.f3182n = Boolean.FALSE;
                            } else {
                                if (!"userSpaceOnUse".equals(strTrim9)) {
                                    throw new C0("Invalid value for attribute maskUnits");
                                }
                                h5.f3182n = Boolean.TRUE;
                            }
                        } else if ("objectBoundingBox".equals(strTrim9)) {
                            h5.f3183o = Boolean.FALSE;
                        } else {
                            if (!"userSpaceOnUse".equals(strTrim9)) {
                                throw new C0("Invalid value for attribute maskContentUnits");
                            }
                            h5.f3183o = Boolean.TRUE;
                        }
                    }
                    this.f3287b.e(h5);
                    this.f3287b = h5;
                    return;
                case 13:
                    C(attributes);
                    return;
                case 14:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    N n6 = new N();
                    n6.f3370a = this.f3286a;
                    n6.f3371b = this.f3287b;
                    g(n6, attributes);
                    j(n6, attributes);
                    f(n6, attributes);
                    m(n6, attributes);
                    for (int i15 = 0; i15 < attributes.getLength(); i15++) {
                        String strTrim10 = attributes.getValue(i15).trim();
                        int iE7 = A0.a.e(attributes, i15);
                        if (iE7 == 25) {
                            E eS12 = s(strTrim10);
                            n6.f3301v = eS12;
                            if (eS12.f()) {
                                throw new C0("Invalid <pattern> element. height cannot be negative");
                            }
                        } else if (iE7 != 26) {
                            switch (iE7) {
                                case 44:
                                    if (!"objectBoundingBox".equals(strTrim10)) {
                                        if (!"userSpaceOnUse".equals(strTrim10)) {
                                            throw new C0("Invalid value for attribute patternContentUnits");
                                        }
                                        n6.f3296q = Boolean.TRUE;
                                    } else {
                                        n6.f3296q = Boolean.FALSE;
                                    }
                                    break;
                                case 45:
                                    n6.f3297r = z(strTrim10);
                                    break;
                                case 46:
                                    if (!"objectBoundingBox".equals(strTrim10)) {
                                        if (!"userSpaceOnUse".equals(strTrim10)) {
                                            throw new C0("Invalid value for attribute patternUnits");
                                        }
                                        n6.f3295p = Boolean.TRUE;
                                    } else {
                                        n6.f3295p = Boolean.FALSE;
                                    }
                                    break;
                                default:
                                    switch (iE7) {
                                        case 81:
                                            E eS13 = s(strTrim10);
                                            n6.f3300u = eS13;
                                            if (eS13.f()) {
                                                throw new C0("Invalid <pattern> element. width cannot be negative");
                                            }
                                            break;
                                            break;
                                        case 82:
                                            n6.f3298s = s(strTrim10);
                                            break;
                                        case 83:
                                            n6.f3299t = s(strTrim10);
                                            break;
                                    }
                                    break;
                            }
                        } else if ("".equals(attributes.getURI(i15)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i15))) {
                            n6.f3302w = strTrim10;
                        }
                    }
                    this.f3287b.e(n6);
                    this.f3287b = n6;
                    return;
                case 15:
                    Y y10 = this.f3287b;
                    if (y10 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    P p6 = new P();
                    p6.f3370a = this.f3286a;
                    p6.f3371b = y10;
                    g(p6, attributes);
                    j(p6, attributes);
                    l(p6, attributes);
                    f(p6, attributes);
                    i(p6, attributes, "polygon");
                    this.f3287b.e(p6);
                    return;
                case 16:
                    Y y11 = this.f3287b;
                    if (y11 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    O o6 = new O();
                    o6.f3370a = this.f3286a;
                    o6.f3371b = y11;
                    g(o6, attributes);
                    j(o6, attributes);
                    l(o6, attributes);
                    f(o6, attributes);
                    i(o6, attributes, "polyline");
                    this.f3287b.e(o6);
                    return;
                case 17:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0409f0 c0409f0 = new C0409f0();
                    c0409f0.f3370a = this.f3286a;
                    c0409f0.f3371b = this.f3287b;
                    g(c0409f0, attributes);
                    j(c0409f0, attributes);
                    h(c0409f0, attributes);
                    for (int i16 = 0; i16 < attributes.getLength(); i16++) {
                        String strTrim11 = attributes.getValue(i16).trim();
                        int iE8 = A0.a.e(attributes, i16);
                        if (iE8 == 6) {
                            c0409f0.f3381m = s(strTrim11);
                        } else if (iE8 == 7) {
                            c0409f0.f3382n = s(strTrim11);
                        } else if (iE8 == 11) {
                            c0409f0.f3384p = s(strTrim11);
                        } else if (iE8 == 12) {
                            c0409f0.f3385q = s(strTrim11);
                        } else if (iE8 != 49) {
                            continue;
                        } else {
                            E eS14 = s(strTrim11);
                            c0409f0.f3383o = eS14;
                            if (eS14.f()) {
                                throw new C0("Invalid <radialGradient> element. r cannot be negative");
                            }
                        }
                    }
                    this.f3287b.e(c0409f0);
                    this.f3287b = c0409f0;
                    return;
                case 18:
                    Y y12 = this.f3287b;
                    if (y12 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    Q q6 = new Q();
                    q6.f3370a = this.f3286a;
                    q6.f3371b = y12;
                    g(q6, attributes);
                    j(q6, attributes);
                    l(q6, attributes);
                    f(q6, attributes);
                    for (int i17 = 0; i17 < attributes.getLength(); i17++) {
                        String strTrim12 = attributes.getValue(i17).trim();
                        int iE9 = A0.a.e(attributes, i17);
                        if (iE9 == 25) {
                            E eS15 = s(strTrim12);
                            q6.f3307r = eS15;
                            if (eS15.f()) {
                                throw new C0("Invalid <rect> element. height cannot be negative");
                            }
                        } else if (iE9 == 56) {
                            E eS16 = s(strTrim12);
                            q6.f3308s = eS16;
                            if (eS16.f()) {
                                throw new C0("Invalid <rect> element. rx cannot be negative");
                            }
                        } else if (iE9 != 57) {
                            switch (iE9) {
                                case 81:
                                    E eS17 = s(strTrim12);
                                    q6.f3306q = eS17;
                                    if (eS17.f()) {
                                        throw new C0("Invalid <rect> element. width cannot be negative");
                                    }
                                    break;
                                    break;
                                case 82:
                                    q6.f3304o = s(strTrim12);
                                    break;
                                case 83:
                                    q6.f3305p = s(strTrim12);
                                    break;
                            }
                        } else {
                            E eS18 = s(strTrim12);
                            q6.f3309t = eS18;
                            if (eS18.f()) {
                                throw new C0("Invalid <rect> element. ry cannot be negative");
                            }
                        }
                    }
                    this.f3287b.e(q6);
                    return;
                case 19:
                    Y y13 = this.f3287b;
                    if (y13 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    S s6 = new S();
                    s6.f3370a = this.f3286a;
                    s6.f3371b = y13;
                    g(s6, attributes);
                    j(s6, attributes);
                    this.f3287b.e(s6);
                    this.f3287b = s6;
                    return;
                case 20:
                    Y y14 = this.f3287b;
                    if (y14 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    if (!(y14 instanceof AbstractC0434z)) {
                        throw new C0("Invalid document. <stop> elements are only valid inside <linearGradient> or <radialGradient> elements.");
                    }
                    T t6 = new T();
                    t6.f3370a = this.f3286a;
                    t6.f3371b = y14;
                    g(t6, attributes);
                    j(t6, attributes);
                    for (int i18 = 0; i18 < attributes.getLength(); i18++) {
                        String strTrim13 = attributes.getValue(i18).trim();
                        if (A0.a.e(attributes, i18) == 39) {
                            if (strTrim13.length() == 0) {
                                throw new C0("Invalid offset value in <stop> (empty string)");
                            }
                            int length = strTrim13.length();
                            if (strTrim13.charAt(strTrim13.length() - 1) == '%') {
                                length--;
                                z6 = true;
                            } else {
                                z6 = false;
                            }
                            try {
                                float fO = o(length, strTrim13);
                                float f7 = 100.0f;
                                if (z6) {
                                    fO /= 100.0f;
                                }
                                if (fO < 0.0f) {
                                    f7 = 0.0f;
                                } else if (fO <= 100.0f) {
                                    f7 = fO;
                                }
                                t6.f3310h = Float.valueOf(f7);
                            } catch (NumberFormatException e6) {
                                throw new C0("Invalid offset value in <stop>: ".concat(strTrim13), e6);
                            }
                        }
                    }
                    this.f3287b.e(t6);
                    this.f3287b = t6;
                    return;
                case 21:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    String str4 = TtmlNode.COMBINE_ALL;
                    boolean zEquals = true;
                    for (int i19 = 0; i19 < attributes.getLength(); i19++) {
                        String strTrim14 = attributes.getValue(i19).trim();
                        int iE10 = A0.a.e(attributes, i19);
                        if (iE10 == 38) {
                            str4 = strTrim14;
                        } else if (iE10 == 77) {
                            zEquals = strTrim14.equals("text/css");
                        }
                    }
                    if (zEquals) {
                        EnumC0404d enumC0404d = EnumC0404d.f3373b;
                        C0402c c0402c = new C0402c(str4);
                        c0402c.J();
                        for (EnumC0404d enumC0404d2 : C0325i.c(c0402c)) {
                            if (enumC0404d2 == EnumC0404d.f3372a || enumC0404d2 == enumC0404d) {
                                this.f3293h = true;
                                return;
                            }
                        }
                    }
                    this.f3288c = true;
                    this.f3289d = 1;
                    return;
                case 22:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0413h0 c0413h0 = new C0413h0();
                    c0413h0.f3370a = this.f3286a;
                    c0413h0.f3371b = this.f3287b;
                    g(c0413h0, attributes);
                    j(c0413h0, attributes);
                    l(c0413h0, attributes);
                    f(c0413h0, attributes);
                    this.f3287b.e(c0413h0);
                    this.f3287b = c0413h0;
                    return;
                case 23:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0415i0 c0415i0 = new C0415i0();
                    c0415i0.f3370a = this.f3286a;
                    c0415i0.f3371b = this.f3287b;
                    g(c0415i0, attributes);
                    j(c0415i0, attributes);
                    f(c0415i0, attributes);
                    m(c0415i0, attributes);
                    this.f3287b.e(c0415i0);
                    this.f3287b = c0415i0;
                    return;
                case 24:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    C0421l0 c0421l0 = new C0421l0();
                    c0421l0.f3370a = this.f3286a;
                    c0421l0.f3371b = this.f3287b;
                    g(c0421l0, attributes);
                    j(c0421l0, attributes);
                    l(c0421l0, attributes);
                    f(c0421l0, attributes);
                    k(c0421l0, attributes);
                    this.f3287b.e(c0421l0);
                    this.f3287b = c0421l0;
                    return;
                case 25:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    o0 o0Var = new o0();
                    o0Var.f3370a = this.f3286a;
                    o0Var.f3371b = this.f3287b;
                    g(o0Var, attributes);
                    j(o0Var, attributes);
                    f(o0Var, attributes);
                    for (int i20 = 0; i20 < attributes.getLength(); i20++) {
                        String strTrim15 = attributes.getValue(i20).trim();
                        int iE11 = A0.a.e(attributes, i20);
                        if (iE11 != 26) {
                            if (iE11 == 61) {
                                o0Var.f3414o = s(strTrim15);
                            }
                        } else if ("".equals(attributes.getURI(i20)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i20))) {
                            o0Var.f3413n = strTrim15;
                        }
                    }
                    this.f3287b.e(o0Var);
                    this.f3287b = o0Var;
                    Y y15 = o0Var.f3371b;
                    if (y15 instanceof C0421l0) {
                        o0Var.f3415p = (C0421l0) y15;
                        return;
                    } else {
                        o0Var.f3415p = ((m0) y15).c();
                        return;
                    }
                case 27:
                    Y y16 = this.f3287b;
                    if (y16 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    if (!(y16 instanceof n0)) {
                        throw new C0("Invalid document. <tref> elements are only valid inside <text> or <tspan> elements.");
                    }
                    C0417j0 c0417j0 = new C0417j0();
                    c0417j0.f3370a = this.f3286a;
                    c0417j0.f3371b = this.f3287b;
                    g(c0417j0, attributes);
                    j(c0417j0, attributes);
                    f(c0417j0, attributes);
                    for (int i21 = 0; i21 < attributes.getLength(); i21++) {
                        String strTrim16 = attributes.getValue(i21).trim();
                        if (A0.a.e(attributes, i21) == 26 && ("".equals(attributes.getURI(i21)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i21)))) {
                            c0417j0.f3396n = strTrim16;
                        }
                    }
                    this.f3287b.e(c0417j0);
                    Y y17 = c0417j0.f3371b;
                    if (y17 instanceof C0421l0) {
                        c0417j0.f3397o = (C0421l0) y17;
                        return;
                    } else {
                        c0417j0.f3397o = ((m0) y17).c();
                        return;
                    }
                case 28:
                    Y y18 = this.f3287b;
                    if (y18 == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    if (!(y18 instanceof n0)) {
                        throw new C0("Invalid document. <tspan> elements are only valid inside <text> or other <tspan> elements.");
                    }
                    C0419k0 c0419k0 = new C0419k0();
                    c0419k0.f3370a = this.f3286a;
                    c0419k0.f3371b = this.f3287b;
                    g(c0419k0, attributes);
                    j(c0419k0, attributes);
                    f(c0419k0, attributes);
                    k(c0419k0, attributes);
                    this.f3287b.e(c0419k0);
                    this.f3287b = c0419k0;
                    Y y19 = c0419k0.f3371b;
                    if (y19 instanceof C0421l0) {
                        c0419k0.f3400r = (C0421l0) y19;
                        return;
                    } else {
                        c0419k0.f3400r = ((m0) y19).c();
                        return;
                    }
                case 29:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    r0 r0Var = new r0();
                    r0Var.f3370a = this.f3286a;
                    r0Var.f3371b = this.f3287b;
                    g(r0Var, attributes);
                    j(r0Var, attributes);
                    l(r0Var, attributes);
                    f(r0Var, attributes);
                    for (int i22 = 0; i22 < attributes.getLength(); i22++) {
                        String strTrim17 = attributes.getValue(i22).trim();
                        int iE12 = A0.a.e(attributes, i22);
                        if (iE12 == 25) {
                            E eS19 = s(strTrim17);
                            r0Var.f3442s = eS19;
                            if (eS19.f()) {
                                throw new C0("Invalid <use> element. height cannot be negative");
                            }
                        } else if (iE12 != 26) {
                            switch (iE12) {
                                case 81:
                                    E eS20 = s(strTrim17);
                                    r0Var.f3441r = eS20;
                                    if (eS20.f()) {
                                        throw new C0("Invalid <use> element. width cannot be negative");
                                    }
                                    break;
                                    break;
                                case 82:
                                    r0Var.f3439p = s(strTrim17);
                                    break;
                                case 83:
                                    r0Var.f3440q = s(strTrim17);
                                    break;
                            }
                        } else if ("".equals(attributes.getURI(i22)) || "http://www.w3.org/1999/xlink".equals(attributes.getURI(i22))) {
                            r0Var.f3438o = strTrim17;
                        }
                    }
                    this.f3287b.e(r0Var);
                    this.f3287b = r0Var;
                    return;
                case 30:
                    if (this.f3287b == null) {
                        throw new C0("Invalid document. Root element must be <svg>");
                    }
                    s0 s0Var = new s0();
                    s0Var.f3370a = this.f3286a;
                    s0Var.f3371b = this.f3287b;
                    g(s0Var, attributes);
                    f(s0Var, attributes);
                    m(s0Var, attributes);
                    this.f3287b.e(s0Var);
                    this.f3287b = s0Var;
                    return;
                default:
                    this.f3288c = true;
                    this.f3289d = 1;
                    return;
            }
        }
    }

    public final void G(String str) {
        if (this.f3288c) {
            return;
        }
        if (this.f3290e) {
            if (this.f3292g == null) {
                this.f3292g = new StringBuilder(str.length());
            }
            this.f3292g.append(str);
        } else if (this.f3293h) {
            if (this.f3294i == null) {
                this.f3294i = new StringBuilder(str.length());
            }
            this.f3294i.append(str);
        } else if (this.f3287b instanceof n0) {
            a(str);
        }
    }

    public final void H(char[] cArr, int i6, int i7) {
        if (this.f3288c) {
            return;
        }
        if (this.f3290e) {
            if (this.f3292g == null) {
                this.f3292g = new StringBuilder(i7);
            }
            this.f3292g.append(cArr, i6, i7);
        } else if (this.f3293h) {
            if (this.f3294i == null) {
                this.f3294i = new StringBuilder(i7);
            }
            this.f3294i.append(cArr, i6, i7);
        } else if (this.f3287b instanceof n0) {
            a(new String(cArr, i6, i7));
        }
    }

    public final void a(String str) {
        X x6 = (X) this.f3287b;
        int size = x6.f3353i.size();
        AbstractC0403c0 abstractC0403c0 = size == 0 ? null : (AbstractC0403c0) x6.f3353i.get(size - 1);
        if (abstractC0403c0 instanceof q0) {
            q0 q0Var = (q0) abstractC0403c0;
            q0Var.f3433c = com.google.android.recaptcha.internal.a.n(new StringBuilder(), q0Var.f3433c, str);
        } else {
            Y y6 = this.f3287b;
            q0 q0Var2 = new q0();
            q0Var2.f3433c = str;
            y6.e(q0Var2);
        }
    }

    public final void c(String str, String str2, String str3) {
        if (this.f3288c) {
            int i6 = this.f3289d - 1;
            this.f3289d = i6;
            if (i6 == 0) {
                this.f3288c = false;
            }
        }
        if ("http://www.w3.org/2000/svg".equals(str) || "".equals(str)) {
            if (str2.length() <= 0) {
                str2 = str3;
            }
            J0 j02 = (J0) J0.f3277e.get(str2);
            if (j02 == null) {
                j02 = J0.f3276d;
            }
            switch (j02.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.f3287b = ((AbstractC0403c0) this.f3287b).f3371b;
                    break;
                case 5:
                case 26:
                    this.f3290e = false;
                    if (this.f3292g != null) {
                        J0 j03 = this.f3291f;
                        if (j03 == J0.f3275c || j03 == J0.f3273a) {
                            this.f3286a.getClass();
                        }
                        this.f3292g.setLength(0);
                    }
                    break;
                case 21:
                    StringBuilder sb = this.f3294i;
                    if (sb != null) {
                        this.f3293h = false;
                        String string = sb.toString();
                        C0325i c0325i = new C0325i(1);
                        C4.f fVar = this.f3286a;
                        C0402c c0402c = new C0402c(string);
                        c0402c.J();
                        ((C0334s) fVar.f742c).c(c0325i.e(c0402c));
                        this.f3294i.setLength(0);
                    }
                    break;
            }
        }
    }
}
