package A;

import J0.C0378p0;
import T0.C0594e;
import T0.C0596g;
import T0.G;
import X0.C;
import X0.D;
import X0.I;
import android.content.ClipData;
import android.os.Parcel;
import android.text.Annotation;
import android.text.SpannableString;
import android.util.Base64;
import f1.C2013a;
import f1.C2024l;
import f1.C2028p;
import h1.o;
import java.util.ArrayList;
import java.util.List;
import p0.C2714u;
import p0.W;
import x4.y;

/* JADX INFO: loaded from: classes.dex */
public abstract class d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final StackTraceElement[] f44a = new StackTraceElement[0];

    /* JADX WARN: Removed duplicated region for block: B:37:0x00a6  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final C0378p0 a(C0596g c0596g) {
        List list = y.f26065a;
        ArrayList arrayList = c0596g.f6511c;
        boolean zIsEmpty = (arrayList == null ? list : arrayList).isEmpty();
        CharSequence charSequence = c0596g.f6510b;
        if (!zIsEmpty) {
            SpannableString spannableString = new SpannableString(charSequence);
            a aVar = new a();
            aVar.f42a = Parcel.obtain();
            if (arrayList != null) {
                list = arrayList;
            }
            int size = list.size();
            int i6 = 0;
            while (i6 < size) {
                C0594e c0594e = (C0594e) list.get(i6);
                G g6 = (G) c0594e.f6503a;
                aVar.f42a.recycle();
                aVar.f42a = Parcel.obtain();
                long jA = g6.f6439a.a();
                long j4 = C2714u.f22945m;
                if (!C2714u.d(jA, j4)) {
                    aVar.c((byte) 1);
                    aVar.f42a.writeLong(g6.f6439a.a());
                }
                long j6 = o.f16633c;
                int i7 = i6;
                long j7 = g6.f6440b;
                byte b5 = 2;
                if (!o.a(j7, j6)) {
                    aVar.c((byte) 2);
                    aVar.e(j7);
                }
                I i8 = g6.f6441c;
                if (i8 != null) {
                    aVar.c((byte) 3);
                    aVar.f42a.writeInt(i8.f8452a);
                }
                C c6 = g6.f6442d;
                if (c6 != null) {
                    aVar.c((byte) 4);
                    int i9 = c6.f8434a;
                    aVar.c((i9 != 0 && i9 == 1) ? (byte) 1 : (byte) 0);
                }
                D d6 = g6.f6443e;
                if (d6 != null) {
                    aVar.c((byte) 5);
                    int i10 = d6.f8435a;
                    if (i10 != 0) {
                        if (i10 == 65535) {
                            b5 = 1;
                        } else if (i10 != 1) {
                            b5 = i10 == 2 ? (byte) 3 : (byte) 0;
                        }
                        aVar.c(b5);
                    }
                }
                String str = g6.f6445g;
                if (str != null) {
                    aVar.c((byte) 6);
                    aVar.f42a.writeString(str);
                }
                long j8 = g6.f6446h;
                if (!o.a(j8, j6)) {
                    aVar.c((byte) 7);
                    aVar.e(j8);
                }
                C2013a c2013a = g6.f6447i;
                if (c2013a != null) {
                    aVar.c((byte) 8);
                    aVar.d(c2013a.f16365a);
                }
                C2028p c2028p = g6.f6448j;
                if (c2028p != null) {
                    aVar.c((byte) 9);
                    aVar.d(c2028p.f16393a);
                    aVar.d(c2028p.f16394b);
                }
                long j9 = g6.l;
                if (!C2714u.d(j9, j4)) {
                    aVar.c((byte) 10);
                    aVar.f42a.writeLong(j9);
                }
                C2024l c2024l = g6.f6450m;
                if (c2024l != null) {
                    aVar.c((byte) 11);
                    aVar.f42a.writeInt(c2024l.f16389a);
                }
                W w6 = g6.f6451n;
                if (w6 != null) {
                    aVar.c((byte) 12);
                    aVar.f42a.writeLong(w6.f22884a);
                    long j10 = w6.f22885b;
                    aVar.d(Float.intBitsToFloat((int) (j10 >> 32)));
                    aVar.d(Float.intBitsToFloat((int) (j10 & 4294967295L)));
                    aVar.d(w6.f22886c);
                }
                spannableString.setSpan(new Annotation("androidx.compose.text.SpanStyle", Base64.encodeToString(aVar.f42a.marshall(), 0)), c0594e.f6504b, c0594e.f6505c, 33);
                i6 = i7 + 1;
            }
            charSequence = spannableString;
        }
        return new C0378p0(ClipData.newPlainText("plain text", charSequence));
    }
}
