package ῲ.ⁱ.K.ῲ;

import android.content.Context;
import android.util.Log;
import android.util.Xml;
import androidx.constraintlayout.widget.ConstraintAttribute;
import androidx.constraintlayout.widget.ConstraintLayout;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* renamed from: ῲ.ⁱ.K.ῲ.㿎  reason: contains not printable characters */
/* compiled from: KeyFrames */
public class C2168 {

    /* renamed from: ῲ  reason: contains not printable characters */
    public static HashMap<String, Constructor<? extends AbstractC2109>> f7557 = new HashMap<>();

    /* renamed from: K  reason: contains not printable characters */
    public HashMap<Integer, ArrayList<AbstractC2109>> f7558 = new HashMap<>();

    static {
        try {
            f7557.put("KeyAttribute", C2166.class.getConstructor(new Class[0]));
            f7557.put("KeyPosition", C2137.class.getConstructor(new Class[0]));
            f7557.put("KeyCycle", C2163.class.getConstructor(new Class[0]));
            f7557.put("KeyTimeCycle", C2135.class.getConstructor(new Class[0]));
            f7557.put("KeyTrigger", C2158.class.getConstructor(new Class[0]));
        } catch (NoSuchMethodException e) {
            Log.e("KeyFrames", "unable to load", e);
        }
    }

    public C2168(Context context, XmlPullParser xmlPullParser) {
        HashMap<String, ConstraintAttribute> hashMap;
        Exception e;
        AbstractC2109 r0 = null;
        try {
            int eventType = xmlPullParser.getEventType();
            while (eventType != 1) {
                if (eventType != 0) {
                    if (eventType == 2) {
                        String name = xmlPullParser.getName();
                        if (f7557.containsKey(name)) {
                            try {
                                AbstractC2109 r1 = (AbstractC2109) f7557.get(name).newInstance(new Object[0]);
                                try {
                                    r1.m5587(context, Xml.asAttributeSet(xmlPullParser));
                                    m5695(r1);
                                    r0 = r1;
                                } catch (Exception e2) {
                                    e = e2;
                                    r0 = r1;
                                    Log.e("KeyFrames", "unable to create ", e);
                                    eventType = xmlPullParser.next();
                                }
                            } catch (Exception e3) {
                                e = e3;
                                Log.e("KeyFrames", "unable to create ", e);
                                eventType = xmlPullParser.next();
                            }
                        } else if (!(!name.equalsIgnoreCase("CustomAttribute") || r0 == null || (hashMap = r0.f7332) == null)) {
                            ConstraintAttribute.m541(context, xmlPullParser, hashMap);
                        }
                    } else if (eventType == 3) {
                        if ("KeyFrameSet".equals(xmlPullParser.getName())) {
                            return;
                        }
                    }
                }
                eventType = xmlPullParser.next();
            }
        } catch (XmlPullParserException e4) {
            e4.printStackTrace();
        } catch (IOException e5) {
            e5.printStackTrace();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5695(AbstractC2109 r4) {
        if (!this.f7558.containsKey(Integer.valueOf(r4.f7330))) {
            this.f7558.put(Integer.valueOf(r4.f7330), new ArrayList<>());
        }
        this.f7558.get(Integer.valueOf(r4.f7330)).add(r4);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5696(C2110 r5) {
        ArrayList<AbstractC2109> arrayList = this.f7558.get(Integer.valueOf(r5.f7344));
        if (arrayList != null) {
            r5.f7355.addAll(arrayList);
        }
        ArrayList<AbstractC2109> arrayList2 = this.f7558.get(-1);
        if (arrayList2 != null) {
            Iterator<AbstractC2109> it2 = arrayList2.iterator();
            while (it2.hasNext()) {
                AbstractC2109 next = it2.next();
                String str = ((ConstraintLayout.C0140) r5.f7346.getLayoutParams()).f1046;
                String str2 = next.f7329;
                if ((str2 == null || str == null) ? false : str.matches(str2)) {
                    r5.f7355.add(next);
                }
            }
        }
    }
}
