package com.ss.android.ugc.aweme.ad.feed.sticker;

import X.0CB;
import X.0CH;
import X.2GO;
import X.2HZ;
import X.2Id;
import X.2UX;
import X.2nK;
import X.6Is;
import X.7R7;
import X.7Yg;
import X.C0339K0c;
import X.C0762KGj;
import X.C0984KOx;
import X.C1567Kek;
import X.C1569Kem;
import X.C2261Kpw;
import X.C2999L4k;
import X.C3000L4l;
import X.C3162LAr;
import X.C3164LAt;
import X.C3290LFp;
import X.C3401LJw;
import X.C3403LJy;
import X.C3406LKb;
import X.C3437LLg;
import X.ISm;
import X.LDV;
import X.LDW;
import X.LJS;
import X.LK0;
import X.LKL;
import X.LKO;
import X.LKV;
import X.M12;
import X.Rc9;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;
import com.google.gson.m;
import com.ss.android.ugc.aweme.ad.FeedAdServiceImpl;
import com.ss.android.ugc.aweme.ad.feed.IFeedAdService;
import com.ss.android.ugc.aweme.ad.feed.lynx.AbstractFeedLynxView;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;

public final class FeedAdLynxSticker extends AbstractFeedLynxView implements 6Is, 2HZ, 2GO {
    public static final LKV LJIILLIIL = new LKV((byte) 0);
    public boolean LJIILJJIL;
    public boolean LJIILL;
    public String LJIIZILJ;
    public final C2261Kpw LJIJ;
    public final C3162LAr LJIJI;
    public LDV LJIJJ;
    public LDW LJIJJLI;
    public LK0 LJIL;
    public boolean LJJ;

