package kotlin; import kotlin.Result; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; /* compiled from: Result.kt */ @Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0003\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0001\u001a.\u0010\u0004\u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u00062\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u0002H\u00060\bH\u0087\bø\u0001\u0000ø\u0001\u0001¢\u0006\u0002\u0010\t\u001a\u0087\u0001\u0010\n\u001a\u0002H\u0006\"\u0004\b\u0000\u0010\u0006\"\u0004\b\u0001\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\f\u001a\u001d\u0012\u0013\u0012\u0011H\u000b¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0004\u0012\u0002H\u00060\r2!\u0010\u0011\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0002\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\u0014\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000\n\b\b\u0001\u0012\u0002\u0010\u0002 \u0000¢\u0006\u0002\u0010\u0012\u001a3\u0010\u0013\u001a\u0002H\u0006\"\u0004\b\u0000\u0010\u0006\"\b\b\u0001\u0010\u000b*\u0002H\u0006*\b\u0012\u0004\u0012\u0002H\u000b0\u00052\u0006\u0010\u0014\u001a\u0002H\u0006H\u0087\bø\u0001\u0001¢\u0006\u0002\u0010\u0015\u001a^\u0010\u0016\u001a\u0002H\u0006\"\u0004\b\u0000\u0010\u0006\"\b\b\u0001\u0010\u000b*\u0002H\u0006*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u0011\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0002\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000¢\u0006\u0002\u0010\u0017\u001a!\u0010\u0018\u001a\u0002H\u000b\"\u0004\b\u0000\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u0005H\u0087\bø\u0001\u0001¢\u0006\u0002\u0010\u0019\u001a`\u0010\u001a\u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u0006\"\u0004\b\u0001\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001b\u001a\u001d\u0012\u0013\u0012\u0011H\u000b¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000¢\u0006\u0002\u0010\u0017\u001aS\u0010\u001c\u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u0006\"\u0004\b\u0001\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001b\u001a\u001d\u0012\u0013\u0012\u0011H\u000b¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001¢\u0006\u0002\u0010\u0017\u001aZ\u0010\u0011\u001a\b\u0012\u0004\u0012\u0002H\u000b0\u0005\"\u0004\b\u0000\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001d\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0002\u0012\u0004\u0012\u00020\u001e0\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000¢\u0006\u0002\u0010\u0017\u001aZ\u0010\f\u001a\b\u0012\u0004\u0012\u0002H\u000b0\u0005\"\u0004\b\u0000\u0010\u000b*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001d\u001a\u001d\u0012\u0013\u0012\u0011H\u000b¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0010\u0012\u0004\u0012\u00020\u001e0\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000¢\u0006\u0002\u0010\u0017\u001ad\u0010\u001f\u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u0006\"\b\b\u0001\u0010\u000b*\u0002H\u0006*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001b\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0002\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0000¢\u0006\u0002\u0010\u0017\u001aW\u0010 \u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u0006\"\b\b\u0001\u0010\u000b*\u0002H\u0006*\b\u0012\u0004\u0012\u0002H\u000b0\u00052!\u0010\u001b\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u000e\u0012\b\b\u000f\u0012\u0004\b\b(\u0002\u0012\u0004\u0012\u0002H\u00060\rH\u0087\bø\u0001\u0000ø\u0001\u0001¢\u0006\u0002\u0010\u0017\u001aC\u0010\u0004\u001a\b\u0012\u0004\u0012\u0002H\u00060\u0005\"\u0004\b\u0000\u0010\u000b\"\u0004\b\u0001\u0010\u0006*\u0002H\u000b2\u0017\u0010\u0007\u001a\u0013\u0012\u0004\u0012\u0002H\u000b\u0012\u0004\u0012\u0002H\u00060\r¢\u0006\u0002\b!H\u0087\bø\u0001\u0000ø\u0001\u0001¢\u0006\u0002\u0010\u0017\u001a\u0018\u0010\"\u001a\u00020\u001e*\u0006\u0012\u0002\b\u00030\u0005H\u0001ø\u0001\u0001¢\u0006\u0002\u0010#\u0082\u0002\u000b\n\u0005\b\u009920\u0001\n\u0002\b\u0019¨\u0006$"}, d2 = {"createFailure", "", "exception", "", "runCatching", "Lkotlin/Result;", "R", "block", "Lkotlin/Function0;", "(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "fold", "T", "onSuccess", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "value", "onFailure", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "getOrDefault", "defaultValue", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "getOrElse", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "getOrThrow", "(Ljava/lang/Object;)Ljava/lang/Object;", "map", "transform", "mapCatching", "action", "", "recover", "recoverCatching", "Lkotlin/ExtensionFunctionType;", "throwOnFailure", "(Ljava/lang/Object;)V", "kotlin-stdlib"}, k = 2, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class ResultKt { public static final Object createFailure(Throwable exception) { Intrinsics.checkNotNullParameter(exception, "exception"); return new Result.Failure(exception); } public static final void throwOnFailure(Object obj) { if (obj instanceof Result.Failure) { throw ((Result.Failure) obj).exception; } } private static final Object runCatching(Function0 block) { Intrinsics.checkNotNullParameter(block, "block"); try { Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(block.invoke()); } catch (Throwable th) { Result.Companion companion2 = Result.INSTANCE; return Result.m288constructorimpl(createFailure(th)); } } private static final Object runCatching(T t, Function1 block) { Intrinsics.checkNotNullParameter(block, "block"); try { Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(block.invoke(t)); } catch (Throwable th) { Result.Companion companion2 = Result.INSTANCE; return Result.m288constructorimpl(createFailure(th)); } } /* JADX WARN: Multi-variable type inference failed */ private static final T getOrThrow(Object obj) { throwOnFailure(obj); return obj; } /* JADX WARN: Multi-variable type inference failed */ private static final R getOrElse(Object obj, Function1 onFailure) { Intrinsics.checkNotNullParameter(onFailure, "onFailure"); Throwable m291exceptionOrNullimpl = Result.m291exceptionOrNullimpl(obj); return m291exceptionOrNullimpl == null ? obj : onFailure.invoke(m291exceptionOrNullimpl); } /* JADX WARN: Multi-variable type inference failed */ private static final R getOrDefault(Object obj, R r) { return Result.m294isFailureimpl(obj) ? r : obj; } private static final R fold(Object obj, Function1 onSuccess, Function1 onFailure) { Intrinsics.checkNotNullParameter(onSuccess, "onSuccess"); Intrinsics.checkNotNullParameter(onFailure, "onFailure"); Throwable m291exceptionOrNullimpl = Result.m291exceptionOrNullimpl(obj); if (m291exceptionOrNullimpl == null) { return onSuccess.invoke(obj); } return onFailure.invoke(m291exceptionOrNullimpl); } private static final Object map(Object obj, Function1 transform) { Intrinsics.checkNotNullParameter(transform, "transform"); if (!Result.m295isSuccessimpl(obj)) { return Result.m288constructorimpl(obj); } Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(transform.invoke(obj)); } private static final Object mapCatching(Object obj, Function1 transform) { Intrinsics.checkNotNullParameter(transform, "transform"); if (!Result.m295isSuccessimpl(obj)) { return Result.m288constructorimpl(obj); } try { Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(transform.invoke(obj)); } catch (Throwable th) { Result.Companion companion2 = Result.INSTANCE; return Result.m288constructorimpl(createFailure(th)); } } private static final Object recover(Object obj, Function1 transform) { Intrinsics.checkNotNullParameter(transform, "transform"); Throwable m291exceptionOrNullimpl = Result.m291exceptionOrNullimpl(obj); if (m291exceptionOrNullimpl == null) { return obj; } Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(transform.invoke(m291exceptionOrNullimpl)); } private static final Object recoverCatching(Object obj, Function1 transform) { Intrinsics.checkNotNullParameter(transform, "transform"); Throwable m291exceptionOrNullimpl = Result.m291exceptionOrNullimpl(obj); if (m291exceptionOrNullimpl == null) { return obj; } try { Result.Companion companion = Result.INSTANCE; return Result.m288constructorimpl(transform.invoke(m291exceptionOrNullimpl)); } catch (Throwable th) { Result.Companion companion2 = Result.INSTANCE; return Result.m288constructorimpl(createFailure(th)); } } private static final Object onFailure(Object obj, Function1 action) { Intrinsics.checkNotNullParameter(action, "action"); Throwable m291exceptionOrNullimpl = Result.m291exceptionOrNullimpl(obj); if (m291exceptionOrNullimpl != null) { action.invoke(m291exceptionOrNullimpl); } return obj; } private static final Object onSuccess(Object obj, Function1 action) { Intrinsics.checkNotNullParameter(action, "action"); if (Result.m295isSuccessimpl(obj)) { action.invoke(obj); } return obj; } }