package X; import com.bytedance.covode.number.Covode; import com.ss.android.ugc.aweme.base.model.UrlModel; import com.ss.android.ugc.aweme.shortvideo.edit.VideoPublishEditModel; import com.ss.android.ugc.aweme.shortvideo.edit.model.SimpleTextStickerData; import com.ss.android.ugc.aweme.shortvideo.model.GreenScreenMaterialKt; import com.ss.android.ugc.aweme.shortvideo.model.SimpleEffect; import com.ss.android.ugc.aweme.shortvideo.model.TTSVoiceStruct; import com.ss.android.ugc.aweme.shortvideo.ui.TimeSpeedModelExtension; import com.ss.android.ugc.aweme.sticker.data.CreateAnchorInfo; import java.util.ArrayList; import java.util.Comparator; import java.util.LinkedHashSet; import java.util.List; import kotlin.g.b.m; import org.json.JSONException; import org.json.JSONObject; /* renamed from: X.5eC reason: invalid class name and case insensitive filesystem */ public final class C139555eC { static { Covode.recordClassIndex(101328); } public C139555eC() { } public /* synthetic */ C139555eC(byte b) { this(); } public final void LIZ(List<CreateAnchorInfo> list, VideoPublishEditModel videoPublishEditModel) { C21090sc.LIZ(list, videoPublishEditModel); LinkedHashSet linkedHashSet = new LinkedHashSet(); List<SimpleTextStickerData> textStickerDataList = videoPublishEditModel.getTextStickerDataList(); m.LIZIZ(textStickerDataList, ""); for (T t : textStickerDataList) { if (t.getHasReadTextAudio() && C20890sI.LIZ(t.getVoiceEffectId()) && C20890sI.LIZ(t.getVoiceAnchorName()) && !AnonymousClass1ZP.LIZ((Iterable) linkedHashSet, (Object) t.getVoiceAnchorName())) { String voiceAnchorName = t.getVoiceAnchorName(); if (voiceAnchorName == null) { m.LIZIZ(); } linkedHashSet.add(voiceAnchorName); String voiceAnchorName2 = t.getVoiceAnchorName(); if (voiceAnchorName2 == null) { m.LIZIZ(); } String json = C18440oL.LIZIZ.toJson(new TTSVoiceStruct(t.getVoiceEffectId(), t.getVoiceEffectIconUrl(), t.getVoiceEffectResourceId())); m.LIZIZ(json, ""); list.add(new CreateAnchorInfo(50, voiceAnchorName2, "", "", json, "https://p16-sg.tiktokcdn.com/obj/tiktok-obj/tts_voice_anchor_icon.png", null, null, null, null, null, null, 4032, null)); } } } /* JADX WARNING: Removed duplicated region for block: B:100:0x0229 */ /* JADX WARNING: Removed duplicated region for block: B:83:0x0192 */ /* JADX WARNING: Removed duplicated region for block: B:84:0x0195 */ /* JADX WARNING: Removed duplicated region for block: B:98:0x01f4 */ public final void LIZIZ(List<CreateAnchorInfo> list, VideoPublishEditModel videoPublishEditModel) { SimpleEffect effectInfo; String name; long j; UrlModel iconUrl; List<String> urlList; UrlModel iconUrl2; List<String> urlList2; SimpleEffect effectInfo2; String extra; boolean z; int i2; int i3; String segmentBeginTime; long j2; C21090sc.LIZ(list, videoPublishEditModel); JSONObject jSONObject = new JSONObject(); ArrayList<TimeSpeedModelExtension> deepCopyFinalVideoList = videoPublishEditModel.deepCopyFinalVideoList(); m.LIZIZ(deepCopyFinalVideoList, ""); if (deepCopyFinalVideoList.size() > 1) { AnonymousClass1ZP.LIZ((List) deepCopyFinalVideoList, (Comparator) new C139615eI()); } for (T t : deepCopyFinalVideoList) { m.LIZIZ(t, ""); String stickerId = t.getStickerId(); if (!((stickerId == null || stickerId.length() == 0) || (effectInfo2 = t.getEffectInfo()) == null || (extra = effectInfo2.getExtra()) == null || extra.length() == 0)) { try { String extra2 = t.getEffectInfo().getExtra(); if (extra2 == null) { m.LIZIZ(); } JSONObject optJSONObject = new JSONObject(extra2).optJSONObject("linked_anchor"); if (optJSONObject != null) { int optInt = optJSONObject.optInt("type", -1); String optString = optJSONObject.optString("keyword"); String optString2 = optJSONObject.optString("url"); String stickerId2 = t.getStickerId(); m.LIZIZ(stickerId2, ""); long parseLong = Long.parseLong(stickerId2); String optString3 = optJSONObject.optString("content"); if (optString3 != null) { if (optString3.length() != 0) { z = false; if (z) { JSONObject jSONObject2 = new JSONObject(optJSONObject.optString("content")); i2 = jSONObject2.optInt("add_from"); i3 = jSONObject2.optInt("ngo_id"); parseLong = jSONObject2.optLong("linked_effect_id"); } else { i2 = 1; i3 = 0; } segmentBeginTime = t.getSegmentBeginTime(); if (segmentBeginTime != null || segmentBeginTime.length() == 0) { j2 = System.currentTimeMillis(); } else { String segmentBeginTime2 = t.getSegmentBeginTime(); m.LIZIZ(segmentBeginTime2, ""); j2 = Long.parseLong(segmentBeginTime2); } if (!(optString == null || optString.length() == 0 || optInt == -1)) { JSONObject jSONObject3 = new JSONObject(); jSONObject3.put("add_from", i2); jSONObject3.put("ngo_id", i3); jSONObject3.put("linked_effect_id", parseLong); m.LIZIZ(optString2, ""); String jSONObject4 = jSONObject3.toString(); m.LIZIZ(jSONObject4, ""); Integer type = GreenScreenMaterialKt.getType(t); list.add(new CreateAnchorInfo(optInt, optString, optString2, "", jSONObject4, "https://p16.tiktokcdn.com/obj/tiktok-obj/who3x.png", Long.valueOf(j2), type == null ? new JSONObject().put("green_screen_materials_type", type.intValue()).toString() : null, null, null, null, null, 3840, null)); } } } z = true; if (z) { } segmentBeginTime = t.getSegmentBeginTime(); if (segmentBeginTime != null) { } j2 = System.currentTimeMillis(); JSONObject jSONObject32 = new JSONObject(); jSONObject32.put("add_from", i2); jSONObject32.put("ngo_id", i3); jSONObject32.put("linked_effect_id", parseLong); m.LIZIZ(optString2, ""); String jSONObject42 = jSONObject32.toString(); m.LIZIZ(jSONObject42, ""); Integer type2 = GreenScreenMaterialKt.getType(t); list.add(new CreateAnchorInfo(optInt, optString, optString2, "", jSONObject42, "https://p16.tiktokcdn.com/obj/tiktok-obj/who3x.png", Long.valueOf(j2), type2 == null ? new JSONObject().put("green_screen_materials_type", type2.intValue()).toString() : null, null, null, null, null, 3840, null)); } } catch (JSONException unused) { } } String stickerId3 = t.getStickerId(); if (!(stickerId3 == null || stickerId3.length() == 0 || (effectInfo = t.getEffectInfo()) == null || (name = effectInfo.getName()) == null || name.length() == 0)) { jSONObject.put("add_from", 1); jSONObject.put("third_id", t.getStickerId()); SimpleEffect effectInfo3 = t.getEffectInfo(); if (effectInfo3 != null && (iconUrl = effectInfo3.getIconUrl()) != null && (urlList = iconUrl.getUrlList()) != null && !urlList.isEmpty()) { SimpleEffect effectInfo4 = t.getEffectInfo(); jSONObject.put("icon_url", (effectInfo4 == null || (iconUrl2 = effectInfo4.getIconUrl()) == null || (urlList2 = iconUrl2.getUrlList()) == null) ? null : urlList2.get(0)); } SimpleEffect effectInfo5 = t.getEffectInfo(); String name2 = effectInfo5 != null ? effectInfo5.getName() : null; String segmentBeginTime3 = t.getSegmentBeginTime(); if (segmentBeginTime3 == null || segmentBeginTime3.length() == 0) { j = System.currentTimeMillis(); } else { String segmentBeginTime4 = t.getSegmentBeginTime(); m.LIZIZ(segmentBeginTime4, ""); j = Long.parseLong(segmentBeginTime4); } if (!(name2 == null || name2.length() == 0)) { if (name2 == null) { m.LIZIZ(); } String jSONObject5 = jSONObject.toString(); m.LIZIZ(jSONObject5, ""); Long valueOf = Long.valueOf(j); Integer type3 = GreenScreenMaterialKt.getType(t); list.add(new CreateAnchorInfo(28, name2, "", "", jSONObject5, "https://p16.tiktokcdn.com/obj/tiktok-obj/20px_anchor_effect3x.png", valueOf, type3 != null ? new JSONObject().put("green_screen_materials_type", type3.intValue()).toString() : null, null, null, null, null, 3840, null)); } } } } }