package lg1; import dm3.p; import em3.q; import java.net.URL; import java.util.Map; import java.util.Set; import kotlin.Result; import kotlin.ResultKt; import kotlin.Unit; import ng1.a; import ng1.b; import okhttp3.HttpUrl; import org.json.JSONObject; import tq.h; import um3.h0; import uq.w; import wl3.e; import wl3.i; import zq0.c; @e(c = "com.linecorp.line.square.remotedata.client.note.SquareNoteNotificationSettingsServiceClient$updateNotificationSettings$2", f = "SquareNoteNotificationSettingsServiceClient.kt", l = {66}, m = "invokeSuspend") public final class d extends i implements p<h0, ul3.d<? super Unit>, Object> { /* renamed from: b reason: collision with root package name */ public Object f106819b; /* renamed from: c reason: collision with root package name */ public int f106820c; /* renamed from: d reason: collision with root package name */ public /* synthetic */ Object f106821d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ e f106822e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ a f106823f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ Set<b> f106824g; /* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.Set<? extends ng1.b> */ /* JADX WARN: Multi-variable type inference failed */ /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public d(e eVar, a aVar, Set<? extends b> set, ul3.d<? super d> dVar) { super(2, dVar); this.f106822e = eVar; this.f106823f = aVar; this.f106824g = set; } @Override // wl3.a public final ul3.d<Unit> create(Object obj, ul3.d<?> dVar) { d dVar2 = new d(this.f106822e, this.f106823f, this.f106824g, dVar); dVar2.f106821d = obj; return dVar2; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // dm3.p public Object invoke(h0 h0Var, ul3.d<? super Unit> dVar) { d dVar2 = new d(this.f106822e, this.f106823f, this.f106824g, dVar); dVar2.f106821d = h0Var; return dVar2.invokeSuspend(Unit.INSTANCE); } /* JADX WARNING: Removed duplicated region for block: B:29:0x00d9 */ /* JADX WARNING: Removed duplicated region for block: B:31:0x00dc */ @Override // wl3.a public final Object invokeSuspend(Object obj) { e eVar; Object obj2; Throwable r04; e eVar2; Throwable th4; Object obj3; e eVar3; vl3.a aVar = vl3.a.COROUTINE_SUSPENDED; int i14 = this.f106820c; if (i14 == 0) { ResultKt.throwOnFailure(obj); h0 h0Var = (h0) this.f106821d; eVar = this.f106822e; a aVar2 = this.f106823f; Set<b> set = this.f106824g; try { Result.Companion companion = Result.Companion; h hVar = eVar.f106826b; q.f(hVar, "serverEndpoints"); HttpUrl a14 = hVar.a("square_note"); if (a14 == null) { a14 = HttpUrl.Companion.get("https://square-note.line-apps.com"); } URL url = a14.newBuilder().encodedPath("/napi/v2/nc/notisetting/square/update.json").build().url(); String jSONObject = rg1.d.a(aVar2, set).toString(); q.e(jSONObject, "settings.toJsonObjectWit… .toString()"); byte[] bytes = jSONObject.getBytes(sm3.b.f143620b); q.e(bytes, "this as java.lang.String).getBytes(charset)"); mr.a aVar3 = eVar.f106825a; kg1.a aVar4 = kg1.a.POST; Map<String, String> map = eVar.f106828d.get(); this.f106821d = eVar; this.f106819b = eVar; this.f106820c = 1; obj3 = jg1.b.a(aVar3, url, aVar4, map, bytes, null, null, null, this, 112); if (obj3 == aVar) { return aVar; } eVar3 = eVar; } catch (Throwable th5) { th4 = th5; eVar2 = eVar; Result.Companion companion2 = Result.Companion; obj2 = Result.m364constructorimpl(ResultKt.createFailure(th4)); eVar = eVar2; e.a(eVar, obj2); r04 = Result.m367exceptionOrNullimpl(obj2); if (r04 == null) { } } } else if (i14 == 1) { eVar2 = (e) this.f106819b; eVar3 = (e) this.f106821d; try { ResultKt.throwOnFailure(obj); eVar = eVar2; obj3 = obj; } catch (Throwable th6) { th4 = th6; Result.Companion companion22 = Result.Companion; obj2 = Result.m364constructorimpl(ResultKt.createFailure(th4)); eVar = eVar2; e.a(eVar, obj2); r04 = Result.m367exceptionOrNullimpl(obj2); if (r04 == null) { } } } else { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } JSONObject jSONObject2 = new JSONObject(eVar3.f106830f.invoke((w) obj3).b()); int i15 = jSONObject2.getInt(c.QUERY_KEY_CODE); if (i15 == 0) { obj2 = Result.m364constructorimpl(jSONObject2.optJSONObject("result")); e.a(eVar, obj2); r04 = Result.m367exceptionOrNullimpl(obj2); if (r04 == null) { return Unit.INSTANCE; } throw r04; } throw new mg1.a(i15); } }