package androidx.credentials; import android.content.ComponentName; import android.os.Bundle; import androidx.annotation.RequiresApi; import androidx.credentials.CredentialOption; import androidx.credentials.internal.FrameworkClassParsingException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import kotlin.collections.CollectionsKt__CollectionsKt; import kotlin.collections.CollectionsKt__IterablesKt; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; @SourceDebugExtension({"SMAP\nGetCredentialRequest.kt\nKotlin\n*S Kotlin\n*F\n+ 1 GetCredentialRequest.kt\nandroidx/credentials/GetCredentialRequest\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,276:1\n1#2:277\n1774#3,4:278\n*S KotlinDebug\n*F\n+ 1 GetCredentialRequest.kt\nandroidx/credentials/GetCredentialRequest\n*L\n81#1:278,4\n*E\n"}) /* loaded from: classes.dex */ public final class GetCredentialRequest { private static final String BUNDLE_KEY_PREFER_IDENTITY_DOC_UI = "androidx.credentials.BUNDLE_KEY_PREFER_IDENTITY_DOC_UI"; public static final String BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS = "androidx.credentials.BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS"; private static final String BUNDLE_KEY_PREFER_UI_BRANDING_COMPONENT_NAME = "androidx.credentials.BUNDLE_KEY_PREFER_UI_BRANDING_COMPONENT_NAME"; public static final Companion Companion = new Companion(null); private final List credentialOptions; private final String origin; private final boolean preferIdentityDocUi; private final boolean preferImmediatelyAvailableCredentials; private final ComponentName preferUiBrandingComponentName; /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public GetCredentialRequest(List credentialOptions) { this(credentialOptions, null, false, null, false, 30, null); Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public GetCredentialRequest(List credentialOptions, String str) { this(credentialOptions, str, false, null, false, 28, null); Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public GetCredentialRequest(List credentialOptions, String str, boolean z) { this(credentialOptions, str, z, null, false, 24, null); Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public GetCredentialRequest(List credentialOptions, String str, boolean z, ComponentName componentName) { this(credentialOptions, str, z, componentName, false, 16, null); Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); } @RequiresApi(34) public static final GetCredentialRequest createFrom(android.credentials.GetCredentialRequest getCredentialRequest) { return Companion.createFrom(getCredentialRequest); } public static final GetCredentialRequest createFrom(List list, String str, Bundle bundle) { return Companion.createFrom(list, str, bundle); } public static final Bundle getRequestMetadataBundle(GetCredentialRequest getCredentialRequest) { return Companion.getRequestMetadataBundle(getCredentialRequest); } public final List getCredentialOptions() { return this.credentialOptions; } public final String getOrigin() { return this.origin; } public final boolean getPreferIdentityDocUi() { return this.preferIdentityDocUi; } public final ComponentName getPreferUiBrandingComponentName() { return this.preferUiBrandingComponentName; } public final boolean preferImmediatelyAvailableCredentials() { return this.preferImmediatelyAvailableCredentials; } /* JADX WARN: Multi-variable type inference failed */ public GetCredentialRequest(List credentialOptions, String str, boolean z, ComponentName componentName, boolean z2) { Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); this.credentialOptions = credentialOptions; this.origin = str; this.preferIdentityDocUi = z; this.preferUiBrandingComponentName = componentName; this.preferImmediatelyAvailableCredentials = z2; if (!(!credentialOptions.isEmpty())) { throw new IllegalArgumentException("credentialOptions should not be empty".toString()); } if (credentialOptions.size() > 1) { List list = credentialOptions; int i = 0; if (!(list instanceof Collection) || !list.isEmpty()) { Iterator it = list.iterator(); while (it.hasNext()) { if ((((CredentialOption) it.next()) instanceof GetDigitalCredentialOption) && (i = i + 1) < 0) { CollectionsKt__CollectionsKt.throwCountOverflow(); } } } if (i > 0 && i != this.credentialOptions.size()) { throw new IllegalArgumentException("Digital Credential Option cannot be used with other credential option."); } Iterator it2 = this.credentialOptions.iterator(); while (it2.hasNext()) { if (it2.next() instanceof GetRestoreCredentialOption) { throw new IllegalArgumentException("Only a single GetRestoreCredentialOption should be provided."); } } } } public /* synthetic */ GetCredentialRequest(List list, String str, boolean z, ComponentName componentName, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) { this(list, (i & 2) != 0 ? null : str, (i & 4) != 0 ? false : z, (i & 8) != 0 ? null : componentName, (i & 16) != 0 ? false : z2); } public static final class Builder { private List credentialOptions = new ArrayList(); private String origin; private boolean preferIdentityDocUi; private boolean preferImmediatelyAvailableCredentials; private ComponentName preferUiBrandingComponentName; public final Builder setOrigin(String origin) { Intrinsics.checkNotNullParameter(origin, "origin"); this.origin = origin; return this; } public final Builder setPreferIdentityDocUi(boolean z) { this.preferIdentityDocUi = z; return this; } public final Builder setPreferImmediatelyAvailableCredentials(boolean z) { this.preferImmediatelyAvailableCredentials = z; return this; } public final Builder setPreferUiBrandingComponentName(ComponentName componentName) { this.preferUiBrandingComponentName = componentName; return this; } public final Builder addCredentialOption(CredentialOption credentialOption) { Intrinsics.checkNotNullParameter(credentialOption, "credentialOption"); this.credentialOptions.add(credentialOption); return this; } public final Builder setCredentialOptions(List credentialOptions) { Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); this.credentialOptions = CollectionsKt___CollectionsKt.toMutableList((Collection) credentialOptions); return this; } public final GetCredentialRequest build() { return new GetCredentialRequest(CollectionsKt___CollectionsKt.toList(this.credentialOptions), this.origin, this.preferIdentityDocUi, this.preferUiBrandingComponentName, this.preferImmediatelyAvailableCredentials); } } @SourceDebugExtension({"SMAP\nGetCredentialRequest.kt\nKotlin\n*S Kotlin\n*F\n+ 1 GetCredentialRequest.kt\nandroidx/credentials/GetCredentialRequest$Companion\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,276:1\n1549#2:277\n1620#2,3:278\n*S KotlinDebug\n*F\n+ 1 GetCredentialRequest.kt\nandroidx/credentials/GetCredentialRequest$Companion\n*L\n226#1:277\n226#1:278,3\n*E\n"}) public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } public final Bundle getRequestMetadataBundle(GetCredentialRequest request) { Intrinsics.checkNotNullParameter(request, "request"); Bundle bundle = new Bundle(); bundle.putBoolean(GetCredentialRequest.BUNDLE_KEY_PREFER_IDENTITY_DOC_UI, request.getPreferIdentityDocUi()); bundle.putBoolean("androidx.credentials.BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS", request.preferImmediatelyAvailableCredentials()); bundle.putParcelable(GetCredentialRequest.BUNDLE_KEY_PREFER_UI_BRANDING_COMPONENT_NAME, request.getPreferUiBrandingComponentName()); return bundle; } @RequiresApi(34) public final GetCredentialRequest createFrom(android.credentials.GetCredentialRequest request) { List credentialOptions; String origin; Bundle data; Intrinsics.checkNotNullParameter(request, "request"); credentialOptions = request.getCredentialOptions(); Intrinsics.checkNotNullExpressionValue(credentialOptions, "request.credentialOptions"); List list = credentialOptions; ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10)); Iterator it = list.iterator(); while (it.hasNext()) { android.credentials.CredentialOption it2 = GetCredentialRequest$Companion$$ExternalSyntheticApiModelOutline1.m(it.next()); CredentialOption.Companion companion = CredentialOption.Companion; Intrinsics.checkNotNullExpressionValue(it2, "it"); arrayList.add(companion.createFrom(it2)); } origin = request.getOrigin(); data = request.getData(); Intrinsics.checkNotNullExpressionValue(data, "request.data"); return createFrom(arrayList, origin, data); } public final GetCredentialRequest createFrom(List credentialOptions, String str, Bundle metadata) { Intrinsics.checkNotNullParameter(credentialOptions, "credentialOptions"); Intrinsics.checkNotNullParameter(metadata, "metadata"); try { boolean z = metadata.getBoolean(GetCredentialRequest.BUNDLE_KEY_PREFER_IDENTITY_DOC_UI); Builder preferImmediatelyAvailableCredentials = new Builder().setCredentialOptions(credentialOptions).setPreferIdentityDocUi(z).setPreferUiBrandingComponentName((ComponentName) metadata.getParcelable(GetCredentialRequest.BUNDLE_KEY_PREFER_UI_BRANDING_COMPONENT_NAME)).setPreferImmediatelyAvailableCredentials(metadata.getBoolean("androidx.credentials.BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS")); if (str != null) { preferImmediatelyAvailableCredentials.setOrigin(str); } return preferImmediatelyAvailableCredentials.build(); } catch (Exception unused) { throw new FrameworkClassParsingException(); } } } }