package tu0; import android.content.Intent; import android.os.Bundle; import android.os.Looper; import android.view.KeyEvent; import com.xingin.pages.CapaDeeplinkUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import kotlin.Deprecated; import kotlin.Metadata; import kotlin.ReplaceWith; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import tu0.b; import tu0.d; import tu0.m; @Metadata(bv = {}, d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010 \n\u0002\b\u0012\b&\u0018\u0000*\u0018\b\u0000\u0010\u0002*\u0012\u0012\u0002\b\u0003\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\u0001*\u001a\b\u0001\u0010\u0003*\u0014\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u0001\u0012\u0004\u0012\u00028\u00020\u0000*\u000e\b\u0002\u0010\u0005*\b\u0012\u0004\u0012\u00028\u00000\u00042\u00020\u0006:\u00010B\u0017\u0012\u0006\u0010$\u001a\u00028\u0000\u0012\u0006\u0010*\u001a\u00028\u0002¢\u0006\u0004\b.\u0010/J\b\u0010\b\u001a\u00020\u0007H\u0002J\u0010\u0010\u000b\u001a\u00020\u00072\u0006\u0010\n\u001a\u00020\tH\u0007J\b\u0010\f\u001a\u00020\u0007H\u0014J\b\u0010\r\u001a\u00020\u0007H\u0014J\u001c\u0010\u000f\u001a\u00020\u00072\u0012\u0010\u000e\u001a\u000e\u0012\u0002\b\u0003\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u0000H\u0005J$\u0010\u000f\u001a\u00020\u00072\u0012\u0010\u000e\u001a\u000e\u0012\u0002\b\u0003\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u00002\u0006\u0010\u0011\u001a\u00020\u0010H\u0005J\u001c\u0010\u0012\u001a\u00020\u00072\u0012\u0010\u000e\u001a\u000e\u0012\u0002\b\u0003\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u0000H\u0005J\u0010\u0010\u0015\u001a\u00020\u00072\b\u0010\u0014\u001a\u0004\u0018\u00010\u0013J\u000e\u0010\u0017\u001a\u00020\u00072\u0006\u0010\u0016\u001a\u00020\u0013J\u001a\u0010\u0015\u001a\u00020\u00072\b\u0010\u0014\u001a\u0004\u0018\u00010\u00132\u0006\u0010\u0011\u001a\u00020\u0010H\u0007J\b\u0010\u0018\u001a\u00020\u0007H\u0007J\u0018\u0010\u001e\u001a\u00020\u001d2\u0006\u0010\u001a\u001a\u00020\u00192\b\u0010\u001c\u001a\u0004\u0018\u00010\u001bR,\u0010 \u001a\u0014\u0012\u0010\u0012\u000e\u0012\u0002\b\u0003\u0012\u0002\b\u0003\u0012\u0002\b\u00030\u00000\u001f8\u0004X\u0004¢\u0006\f\n\u0004\b \u0010!\u001a\u0004\b\"\u0010#R\"\u0010$\u001a\u00028\u00008\u0006@\u0006X\u000e¢\u0006\u0012\n\u0004\b$\u0010%\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R\u001a\u0010*\u001a\u00028\u00028\u0004X\u0004¢\u0006\f\n\u0004\b*\u0010+\u001a\u0004\b,\u0010-¨\u00061"}, d2 = {"Ltu0/m;", "Ltu0/b;", "C", "L", "Ltu0/d;", "D", "", "", "checkMainThread", "Landroid/content/Intent;", "intent", "onNewIntent", "onAttach", "onDetach", "childLinker", "attachChild", "", "tag", "detachChild", "Landroid/os/Bundle;", "savedInstanceState", CapaDeeplinkUtils.DEEPLINK_ATTACH, "outState", "onSaveInstanceState", "detach", "", "keyCode", "Landroid/view/KeyEvent;", "event", "", "onKeyDown", "", "children", "Ljava/util/List;", "getChildren", "()Ljava/util/List;", "controller", "Ltu0/b;", "getController", "()Ltu0/b;", "setController", "(Ltu0/b;)V", "component", "Ltu0/d;", "getComponent", "()Ltu0/d;", "<init>", "(Ltu0/b;Ltu0/d;)V", "a", "library-core_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: Linker.kt */ public abstract class m<C extends b<?, C, L>, L extends m<C, L, D>, D extends d<C>> { public static final a Companion = new a(null); private static final String KEY_CHILD_LINKERS = "Linker.childLinkers"; private static final String KEY_CONTROLLER = "Linker.controller"; private final List<m<?, ?, ?>> _children; private final List<m<?, ?, ?>> children; private final D component; private C controller; private Bundle savedInstanceState; private String tag; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0006\u0010\u0007R\u0014\u0010\u0003\u001a\u00020\u00028\u0002XT¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0002XT¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004¨\u0006\b"}, d2 = {"Ltu0/m$a;", "", "", "KEY_CHILD_LINKERS", "Ljava/lang/String;", "KEY_CONTROLLER", "<init>", "()V", "library-core_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: Linker.kt */ public static final class a { public a() { } public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) { this(); } } public m(C c14, D d14) { Intrinsics.checkParameterIsNotNull(c14, "controller"); Intrinsics.checkParameterIsNotNull(d14, "component"); this.controller = c14; this.component = d14; ArrayList arrayList = new ArrayList(); this._children = arrayList; this.children = arrayList; d14.inject(this.controller); this.controller.setLinker(this); } private final void checkMainThread() { Looper mainLooper = Looper.getMainLooper(); Intrinsics.checkExpressionValueIsNotNull(mainLooper, "Looper.getMainLooper()"); if (!Intrinsics.areEqual(mainLooper.getThread(), Thread.currentThread())) { throw new IllegalStateException("Call must happen on main thread"); } } public final void attach(Bundle bundle) { String name = getClass().getName(); Intrinsics.checkExpressionValueIsNotNull(name, "this.javaClass.name"); attach(bundle, name); } public final void attachChild(m<?, ?, ?> mVar) { Intrinsics.checkParameterIsNotNull(mVar, "childLinker"); String name = mVar.getClass().getName(); Intrinsics.checkExpressionValueIsNotNull(name, "childLinker.javaClass.name"); attachChild(mVar, name); } public final void detach() { j jVar = j.f135072b; jVar.a(this + " detach"); checkMainThread(); Iterator<T> it3 = this._children.iterator(); while (it3.hasNext()) { it3.next().detach(); } this.controller.detach(); j jVar2 = j.f135072b; jVar2.a(this + " onDetach"); onDetach(); } public final void detachChild(m<?, ?, ?> mVar) { Bundle bundle; Intrinsics.checkParameterIsNotNull(mVar, "childLinker"); this._children.remove(mVar); Bundle bundle2 = this.savedInstanceState; if (!(bundle2 == null || (bundle = bundle2.getBundle(KEY_CHILD_LINKERS)) == null)) { bundle.remove(mVar.tag); } mVar.detach(); } public final List<m<?, ?, ?>> getChildren() { return this.children; } public final D getComponent() { return this.component; } public final C getController() { return this.controller; } public void onAttach() { } public void onDetach() { } public final boolean onKeyDown(int i10, KeyEvent keyEvent) { boolean onKeyDown = this.controller.onKeyDown(i10, keyEvent); Iterator<T> it3 = this._children.iterator(); while (it3.hasNext()) { onKeyDown |= it3.next().onKeyDown(i10, keyEvent); } return onKeyDown; } @Deprecated(message = "use LCBActivity.newIntentEvent() instead", replaceWith = @ReplaceWith(expression = "activity.newIntentEvent()", imports = {})) public final void onNewIntent(Intent intent) { Intrinsics.checkParameterIsNotNull(intent, "intent"); this.controller.onNewIntent(intent); Iterator<T> it3 = this._children.iterator(); while (it3.hasNext()) { it3.next().onNewIntent(intent); } } public final void onSaveInstanceState(Bundle bundle) { Intrinsics.checkParameterIsNotNull(bundle, "outState"); Bundle bundle2 = new Bundle(); this.controller.onSaveInstanceState(bundle2); bundle.putBundle(KEY_CONTROLLER, bundle2); Bundle bundle3 = new Bundle(); for (T t14 : this._children) { Bundle bundle4 = new Bundle(); t14.onSaveInstanceState(bundle4); bundle3.putBundle(t14.tag, bundle4); } bundle.putBundle(KEY_CHILD_LINKERS, bundle3); } public final void setController(C c14) { Intrinsics.checkParameterIsNotNull(c14, "<set-?>"); this.controller = c14; } public final void attach(Bundle bundle, String str) { Intrinsics.checkParameterIsNotNull(str, "tag"); j jVar = j.f135072b; jVar.a(this + " attach"); checkMainThread(); this.savedInstanceState = bundle; this.tag = str; jVar.a(this + " onAttach"); onAttach(); this.controller.attach(bundle != null ? bundle.getBundle(KEY_CONTROLLER) : null); } public final void attachChild(m<?, ?, ?> mVar, String str) { Bundle bundle; Intrinsics.checkParameterIsNotNull(mVar, "childLinker"); Intrinsics.checkParameterIsNotNull(str, "tag"); this._children.add(mVar); Bundle bundle2 = this.savedInstanceState; mVar.attach((bundle2 == null || (bundle = bundle2.getBundle(KEY_CHILD_LINKERS)) == null) ? null : bundle.getBundle(str), str); } }