package com.bytedance.android.livesdk.usercard;

import X.0AA;
import X.0b0;
import X.0cm;
import X.163;
import X.165;
import X.168;
import X.169;
import X.16A;
import X.16B;
import X.1fg;
import X.1hK;
import X.1jk;
import X.2DD;
import X.2fU;
import X.C0989Ftu;
import X.C1006FuB;
import X.C1044Fun;
import X.C1427G2i;
import X.C1428G2j;
import X.C2402Gbb;
import X.C2833GiY;
import X.C3028Glh;
import X.C3441GsM;
import X.C3491GtA;
import X.C4100H7d;
import X.D0R;
import X.G2V;
import X.G2X;
import X.G3V;
import X.HG2;
import X.M12;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import androidx.fragment.app.DialogFragment;
import com.bytedance.android.live.adminsetting.IAdminSettingService;
import com.bytedance.android.live.base.model.user.User;
import com.bytedance.android.live.usermanage.IUserManageService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.adminsetting.LiveAdminSettingDialog;
import com.bytedance.android.livesdk.livesetting.roomfunction.LiveModeratorPerceptionSetting;
import com.bytedance.android.livesdk.model.UserAttr;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.util.HashMap;
import kotlin.h.b.n;

public final class LiveProfileManageDialog extends LiveDialogFragment implements View.OnClickListener, 163, 165, 168 {
    public static final C1428G2j LIZJ = new C1428G2j((byte) 0);
    public Room LIZ;
    public User LIZIZ;
    public boolean LIZLLL = true;
    public HashMap LJ;

    static {
        Covode.recordClassIndex(21143);
    }

