package com.vk.api.sdk.auth; import android.os.Bundle; import com.microsoft.services.msa.PreferencesConstants; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import kotlin.collections.CollectionsKt__IterablesKt; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.collections.SetsKt__SetsKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* compiled from: VKAuthParams.kt */ public final class VKAuthParams { /* renamed from: c reason: collision with root package name */ public static final Companion f46581c = new Companion(null); /* renamed from: a reason: collision with root package name */ private final Set<VKScope> f46582a; /* renamed from: b reason: collision with root package name */ private final int f46583b; /* compiled from: VKAuthParams.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final VKAuthParams a(Bundle bundle) { Collection collection; if (bundle == null) { return null; } int i10 = bundle.getInt("vk_app_id"); ArrayList<String> stringArrayList = bundle.getStringArrayList("vk_app_scope"); if (stringArrayList != null) { collection = new ArrayList(CollectionsKt__IterablesKt.r(stringArrayList, 10)); for (T t10 : stringArrayList) { Intrinsics.c(t10, "it"); collection.add(VKScope.valueOf(t10)); } } else { collection = SetsKt__SetsKt.d(); } return new VKAuthParams(i10, collection); } } public VKAuthParams(int i10, Collection<? extends VKScope> collection) { Intrinsics.g(collection, "scope"); this.f46583b = i10; if (i10 != 0) { this.f46582a = new HashSet(collection); return; } throw new IllegalStateException("AppId is empty! Find out how to get your appId at https://vk.com/dev/access_token"); } public final int a() { return this.f46583b; } public final Bundle b() { Bundle bundle = new Bundle(); bundle.putInt("vk_app_id", this.f46583b); Set<VKScope> set = this.f46582a; ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.r(set, 10)); Iterator<T> it = set.iterator(); while (it.hasNext()) { arrayList.add(it.next().name()); } bundle.putStringArrayList("vk_app_scope", new ArrayList<>(arrayList)); return bundle; } public final Bundle c() { Bundle bundle = new Bundle(); bundle.putInt("client_id", this.f46583b); bundle.putBoolean("revoke", true); bundle.putString("scope", CollectionsKt___CollectionsKt.X(this.f46582a, PreferencesConstants.COOKIE_DELIMITER, null, null, 0, null, null, 62, null)); return bundle; } }