package com.ss.android.ugc.aweme.bullet.business;

import X.2nK;
import X.C3420JXn;
import X.C3423JXq;
import X.C3425JXs;
import X.Kns;
import X.Knz;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.POl;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.bullet.business.BulletBusinessService;
import com.ss.android.ugc.aweme.share.improve.pkg.WebSharePackage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;
import org.json.JSONObject;

public abstract class AbsShareBusiness extends BulletBusinessService.Business {
    public static final C3425JXs LJIIIZ = new C3425JXs((byte) 0);
    public List<Object> LIZ;
    public WebSharePackage LIZIZ;
    public List<String> LIZJ;
    public String LIZLLL;
    public boolean LJ;
    public String LJFF;
    public String LJI;
    public C3420JXn LJII = new C3420JXn(this);
    public Kns LJIIIIZZ;

    static {
        Covode.recordClassIndex(55157);
    }

    public abstract void LIZ();

    public final void LIZIZ() {
        Mk2.LIZ(Mk3.LIZ).LIZ(new C3423JXq(this));
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public AbsShareBusiness(Knz knz) {
        super(knz);
        M12.LIZ(knz);
        ArrayList LIZ2 = POl.LIZ(new String[]{"copylink", "qrcode", "browser", "refresh"});
        n.LIZIZ(LIZ2, "");
        this.LIZJ = LIZ2;
    }

    public final void LIZ(String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        M12.LIZ(str);
        HashMap hashMap = new HashMap();
        hashMap.put("enter_from", "h5_page");
        hashMap.put("platform", str);
        Kns kns = this.LJIIIIZZ;
        String str6 = "";
        if (kns == null || (str2 = kns.LJI()) == null) {
            str2 = str6;
        }
        hashMap.put("previous_page", str2);
        Kns kns2 = this.LJIIIIZZ;
        if (kns2 == null || (str3 = kns2.LJII()) == null) {
            str3 = str6;
        }
        hashMap.put("group_id", str3);
        Kns kns3 = this.LJIIIIZZ;
        String str7 = null;
        if (kns3 != null) {
            str4 = kns3.LJII();
        } else {
            str4 = null;
        }
        if (TextUtils.isEmpty(str4)) {
            str5 = str6;
        } else {
            str5 = "article";
        }
        hashMap.put("webview_type", str5);
        WebSharePackage webSharePackage = this.LIZIZ;
        if (webSharePackage != null) {
            str7 = webSharePackage.LJIILIIL;
        }
        if (TextUtils.isEmpty(str7)) {
            String str8 = this.LIZLLL;
            if (str8 != null) {
                str6 = str8;
            }
        } else {
            WebSharePackage webSharePackage2 = this.LIZIZ;
            if (webSharePackage2 == null) {
                n.LIZIZ();
            }
            str6 = webSharePackage2.LJIILIIL;
        }
        hashMap.put("url", str6);
        2nK.LIZ("h5_share", hashMap);
    }

    public final String LIZ(JSONObject jSONObject, String str) {
        String optString;
        if (jSONObject == null || (optString = jSONObject.optString(str)) == null || TextUtils.equals(optString, "null")) {
            return null;
        }
        return optString;
    }
}
