// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/LifecycleTransformer.java
// @ParametersAreNonnullByDefault
// public final class LifecycleTransformer<T> implements ObservableTransformer<T, T>,
//                                                       FlowableTransformer<T, T>,
//                                                       SingleTransformer<T, T>,
//                                                       MaybeTransformer<T, T>,
//                                                       CompletableTransformer
// {
//     final Observable<?> observable;
// 
//     LifecycleTransformer(Observable<?> observable) {
//         checkNotNull(observable, "observable == null");
//         this.observable = observable;
//     }
// 
//     @Override
//     public ObservableSource<T> apply(Observable<T> upstream) {
//         return upstream.takeUntil(observable);
//     }
// 
//     @Override
//     public Publisher<T> apply(Flowable<T> upstream) {
//         return upstream.takeUntil(observable.toFlowable(BackpressureStrategy.LATEST));
//     }
// 
//     @Override
//     public SingleSource<T> apply(Single<T> upstream) {
//         return upstream.takeUntil(observable.firstOrError());
//     }
// 
//     @Override
//     public MaybeSource<T> apply(Maybe<T> upstream) {
//         return upstream.takeUntil(observable.firstElement());
//     }
// 
//     @Override
//     public CompletableSource apply(Completable upstream) {
//         return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) { return true; }
//         if (o == null || getClass() != o.getClass()) { return false; }
// 
//         LifecycleTransformer<?> that = (LifecycleTransformer<?>) o;
// 
//         return observable.equals(that.observable);
//     }
// 
//     @Override
//     public int hashCode() {
//         return observable.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return "LifecycleTransformer{" +
//             "observable=" + observable +
//             '}';
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/OutsideLifecycleException.java
// public class OutsideLifecycleException extends IllegalStateException {
// 
//     public OutsideLifecycleException(@Nullable String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/RxLifecycle.java
// @Nonnull
// @CheckReturnValue
// public static <T, R> LifecycleTransformer<T> bind(@Nonnull final Observable<R> lifecycle) {
//     return new LifecycleTransformer<>(lifecycle);
// }


import com.trello.rxlifecycle4.LifecycleTransformer;
import com.trello.rxlifecycle4.OutsideLifecycleException;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Function;
import static com.trello.rxlifecycle4.RxLifecycle.bind;
package com.trello.lifecycle4.android.lifecycle;




public final class RxLifecycleAndroidLifecycle {

    private RxLifecycleAndroidLifecycle() {
        throw new AssertionError("No instances");
    }

    /**
     * Binds the given source to an Android lifecycle.
     * <p>
     * This helper automatically determines (based on the lifecycle sequence itself) when the source
     * should stop emitting items. In the case that the lifecycle sequence is in the
     * creation phase (ON_CREATE, ON_START, etc) it will choose the equivalent destructive phase (ON_DESTROY,
     * ON_STOP, etc). If used in the destructive phase, the notifications will cease at the next event;
     * for example, if used in ON_PAUSE, it will unsubscribe in ON_STOP.
     *
     * @param lifecycle the lifecycle sequence of an Activity
     * @return a reusable {@link LifecycleTransformer} that unsubscribes the source during the Activity lifecycle
     */
    @NonNull
    @CheckResult
    public static <T> LifecycleTransformer<T> bindLifecycle(@NonNull Observable<Lifecycle.Event> lifecycle) {
        return bind(lifecycle, LIFECYCLE);
    }