    static {
        Covode.recordClassIndex(52754);
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(205, new Rc9(FeedAdLynxSticker.class, "onCardStatusEvent", C2999L4k.class, ThreadMode.MAIN, 0, false));
        hashMap.put(383, new Rc9(FeedAdLynxSticker.class, "onAdPlayEvent", 7R7.class, ThreadMode.MAIN, 0, false));
        hashMap.put(384, new Rc9(FeedAdLynxSticker.class, "onCardStatusEvent", C3000L4l.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final String LIZ() {
        return this.LJIIZILJ;
    }

    public final LDV LIZLLL() {
        return this.LJIJJ;
    }

    public final LDW LJ() {
        return this.LJIJJLI;
    }

    public final boolean LJII() {
        return 2Id.LIZ();
    }

    public final Bundle LJIIJ() {
        Bundle LJIIJ = super.LJIIJ();
        M12.LIZ((Object) LJIIJ);
        return LJIIJ;
    }

    public final boolean LJI() {
        return C3164LAt.LIZIZ.LIZ().LJ;
    }

    public final m LJIIIZ() {
        LJS ljs = LJS.LIZ;
        Aweme aweme = this.LIZ;
        m LJIIIZ = super.LJIIIZ();
        ljs.LIZ(aweme, LJIIIZ);
        return LJIIIZ;
    }

    public final int LJFF() {
        if (C3164LAt.LIZIZ.LIZ().LJ) {
            return 2131560370;
        }
        return 2131560369;
    }

    public final void LJIIJJI() {
        String str;
        if (C3164LAt.LIZIZ.LIZ().LJ) {
            str = "spark";
        } else {
            str = "bullet";
        }
        C3000L4l.LIZIZ.LIZ("ad_lynx_sticker_show_success", str, this.LJIIZILJ, this.LJJ, this.LJIILL, this.LJFF);
        C0762KGj LIZ = C0339K0c.LIZ("draw_ad", "othershow", this.LIZIZ);
        LIZ.LIZIZ("refer", "sticker");
        LIZ.LIZIZ();
    }

    public final void LIZ(C3401LJw lJw) {
        M12.LIZ((Object) lJw);
        super.LIZ(lJw);
        this.LJIILL = true;
    }

    public final void LIZIZ(C3401LJw lJw) {
        M12.LIZ((Object) lJw);
        super.LIZIZ(lJw);
        this.LJIILL = true;
    }

    public final void LIZ(Aweme aweme) {
        String str;
        super.LIZ(aweme);
        LK0 LJJJJ = C3290LFp.LJJJJ(aweme);
        this.LJIL = LJJJJ;
        if (LJJJJ != null) {
            str = LJJJJ.getStickerUrl();
        } else {
            str = null;
        }
        this.LJIIZILJ = str;
        if (aweme != null) {
            EventBus.LIZ(EventBus.LIZ(), this);
        }
    }

    public final C3401LJw LIZIZ(String str) {
        C3406LKb LJ;
        IFeedAdService LJFF = FeedAdServiceImpl.LJFF();
        if (LJFF == null || (LJ = LJFF.LJ()) == null) {
            return null;
        }
        return (LKL) LJ.LIZ(str);
    }

    public final void LIZ(String str) {
        C1569Kem kitView;
        M12.LIZ((Object) str);
        if (C3164LAt.LIZIZ.LIZ().LJ) {
            C1567Kek LIZJ = LIZJ();
            if (LIZJ != null && (kitView = LIZJ.getKitView()) != null) {
                kitView.LIZ(str, (JSONObject) null);
                return;
            }
            return;
        }
        C0984KOx kOx = this.LJII;
        if (kOx != null) {
            kOx.onEvent(new LKO(str, (JSONObject) null));
        }
    }

    public final void LIZIZ(Aweme aweme) {
        String str;
        M12.LIZ((Object) aweme);
        2UX r2 = new 2UX();
        r2.LIZ("is_successful", 0);
        r2.LIZ("is_ever_failed", 0);
        if (C3164LAt.LIZIZ.LIZ().LJ) {
            str = "1";
        } else {
            str = "0";
        }
        r2.LIZ("is_spark", str);
        r2.LIZ("failed_reason", 1);
        2nK.LIZ("feed_lynx_sticker_preload_usage", r2.LIZ);
    }

    public final void LIZJ(String str) {
        String str2;
        if (n.LIZ(str, "load_timeout")) {
            if (C3164LAt.LIZIZ.LIZ().LJ) {
                str2 = "spark";
            } else {
                str2 = "bullet";
            }
            C3000L4l.LIZIZ.LIZ("ad_lynx_sticker_load_timeout", str2, this.LJIIZILJ, this.LJJ, this.LJIILL, this.LJFF);
        }
        C0762KGj LIZ = C0339K0c.LIZ("draw_ad", "othershow_fail", this.LIZIZ);
        LIZ.LIZIZ("refer", "sticker");
        LIZ.LIZ("fail_reason", str);
        LIZ.LIZIZ();
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onAdPlayEvent(7R7 r3) {
        M12.LIZ((Object) r3);
        C3437LLg lLg = this.LJIIL;
        if (!(lLg instanceof C3403LJy)) {
            lLg = null;
        }
        C3403LJy lJy = (C3403LJy) lLg;
        if (lJy != null && !lJy.LIZLLL() && this.LJIIL.LIZJ()) {
            LIZ("event_card_show");
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onCardStatusEvent(C3000L4l l4l) {
        C3000L4l l4l2 = l4l;
        M12.LIZ((Object) l4l2);
        this.LJJ = true;
        if (l4l2.LIZ == 1) {
            this.LJIILL = true;
        } else if (C3164LAt.LIZIZ.LIZ().LJ) {
            C3000L4l.LIZIZ.LIZ(l4l2, "adLynx_sticker_status_fail", this.LJIIIIZZ, "spark", this.LJIIZILJ);
        } else {
            C3000L4l.LIZIZ.LIZ(l4l2, "adLynx_sticker_status_fail", this.LJIIIIZZ, "bullet", this.LJIIZILJ);
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onCardStatusEvent(C2999L4k l4k) {
        M12.LIZ((Object) l4k);
        if (7Yg.LIZIZ.LIZ()) {
            this.LJJ = true;
            if (l4k.LIZ == 1) {
                this.LJIILL = true;
            } else if (C3164LAt.LIZIZ.LIZ().LJ) {
                C3000L4l.LIZIZ.LIZ(new C3000L4l(l4k.LIZ), "adLynx_sticker_status_fail_old_jsb", this.LJIIIIZZ, "spark", this.LJIIZILJ);
            } else {
                C3000L4l.LIZIZ.LIZ(new C3000L4l(l4k.LIZ), "adLynx_sticker_status_fail_old_jsb", this.LJIIIIZZ, "bullet", this.LJIIZILJ);
            }
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r3v2, resolved type: java.lang.String} */
    /* JADX WARNING: type inference failed for: r3v0 */
    /* JADX WARNING: type inference failed for: r3v1, types: [X.LDW] */
    /* JADX WARNING: type inference failed for: r3v5 */
    /* JADX WARNING: type inference failed for: r3v6 */
    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public FeedAdLynxSticker(android.view.ViewGroup r8, X.C3403LJy r9, java.lang.String r10) {
        /*
            r7 = this;
            X.M12.LIZ((java.lang.Object) r8, (java.lang.Object) r9)
            r7.<init>(r8, r9, r10)
            X.LK8 r6 = new X.LK8
            r6.<init>(r7)
            r7.LJIJ = r6
            X.LK1 r5 = new X.LK1
            r5.<init>(r7)
            r7.LJIJI = r5
            X.LKC r2 = r7.LJ
            java.lang.String r4 = "lynx_feed"
            r3 = 0
            if (r2 == 0) goto L_0x004a
            X.KfG r1 = r7.LIZIZ()
            com.ss.android.ugc.aweme.ad.preload.IAdLandPagePreloadService r0 = com.ss.android.ugc.aweme.ad.preload.AdLandPagePreloadServiceImpl.LJFF()
            if (r0 == 0) goto L_0x0048
            java.lang.String r0 = r0.LJI(r4)
        L_0x0029:
            X.LDV r0 = r2.LIZ((X.C1599KfG) r1, (java.lang.String) r0, (X.C2261Kpw) r6)
        L_0x002d:
            r7.LJIJJ = r0
            X.LKC r2 = r7.LJ
            if (r2 == 0) goto L_0x0045
            X.Kek r1 = r7.LIZJ()
            com.ss.android.ugc.aweme.ad.preload.IAdLandPagePreloadService r0 = com.ss.android.ugc.aweme.ad.preload.AdLandPagePreloadServiceImpl.LJFF()
            if (r0 == 0) goto L_0x0041
            java.lang.String r3 = r0.LJI(r4)
        L_0x0041:
            X.LDW r3 = r2.LIZ((X.C1567Kek) r1, (java.lang.String) r3, (X.C3162LAr) r5)
        L_0x0045:
            r7.LJIJJLI = r3
            return
        L_0x0048:
            r0 = r3
            goto L_0x0029
        L_0x004a:
            r0 = r3
            goto L_0x002d
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ad.feed.sticker.FeedAdLynxSticker.<init>(android.view.ViewGroup, X.LJy, java.lang.String):void");
    }
}