    public final View LIZ(int i) {
        if (this.LJ == null) {
            this.LJ = new HashMap();
        }
        View view = (View) this.LJ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final void LIZ(16B r1, Exception exc) {
    }

    public final void LIZ(1fg r1, Exception exc) {
    }

    public final void LIZ(Exception exc) {
    }

    public final void LIZIZ(Exception exc) {
    }

    public final void LIZJ() {
    }

    public final void LIZLLL() {
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        z_();
    }

    public final void z_() {
        HashMap hashMap = this.LJ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void LJ() {
        String str;
        0AA r5;
        Bundle arguments = getArguments();
        if (arguments == null || (str = arguments.getString("arg_msg_content")) == null) {
            str = "";
        }
        n.LIZIZ(str, "");
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel != null && (r5 = (0AA) dataChannel.LIZIZ(HG2.class)) != null) {
            IAdminSettingService LIZ2 = 0cm.LIZ(IAdminSettingService.class);
            Room room = this.LIZ;
            if (room == null) {
                n.LIZ("");
            }
            LIZ2.checkFastAddBlockKeywordsDialog(room.getId(), str, r5, "LiveFastAddBlockKeywordsDialog");
        }
    }

    public final C1044Fun LIZ() {
        boolean z;
        int i;
        Bundle arguments = getArguments();
        if (arguments != null) {
            z = arguments.getBoolean("arg_msg_is_vertical");
        } else {
            z = true;
        }
        this.LIZLLL = z;
        if (this.LIZLLL) {
            i = 2131561657;
        } else {
            i = 2131561658;
        }
        C1044Fun fun = new C1044Fun(i);
        fun.LIZ = 0;
        if (this.LIZLLL) {
            fun.LJI = 80;
            fun.LJII = -1;
            fun.LJIIIIZZ = -2;
            fun.LIZIZ = 2131887243;
        } else {
            fun.LJI = 5;
            fun.LJII = 0b0.LIZLLL(2131166139);
            fun.LJIIIIZZ = -1;
            fun.LIZIZ = 2131887244;
        }
        return fun;
    }

    public static final /* synthetic */ User LIZ(LiveProfileManageDialog liveProfileManageDialog) {
        User user = liveProfileManageDialog.LIZIZ;
        if (user == null) {
            n.LIZ("");
        }
        return user;
    }

    public static final /* synthetic */ Room LIZIZ(LiveProfileManageDialog liveProfileManageDialog) {
        Room room = liveProfileManageDialog.LIZ;
        if (room == null) {
            n.LIZ("");
        }
        return room;
    }

    public final void LIZ(boolean z) {
        int i;
        LJ();
        if (this.LJIIL) {
            1jk LIZ2 = LIZ(2131367849);
            if (z) {
                i = 2131834005;
            } else {
                i = 2131834006;
            }
            LIZ2.setText(i);
        }
    }

    public final void onClick(View view) {
        String str;
        boolean z;
        0AA r1;
        long j;
        String str2;
        String str3;
        G3V g3v;
        String string;
        M12.LIZ(view);
        String LIZ2 = C2402Gbb.LIZ.LIZ();
        String LIZLLL2 = C2402Gbb.LIZ.LIZLLL();
        int id = view.getId();
        long j2 = 0;
        if (id == 2131369483) {
            boolean z2 = C2833GiY.LIZ().LJIIZILJ;
            String str4 = "report_anchor";
            if (getArguments() != null) {
                Bundle arguments = getArguments();
                if (!(arguments == null || (string = arguments.getString("arg_msg_report_type")) == null)) {
                    str4 = string;
                }
                Bundle arguments2 = getArguments();
                if (arguments2 != null) {
                    j = arguments2.getLong("arg_msg_id");
                } else {
                    j = 0;
                }
                Bundle arguments3 = getArguments();
                if (arguments3 == null || (str2 = arguments3.getString("arg_msg_content")) == null) {
                    str2 = "";
                }
            } else {
                j = 0;
                str2 = "";
            }
            Room room = this.LIZ;
            if (room == null) {
                n.LIZ("");
            }
            long ownerUserId = room.getOwnerUserId();
            User user = this.LIZIZ;
            if (user == null) {
                n.LIZ("");
            }
            if (ownerUserId == user.getId()) {
                str3 = "anchor_profile";
            } else {
                str3 = "user_profile";
            }
            if (j == 0 || TextUtils.isEmpty(str2)) {
                Room room2 = this.LIZ;
                if (room2 == null) {
                    n.LIZ("");
                }
                long id2 = room2.getId();
                Room room3 = this.LIZ;
                if (room3 == null) {
                    n.LIZ("");
                }
                long ownerUserId2 = room3.getOwnerUserId();
                User user2 = this.LIZIZ;
                if (user2 == null) {
                    n.LIZ("");
                }
                long id3 = user2.getId();
                User user3 = this.LIZIZ;
                if (user3 == null) {
                    n.LIZ("");
                }
                g3v = new G3V(id2, ownerUserId2, id3, user3.getSecUid(), str3, LIZ2, LIZLLL2, C2402Gbb.LIZ.LJ(), str4, C2402Gbb.LIZ.LJIIJ(), new C3441GsM(this.LJIILIIL, "user_live_duration"));
            } else {
                Room room4 = this.LIZ;
                if (room4 == null) {
                    n.LIZ("");
                }
                long id4 = room4.getId();
                Room room5 = this.LIZ;
                if (room5 == null) {
                    n.LIZ("");
                }
                long ownerUserId3 = room5.getOwnerUserId();
                User user4 = this.LIZIZ;
                if (user4 == null) {
                    n.LIZ("");
                }
                long id5 = user4.getId();
                User user5 = this.LIZIZ;
                if (user5 == null) {
                    n.LIZ("");
                }
                g3v = new G3V(id4, ownerUserId3, id5, user5.getSecUid(), str3, j, str2, C2402Gbb.LIZ.LJIIJ(), LIZ2, LIZLLL2, str4, "1", new C3441GsM(this.LJIILIIL, "user_live_duration"), C2402Gbb.LIZ.LJ());
            }
            g3v.LJIJJLI = 0cm.LIZ(IUserManageService.class).getReportScene();
            g3v.LJIJJ = z2;
            g3v.LJIILIIL = this.LIZLLL;
            0cm.LIZ(IUserManageService.class).report(getContext(), g3v);
            dismiss();
            return;
        }
        1hK r3 = null;
        boolean z3 = false;
        if (id == 2131367544) {
            dismiss();
            User user6 = this.LIZIZ;
            if (user6 == null) {
                n.LIZ("");
            }
            UserAttr userAttr = user6.getUserAttr();
            if (userAttr == null || !userAttr.LIZIZ) {
                z = true;
            } else {
                z = false;
            }
            if (LiveModeratorPerceptionSetting.INSTANCE.newStyle()) {
                DataChannel dataChannel = this.LJIILIIL;
                if (dataChannel != null) {
                    Class<2DD> cls = 2DD.class;
                    C0989Ftu ftu = C0989Ftu.MODERATOR_LIST;
                    169 r2 = 16A.LJIIIIZZ;
                    User user7 = this.LIZIZ;
                    if (user7 == null) {
                        n.LIZ("");
                    }
                    dataChannel.LIZ(cls, new D0R(ftu, r2.LIZ(user7), false));
                }
                C0989Ftu ftu2 = C0989Ftu.EDIT_MODERATOR_PERMISSION;
                M12.LIZ(ftu2);
                LiveAdminSettingDialog liveAdminSettingDialog = new LiveAdminSettingDialog();
                Bundle bundle = new Bundle();
                bundle.putSerializable("argument_initial_page", ftu2);
                liveAdminSettingDialog.setArguments(bundle);
                DataChannel dataChannel2 = this.LJIILIIL;
                if (dataChannel2 != null && (r1 = (0AA) dataChannel2.LIZIZ(HG2.class)) != null) {
                    liveAdminSettingDialog.show(r1, "LiveProfileManageDialog");
                    return;
                }
                return;
            }
            IUserManageService LIZ3 = 0cm.LIZ(IUserManageService.class);
            User user8 = this.LIZIZ;
            if (user8 == null) {
                n.LIZ("");
            }
            Room room6 = this.LIZ;
            if (room6 == null) {
                n.LIZ("");
            }
            User owner = room6.getOwner();
            if (owner != null) {
                j2 = owner.getId();
            }
            Room room7 = this.LIZ;
            if (room7 == null) {
                n.LIZ("");
            }
            LIZ3.updateAdmin(this, z, user8, j2, room7.getId(), "profile_card");
        } else if (id == 2131366753) {
            dismiss();
            IUserManageService LIZ4 = 0cm.LIZ(IUserManageService.class);
            Context context = getContext();
            Room room8 = this.LIZ;
            if (room8 == null) {
                n.LIZ("");
            }
            long id6 = room8.getId();
            Room room9 = this.LIZ;
            if (room9 == null) {
                n.LIZ("");
            }
            long ownerUserId4 = room9.getOwnerUserId();
            User user9 = this.LIZIZ;
            if (user9 == null) {
                n.LIZ("");
            }
            Dialog ensureKickOutDialog = LIZ4.getEnsureKickOutDialog(context, id6, ownerUserId4, user9.getId(), new C1427G2i(this));
            if (ensureKickOutDialog != null) {
                ensureKickOutDialog.show();
                2fU.LIZ.LIZ(ensureKickOutDialog);
            }
            Room room10 = this.LIZ;
            if (room10 == null) {
                n.LIZ("");
            }
            C3491GtA LIZ5 = C3491GtA.LJFF.LIZ("blocked_list_click");
            LIZ5.LIZ();
            User user10 = this.LIZIZ;
            if (user10 == null) {
                n.LIZ("");
            }
            LIZ5.LIZ("user_id", String.valueOf(user10.getId()));
            C3028Glh LIZIZ2 = C4100H7d.LIZ().LIZIZ();
            if (LIZIZ2 == null || LIZIZ2.LIZJ() != room10.getOwnerUserId()) {
                str = "admin";
            } else {
                str = "anchor";
            }
            LIZ5.LIZ("admin_type", str);
            LIZ5.LIZJ("relation");
            LIZ5.LIZLLL("click");
            LIZ5.LIZLLL();
        } else if (id == 2131367849) {
            dismiss();
            User user11 = this.LIZIZ;
            if (user11 == null) {
                n.LIZ("");
            }
            UserAttr userAttr2 = user11.getUserAttr();
            if (userAttr2 == null || !userAttr2.LIZ) {
                z3 = true;
                1hK context2 = getContext();
                if (context2 instanceof 1hK) {
                    r3 = context2;
                }
                1hK r32 = r3;
                if (r32 != null) {
                    0AA supportFragmentManager = r32.getSupportFragmentManager();
                    DialogFragment muteConfirmDialog = 0cm.LIZ(IAdminSettingService.class).getMuteConfirmDialog(new G2X(this));
                    if (muteConfirmDialog != null) {
                        muteConfirmDialog.show(supportFragmentManager, getClass().getSimpleName());
                    }
                }
            } else {
                IUserManageService LIZ6 = 0cm.LIZ(IUserManageService.class);
                User user12 = this.LIZIZ;
                if (user12 == null) {
                    n.LIZ("");
                }
                Room room11 = this.LIZ;
                if (room11 == null) {
                    n.LIZ("");
                }
                LIZ6.unmuteUser(user12, room11.getId(), this);
            }
            Room room12 = this.LIZ;
            if (room12 == null) {
                n.LIZ("");
            }
            0cm.LIZ(IUserManageService.class).getMuteDuration().LJ(new G2V(this, room12, z3));
        } else if (id == 2131363121) {
            dismiss();
            C1006FuB.LIZ(getContext());
        }
    }

    public final void LIZ(boolean z, long j) {
        1jk LIZ2;
        int i;
        User user = this.LIZIZ;
        if (user == null) {
            n.LIZ("");
        }
        if (user.getUserAttr() == null) {
            User user2 = this.LIZIZ;
            if (user2 == null) {
                n.LIZ("");
            }
            user2.setUserAttr(new UserAttr());
        }
        User user3 = this.LIZIZ;
        if (user3 == null) {
            n.LIZ("");
        }
        UserAttr userAttr = user3.getUserAttr();
        n.LIZIZ(userAttr, "");
        userAttr.LIZIZ = z;
        if (this.LJIIL && (LIZ2 = LIZ(2131367544)) != null) {
            if (z) {
                i = 2131829407;
            } else {
                i = 2131829406;
            }
            LIZ2.setText(i);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:40:0x00c9, code lost:
        if (r2 == false) goto L_0x00cb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x00d2, code lost:
        if (X.C1429G2k.LIZ.LIZ(3) == false) goto L_0x00e5;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:43:0x00d4, code lost:
        X.C1430G2l.LIZIZ(LIZ(2131366753));
        X.C1430G2l.LIZIZ(LIZ(2131366754));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00e5, code lost:
        r3 = r6.LJIILIIL;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00e7, code lost:
        if (r3 == null) goto L_?;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00e9, code lost:
        r3.LIZ((X.0CH) r6, X.C2463Gca.class, new X.C1426G2h(r6));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:48:0x00fd, code lost:
        if (X.C1429G2k.LIZ.LIZ(2) != false) goto L_0x00b8;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:57:?, code lost:
        return;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:58:?, code lost:
        return;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onViewCreated(android.view.View r7, android.os.Bundle r8) {
        /*
            r6 = this;
            X.M12.LIZ(r7)
            super.onViewCreated(r7, r8)
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r6.LJIILIIL
            if (r1 == 0) goto L_0x0014
            java.lang.Class<X.Fv7> r0 = X.C1064Fv7.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = (com.bytedance.android.livesdkapi.depend.model.live.Room) r0
            if (r0 != 0) goto L_0x0015
        L_0x0014:
            return
        L_0x0015:
            r6.LIZ = r0
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r6.LJIILIIL
            if (r1 == 0) goto L_0x0014
            java.lang.Class<X.HGC> r0 = X.HGC.class
            java.lang.Object r0 = r1.LIZIZ(r0)
            com.bytedance.android.live.base.model.user.User r0 = (com.bytedance.android.live.base.model.user.User) r0
            if (r0 != 0) goto L_0x0026
            goto L_0x0014
        L_0x0026:
            r6.LIZIZ = r0
            r0 = 2131363121(0x7f0a0531, float:1.8346042E38)
            android.view.View r1 = r6.LIZ((int) r0)
            X.1jk r1 = (X.1jk) r1
            if (r1 == 0) goto L_0x0037
            r0 = r6
            r1.setOnClickListener(r0)
        L_0x0037:
            r0 = 2131369483(0x7f0a1e0b, float:1.8358946E38)
            android.view.View r0 = r6.LIZ((int) r0)
            X.1jk r0 = (X.1jk) r0
            r1 = r6
            r0.setOnClickListener(r1)
            r4 = 2131367849(0x7f0a17a9, float:1.8355631E38)
            android.view.View r0 = r6.LIZ((int) r4)
            X.1jk r0 = (X.1jk) r0
            r0.setOnClickListener(r1)
            r3 = 2131366753(0x7f0a1361, float:1.8353408E38)
            android.view.View r0 = r6.LIZ((int) r3)
            X.1jk r0 = (X.1jk) r0
            if (r0 == 0) goto L_0x005e
            r0.setOnClickListener(r1)
        L_0x005e:
            r5 = 2131367544(0x7f0a1678, float:1.8355013E38)
            android.view.View r0 = r6.LIZ((int) r5)
            X.1jk r0 = (X.1jk) r0
            if (r0 == 0) goto L_0x006c
            r0.setOnClickListener(r1)
        L_0x006c:
            com.bytedance.android.live.base.model.user.User r1 = r6.LIZIZ
            if (r1 != 0) goto L_0x0075
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZ(r0)
        L_0x0075:
            com.bytedance.android.livesdk.model.UserAttr r2 = r1.getUserAttr()
            if (r2 == 0) goto L_0x00a5
            android.view.View r1 = r6.LIZ((int) r5)
            X.1jk r1 = (X.1jk) r1
            if (r1 == 0) goto L_0x0095
            boolean r0 = r2.LIZIZ
            if (r0 == 0) goto L_0x0104
            com.bytedance.android.livesdk.livesetting.roomfunction.LiveModeratorPerceptionSetting r0 = com.bytedance.android.livesdk.livesetting.roomfunction.LiveModeratorPerceptionSetting.INSTANCE
            boolean r0 = r0.newStyle()
            if (r0 == 0) goto L_0x0104
            r0 = 2131829803(0x7f11242b, float:1.9292585E38)
        L_0x0092:
            r1.setText(r0)
        L_0x0095:
            android.view.View r1 = r6.LIZ((int) r4)
            X.1jk r1 = (X.1jk) r1
            boolean r0 = r2.LIZ
            if (r0 == 0) goto L_0x0100
            r0 = 2131834005(0x7f113495, float:1.9301108E38)
        L_0x00a2:
            r1.setText(r0)
        L_0x00a5:
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r6.LJIILIIL
            boolean r2 = X.C1430G2l.LIZJ((com.bytedance.ies.sdk.datachannel.DataChannel) r0)
            if (r2 == 0) goto L_0x00f6
            android.view.View r0 = r6.LIZ((int) r5)
            X.1jk r0 = (X.1jk) r0
            if (r0 == 0) goto L_0x00b8
            X.C1430G2l.LIZIZ((android.view.View) r0)
        L_0x00b8:
            android.view.View r0 = r6.LIZ((int) r4)
            X.C1430G2l.LIZIZ((android.view.View) r0)
            r0 = 2131367850(0x7f0a17aa, float:1.8355633E38)
            android.view.View r0 = r6.LIZ((int) r0)
            X.C1430G2l.LIZIZ((android.view.View) r0)
            if (r2 != 0) goto L_0x00d4
        L_0x00cb:
            X.G2k r1 = X.C1429G2k.LIZ
            r0 = 3
            boolean r0 = r1.LIZ(r0)
            if (r0 == 0) goto L_0x00e5
        L_0x00d4:
            android.view.View r0 = r6.LIZ((int) r3)
            X.C1430G2l.LIZIZ((android.view.View) r0)
            r0 = 2131366754(0x7f0a1362, float:1.835341E38)
            android.view.View r0 = r6.LIZ((int) r0)
            X.C1430G2l.LIZIZ((android.view.View) r0)
        L_0x00e5:
            com.bytedance.ies.sdk.datachannel.DataChannel r3 = r6.LJIILIIL
            if (r3 == 0) goto L_0x0014
            r2 = r6
            java.lang.Class<X.Gca> r1 = X.C2463Gca.class
            X.G2h r0 = new X.G2h
            r0.<init>(r6)
            r3.LIZ((X.0CH) r2, r1, r0)
            goto L_0x0014
        L_0x00f6:
            X.G2k r1 = X.C1429G2k.LIZ
            r0 = 2
            boolean r0 = r1.LIZ(r0)
            if (r0 == 0) goto L_0x00cb
            goto L_0x00b8
        L_0x0100:
            r0 = 2131834006(0x7f113496, float:1.930111E38)
            goto L_0x00a2
        L_0x0104:
            boolean r0 = r2.LIZIZ
            if (r0 == 0) goto L_0x010c
            r0 = 2131829407(0x7f11229f, float:1.9291782E38)
            goto L_0x0092
        L_0x010c:
            r0 = 2131829406(0x7f11229e, float:1.929178E38)
            goto L_0x0092
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.usercard.LiveProfileManageDialog.onViewCreated(android.view.View, android.os.Bundle):void");
    }
}