    private static final Function<Lifecycle.Event, Lifecycle.Event> LIFECYCLE = new Function<Lifecycle.Event, Lifecycle.Event>() {
        @Override
        public Lifecycle.Event apply(Lifecycle.Event lastEvent) throws Exception {
            switch (lastEvent) {
                case ON_CREATE:
                    return Lifecycle.Event.ON_DESTROY;
                case ON_START:
                    return Lifecycle.Event.ON_STOP;
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/LifecycleTransformer.java
// @ParametersAreNonnullByDefault
// public final class LifecycleTransformer<T> implements ObservableTransformer<T, T>,
//                                                       FlowableTransformer<T, T>,
//                                                       SingleTransformer<T, T>,
//                                                       MaybeTransformer<T, T>,
//                                                       CompletableTransformer
// {
//     final Observable<?> observable;
// 
//     LifecycleTransformer(Observable<?> observable) {
//         checkNotNull(observable, "observable == null");
//         this.observable = observable;
//     }
// 
//     @Override
//     public ObservableSource<T> apply(Observable<T> upstream) {
//         return upstream.takeUntil(observable);
//     }
// 
//     @Override
//     public Publisher<T> apply(Flowable<T> upstream) {
//         return upstream.takeUntil(observable.toFlowable(BackpressureStrategy.LATEST));
//     }
// 
//     @Override
//     public SingleSource<T> apply(Single<T> upstream) {
//         return upstream.takeUntil(observable.firstOrError());
//     }
// 
//     @Override
//     public MaybeSource<T> apply(Maybe<T> upstream) {
//         return upstream.takeUntil(observable.firstElement());
//     }
// 
//     @Override
//     public CompletableSource apply(Completable upstream) {
//         return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) { return true; }
//         if (o == null || getClass() != o.getClass()) { return false; }
// 
//         LifecycleTransformer<?> that = (LifecycleTransformer<?>) o;
// 
//         return observable.equals(that.observable);
//     }
// 
//     @Override
//     public int hashCode() {
//         return observable.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return "LifecycleTransformer{" +
//             "observable=" + observable +
//             '}';
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/OutsideLifecycleException.java
// public class OutsideLifecycleException extends IllegalStateException {
// 
//     public OutsideLifecycleException(@Nullable String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: rxlifecycle/src/main/java/com/trello/rxlifecycle4/RxLifecycle.java
// @Nonnull
// @CheckReturnValue
// public static <T, R> LifecycleTransformer<T> bind(@Nonnull final Observable<R> lifecycle) {
//     return new LifecycleTransformer<>(lifecycle);
// }


// Path: rxlifecycle-android-lifecycle/src/main/java/com/trello/lifecycle4/android/lifecycle/RxLifecycleAndroidLifecycle.java
import com.trello.rxlifecycle4.LifecycleTransformer;
import com.trello.rxlifecycle4.OutsideLifecycleException;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Function;
import static com.trello.rxlifecycle4.RxLifecycle.bind;

package com.trello.lifecycle4.android.lifecycle;




public final class RxLifecycleAndroidLifecycle {

    private RxLifecycleAndroidLifecycle() {
        throw new AssertionError("No instances");
    }

    /**
     * Binds the given source to an Android lifecycle.
     * <p>
     * This helper automatically determines (based on the lifecycle sequence itself) when the source
     * should stop emitting items. In the case that the lifecycle sequence is in the
     * creation phase (ON_CREATE, ON_START, etc) it will choose the equivalent destructive phase (ON_DESTROY,
     * ON_STOP, etc). If used in the destructive phase, the notifications will cease at the next event;
     * for example, if used in ON_PAUSE, it will unsubscribe in ON_STOP.
     *
     * @param lifecycle the lifecycle sequence of an Activity
     * @return a reusable {@link LifecycleTransformer} that unsubscribes the source during the Activity lifecycle
     */
    @NonNull
    @CheckResult
    public static <T> LifecycleTransformer<T> bindLifecycle(@NonNull Observable<Lifecycle.Event> lifecycle) {
        return bind(lifecycle, LIFECYCLE);
    }

    private static final Function<Lifecycle.Event, Lifecycle.Event> LIFECYCLE = new Function<Lifecycle.Event, Lifecycle.Event>() {
        @Override
        public Lifecycle.Event apply(Lifecycle.Event lastEvent) throws Exception {
            switch (lastEvent) {
                case ON_CREATE:
                    return Lifecycle.Event.ON_DESTROY;
                case ON_START:
                    return Lifecycle.Event.ON_STOP;
                case ON_RESUME: