package kotlinx.coroutines.internal; import kotlin.ExceptionsKt__ExceptionsKt; import kotlin.Unit; import kotlin.coroutines.CoroutineContext; import kotlin.jvm.functions.Function1; import kotlinx.coroutines.CoroutineExceptionHandlerKt; /* loaded from: classes5.dex */ public abstract class OnUndeliveredElementKt { public static /* synthetic */ UndeliveredElementException callUndeliveredElementCatchingException$default(Function1 function1, Object obj, UndeliveredElementException undeliveredElementException, int i, Object obj2) { if ((i & 2) != 0) { undeliveredElementException = null; } return callUndeliveredElementCatchingException(function1, obj, undeliveredElementException); } public static final UndeliveredElementException callUndeliveredElementCatchingException(Function1 function1, Object obj, UndeliveredElementException undeliveredElementException) { try { function1.invoke(obj); } catch (Throwable th) { if (undeliveredElementException == null || undeliveredElementException.getCause() == th) { return new UndeliveredElementException("Exception in undelivered element handler for " + obj, th); } ExceptionsKt__ExceptionsKt.addSuppressed(undeliveredElementException, th); } return undeliveredElementException; } public static final void callUndeliveredElement(Function1 function1, Object obj, CoroutineContext coroutineContext) { UndeliveredElementException callUndeliveredElementCatchingException = callUndeliveredElementCatchingException(function1, obj, null); if (callUndeliveredElementCatchingException != null) { CoroutineExceptionHandlerKt.handleCoroutineException(coroutineContext, callUndeliveredElementCatchingException); } } public static final Function1 bindCancellationFun(final Function1 function1, final Object obj, final CoroutineContext coroutineContext) { return new Function1() { // from class: kotlinx.coroutines.internal.OnUndeliveredElementKt$bindCancellationFun$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Object invoke(Object obj2) { invoke((Throwable) obj2); return Unit.INSTANCE; } public final void invoke(Throwable th) { OnUndeliveredElementKt.callUndeliveredElement(Function1.this, obj, coroutineContext); } }; } }