package defpackage;

import android.os.Handler;
import android.os.Looper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/* renamed from: ˈᵵ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1104 {

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static final Object f4740 = new Object();

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public static volatile C1104 f4741;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final C3664 f4742;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final ˊᵻ f4743;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final InterfaceC4920 f4744;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public volatile int f4745;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final C2076 f4746;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final ReentrantReadWriteLock f4747;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C0277 f4748;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final int f4749;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Handler f4750;

    public C1104(C4482 c4482) {
        ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock();
        this.f4747 = reentrantReadWriteLock;
        this.f4745 = 3;
        InterfaceC4920 interfaceC4920 = (InterfaceC4920) c4482.f18522;
        this.f4744 = interfaceC4920;
        int i = c4482.f18521;
        this.f4749 = i;
        this.f4746 = (C2076) c4482.f18520;
        this.f4750 = new Handler(Looper.getMainLooper());
        this.f4748 = new C0277(0);
        this.f4743 = new ˊᵻ(20);
        C3664 c3664 = new C3664(this);
        this.f4742 = c3664;
        reentrantReadWriteLock.writeLock().lock();
        if (i == 0) {
            try {
                this.f4745 = 0;
            } catch (Throwable th) {
                this.f4747.writeLock().unlock();
                throw th;
            }
        }
        reentrantReadWriteLock.writeLock().unlock();
        if (m3508() == 0) {
            try {
                interfaceC4920.mo9056(new C1088(c3664));
            } catch (Throwable th2) {
                m3509(th2);
            }
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static C1104 m3504() {
        C1104 c1104;
        synchronized (f4740) {
            try {
                c1104 = f4741;
                if (!(c1104 != null)) {
                    throw new IllegalStateException("EmojiCompat is not initialized.\n\nYou must initialize EmojiCompat prior to referencing the EmojiCompat instance.\n\nThe most likely cause of this error is disabling the EmojiCompatInitializer\neither explicitly in AndroidManifest.xml, or by including\nandroidx.emoji2:emoji2-bundled.\n\nAutomatic initialization is typically performed by EmojiCompatInitializer. If\nyou are not expecting to initialize EmojiCompat manually in your application,\nplease check to ensure it has not been removed from your APK's manifest. You can\ndo this in Android Studio using Build > Analyze APK.\n\nIn the APK Analyzer, ensure that the startup entry for\nEmojiCompatInitializer and InitializationProvider is present in\n AndroidManifest.xml. If it is missing or contains tools:node=\"remove\", and you\nintend to use automatic configuration, verify:\n\n  1. Your application does not include emoji2-bundled\n  2. All modules do not contain an exclusion manifest rule for\n     EmojiCompatInitializer or InitializationProvider. For more information\n     about manifest exclusions see the documentation for the androidx startup\n     library.\n\nIf you intend to use emoji2-bundled, please call EmojiCompat.init. You can\nlearn more in the documentation for BundledEmojiCompatConfig.\n\nIf you intended to perform manual configuration, it is recommended that you call\nEmojiCompat.init immediately on application startup.\n\nIf you still cannot resolve this issue, please open a bug with your specific\nconfiguration to help improve error message.");
                }
            } finally {
            }
        }
        return c1104;
    }

    /* JADX WARN: Removed duplicated region for block: B:112:? A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:114:? A[RETURN, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0089 A[Catch: all -> 0x007c, TRY_ENTER, TryCatch #3 {all -> 0x007c, blocks: (B:35:0x0054, B:38:0x0059, B:40:0x005d, B:42:0x006a, B:49:0x0089, B:51:0x0093, B:53:0x0096, B:55:0x0099, B:57:0x00a9, B:58:0x00ac), top: B:109:0x0054 }] */
    /* JADX WARN: Removed duplicated region for block: B:55:0x0099 A[Catch: all -> 0x007c, TryCatch #3 {all -> 0x007c, blocks: (B:35:0x0054, B:38:0x0059, B:40:0x005d, B:42:0x006a, B:49:0x0089, B:51:0x0093, B:53:0x0096, B:55:0x0099, B:57:0x00a9, B:58:0x00ac), top: B:109:0x0054 }] */
    /* JADX WARN: Removed duplicated region for block: B:62:0x00bb A[Catch: all -> 0x00f2, TRY_ENTER, TryCatch #0 {all -> 0x00f2, blocks: (B:62:0x00bb, B:65:0x00c3, B:68:0x00cb, B:47:0x007f), top: B:103:0x007f }] */
    /* JADX WARN: Removed duplicated region for block: B:64:0x00c1  */
    /* JADX WARN: Removed duplicated region for block: B:88:0x00ff  */
    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.CharSequence m3505(java.lang.CharSequence r12, int r13, int r14) throws java.lang.Throwable {
        /*
            Method dump skipped, instructions count: 299
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C1104.m3505(java.lang.CharSequence, int, int):java.lang.CharSequence");
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void m3506(AbstractC3949 abstractC3949) {
        ˀʾˀᵛ.ˏˋٴ(abstractC3949, "initCallback cannot be null");
        this.f4747.writeLock().lock();
        try {
            if (this.f4745 == 1 || this.f4745 == 2) {
                this.f4750.post(new RunnableC4456(Arrays.asList(abstractC3949), this.f4745, null));
            } else {
                this.f4748.add(abstractC3949);
            }
            this.f4747.writeLock().unlock();
        } catch (Throwable th) {
            this.f4747.writeLock().unlock();
            throw th;
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m3507() {
        if (!(this.f4749 == 1)) {
            ᵹˉᵞ.ᵳٴᵶ("Set metadataLoadStrategy to LOAD_STRATEGY_MANUAL to execute manual loading");
            return;
        }
        if (m3508() == 1) {
            return;
        }
        this.f4747.writeLock().lock();
        try {
            if (this.f4745 == 0) {
                return;
            }
            this.f4745 = 0;
            this.f4747.writeLock().unlock();
            C3664 c3664 = this.f4742;
            C1104 c1104 = (C1104) c3664.f13653;
            try {
                c1104.f4744.mo9056(new C1088(c3664));
            } catch (Throwable th) {
                c1104.m3509(th);
            }
        } finally {
            this.f4747.writeLock().unlock();
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int m3508() {
        this.f4747.readLock().lock();
        try {
            return this.f4745;
        } finally {
            this.f4747.readLock().unlock();
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m3509(Throwable th) {
        ArrayList arrayList = new ArrayList();
        this.f4747.writeLock().lock();
        try {
            this.f4745 = 2;
            arrayList.addAll(this.f4748);
            this.f4748.clear();
            this.f4747.writeLock().unlock();
            this.f4750.post(new RunnableC4456(arrayList, this.f4745, th));
        } catch (Throwable th2) {
            this.f4747.writeLock().unlock();
            throw th2;
        }
    }
}
