package com.bytedance.android.live.liveinteract.linkroom.widget;

import X.2Pr;
import X.2fU;
import X.6Is;
import X.7er;
import X.7ju;
import X.8gM;
import X.8gY;
import X.9qj;
import X.AnonymousClass0CB;
import X.AnonymousClass0CH;
import X.AnonymousClass0S6;
import X.AnonymousClass158;
import X.AnonymousClass1P2;
import X.AnonymousClass1PF;
import X.AnonymousClass1R0;
import X.AnonymousClass1R3;
import X.AnonymousClass1RA;
import X.AnonymousClass1RK;
import X.AnonymousClass1RS;
import X.AnonymousClass1TU;
import X.AnonymousClass1U0;
import X.AnonymousClass1V2;
import X.AnonymousClass292;
import X.AnonymousClass2AD;
import X.AnonymousClass2AE;
import X.AnonymousClass2AF;
import X.AnonymousClass2AH;
import X.AnonymousClass2AL;
import X.AnonymousClass2AO;
import X.AnonymousClass2AZ;
import X.AnonymousClass2B9;
import X.AnonymousClass2BC;
import X.AnonymousClass2BF;
import X.AnonymousClass2BG;
import X.AnonymousClass2BQ;
import X.AnonymousClass2CA;
import X.AnonymousClass2CB;
import X.AnonymousClass2CC;
import X.AnonymousClass2CJ;
import X.AnonymousClass2CK;
import X.AnonymousClass2CL;
import X.AnonymousClass2CN;
import X.AnonymousClass2CP;
import X.AnonymousClass2CQ;
import X.AnonymousClass2CU;
import X.AnonymousClass2D2;
import X.C09630aP;
import X.C10000b0;
import X.C10310bV;
import X.C10570bv;
import X.C11100cm;
import X.C14250hr;
import X.C14260hs;
import X.C14300hw;
import X.C14350i1;
import X.C14520iI;
import X.C14600iQ;
import X.C14700ia;
import X.C14730id;
import X.C14750if;
import X.C14770ih;
import X.C14870ir;
import X.C14960j0;
import X.C16110kr;
import X.C16200l0;
import X.C16280l8;
import X.C16290l9;
import X.C16350lF;
import X.C16360lG;
import X.C16370lH;
import X.C16390lJ;
import X.C16400lK;
import X.C16410lL;
import X.C16420lM;
import X.C16460lQ;
import X.C16480lS;
import X.C16630lh;
import X.C18000nu;
import X.C18580oq;
import X.C18600os;
import X.C20260rY;
import X.C21140sy;
import X.C21810u3;
import X.C23840xK;
import X.C23890xP;
import X.C23910xR;
import X.C23920xS;
import X.C24150xp;
import X.C24170xr;
import X.C24190xt;
import X.C24230xx;
import X.C24290y3;
import X.C24410yF;
import X.C24420yG;
import X.C24850yx;
import X.C264913v;
import X.C31161Lu;
import X.C31851Ol;
import X.C31861Om;
import X.C31891Op;
import X.C32371Ql;
import X.C32381Qm;
import X.C32511Qz;
import X.C32671Rp;
import X.C32701Rs;
import X.C32711Rt;
import X.C32841Sg;
import X.C33641Vi;
import X.C33651Vj;
import X.C34361Yc;
import X.C35561b8;
import X.C35621bE;
import X.C35941bk;
import X.C41491kh;
import X.C41521kk;
import X.C41661ky;
import X.C41731l5;
import X.C41751l7;
import X.C41761l8;
import X.C41941lQ;
import X.C41951lR;
import X.C41961lS;
import X.C41971lT;
import X.C41981lU;
import X.C41991lV;
import X.C42041la;
import X.C42051lb;
import X.C42061lc;
import X.C42071ld;
import X.C42081le;
import X.C42091lf;
import X.C42101lg;
import X.C42111lh;
import X.C42121li;
import X.C42131lj;
import X.C42141lk;
import X.C42151ll;
import X.C42161lm;
import X.C42171ln;
import X.C42181lo;
import X.C42191lp;
import X.C42201lq;
import X.C42211lr;
import X.C42221ls;
import X.C42231lt;
import X.C42241lu;
import X.C42251lv;
import X.C42261lw;
import X.C42271lx;
import X.C42281ly;
import X.C42291lz;
import X.C42301m0;
import X.C42311m1;
import X.C42561mQ;
import X.C42971n5;
import X.C42981n6;
import X.C43231nV;
import X.C46271sP;
import X.C53592Ab;
import X.C53602Ac;
import X.C53612Ad;
import X.C53622Ae;
import X.C53632Af;
import X.C53662Ai;
import X.C53672Aj;
import X.C53682Ak;
import X.C53692Al;
import X.C53702Am;
import X.C53712An;
import X.C53722Ao;
import X.C53792Av;
import X.C54232Cn;
import X.C54252Cp;
import X.C54262Cq;
import X.Cvq;
import X.Cw4;
import X.DEF;
import X.Fv2;
import X.Fv7;
import X.Fx3;
import X.Fz8;
import X.G0S;
import X.G9W;
import X.GAX;
import X.GFy;
import X.GIv;
import X.GYF;
import X.GbZ;
import X.Gc2;
import X.Gcz;
import X.GdC;
import X.GdG;
import X.GiY;
import X.GiZ;
import X.Glf;
import X.HEP;
import X.HFc;
import X.HFg;
import X.HFh;
import X.HGo;
import X.HI6;
import X.HKs;
import X.Hdy;
import X.He0;
import X.Hzs;
import X.LsC;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PgV;
import X.PhE;
import X.PlI;
import X.TLk;
import android.os.SystemClock;
import android.text.TextUtils;
import com.bytedance.android.live.base.model.ImageModel;
import com.bytedance.android.live.base.model.user.User;
import com.bytedance.android.live.design.app.LiveDialog;
import com.bytedance.android.live.liveinteract.api.BaseLinkControlWidget;
import com.bytedance.android.live.liveinteract.api.CoHostLiveWidget;
import com.bytedance.android.live.liveinteract.api.IInteractService;
import com.bytedance.android.live.liveinteract.cohost.remote.api.CoHostApi;
import com.bytedance.android.live.liveinteract.cohost.ui.dialog.LinkDialog;
import com.bytedance.android.live.liveinteract.cohost.widget.LinkCoHostBeInviteVideoPreloadWidget;
import com.bytedance.android.live.liveinteract.cohost.widget.LinkCrossRoomWidget;
import com.bytedance.android.live.liveinteract.commoninterface.BaseInternalLinkMicAnchorWidget;
import com.bytedance.android.live.liveinteract.multicohost.widget.MultiCoHostWidget;
import com.bytedance.android.live.microom.IMicRoomService;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveCoHostPreviewAnchorAndroidSwitchSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveSdkGuestOneVnSetting;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveCohostPreviewAnchorSetting;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveCohostPreviewDelaySetting;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveSdkLinkmicFinishAnchorProtectSetting;
import com.bytedance.android.livesdk.livesetting.linkmic.multilive.MultiGuestHostSideSwitchSetting;
import com.bytedance.android.livesdk.livesetting.watchlive.CohostShowNewTipsText;
import com.bytedance.android.livesdk.model.message.LinkMessage;
import com.bytedance.android.livesdk.model.message.LinkMicAnchorGuideMessage;
import com.bytedance.android.livesdk.model.message.linker.invite_message.LinkerInviteContent;
import com.bytedance.android.livesdk.performance.LivePerformanceManager;
import com.bytedance.android.livesdk.utils.LiveAppBundleUtils;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.session.EnterRoomConfig;
import com.bytedance.android.livesdkapi.session.EnterRoomLinkSession;
import com.bytedance.bpea.basics.Cert;
import com.bytedance.bpea.basics.PrivacyCert;
import com.bytedance.bpea.store.policy.PrivacyPolicyStore;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.LiveWidget;
import com.ss.ugc.live.sdk.message.interfaces.IMessageManager;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.json.JSONObject;

public class LinkControlWidget extends BaseLinkControlWidget implements C16280l8, C41751l7, GYF, 6Is {
    public BaseInternalLinkMicAnchorWidget LIZIZ;
    public C31891Op LIZJ;
    public CoHostLiveWidget LIZLLL;
    public C14730id LJ;
    public LinkCoHostBeInviteVideoPreloadWidget LJFF;
    public C41761l8 LJI;
    public Room LJII;
    public boolean LJIIIIZZ;
    public C14260hs LJIIIZ;
    public boolean LJIIJ;
    public int LJIIJJI;
    public final C16290l9 LJIIL = new C16290l9(this, this);
    public boolean LJIILIIL = false;
    public boolean LJIILJJIL = false;
    public C42981n6 LJIILL;
    public C42971n5 LJIILLIIL;
    public C14750if LJIIZILJ = null;
    public C16630lh LJIJ = null;
    public C16630lh LJIJI = null;
    public GIv LJIJJ;
    public boolean LJIJJLI;
    public long LJIL;
    public boolean LJJ = false;
    public boolean LJJI = false;
    public Hzs LJJIFFI;
    @C14700ia(LIZ = "LINKER_MANAGER")
    public C23920xS LJJII;
    @C14700ia(LIZ = "LINK_MESSAGE_CENTER")
    public C35621bE LJJIII;
    public LiveDialog LJJIIJ = null;

    static {
        Covode.recordClassIndex(7155);
    }

    public final void LIZ(Throwable th) {
        Gc2.LIZ(this, th);
    }

    public int getLayoutId() {
        return 2131562082;
    }

