package com.ss.android.ugc.aweme.discover.ui.search.jsbridge.bullet;

import X.0CB;
import X.0CH;
import X.4UQ;
import X.6Is;
import X.C0651KCc;
import X.C1208KXn;
import X.C1599KfG;
import X.C3811LZq;
import X.KJG;
import X.KT7;
import X.KT8;
import X.M12;
import X.SXf;
import X.Sd1;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.bullet.bridge.BaseBridgeMethod;
import java.util.Iterator;
import java.util.LinkedHashMap;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class SearchCardClickMethod extends BaseBridgeMethod implements 6Is {
    public static final C3811LZq LIZIZ = new C3811LZq((byte) 0);
    public final String LIZJ = "click_search_card";
    public C0651KCc LIZLLL = C0651KCc.PRIVATE;
    public String LJ = "";

    static {
        Covode.recordClassIndex(65945);
    }

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

    public final C0651KCc LIZIZ() {
        return this.LIZLLL;
    }

    public final String LIZLLL() {
        return this.LIZJ;
    }

    public final void LIZ(C0651KCc kCc) {
        M12.LIZ((Object) kCc);
        this.LIZLLL = kCc;
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public SearchCardClickMethod(KT7 kt7) {
        super(kt7);
        M12.LIZ((Object) kt7);
    }

    public final void LIZ(JSONObject jSONObject, 4UQ r8) {
        Object obj;
        C1208KXn kXn;
        String str;
        Iterator<String> keys;
        M12.LIZ((Object) jSONObject, (Object) r8);
        if (jSONObject.has("card_params")) {
            this.LJ = jSONObject.optString("react_id");
            try {
                JSONObject optJSONObject = jSONObject.optJSONObject("card_params");
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                if (!(optJSONObject == null || (keys = optJSONObject.keys()) == null)) {
                    while (keys.hasNext()) {
                        String next = keys.next();
                        n.LIZIZ(next, "");
                        String string = optJSONObject.getString(next);
                        if (string == null) {
                            string = "";
                        }
                        linkedHashMap.put(next, string);
                    }
                }
                KT8<C1599KfG> LIZIZ2 = this.LIZ.LIZIZ(C1599KfG.class);
                if ((LIZIZ2 == null || (obj = LIZIZ2.LIZIZ()) == null) && ((kXn = this.LIZ.LIZIZ) == null || (str = kXn.LJFF) == null || (obj = KJG.LIZIZ.LIZ(str)) == null)) {
                    throw new NullPointerException("null cannot be cast to non-null type android.view.View");
                }
                View view = (View) obj;
                SXf.LJIIL.LIZ(view, (String) linkedHashMap.get("search_result_id"), Sd1.LIZIZ.LIZ(view).LJIIL, linkedHashMap);
            } catch (Exception e) {
                r8.LIZ(0, e.getMessage());
            }
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("code", 1);
        r8.LIZ(jSONObject2);
    }
}
