package X; import com.bytedance.covode.number.Covode; import com.google.gson.Gson; import com.ss.android.ugc.aweme.base.model.UrlModel; import com.ss.android.ugc.aweme.internal.PrivacyServiceImpl; import com.ss.android.ugc.aweme.services.shoutout.AVAnchorPublishStruct; import com.ss.android.ugc.aweme.shortvideo.edit.VideoPublishEditModel; import com.ss.android.ugc.aweme.shortvideo.library.LibraryMaterialInfoSv; import com.ss.android.ugc.aweme.shortvideo.model.MvModel; import com.ss.android.ugc.aweme.sticker.data.CreateAnchorInfo; import com.ss.android.ugc.aweme.ttsvoice.repo.TTSVoiceRecordService; import com.zhiliaoapp.musically.R; import java.util.ArrayList; import java.util.List; import kotlin.g.b.m; import org.json.JSONObject; /* renamed from: X.5el reason: invalid class name and case insensitive filesystem */ public final class C139905el { public static final C139905el LIZ = new C139905el(); static { Covode.recordClassIndex(96306); } private final void LIZ(List<CreateAnchorInfo> list, ArrayList<LibraryMaterialInfoSv> arrayList) { String str; int i2 = 0; for (T t : arrayList) { int i3 = i2 + 1; if (i2 < 0) { AnonymousClass1ZP.LIZ(); } T t2 = t; Integer materialType = arrayList.get(i2).getMaterialType(); String LIZIZ = (materialType != null && materialType.intValue() == 1) ? C70832qe.LIZIZ(R.string.dgx) : (materialType != null && materialType.intValue() == 2) ? C70832qe.LIZIZ(R.string.dgw) : ""; if (LIZIZ == null || LIZIZ.length() == 0) { C19630qG.LIZIZ("[addLibraryAnchors] -> keyword = ".concat(String.valueOf(LIZIZ))); return; } String json = new Gson().toJson(arrayList.get(i2)); m.LIZIZ(json, ""); Long valueOf = Long.valueOf(System.currentTimeMillis()); Integer materialType2 = t2.getMaterialType(); if (materialType2 != null) { int intValue = materialType2.intValue(); str = (intValue != 1 ? intValue != 2 ? EnumC139925en.UNKNOWN : EnumC139925en.GIF : EnumC139925en.VIDEO_CLIP).getType(); } else { str = null; } list.add(new CreateAnchorInfo(49, LIZIZ, "", "", "", "https://p16.tiktokcdn.com/obj/tiktok-obj/library_anchor_icon.png", valueOf, json, null, null, str, null, 2816, null)); i2 = i3; } } /* JADX WARNING: Removed duplicated region for block: B:39:0x007e A[Catch:{ Exception -> 0x0110 }] */ /* JADX WARNING: Removed duplicated region for block: B:40:0x008d A[Catch:{ Exception -> 0x0110 }] */ /* JADX WARNING: Removed duplicated region for block: B:56:0x00ba A[Catch:{ Exception -> 0x00dc }] */ /* JADX WARNING: Removed duplicated region for block: B:68:0x00fc */ /* JADX WARNING: Removed duplicated region for block: B:70:0x010d */ public final List<CreateAnchorInfo> LIZ(VideoPublishEditModel videoPublishEditModel) { AVAnchorPublishStruct LIZIZ; boolean z; boolean z2; UrlModel iconUrl; List<String> urlList; UrlModel iconUrl2; C21090sc.LIZ(videoPublishEditModel); ArrayList arrayList = new ArrayList(); if (PrivacyServiceImpl.LIZJ().LIZIZ()) { return arrayList; } String stickers = videoPublishEditModel.getStickers(); boolean z3 = true; if (!(stickers == null || stickers.length() == 0)) { String propSource = videoPublishEditModel.getPropSource(); if (!(propSource == null || propSource.length() == 0)) { C139755eW.LIZ.LIZIZ(arrayList, videoPublishEditModel); } } if (!videoPublishEditModel.isPhotoMvMode) { String json = C20590ro.LIZ().toJson(videoPublishEditModel.uploadMiscInfoStruct); if (!(json == null || json.length() == 0)) { try { C19550q8 r5 = videoPublishEditModel.uploadMiscInfoStruct; m.LIZIZ(r5, ""); MvModel mvModel = r5.mvInfo; String str = null; String name = mvModel != null ? mvModel.getName() : null; if (name != null) { if (name.length() != 0) { z = false; if (!z) { C19630qG.LIZ("[addMiscInfoAnchors] : keyword = ".concat(String.valueOf(name))); } else { JSONObject jSONObject = new JSONObject(); try { jSONObject.put("add_from", 1); jSONObject.put("third_id", r5.mvThemeId); MvModel mvModel2 = r5.mvInfo; List<String> urlList2 = (mvModel2 == null || (iconUrl2 = mvModel2.getIconUrl()) == null) ? null : iconUrl2.getUrlList(); if (urlList2 != null) { if (!urlList2.isEmpty()) { z2 = false; if (!z2) { MvModel mvModel3 = r5.mvInfo; if (!(mvModel3 == null || (iconUrl = mvModel3.getIconUrl()) == null || (urlList = iconUrl.getUrlList()) == null)) { str = urlList.get(0); } jSONObject.put("icon_url", str); } jSONObject.put("mv_template_type", r5.mvType); String jSONObject2 = jSONObject.toString(); m.LIZIZ(jSONObject2, ""); arrayList.add(new CreateAnchorInfo(29, name, "", "", jSONObject2, "https://p16.tiktokcdn.com/obj/tiktok-obj/20px_anchor_template3x.png", -1L, null, null, null, r5.mvType != 2 ? "capcut" : "", null, 2944, null)); } } z2 = true; if (!z2) { } jSONObject.put("mv_template_type", r5.mvType); } catch (Exception unused) { } String jSONObject22 = jSONObject.toString(); m.LIZIZ(jSONObject22, ""); arrayList.add(new CreateAnchorInfo(29, name, "", "", jSONObject22, "https://p16.tiktokcdn.com/obj/tiktok-obj/20px_anchor_template3x.png", -1L, null, null, null, r5.mvType != 2 ? "capcut" : "", null, 2944, null)); } } } z = true; if (!z) { } } catch (Exception e) { e.printStackTrace(); } } } if (videoPublishEditModel.getTextStickerDataList() != null && TTSVoiceRecordService.LIZLLL().LIZ()) { C139755eW.LIZ.LIZ(arrayList, videoPublishEditModel); } if (videoPublishEditModel.getMainBusinessContext() != null) { arrayList.addAll(AnonymousClass5DW.LJIIIZ(C139835ee.LIZ(videoPublishEditModel.getMainBusinessContext(), EnumC139875ei.TRACK_PAGE_EDIT))); } if (videoPublishEditModel.getMainBusinessContext() != null) { arrayList.addAll(AnonymousClass5DW.LJIIJ(C139835ee.LIZ(videoPublishEditModel.getMainBusinessContext(), EnumC139875ei.TRACK_PAGE_EDIT))); } if (!videoPublishEditModel.mIsFromDraft && videoPublishEditModel.mShoutOutsData != null && AnonymousClass1ZS.LIZ(videoPublishEditModel.mShoutOutsData.getShoutOutsMode(), C19700qN.MODE_POST, false) && (LIZIZ = C18440oL.LJIIZILJ.LIZIZ()) != null) { JSONObject jSONObject3 = new JSONObject(); try { jSONObject3.put("third_id", videoPublishEditModel.mShoutOutsData.getProductId()); } catch (Exception e2) { e2.printStackTrace(); } String keyword = LIZIZ.getKeyword(); String jSONObject4 = jSONObject3.toString(); m.LIZIZ(jSONObject4, ""); arrayList.add(new CreateAnchorInfo(40, keyword, "", "", jSONObject4, LIZIZ.getImg(), -1L, null, null, null, null, null, 3968, null)); } ArrayList<LibraryMaterialInfoSv> arrayList2 = videoPublishEditModel.libraryMaterialList; if (arrayList2 != null && !arrayList2.isEmpty()) { z3 = false; } if (!z3) { LIZ(arrayList, arrayList2); } AbstractC145055n4 r2 = C18440oL.LJIILL; m.LIZIZ(r2, ""); List<AbstractC139685eP> LIZIZ2 = r2.LIZIZ(); m.LIZIZ(LIZIZ2, ""); for (AbstractC139685eP r22 : LIZIZ2) { r22.LIZ(videoPublishEditModel, arrayList); } return arrayList; } }