    public void onStateChanged(AnonymousClass0CH r1, AnonymousClass0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final void LIZ(7er r10) {
        C33641Vi r1;
        if (!this.LJJ) {
            if (!this.LJII.isLiveTypeAudio()) {
                if (!C20260rY.LIZJ.LIZ().LIZLLL()) {
                    C23890xP LIZ = this.LJJII.LIZ();
                    if (!(LIZ instanceof AnonymousClass1V2)) {
                        C41491kh.LIZ.LIZ(new C42561mQ(), (String) null);
                        C35561b8 r8 = new C35561b8();
                        r8.LIZIZ = this.LJIIIIZZ;
                        this.LJJII.LIZ(this.LJII.getOwnerUserId(), C23840xK.MULTIGUEST, this.dataChannel, r8);
                        LIZ = this.LJJII.LIZIZ(C23840xK.MULTIGUEST);
                    }
                    if (!this.LJIIIIZZ && (LIZ instanceof AnonymousClass1V2)) {
                        ((AnonymousClass1V2) LIZ).LIZLLL.LIZ(this.LJI.LJII);
                        if (this.LJI.LJII) {
                            GiY.LIZ().LJJIIJZLJL = 3;
                        }
                    }
                } else if (!this.LJIIIIZZ && (r1 = (C33641Vi) C41491kh.LIZ.LIZ("MULTI_GUEST_DATA_HOLDER")) != null) {
                    r1.LIZ(this.LJI.LJII);
                }
                C24190xt.LIZJ("onMultiGuestTurnedOn", "source:" + r10.value);
                if (this.LJIIIIZZ || !C20260rY.LIZJ.LIZ().LIZLLL() || !LiveSdkGuestOneVnSetting.INSTANCE.isDisable()) {
                    LIZLLL(2);
                    C24150xp.LIZ = SystemClock.uptimeMillis();
                    Map<String, String> LIZLLL2 = C24150xp.LIZLLL.LIZLLL();
                    String str = C24150xp.LIZIZ;
                    if (str == null) {
                        str = "others";
                    }
                    LIZLLL2.put("trigger", str);
                    LIZLLL2.put("permission_type", C21140sy.LIZLLL());
                    C21810u3.LIZIZ.LIZ(LIZLLL2, C21810u3.LIZIZ.LIZIZ());
                    C24150xp.LIZIZ = null;
                    C24150xp.LIZLLL.LIZ("livesdk_guest_connection_mode_view_start", LIZLLL2);
                } else {
                    C24190xt.LIZJ("onMultiGuestTurnedOn", "block turn on by 1vn guestsetting.");
                    return;
                }
            }
            if (!MultiGuestHostSideSwitchSetting.INSTANCE.isEnable() && r10 == 7er.USER_CLICK) {
                Fz8.LIZ(C10000b0.LJ(), 2131828226);
            }
            if (r10 == 7er.ACTIVITY_PAGE_OPEN) {
                C21140sy.LIZ(C21140sy.LIZJ(), C21140sy.LIZ(), 7er.ACTIVITY_PAGE_OPEN);
            }
            GiY.LIZ().LIZ(true);
            if (this.LJIILJJIL) {
                this.dataChannel.LIZIZ(AnonymousClass2CQ.class, true);
                this.LJIILJJIL = false;
            }
        }
    }

    public final void LIZ(7er r5, Throwable th) {
        if (this.LJIILJJIL) {
            if (this.dataChannel != null) {
                this.dataChannel.LIZIZ(AnonymousClass2CQ.class, false);
            }
            this.LJIILJJIL = false;
        }
        if (r5 == 7er.USER_CLICK) {
            G0S.LIZ(this.context, th, 2131833962);
        }
    }

    /* JADX WARNING: type inference failed for: r8v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget, com.bytedance.android.widget.Widget] */
    public final void LIZ(final LinkerInviteContent linkerInviteContent) {
        JSONObject jSONObject = new JSONObject();
        C10570bv.LIZ(jSONObject, "room_id", this.LJII.getIdStr());
        C10570bv.LIZ(jSONObject, "remote_room_id", linkerInviteContent.LIZIZ);
        C10570bv.LIZ(jSONObject, "record_id", C31851Ol.LLFII.LIZ().LJJJLL);
        C10570bv.LIZ(jSONObject, "user_id", this.LJII.getOwnerUserId());
        C10570bv.LIZ(jSONObject, "remote_user_id", linkerInviteContent.LIZ);
        C10570bv.LIZ(jSONObject, "is_inviter", false);
        TLk.LIZIZ.LIZ(jSONObject);
        TLk.LIZIZ.LIZ("popup_show");
        if (isViewValid()) {
            C09630aP.LIZ(4, "LinkControlWidget", "onReceiveInvitation, channelId = " + C31851Ol.LLFII.LIZ().LJ);
            if (C31851Ol.LLFII.LIZ().LJ != 0) {
                C18580oq.LIZ("LinkDialog");
                C09630aP.LIZ(4, "LinkControlWidget", "onReceiveInvitation, InviteType = " + C31851Ol.LLFII.LIZ().LJIILL);
                if (C31851Ol.LLFII.LIZ().LJIILL == C14770ih.RANDOM_LINK_MIC_INVITE && AnonymousClass1PF.LIZIZ()) {
                    if (this.dataChannel != null) {
                        this.dataChannel.LIZJ(C53672Aj.class, "");
                    }
                    C31851Ol.LLFII.LIZ().LJIILIIL = true;
                    if (C31851Ol.LLFII.LIZ().LJJIJIL && !TextUtils.isEmpty(C31851Ol.LLFII.LIZ().LJJIJIIJIL)) {
                        PrivacyCert.Builder with = PrivacyCert.Builder.with("bpea-505");
                        with.usage("");
                        with.tag("link mic start to push stream");
                        with.policies(new 9qj[]{PrivacyPolicyStore.getAudioPrivacyPolicy()});
                        LIZ((Cert) with.build());
                    }
                    C31851Ol LIZ = C31851Ol.LLFII.LIZ();
                    if (LIZ.LJ == 0 || this.LJII == null) {
                        C41521kk.LIZ();
                        return;
                    }
                    if (LIZ.LJJIJIL && !TextUtils.isEmpty(LIZ.LJJIJIIJIL)) {
                        C24190xt.LIZJ("LinkCross_Reply", "start Interact when reply click agree");
                        LIZ.LIZJ = true;
                        if (this.dataChannel != null) {
                            this.dataChannel.LIZIZ(C53682Ak.class, new G9W(4));
                        }
                    }
                    HashMap hashMap = new HashMap();
                    hashMap.put("reply_status", 1);
                    if (this.LJJII.LIZIZ(C23840xK.COHOST) != null) {
                        PgV<C23910xR> LIZIZ2 = this.LJJII.LIZIZ(C23840xK.COHOST).LIZIZ(hashMap);
                        if (LIZIZ2 == null) {
                            C24190xt.LIZJ("LinkCross_Reply", "single is null");
                            return;
                        }
                        if (this.LJJIFFI == null) {
                            this.LJJIFFI = new Hzs();
                        }
                        ((Cw4) LIZIZ2.LIZ(DEF.LIZ(Cvq.LIZ(this, AnonymousClass0CB.ON_DESTROY), this.LJJIFFI))).LIZ(C32701Rs.LIZ, new C32711Rt(this));
                    }
                } else if (C31851Ol.LLFII.LIZ().LJIILL != C14770ih.RANDOM_LINK_MIC_INVITE) {
                    TLk.LIZIZ.LIZ("inviter_preview_first_frame_render");
                    C18000nu r6 = (C18000nu) this.dataChannel.LIZIZ(AnonymousClass2BF.class);
                    C09630aP.LIZ(4, "LinkControlWidget", "showInviteFragmentAndStartLinkCross, permission = ".concat(String.valueOf(r6)));
                    this.LJIJJLI = false;
                    if (!LiveCohostPreviewAnchorSetting.INSTANCE.isOpenCoHostPreviewAnchor() || LJIILLIIL() || !LiveCoHostPreviewAnchorAndroidSwitchSetting.INSTANCE.getValue() || (r6 != null && r6.isMultiCoHost())) {
                        C09630aP.LIZ(4, "LinkControlWidget", "onReceiveInvitation, not preview show");
                        C24190xt.LIZ("CoHost_PrePare_Show_HeadPortraitPreview");
                        if (LiveCoHostPreviewAnchorAndroidSwitchSetting.INSTANCE.getValue()) {
                            if (LJIILLIIL()) {
                                LIZJ(-5);
                            } else {
                                LIZJ(1);
                            }
                        }
                        LIZ(linkerInviteContent, (LinkCoHostBeInviteVideoPreloadWidget) null, false, false);
                        return;
                    }
                    C09630aP.LIZ(4, "LinkControlWidget", "onReceiveInvitation, preview show");
                    C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_Start");
                    LinkCoHostBeInviteVideoPreloadWidget linkCoHostBeInviteVideoPreloadWidget = (LinkCoHostBeInviteVideoPreloadWidget) this.LJIIIZ.LIZ(5);
                    this.LJFF = linkCoHostBeInviteVideoPreloadWidget;
                    linkCoHostBeInviteVideoPreloadWidget.LIZ((C41661ky) new C41661ky() {
                        static {
                            Covode.recordClassIndex(7158);
                        }

                        public final void LIZ() {
                            super.LIZ();
                            C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onPlayDisplayed");
                            LinkControlWidget.this.LIZJ(0);
                            LinkControlWidget linkControlWidget = LinkControlWidget.this;
                            linkControlWidget.LIZ(linkerInviteContent, linkControlWidget.LJFF, true, false);
                        }

                        public final void LIZIZ() {
                            super.LIZIZ();
                            C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onPlayOverTime");
                            LinkControlWidget.this.LIZJ(-1);
                            LinkControlWidget.this.LIZ(linkerInviteContent, (LinkCoHostBeInviteVideoPreloadWidget) null, true, true);
                        }

                        public final void LIZ(Exception exc) {
                            super.LIZ(exc);
                            if (exc == null) {
                                C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onNonPlayerInternalError");
                            } else {
                                C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onNonPlayerInternalError: " + exc.getMessage());
                            }
                            LinkControlWidget linkControlWidget = LinkControlWidget.this;
                            linkControlWidget.LIZJ(linkControlWidget.LJIILIIL());
                            LinkControlWidget.this.LIZ(linkerInviteContent, (LinkCoHostBeInviteVideoPreloadWidget) null, true, true);
                        }

                        public final void a_(Exception exc) {
                            super.a_(exc);
                            if (exc == null) {
                                C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onError");
                            } else {
                                C24190xt.LIZ("CoHost_PrePare_Show_VideoPreview_onError: " + exc.getMessage());
                            }
                            LinkControlWidget linkControlWidget = LinkControlWidget.this;
                            linkControlWidget.LIZJ(linkControlWidget.LJIILIIL());
                            LinkControlWidget.this.LIZ(linkerInviteContent, (LinkCoHostBeInviteVideoPreloadWidget) null, true, true);
                        }
                    });
                    LinkCoHostBeInviteVideoPreloadWidget linkCoHostBeInviteVideoPreloadWidget2 = this.LJFF;
                    String valueOf = String.valueOf(linkerInviteContent.LIZIZ);
                    long elapsedRealtime = SystemClock.elapsedRealtime();
                    C24190xt.LIZ("LinkCoHostBeInviteVideoPreloadWidget_StarPreLoadVideo");
                    if (valueOf == null || valueOf.length() == 0) {
                        linkCoHostBeInviteVideoPreloadWidget2.LJIIIZ = -4;
                        linkCoHostBeInviteVideoPreloadWidget2.LIZIZ(new Exception("RoomIds_IsNullOrEmpty"));
                    } else if (!linkCoHostBeInviteVideoPreloadWidget2.LIZIZ) {
                        linkCoHostBeInviteVideoPreloadWidget2.LIZIZ = true;
                        C16110kr r7 = new C16110kr(linkCoHostBeInviteVideoPreloadWidget2);
                        C10310bV.LIZ().postDelayed(r7, (long) (LiveCohostPreviewDelaySetting.INSTANCE.getValue() * 1000.0f));
                        linkCoHostBeInviteVideoPreloadWidget2.LIZLLL = r7;
                        linkCoHostBeInviteVideoPreloadWidget2.LIZJ = ((CoHostApi) C24850yx.LIZ().LIZ(CoHostApi.class)).getPullStreamInfoByRoomIds(valueOf).LIZ(new Hzs()).LIZ(new C32371Ql(linkCoHostBeInviteVideoPreloadWidget2, valueOf, elapsedRealtime), new C32381Qm(linkCoHostBeInviteVideoPreloadWidget2));
                    }
                }
            }
        }
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget] */
    public final void LIZ(LinkerInviteContent linkerInviteContent, LinkCoHostBeInviteVideoPreloadWidget linkCoHostBeInviteVideoPreloadWidget, boolean z, boolean z2) {
        if (LiveCoHostPreviewAnchorAndroidSwitchSetting.INSTANCE.getValue()) {
            if (this.LJIJJLI) {
                C24190xt.LIZ("HasShowBeInvitedFragment_True");
                return;
            }
            this.LJIJJLI = true;
            if (z && z2) {
                LJIILJJIL();
            }
        }
        C18000nu r3 = (C18000nu) this.dataChannel.LIZIZ(AnonymousClass2BF.class);
        C09630aP.LIZ(4, "LinkControlWidget", "showInviteFragmentAndStartLinkCross, permission = ".concat(String.valueOf(r3)));
        if (r3 == null || !r3.isMultiCoHost()) {
            AnonymousClass1U0.LIZ(this.dataChannel, C24420yG.LIZ((AnonymousClass0CH) this, linkerInviteContent, linkCoHostBeInviteVideoPreloadWidget));
            if (C31851Ol.LLFII.LIZ().LJJIJIL && !TextUtils.isEmpty(C31851Ol.LLFII.LIZ().LJJIJIIJIL)) {
                PrivacyCert.Builder with = PrivacyCert.Builder.with("bpea-507");
                with.usage("");
                with.tag("link mic start to push stream");
                with.policies(new 9qj[]{PrivacyPolicyStore.getAudioPrivacyPolicy()});
                LIZ((Cert) with.build());
                CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
                if (coHostLiveWidget != null && (coHostLiveWidget instanceof LinkCrossRoomWidget)) {
                    ((LinkCrossRoomWidget) coHostLiveWidget).LIZ((Boolean) true);
                }
            }
        } else {
            AnonymousClass1U0.LIZ(this.dataChannel, C24420yG.LIZ(this, linkerInviteContent));
        }
        this.dataChannel.LIZJ(AnonymousClass2CB.class);
    }

    public final void LIZ(int i, boolean z, Cert cert) {
        JSONObject LJIIZILJ2 = LJIIZILJ();
        C10570bv.LIZ(LJIIZILJ2, "reply_status", i);
        TLk.LIZIZ.LIZJ("get_reply", LJIIZILJ2);
        if (i != 1) {
            JSONObject LJIIZILJ3 = LJIIZILJ();
            C10570bv.LIZ(LJIIZILJ3, "end_reason", "not_agree");
            TLk.LIZIZ.LIZ(2, LJIIZILJ3);
        }
        if (isViewValid()) {
            if (z || !C31851Ol.LLFII.LIZ().LIZJ) {
                C31851Ol.LLFII.LIZ().LIZJ = true;
                C09630aP.LIZ(4, "LinkControlWidget", "onReceiveReply, reply = " + i + "   guestUserId = " + C31851Ol.LLFII.LIZ().LJFF);
                if (i == 1) {
                    if (AnonymousClass1PF.LIZJ()) {
                        if (this.dataChannel != null) {
                            this.dataChannel.LIZJ(C53672Aj.class, "");
                        }
                        C31851Ol.LLFII.LIZ().LJIILIIL = true;
                    }
                    C18580oq.LIZ();
                    LIZ(cert);
                } else if (!AnonymousClass1PF.LIZJ()) {
                    Fz8.LIZ(C10000b0.LJ(), LIZIZ(i));
                    C23890xP LIZIZ2 = this.LJJII.LIZIZ(C23840xK.COHOST);
                    if (LIZIZ2 instanceof AnonymousClass1P2) {
                        ((AnonymousClass1P2) LIZIZ2).LIZJ();
                    }
                } else {
                    C31851Ol.LLFII.LIZ().LJIIJJI = true;
                    C23890xP LIZIZ3 = this.LJJII.LIZIZ(C23840xK.COHOST);
                    if ((LIZIZ3 instanceof AnonymousClass1P2) && ((AnonymousClass1P2) LIZIZ3).LIZJ()) {
                        this.dataChannel.LIZJ(C53662Ai.class, "");
                    }
                }
            }
        }
    }

    public final void LIZ(LinkMessage linkMessage) {
        if (!isViewValid() || linkMessage.LIZJ != 4) {
            return;
        }
        if (!this.LJIIIIZZ) {
            if (C31861Om.LIZ().LIZJ() && (this.dataChannel == null || this.dataChannel.LIZIZ(Fx3.class) == null || !((Boolean) this.dataChannel.LIZIZ(Fx3.class)).booleanValue())) {
                if (this.LJJIIJ == null) {
                    C31161Lu r2 = new C31161Lu(this.context);
                    r2.LIZJ(2131828992);
                    r2.LIZ(2131830035, C32671Rp.LIZ);
                    this.LJJIIJ = r2.LIZIZ();
                }
                LiveDialog liveDialog = this.LJJIIJ;
                if (liveDialog != null) {
                    liveDialog.show();
                    2fU.LIZ.LIZ(liveDialog);
                }
            }
            LJ(2);
            C43231nV.LJI(false);
        } else if (LiveSdkLinkmicFinishAnchorProtectSetting.INSTANCE.getValue()) {
            LIZIZ();
        }
    }

    public final void LIZ(String str) {
        C09630aP.LIZ(4, "LinkControlWidget", "linkmic_sei_update, sei = ".concat(String.valueOf(str)));
        C31851Ol.LLFII.LIZ().LJIL = str;
        if (!this.LJIIIIZZ) {
            boolean LIZ = C14350i1.LIZ(this.LJIIJJI, 2);
            C09630aP.LIZ(4, "LinkControlWidget", "onSei, containMultiGuest = ".concat(String.valueOf(LIZ)));
            if (!LIZ || this.LIZJ == null) {
                boolean LIZ2 = C14350i1.LIZ(this.LJIIJJI, 4);
                C09630aP.LIZ(4, "LinkControlWidget", "onSei, containCoHost = ".concat(String.valueOf(LIZ2)));
                if (LIZ2 && this.LIZLLL != null) {
                    C09630aP.LIZ(4, "LinkControlWidget", "onSei, containCoHost = true, mLinkCrossRoomWidget = " + this.LIZLLL);
                    this.LIZLLL.LIZ(str);
                    return;
                }
                return;
            }
            C09630aP.LIZ(4, "LinkControlWidget", "onSei, containMultiGuest = true, mMultiGuestAsGuestWidget = " + this.LIZJ);
            this.LIZJ.LIZ(str);
        }
    }

    public final void LIZ(C18000nu r8) {
        int i;
        C16290l9 r6 = this.LJIIL;
        M12.LIZ(r8);
        AnonymousClass1RA r2 = r6.LIZ;
        M12.LIZ(r8);
        boolean z = true;
        int i2 = 0;
        boolean z2 = r8 != C18000nu.NONE;
        if (r2.LJIJI != z2) {
            r2.LJIJI = z2;
            if (r2.LJIJI) {
                i = 0;
            } else {
                i = 8;
            }
            r2.LIZ(i);
        }
        r2.LJIJ = r8;
        r6.LIZLLL = r8;
        if (r8 == C18000nu.NONE) {
            z = false;
        }
        C24190xt.LIZJ("LinkCrossRoomPermissionResult", "result : ".concat(String.valueOf(z)));
        C09630aP.LIZ(4, "LinkControlWidget", "onLinkCrossRoomPermissionResult, permission = ".concat(String.valueOf(r8)));
        JSONObject jSONObject = new JSONObject();
        if (!z) {
            i2 = -1;
        }
        C10570bv.LIZ(jSONObject, "err_code", i2);
        Hdy.LIZ.LIZIZ("check_permission", jSONObject);
        if (this.LJJ) {
            this.LJIIL.LIZ(8, 17);
        }
        this.LJJII.LIZ = z;
        C31851Ol.LLFII.LIZ().LJJL = z;
        LJIJJLI();
    }

    public final void LIZ(boolean z) {
        if (this.LJIIIIZZ && z) {
            HashMap hashMap = new HashMap();
            hashMap.put("action_type", "show");
            hashMap.put("invite_entrance", "golive_window");
            C21810u3.LIZIZ.LIZ((Map<String, String>) hashMap, C21810u3.LIZIZ.LIZIZ());
            C24230xx.LIZJ.LIZ("livesdk_anchor_guest_connection_entrance_click", (Map<String, String>) hashMap);
        }
        C24190xt.LIZJ("LinkInRoomPermissionResult", "result : ".concat(String.valueOf(z)));
        C16290l9 r3 = this.LJIIL;
        AnonymousClass1RK r1 = r3.LIZIZ;
        r1.LIZ = z;
        r1.LIZ(r1.LIZ ? 0 : 8);
        r3.LIZJ = z;
        if (this.LJJ) {
            this.LJIIL.LIZ(8, 17);
        }
        this.LJJII.LIZIZ = z;
        GiY.LIZ().LJJIIJ = z;
        LJIJJLI();
        Room room = this.LJII;
        boolean booleanValue = ((Boolean) GFy.LLIFFJFJJ.LIZ()).booleanValue();
        HashMap hashMap2 = new HashMap();
        hashMap2.put("anchor_id", String.valueOf(room.getOwnerUserId()));
        hashMap2.put("room_id", room.getIdStr());
        String str = "1";
        hashMap2.put("guest_avaliable", z ? str : "0");
        if (!booleanValue) {
            str = "0";
        }
        hashMap2.put("guest_connection_switch_status", str);
        C24290y3.LIZ("livesdk_guest_connection_switch_status", (Map<String, String>) hashMap2);
        if (z && !this.LJJ && this.LJI != null) {
            if (((Boolean) GFy.LLIFFJFJJ.LIZ()).booleanValue() && !LJIJJ()) {
                this.LJI.LIZ(7er.AUTO_START);
            } else if (LJIJJ()) {
                this.LJI.LIZ(7er.ACTIVITY_PAGE_OPEN);
            } else if (((Boolean) GFy.LLIFFJFJJ.LIZ()).booleanValue()) {
                GFy.LLIFFJFJJ.LIZ(false);
            }
        }
    }

    public final void LIZ(LinkMicAnchorGuideMessage linkMicAnchorGuideMessage) {
        String valueOf;
        C46271sP r7;
        C46271sP r8;
        Boolean bool = false;
        if (!(this.dataChannel == null || this.dataChannel.LIZIZ(HFh.class) == null)) {
            bool = (Boolean) this.dataChannel.LIZIZ(HFh.class);
        }
        if (C31851Ol.LLFII.LIZ().LJJJZ == -1 && !bool.booleanValue()) {
            C31851Ol.LLFII.LIZ().LJLLLL = linkMicAnchorGuideMessage.LJFF;
            if (linkMicAnchorGuideMessage.LJ != null) {
                this.dataChannel.LIZ(HFg.class, Long.valueOf(linkMicAnchorGuideMessage.LJ.getId()));
                C16290l9 r1 = this.LJIIL;
                M12.LIZ(linkMicAnchorGuideMessage);
                User user = linkMicAnchorGuideMessage.LJ;
                String str = "";
                if (user != null) {
                    AnonymousClass1RA r6 = r1.LIZ;
                    n.LIZIZ(user, str);
                    M12.LIZ(user);
                    AnonymousClass292 r9 = r6.LJIIJ;
                    if (!(r9 == null || (r7 = r6.LJIIIIZZ) == null || (r8 = r6.LJIIIZ) == null)) {
                        C41731l5 r5 = new C41731l5(r6, r7, r8, r9, new AnonymousClass1R3(r6, r8, r9, r7));
                        ImageModel avatarThumb = user.getAvatarThumb();
                        n.LIZIZ(avatarThumb, str);
                        HI6.LIZ(avatarThumb).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C32511Qz(r6, r5, avatarThumb, r7), new AnonymousClass1R0(r5, avatarThumb));
                    }
                }
                Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
                if (room == null) {
                    valueOf = str;
                } else {
                    valueOf = String.valueOf(room.getOwnerUserId());
                    str = room.getIdStr();
                }
                C24290y3.LIZ(valueOf, str, "anchor_icon", String.valueOf(linkMicAnchorGuideMessage.LJI), String.valueOf(linkMicAnchorGuideMessage.LJ.getId()));
            }
        }
    }

    public final void LIZLLL() {
        LJ(4);
    }

    public final void LJIIJ() {
        C21140sy.LIZLLL(this.dataChannel);
    }

    private void LJIL() {
        C16370lH.LIZ(this.LJII, new C41951lR(this));
    }

    private void LJJ() {
        C16370lH.LIZ(this.LJII, new C41961lS(this));
    }

    public static void LJJI() {
        LivePerformanceManager.getInstance().onModuleStop("link_mic");
    }

    public final void LIZJ() {
        C18580oq.LIZ("LinkDialog");
        LIZLLL(4);
    }

    public final void LJ() {
        if (isViewValid()) {
            C18580oq.LIZ();
        }
    }

    public final void LJFF() {
        if (isViewValid()) {
            C18580oq.LIZ("LinkDialog");
            LJIILJJIL();
        }
    }

    public final void LJII() {
        CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
        if (coHostLiveWidget != null && this.LJIIIIZZ) {
            coHostLiveWidget.LIZ(204);
        }
    }

    public final String LJIIL() {
        return getClass().getName();
    }

    public final int LJIILIIL() {
        LinkCoHostBeInviteVideoPreloadWidget linkCoHostBeInviteVideoPreloadWidget = this.LJFF;
        if (linkCoHostBeInviteVideoPreloadWidget != null) {
            return linkCoHostBeInviteVideoPreloadWidget.LJIIIZ;
        }
        return -4;
    }

    private boolean LJIILLIIL() {
        if (C31851Ol.LLFII.LIZ().LJJLJLI >= 10000) {
            return true;
        }
        return false;
    }

    private boolean LJIJJ() {
        C264913v r1 = (C264913v) DataChannelGlobal.LIZLLL.LIZIZ(C54252Cp.class);
        if (r1 == null || r1.LIZIZ == null || r1.LIZIZ.intValue() != 1) {
            return false;
        }
        return true;
    }

    public final void LIZ() {
        LJIJ();
        C16480lS.LIZJ.LIZIZ(this.LJIIL.LIZIZ.LIZJ, new C16390lJ(this), C16460lQ.MULTIGUEST);
    }

    public final void LJIILJJIL() {
        if (this.LJFF != null && LiveCoHostPreviewAnchorAndroidSwitchSetting.INSTANCE.getValue()) {
            this.LJIIIZ.LIZ((LiveWidget) this.LJFF);
            this.LJFF = null;
        }
    }

    private JSONObject LJIIZILJ() {
        String str;
        String str2;
        JSONObject jSONObject = new JSONObject();
        C31851Ol LIZ = C31851Ol.LLFII.LIZ();
        if (LIZ.LJIILLIIL) {
            str = "inviter";
        } else {
            str = "invitee";
        }
        C10570bv.LIZ(jSONObject, "role_type", str);
        if (LIZ.LJIILIIL) {
            str2 = "random";
        } else {
            str2 = "normal";
        }
        C10570bv.LIZ(jSONObject, "from", str2);
        return jSONObject;
    }

    private void LJIJ() {
        CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
        if (coHostLiveWidget != null && coHostLiveWidget.LIZJ() != null) {
            Object LIZJ2 = this.LIZLLL.LIZJ();
            if (LIZJ2 instanceof C32841Sg) {
                C16480lS.LIZJ.LIZ(((C32841Sg) LIZJ2).LIZ, new C16410lL(this), C16460lQ.PK);
            }
        }
    }

    private void LJIJJLI() {
        if (this.dataChannel != null && LiveAppBundleUtils.isPluginAvailable(8gY.LINK_MIC)) {
            boolean z = this.LJJII.LIZ;
            boolean z2 = this.LJJII.LIZIZ;
            int i = 0;
            if (z) {
                if (z2) {
                    i = 3;
                } else {
                    i = 1;
                }
            } else if (z2) {
                i = 2;
            }
            this.dataChannel.LIZ(AnonymousClass2AD.class, Integer.valueOf(i));
            C09630aP.LIZ(4, "updateLinkMicEnableStatus", "newestStatus = ".concat(String.valueOf(i)));
        }
    }

    public final void LJI() {
        if (isViewValid() && C18580oq.LIZIZ("LinkDialog")) {
            M12.LIZ("LinkDialog");
            C18600os r1 = C18580oq.LIZ.get("LinkDialog");
            if (r1 != null && (r1 instanceof AnonymousClass1U0) && !((AnonymousClass1U0) r1).LIZIZ.LIZLLL().isUserListType()) {
                C18580oq.LIZ("LinkDialog");
            }
        }
    }

    public final void LIZIZ() {
        GiY.LIZ().LIZ(false);
        if (C14350i1.LIZ(this.LJIIJJI, 2)) {
            LJ(2);
        }
        if (this.LJIIIIZZ && MultiGuestHostSideSwitchSetting.INSTANCE.isEnable()) {
            Fz8.LIZ(C10000b0.LJ(), 2131829938);
        }
        if (!this.LJIIIIZZ) {
            this.LJIIL.LIZ(8, 16);
            C21810u3.LIZIZ.LIZIZ("others", C14600iQ.NORMAL);
        }
        7ju.LIZ.LIZIZ("multi-guest turn off");
    }

    public final void LJIIIIZZ() {
        if (isViewValid() && !this.LJIIIIZZ) {
            if (!LiveAppBundleUtils.isPluginAvailable(8gY.LINK_MIC)) {
                LiveAppBundleUtils.ensurePluginAvailable(8gY.LINK_MIC);
                Fz8.LIZ(C10000b0.LJ(), 2131830069);
            } else if (this.LJJ) {
                Fz8.LIZ(C10000b0.LJ(), 2131829096);
            } else if (!C14350i1.LIZ(this.LJIIJJI, 2)) {
                Fz8.LIZ(C10000b0.LJ(), 2131829983);
            } else {
                LIZLLL(this.LJIIIIZZ);
            }
        }
    }

    /* renamed from: com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget$5  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass5 {
        public static final /* synthetic */ int[] LIZ;
        public static final /* synthetic */ int[] LIZIZ;

        /* JADX WARNING: Can't wrap try/catch for region: R(24:0|1|2|3|(2:5|6)|7|(2:9|10)|11|(2:13|14)|15|17|18|19|20|21|23|24|25|26|27|28|29|30|(3:31|32|34)) */
        /* JADX WARNING: Can't wrap try/catch for region: R(27:0|1|2|3|(2:5|6)|7|(2:9|10)|11|13|14|15|17|18|19|20|21|23|24|25|26|27|28|29|30|31|32|34) */
        /* JADX WARNING: Can't wrap try/catch for region: R(28:0|1|2|3|5|6|7|(2:9|10)|11|13|14|15|17|18|19|20|21|23|24|25|26|27|28|29|30|31|32|34) */
        /* JADX WARNING: Can't wrap try/catch for region: R(29:0|1|2|3|5|6|7|9|10|11|13|14|15|17|18|19|20|21|23|24|25|26|27|28|29|30|31|32|34) */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:19:0x0043 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:25:0x005f */
        /* JADX WARNING: Missing exception handler attribute for start block: B:27:0x0069 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:29:0x0073 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:31:0x007d */
        static {
            /*
                r0 = 7160(0x1bf8, float:1.0033E-41)
                com.bytedance.covode.number.Covode.recordClassIndex(r0)
                X.0if[] r0 = X.C14750if.values()
                int r0 = r0.length
                int[] r1 = new int[r0]
                LIZIZ = r1
                r7 = 1
                X.0if r0 = X.C14750if.DISABLED     // Catch:{ NoSuchFieldError -> 0x0017 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0017 }
                r1[r0] = r7     // Catch:{ NoSuchFieldError -> 0x0017 }
            L_0x0017:
                r6 = 2
                int[] r1 = LIZIZ     // Catch:{ NoSuchFieldError -> 0x0022 }
                X.0if r0 = X.C14750if.CONNECTION_FINISH_SUCCEED     // Catch:{ NoSuchFieldError -> 0x0022 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0022 }
                r1[r0] = r6     // Catch:{ NoSuchFieldError -> 0x0022 }
            L_0x0022:
                r5 = 3
                int[] r1 = LIZIZ     // Catch:{ NoSuchFieldError -> 0x002d }
                X.0if r0 = X.C14750if.MATCH     // Catch:{ NoSuchFieldError -> 0x002d }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x002d }
                r1[r0] = r5     // Catch:{ NoSuchFieldError -> 0x002d }
            L_0x002d:
                r4 = 4
                int[] r1 = LIZIZ     // Catch:{ NoSuchFieldError -> 0x0038 }
                X.0if r0 = X.C14750if.INVITING     // Catch:{ NoSuchFieldError -> 0x0038 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0038 }
                r1[r0] = r4     // Catch:{ NoSuchFieldError -> 0x0038 }
            L_0x0038:
                r3 = 5
                int[] r1 = LIZIZ     // Catch:{ NoSuchFieldError -> 0x0043 }
                X.0if r0 = X.C14750if.CONNECTION_START     // Catch:{ NoSuchFieldError -> 0x0043 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0043 }
                r1[r0] = r3     // Catch:{ NoSuchFieldError -> 0x0043 }
            L_0x0043:
                int[] r2 = LIZIZ     // Catch:{ NoSuchFieldError -> 0x004e }
                X.0if r0 = X.C14750if.CONNECTION_SUCCEED     // Catch:{ NoSuchFieldError -> 0x004e }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x004e }
                r0 = 6
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x004e }
            L_0x004e:
                X.0lh[] r0 = X.C16630lh.values()
                int r0 = r0.length
                int[] r1 = new int[r0]
                LIZ = r1
                X.0lh r0 = X.C16630lh.INVITED     // Catch:{ NoSuchFieldError -> 0x005f }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x005f }
                r1[r0] = r7     // Catch:{ NoSuchFieldError -> 0x005f }
            L_0x005f:
                int[] r1 = LIZ     // Catch:{ NoSuchFieldError -> 0x0069 }
                X.0lh r0 = X.C16630lh.NORMAL     // Catch:{ NoSuchFieldError -> 0x0069 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0069 }
                r1[r0] = r6     // Catch:{ NoSuchFieldError -> 0x0069 }
            L_0x0069:
                int[] r1 = LIZ     // Catch:{ NoSuchFieldError -> 0x0073 }
                X.0lh r0 = X.C16630lh.END     // Catch:{ NoSuchFieldError -> 0x0073 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0073 }
                r1[r0] = r5     // Catch:{ NoSuchFieldError -> 0x0073 }
            L_0x0073:
                int[] r1 = LIZ     // Catch:{ NoSuchFieldError -> 0x007d }
                X.0lh r0 = X.C16630lh.START     // Catch:{ NoSuchFieldError -> 0x007d }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x007d }
                r1[r0] = r4     // Catch:{ NoSuchFieldError -> 0x007d }
            L_0x007d:
                int[] r1 = LIZ     // Catch:{ NoSuchFieldError -> 0x0087 }
                X.0lh r0 = X.C16630lh.PUNISH     // Catch:{ NoSuchFieldError -> 0x0087 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0087 }
                r1[r0] = r3     // Catch:{ NoSuchFieldError -> 0x0087 }
            L_0x0087:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget.AnonymousClass5.<clinit>():void");
        }
    }

    private void LJIJI() {
        this.LJIL = SystemClock.elapsedRealtime();
        if (C31851Ol.LLFII.LIZ().LJIIZILJ > 0) {
            C31851Ol.LLFII.LIZ().LJJJJZ = this.LJIL;
        }
        C18000nu r0 = (C18000nu) this.dataChannel.LIZIZ(AnonymousClass2BF.class);
        if (r0 != null && r0.isMultiCoHost() && !AnonymousClass1PF.LIZ()) {
            this.LIZLLL = (CoHostLiveWidget) this.LJIIIZ.LIZ(6);
        } else if (!C41491kh.LIZ.LIZJ("LINKER_MANAGER")) {
            if (!(this.LJJII.LIZ() instanceof AnonymousClass1P2)) {
                this.LJI.LIZJ();
            }
            this.LIZLLL = (CoHostLiveWidget) this.LJIIIZ.LIZ(2);
        } else {
            return;
        }
        if (this.LJIIIIZZ) {
            this.LJIIL.LIZ(0, 1);
        } else {
            this.LJIIL.LIZ(8, 16);
        }
        this.dataChannel.LIZIZ(AnonymousClass2CK.class, 4);
        if (!this.LJIIIIZZ) {
            String str = C31851Ol.LLFII.LIZ().LJIL;
            if (!TextUtils.isEmpty(str)) {
                LIZ(str);
            }
        }
    }

    public final void LJIIIZ() {
        if (isViewValid() && this.LJIIIIZZ) {
            if (!LiveAppBundleUtils.isPluginAvailable(8gY.LINK_MIC)) {
                LiveAppBundleUtils.ensurePluginAvailable(8gY.LINK_MIC);
                Fz8.LIZ(C10000b0.LJ(), 2131830069);
            } else if (this.LJJ) {
                Fz8.LIZ(C10000b0.LJ(), 2131829096);
            } else {
                Room room = this.LJII;
                if (room != null && room.getMosaicStatus() == 1) {
                    Fz8.LIZ(C10000b0.LJ(), 2131833992);
                } else if (C14350i1.LIZ(this.LJIIJJI, 4)) {
                    if (C31851Ol.LLFII.LIZ().LIZ(C14750if.CONNECTION_START)) {
                        C09630aP.LIZ(6, "LinkControlWidget", "H5 open co-host, but now is co-hosting!");
                    } else if (C31851Ol.LLFII.LIZ().LIZJ() == C14750if.INVITING) {
                        C09630aP.LIZ(6, "LinkControlWidget", "H5 open co-host, but is inviting other host!");
                    }
                } else if (this.LJIIL.LIZ.LJIJI) {
                    C16360lG.LIZ(1);
                    this.LJIIL.LIZ(false);
                    C31851Ol.LLFII.LIZ().LJJLIIIJL = new C14300hw(C14300hw.LJII);
                    C24170xr.LIZ("connection_invite", C31851Ol.LLFII.LIZ().LJJLIIIJL);
                    LJIILL();
                    C24290y3.LIZ(this.dataChannel);
                }
            }
        }
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget] */
    public final boolean LJIILL() {
        Object LIZIZ2;
        JSONObject jSONObject = new JSONObject();
        C14300hw r1 = C31851Ol.LLFII.LIZ().LJJLIIIJL;
        if (r1 == null) {
            r1 = new C14300hw(C14300hw.LJII);
            C31851Ol.LLFII.LIZ().LJJLIIIJL = r1;
        }
        C10570bv.LIZ(jSONObject, "from", r1.LIZJ);
        C10570bv.LIZ(jSONObject, "room_id", this.LJII.getIdStr());
        C10570bv.LIZ(jSONObject, "record_id", this.LJII.getIdStr());
        C10570bv.LIZ(jSONObject, "user_id", this.LJII.getOwnerUserId());
        He0.LIZ.LIZ(jSONObject);
        if (!((IInteractService) C11100cm.LIZ(IInteractService.class)).canLinkMic()) {
            Fz8.LIZ(C10000b0.LJ(), 2131828342);
            return false;
        } else if (this.LJI.LIZLLL() || C18580oq.LIZIZ("LinkDialog") || (LIZIZ2 = this.dataChannel.LIZIZ(AnonymousClass2BF.class)) == C18000nu.NONE) {
            return false;
        } else {
            if (LIZIZ2 == C18000nu.SUPPORT_MULTI) {
                AnonymousClass1U0.LIZ(this.dataChannel, C24420yG.LIZIZ(this));
                return true;
            }
            AnonymousClass1U0.LIZ(this.dataChannel, C24420yG.LIZ(this));
            return true;
        }
    }

    public void onDestroy() {
        this.LJIIIZ = null;
        C35621bE r2 = this.LJJIII;
        if (r2 != null) {
            try {
                IMessageManager iMessageManager = (IMessageManager) r2.LIZ.LIZIZ(HGo.class);
                if (iMessageManager != null) {
                    iMessageManager.removeMessageListener(r2);
                }
            } catch (Exception e) {
                C09630aP.LIZ("ALogger", e);
            }
        }
        C41761l8 r0 = this.LJI;
        if (r0 != null) {
            r0.f_();
        }
        C18580oq.LIZ("LinkDialog");
        this.dataChannel.LIZIZ(this);
        DataChannelGlobal.LIZLLL.LIZIZ(this);
        GiY.LIZ().LIZ = null;
        if (!this.LJIIIIZZ) {
            C21810u3.LIZIZ.LIZIZ("live_over", (C14600iQ) null);
        }
        LinkControlWidget.super.onDestroy();
        if (!LJIJJ()) {
            C41491kh.LIZ.LIZ().clear();
        }
        C18580oq.LIZ();
        this.LJJII.LIZ(C23840xK.MULTIGUEST);
        if (C20260rY.LIZJ.LIZ().LIZLLL()) {
            C20260rY.LIZJ.LIZ().LJII();
            C14250hr.LIZIZ().release();
        }
        LIZJ("onDestroy");
    }

    public final void LJIIJJI() {
        boolean z;
        Boolean bool;
        if (!LiveAppBundleUtils.isPluginAvailable(8gY.LINK_MIC)) {
            Fz8.LIZ(C10000b0.LJ(), 2131833755);
            return;
        }
        Room room = this.LJII;
        if (room == null || room.getMosaicStatus() != 1) {
            C24290y3.LIZ(this.LJIIJJI, this.LJII, (C14600iQ) null, true, AnonymousClass1PF.LIZ());
            C14300hw r4 = new C14300hw("connection_icon");
            DataChannel dataChannel = this.LJIIL.LIZ.LJIIZILJ;
            if (dataChannel == null || (bool = (Boolean) dataChannel.LIZIZ(C53792Av.class)) == null) {
                z = false;
            } else {
                z = bool.booleanValue();
            }
            r4.LIZIZ = Boolean.valueOf(z);
            if (AnonymousClass1PF.LJ() || AnonymousClass1PF.LIZLLL()) {
                C31851Ol.LLFII.LIZ().LJJLIIIJL = r4;
                C24170xr.LIZ("cancel_random_waiting", r4);
                AnonymousClass1PF.LIZ(C14870ir.PREVIEW_DIALOG);
            } else if (AnonymousClass1PF.LJFF()) {
                C31851Ol.LLFII.LIZ().LJJLIIIJL = r4;
                C24170xr.LIZ("disconnect_connection", r4);
                AnonymousClass1PF.LIZ(C14870ir.CANCEL_DIALOG);
            } else if (C14350i1.LIZ(this.LJIIJJI, 4)) {
                CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
                if (coHostLiveWidget != null) {
                    coHostLiveWidget.LIZIZ();
                }
            } else {
                C16360lG.LIZ(1);
                C31851Ol.LLFII.LIZ().LJJLIIIJL = r4;
                String str = "";
                if (LJIILL()) {
                    if (((IInteractService) C11100cm.LIZ(IInteractService.class)).hasMultiCoHostPermission()) {
                        C24170xr.LIZ("connection_invite", C31851Ol.LLFII.LIZ().LJJLIIIJL);
                    } else {
                        HashMap hashMap = new HashMap();
                        hashMap.put("request_page", "room");
                        if (!TextUtils.isEmpty((CharSequence) null)) {
                            hashMap.put("notice_type", (Object) null);
                        }
                        hashMap.put("enter_from", "connection_icon");
                        Room room2 = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
                        if (room2 != null) {
                            hashMap.put("room_id", String.valueOf(room2.getId()));
                            hashMap.put("anchor_id", String.valueOf(room2.getOwnerUserId()));
                        }
                        String str2 = C31851Ol.LLFII.LIZ().LJLLLLLL;
                        String str3 = "0";
                        if (str2 != null && !str3.equals(str2)) {
                            str3 = "1";
                        }
                        hashMap.put("is_anchor_icon_show", str3);
                        String str4 = C31851Ol.LLFII.LIZ().LJLLLL;
                        if (str2 == null || str2.isEmpty()) {
                            hashMap.put("log_id", str);
                        } else {
                            hashMap.put("to_anchor_id", str2);
                            hashMap.put("log_id", str4);
                        }
                        if (C31851Ol.LLFII.LIZ().LJ != 0) {
                            hashMap.put("channel_id", String.valueOf(C31851Ol.LLFII.LIZ().LJ));
                        }
                        hashMap.put("click_reason", "connection_invite");
                        C24290y3.LIZ("connection_icon_click", (Map<String, String>) hashMap);
                    }
                    C24290y3.LIZ(this.dataChannel);
                }
                Object LIZIZ2 = this.dataChannel.LIZIZ(HFg.class);
                C31851Ol LIZ = C31851Ol.LLFII.LIZ();
                if (LIZIZ2 != null) {
                    str = String.valueOf(LIZIZ2);
                }
                LIZ.LJLLLLLL = str;
            }
        } else {
            Fz8.LIZ(C10000b0.LJ(), 2131833992);
        }
    }

    /* JADX WARNING: type inference failed for: r13v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget, java.lang.Object, X.1l7] */
    public void onCreate() {
        EnterRoomConfig enterRoomConfig;
        LinkControlWidget.super.onCreate();
        LIZJ("onCreate");
        this.LJJ = ((IMicRoomService) C11100cm.LIZ(IMicRoomService.class)).isMicRoomForCurrentRoom();
        this.LJII = (Room) this.dataChannel.LIZIZ(Fv7.class);
        this.LJIIIIZZ = ((Boolean) this.dataChannel.LIZIZ(Fv2.class)).booleanValue();
        this.LJIJJ = (GIv) this.dataChannel.LIZIZ(HFc.class);
        if (this.LJIIIIZZ) {
            AnonymousClass158.COHOST.load(this.dataChannel, this.LJIIL.LIZ, false);
        }
        AnonymousClass158.MULTIGUEST.load(this.dataChannel, this.LJIIL.LIZIZ, false);
        this.LJIIL.LIZ(8, 17);
        C35621bE r2 = new C35621bE(this.dataChannel);
        this.LJJIII = r2;
        IMessageManager iMessageManager = (IMessageManager) r2.LIZ.LIZIZ(HGo.class);
        if (iMessageManager != null) {
            iMessageManager.addMessageListener(HKs.LINK_MIC_SIGNAL.getIntType(), r2);
            iMessageManager.addMessageListener(HKs.LINK_MIC.getIntType(), r2);
            iMessageManager.addMessageListener(HKs.LINK_MESSAGE.getIntType(), r2);
            iMessageManager.addMessageListener(HKs.SOCIAL.getIntType(), r2);
            iMessageManager.addMessageListener(HKs.LINK_CO_HOST_GUIDE.getIntType(), r2);
        }
        C41491kh.LIZ.LIZ(new C23920xS(), (String) null);
        C41491kh.LIZ.LIZ(this.LJJIII, (String) null);
        C41491kh.LIZ.LIZ((Object) this);
        C41761l8 r5 = new C41761l8(this.LJII, this.LJIIIIZZ, this.LJIJJ);
        this.LJI = r5;
        r5.LIZ((C41751l7) this);
        DataChannel dataChannel = this.dataChannel;
        dataChannel.LIZ(this, AnonymousClass2CA.class, new C41941lQ(this));
        dataChannel.LIZ(this, C53682Ak.class, new C42091lf(this));
        dataChannel.LIZ(this, GdG.class, new C42201lq(this));
        dataChannel.LIZ(this, GdC.class, new C42311m1(this));
        dataChannel.LIZ(this, C53592Ab.class, new C41981lU(this));
        dataChannel.LIZ(this, AnonymousClass2CL.class, new C42041la(this));
        dataChannel.LIZ(this, AnonymousClass2CC.class, new C42051lb(this));
        dataChannel.LIZ(this, AnonymousClass2AH.class, new C42061lc(this));
        dataChannel.LIZ(this, C53632Af.class, new C42071ld(this));
        dataChannel.LIZ(this, C53692Al.class, new C42081le(this));
        dataChannel.LIZ(this, C53722Ao.class, new C42101lg(this));
        dataChannel.LIZ(this, C53702Am.class, new C42111lh(this));
        dataChannel.LIZ(this, C53712An.class, new C42121li(this));
        dataChannel.LIZ(this, AnonymousClass2CJ.class, new C42131lj(this));
        dataChannel.LIZ(this, AnonymousClass2BG.class, C42141lk.LIZ);
        dataChannel.LIZ(this, AnonymousClass2BQ.class, new C42151ll(this));
        dataChannel.LIZ(this, AnonymousClass2CU.class, new C42161lm(this));
        dataChannel.LIZ(this, AnonymousClass2D2.class, new C42171ln(this));
        dataChannel.LIZ(this, AnonymousClass2AZ.class, new C42181lo(this));
        dataChannel.LIZ(this, C53602Ac.class, new C42191lp(this));
        dataChannel.LIZ(this, AnonymousClass2AE.class, new C42211lr(this));
        dataChannel.LIZ(this, C53622Ae.class, new C42221ls(this));
        dataChannel.LIZ(this, C53612Ad.class, C42231lt.LIZ);
        dataChannel.LIZ(this, AnonymousClass2CP.class, new C42241lu(this));
        DataChannelGlobal.LIZLLL.LIZ(this, AnonymousClass2CN.class, new C42251lv(this));
        DataChannelGlobal.LIZLLL.LIZ(this, C54262Cq.class, new C42261lw(this));
        C16350lF r52 = new C16350lF();
        boolean z = this.LJIIIIZZ;
        boolean z2 = this.LJJ;
        int i = this.LJIIJJI;
        C16290l9 r10 = this.LJIIL;
        M12.LIZ(r10);
        C24410yF r9 = (C24410yF) C41491kh.LIZ.LIZIZ("LINK_MIC_APP_BUNDLE_UTIL");
        if (r9 == null) {
            r9 = new C35941bk(z);
            C41491kh.LIZ.LIZ(r9, (String) null);
        }
        Hdy.LIZ.LIZ("load_plugin", (JSONObject) null);
        C35941bk.LIZJ.LIZ("start load linkmic plugin silently. ".concat(String.valueOf(r52)));
        LiveAppBundleUtils.ensurePluginAvailable$default(8gY.LINK_MIC, new AnonymousClass1RS(r52, z, System.currentTimeMillis(), r9, r10, i, z2), false, 4, (Object) null);
        LiveAppBundleUtils.ensurePluginAvailable$default(8gY.QUIC, (8gM) null, false, 6, (Object) null);
        LiveAppBundleUtils.ensurePluginAvailable$default(8gY.RTS, (8gM) null, false, 6, (Object) null);
        if (this.dataChannel != null) {
            this.dataChannel.LIZ(this, C54232Cn.class, new C41971lT(this));
        }
        if (this.dataChannel != null) {
            this.dataChannel.LIZ(this, AnonymousClass2AF.class, new C41991lV(this));
        }
        DataChannel dataChannel2 = this.dataChannel;
        dataChannel2.LIZ(this, AnonymousClass2AO.class, new C42281ly(this));
        dataChannel2.LIZ(this, AnonymousClass2BC.class, new C42291lz(this));
        dataChannel2.LIZ(this, AnonymousClass2B9.class, new C42301m0(this));
        GiY.LIZ().LIZ = new GiZ() {
            public boolean LIZ;

            static {
                Covode.recordClassIndex(7156);
            }

            public final void LIZ(boolean z) {
                if (this.LIZ != z) {
                    this.LIZ = z;
                    C09630aP.LIZ(4, "LinkControlWidget", "multi-guest state: ".concat(String.valueOf(z)));
                    if (z) {
                        LinkControlWidget.this.dataChannel.LIZJ(AnonymousClass2AL.class, new C14520iI(C14520iI.LIZJ));
                        C16200l0.LIZIZ.LIZ(C14520iI.LIZJ);
                        return;
                    }
                    LinkControlWidget.this.dataChannel.LIZJ(AnonymousClass2AL.class, new C14520iI(C14520iI.LIZIZ));
                    C16200l0.LIZIZ.LIZ(C14520iI.LIZIZ);
                }
            }
        };
        GiY.LIZ().LIZIZ = new GiZ() {
            public boolean LIZ;

            static {
                Covode.recordClassIndex(7157);
            }

            public final void LIZ(boolean z) {
                if (this.LIZ != z) {
                    this.LIZ = z;
                    LinkControlWidget.this.dataChannel.LIZJ(C53632Af.class);
                }
            }
        };
        if (!this.LJIIIIZZ) {
            this.dataChannel.LIZ(this, Gcz.class, new C42271lx(this));
        }
        if (!this.LJIIIIZZ) {
            C21810u3.LIZIZ.LIZ("live_play", C14600iQ.NORMAL);
        }
        boolean z3 = this.LJIIIIZZ;
        Room room = this.LJII;
        M12.LIZ(room);
        if (!z3) {
            C34361Yc r4 = new C34361Yc();
            Glf glf = GAX.LIZ;
            n.LIZIZ(glf, "");
            EnterRoomLinkSession LIZIZ2 = glf.LIZIZ();
            if (!(LIZIZ2 == null || (enterRoomConfig = LIZIZ2.LIZIZ) == null)) {
                r4.LIZ(enterRoomConfig.LIZLLL.LJIILL, room, true);
                C41491kh.LIZ.LIZ(r4, (String) null);
                if (enterRoomConfig.LIZLLL.LJIILL != null) {
                    enterRoomConfig.LIZLLL.LJIILL = "-1";
                }
            }
        }
        GbZ.LIZIZ().LIZ("link_mic_sync", "widget_create");
    }

    public final void LIZIZ(boolean z) {
        C21140sy.LIZJ(this.dataChannel);
        C31891Op r1 = this.LIZJ;
        if (r1 != null) {
            r1.LIZ(z, true);
        }
    }

    public final void LIZLLL(boolean z) {
        if (z) {
            LJJ();
        } else {
            LJIL();
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget, X.0l8] */
    public LinkControlWidget(C14260hs r2) {
        this.LJIIIZ = r2;
    }

    public final int LIZIZ(int i) {
        if (i != 2 && i != 4 && i != 11) {
            return 2131828342;
        }
        if (CohostShowNewTipsText.INSTANCE.isUseNewText()) {
            return 2131828064;
        }
        return 2131829128;
    }

    public final void LIZJ(boolean z) {
        C21140sy.LIZIZ(this.dataChannel);
        C31891Op r1 = this.LIZJ;
        if (r1 != null) {
            r1.LIZ(z, false);
        }
    }

    private void LIZ(Cert cert) {
        if (this.LIZLLL != null) {
            C09630aP.LIZ(4, "LinkControlWidget", "startLinkCross, mLinkCrossRoomWidget = " + this.LIZLLL);
            CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
            if (coHostLiveWidget instanceof LinkCrossRoomWidget) {
                ((LinkCrossRoomWidget) coHostLiveWidget).LIZ(cert);
                return;
            }
            return;
        }
        C09630aP.LIZ(4, "LinkControlWidget", "startLinkCross, switchMode");
        LIZLLL(4);
    }

    private void LIZJ(String str) {
        C09630aP.LIZ(4, "LinkControlWidget", "reset data holder ".concat(String.valueOf(str)));
        GiY.LIZ().LIZJ();
        7ju.LIZ.LIZIZ(str);
        C31861Om.LIZ().LJFF();
    }

    public final void LIZJ(int i) {
        if (LiveCoHostPreviewAnchorAndroidSwitchSetting.INSTANCE.getValue()) {
            JSONObject jSONObject = new JSONObject();
            C10570bv.LIZ(jSONObject, "err_code", i);
            LinkCoHostBeInviteVideoPreloadWidget linkCoHostBeInviteVideoPreloadWidget = this.LJFF;
            if (linkCoHostBeInviteVideoPreloadWidget != null) {
                C10570bv.LIZ(jSONObject, "get_pull_info_cost", linkCoHostBeInviteVideoPreloadWidget.LJII);
                C10570bv.LIZ(jSONObject, "pull_stream_cost", this.LJFF.LJIIIIZZ);
            }
            TLk.LIZIZ.LIZIZ("inviter_preview_first_frame_render", jSONObject);
        }
    }

    public final /* synthetic */ 2Pr LIZ(G9W g9w) {
        C09630aP.LIZ(4, "LinkControlWidget", "onPkEvent, event = ".concat(String.valueOf(g9w)));
        if (g9w.LIZ == 4) {
            PrivacyCert.Builder with = PrivacyCert.Builder.with("bpea-502");
            with.usage("");
            with.tag("link mic start to push stream");
            with.policies(new 9qj[]{PrivacyPolicyStore.getAudioPrivacyPolicy()});
            LIZ((Cert) with.build());
        }
        return 2Pr.LIZ;
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget, java.lang.Object, com.bytedance.android.widget.Widget] */
    public final void LIZIZ(LinkerInviteContent linkerInviteContent) {
        if (isViewValid() && C31851Ol.LLFII.LIZ().LJ != 0) {
            JSONObject jSONObject = new JSONObject();
            C10570bv.LIZ(jSONObject, "room_id", this.LJII.getIdStr());
            C10570bv.LIZ(jSONObject, "remote_room_id", linkerInviteContent.LIZIZ);
            C10570bv.LIZ(jSONObject, "record_id", C31851Ol.LLFII.LIZ().LJJJLL);
            C10570bv.LIZ(jSONObject, "user_id", this.LJII.getOwnerUserId());
            C10570bv.LIZ(jSONObject, "remote_user_id", linkerInviteContent.LIZ);
            C10570bv.LIZ(jSONObject, "is_inviter", false);
            TLk.LIZIZ.LIZ(jSONObject);
            TLk.LIZIZ.LIZ("popup_show");
            C09630aP.LIZ(4, "LinkControlWidget", "onReceiveApply, channelId = " + C31851Ol.LLFII.LIZ().LJ);
            C18580oq.LIZ("LinkDialog");
            C18000nu r0 = (C18000nu) this.dataChannel.LIZIZ(AnonymousClass2BF.class);
            if (r0 != null && r0.isMultiCoHost()) {
                DataChannel dataChannel = this.dataChannel;
                M12.LIZ(this, linkerInviteContent);
                LinkDialog linkDialog = new LinkDialog(this);
                C14960j0 r2 = C14960j0.INVITEE_APPLIED_MULTI_CO_HOST_FRAGMENT;
                AnonymousClass1TU LIZ = AnonymousClass1TU.LIZJ.LIZ(linkerInviteContent);
                LIZ.LIZIZ = 2;
                linkDialog.LIZIZ(r2, LIZ);
                AnonymousClass1U0.LIZ(dataChannel, linkDialog);
            }
        }
    }

    private void LIZLLL(int i) {
        if (isViewValid()) {
            boolean LIZ = C14350i1.LIZ(this.LJIIJJI, i);
            C24190xt.LIZJ("SwitchMode", "CurrentMode:" + this.LJIIJJI + "; TargetMode:" + i + ", containMode = " + LIZ);
            C09630aP.LIZ(4, "LinkControlWidget", "switchMode, before -> CurrentMode:" + this.LJIIJJI + "; TargetMode:" + i + ", containMode = " + LIZ);
            if (!LIZ) {
                this.LJIIJJI |= i;
                C09630aP.LIZ(4, "LinkControlWidget", "switchMode, after -> CurrentMode:" + this.LJIIJJI);
                C31851Ol.LLFII.LIZ().LIZ(this.LJIIJJI);
                if (i == 2) {
                    LIZ("normal", this.LJIIIIZZ);
                    if (this.LJIIIIZZ) {
                        if (!this.LIZ) {
                            LJIJ();
                            C16480lS.LIZJ.LIZIZ(this.LJIIL.LIZIZ.LIZJ, new C16400lK(this), C16460lQ.MULTIGUEST);
                        }
                        BaseInternalLinkMicAnchorWidget baseInternalLinkMicAnchorWidget = (BaseInternalLinkMicAnchorWidget) this.LJIIIZ.LIZ(0);
                        this.LIZIZ = baseInternalLinkMicAnchorWidget;
                        C42981n6 r0 = this.LJIILL;
                        if (r0 != null) {
                            baseInternalLinkMicAnchorWidget.LIZ((C33651Vj) r0);
                        }
                        C42971n5 r1 = this.LJIILLIIL;
                        if (r1 != null) {
                            this.LIZIZ.LIZ(r1);
                        }
                        if (this.LJIIJ) {
                            this.LIZIZ.LIZIZ();
                        }
                        this.LJIIJ = false;
                    } else {
                        this.LIZJ = (C31891Op) this.LJIIIZ.LIZ(1);
                        C21140sy.LIZIZ(this.LJII, this.dataChannel);
                        C24190xt.LIZJ("SwitchMode", "TargetMode:" + i + ", action:loadMultiGuestWidget");
                    }
                    this.dataChannel.LIZIZ(AnonymousClass2CK.class, 2);
                } else if (i == 4) {
                    C24190xt.LIZJ("SwitchMode", "TargetMode:" + i + ", action:loadCoHostWidget");
                    LIZ("pk", this.LJIIIIZZ);
                    LJIJI();
                }
            }
        }
    }

    private void LJ(int i) {
        C09630aP.LIZ(4, "LinkControlWidget", "unLoadWidget, before -> CurrentMode = " + this.LJIIJJI + "  removeMode = " + i);
        C24190xt.LIZJ("unLoadWidget", "mode:".concat(String.valueOf(i)));
        if (C14350i1.LIZ(this.LJIIJJI, i)) {
            this.LJIIJJI = C14350i1.LIZIZ(this.LJIIJJI, i);
            C09630aP.LIZ(4, "LinkControlWidget", "unLoadWidget, after -> CurrentMode:" + this.LJIIJJI);
            C31851Ol.LLFII.LIZ().LIZ(this.LJIIJJI);
            C09630aP.LIZ(4, "LinkControlWidget", "unLoadWidget, after remove mode, mCurrentMode = " + this.LJIIJJI);
            if (i == 2) {
                C24150xp.LIZLLL.LIZ("other");
                C24150xp.LIZLLL.LIZIZ("connection_over");
                this.LJIIIZ.LIZ((LiveWidget) this.LIZIZ);
                this.LJIIIZ.LIZ(this.LIZJ);
                this.LIZIZ = null;
                this.LIZJ = null;
                this.LJJII.LIZ(C23840xK.MULTIGUEST);
                if (C20260rY.LIZJ.LIZ().LIZLLL()) {
                    C20260rY.LIZJ.LIZ().LJII();
                }
            } else if (i == 4) {
                this.LJIIIZ.LIZ((LiveWidget) this.LIZLLL);
                AnonymousClass0S6.LJFF.LIZ(2131562088);
                this.LJI.LJFF();
                this.LIZLLL = null;
                this.LJJII.LIZ(C23840xK.COHOST);
                LJIILJJIL();
                C18580oq.LIZ();
            }
            if (this.LJIIJJI == 0) {
                if (!this.LJIIIIZZ) {
                    this.LJIIL.LIZ(8, 16);
                    C24150xp.LIZLLL.LIZ("other");
                    if (C21810u3.LIZIZ.LIZ()) {
                        C21810u3.LIZIZ.LIZIZ("others", (C14600iQ) null);
                        C21810u3.LIZIZ.LIZ("others", C14600iQ.NORMAL);
                    }
                } else if (!this.LJJ && !this.LIZ) {
                    LJIJ();
                    C16480lS.LIZJ.LIZIZ(this.LJIIL.LIZIZ.LIZJ, new C16420lM(this), C16460lQ.MULTIGUEST);
                }
                this.dataChannel.LIZIZ(AnonymousClass2CK.class, 0);
                LJJI();
            }
        }
    }

    public final /* synthetic */ 2Pr LIZ(Boolean bool) {
        boolean booleanValue = bool.booleanValue();
        if (this.LJI == null) {
            return null;
        }
        this.LJJ = booleanValue;
        C16290l9 r4 = this.LJIIL;
        AnonymousClass1RA r1 = r4.LIZ;
        if (booleanValue) {
            r1.LIZ(8);
            r1.LJIIIIZZ();
        } else if (r1.LJIJI) {
            r1.LIZ(0);
        }
        AnonymousClass1RK r12 = r4.LIZIZ;
        if (booleanValue) {
            r12.LIZ(8);
        } else if (r12.LJI()) {
            r12.LIZ(0);
        }
        if (this.LJJ) {
            this.LJI.LJI = true;
            if (C14350i1.LIZ(this.LJIIJJI, 4)) {
                C18580oq.LIZ("LinkDialog");
                CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
                if (coHostLiveWidget == null) {
                    return null;
                }
                coHostLiveWidget.LIZ();
                return null;
            } else if (!C14350i1.LIZ(this.LJIIJJI, 2)) {
                return null;
            } else {
                this.LJJI = true;
                BaseInternalLinkMicAnchorWidget baseInternalLinkMicAnchorWidget = this.LIZIZ;
                if (baseInternalLinkMicAnchorWidget == null) {
                    return null;
                }
                baseInternalLinkMicAnchorWidget.LIZ();
                return null;
            }
        } else {
            this.LJI.LJI = false;
            if (!this.LJJI) {
                return null;
            }
            this.LJI.LIZ(7er.RESTART_AFTER_MIC_ROOM);
            this.LJJI = false;
            return null;
        }
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.bytedance.ies.sdk.widgets.LiveWidget, X.0CH, com.bytedance.android.live.liveinteract.linkroom.widget.LinkControlWidget] */
    public final void LIZIZ(String str) {
        C18580oq.LIZ("MultiCoHostExclusiveDialog");
        if (!C18580oq.LIZIZ("LinkDialog")) {
            if (TextUtils.isEmpty(str)) {
                C31851Ol.LLFII.LIZ().LJJLIIIJL = new C14300hw(C14300hw.LJII);
            } else {
                C31851Ol.LLFII.LIZ().LJJLIIIJL = new C14300hw(str);
            }
            if (C14350i1.LIZ(this.LJIIJJI, 4)) {
                CoHostLiveWidget coHostLiveWidget = this.LIZLLL;
                if (coHostLiveWidget != null && (coHostLiveWidget instanceof MultiCoHostWidget)) {
                    AnonymousClass1U0.LIZ(this.dataChannel, C24420yG.LIZ((AnonymousClass0CH) this, false, (LsC<? super Long, 2Pr>) null));
                    return;
                }
                return;
            }
            LJIILL();
        }
    }

    public final /* synthetic */ 2Pr LIZ(Integer num) {
        C41761l8 r0 = this.LJI;
        if (r0 != null) {
            r0.LJFF();
        }
        int intValue = num.intValue();
        PrivacyCert.Builder with = PrivacyCert.Builder.with("bpea-504");
        with.usage("");
        with.tag("link mic start to push stream");
        with.policies(new 9qj[]{PrivacyPolicyStore.getAudioPrivacyPolicy()});
        LIZ(intValue, false, with.build());
        return 2Pr.LIZ;
    }

    public final void LIZ(int i) {
        JSONObject LJIIZILJ2 = LJIIZILJ();
        C10570bv.LIZ(LJIIZILJ2, "permit_status", i);
        TLk.LIZIZ.LIZJ("get_reply", LJIIZILJ2);
        if (i != 1) {
            JSONObject LJIIZILJ3 = LJIIZILJ();
            C10570bv.LIZ(LJIIZILJ3, "end_reason", "not_agree");
            TLk.LIZIZ.LIZ(2, LJIIZILJ3);
        }
        if (isViewValid()) {
            C31851Ol.LLFII.LIZ().LIZJ = true;
            C09630aP.LIZ(4, "LinkControlWidget", "onReceivePermitApply, permit = " + i + "   guestUserId = " + C31851Ol.LLFII.LIZ().LJFF);
            if (i == 1) {
                if (AnonymousClass1PF.LIZJ()) {
                    if (this.dataChannel != null) {
                        this.dataChannel.LIZJ(C53672Aj.class, "");
                    }
                    C31851Ol.LLFII.LIZ().LJIILIIL = true;
                }
                C18580oq.LIZ();
                PrivacyCert.Builder with = PrivacyCert.Builder.with("bpea-503");
                with.usage("");
                with.tag("link mic start to push stream");
                with.policies(new 9qj[]{PrivacyPolicyStore.getAudioPrivacyPolicy()});
                LIZ((Cert) with.build());
                return;
            }
            Fz8.LIZ(C10000b0.LJ(), 2131828421);
        }
    }

    public final boolean LIZ(Runnable runnable, boolean z) {
        C31891Op r0;
        if (this.LJIIIIZZ || (r0 = this.LIZJ) == null) {
            return false;
        }
        return r0.LIZ(runnable, z);
    }

    public static void LIZ(String str, boolean z) {
        HashMap hashMap = new HashMap();
        hashMap.put("mode", str);
        String str2 = "0";
        hashMap.put("stream_mix_on_client", str2);
        if (z) {
            str2 = "1";
        }
        hashMap.put("is_anchor", str2);
        LivePerformanceManager.getInstance().onModuleStart("link_mic", hashMap);
    }
}
