package g0;

import i1.g;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import y0.l2;
import y0.q1;
import y0.s3;
import y0.x2;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class f0 implements i1.g, i1.d {

    /* renamed from: d, reason: collision with root package name */
    public static final b f18885d = new b(null);

    /* renamed from: a, reason: collision with root package name */
    private final i1.g f18886a;

    /* renamed from: b, reason: collision with root package name */
    private final q1 f18887b;

    /* renamed from: c, reason: collision with root package name */
    private final Set f18888c;

    /* loaded from: classes.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ i1.g f18889p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(i1.g gVar) {
            super(1);
            this.f18889p = gVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(Object obj) {
            i1.g gVar = this.f18889p;
            return Boolean.valueOf(gVar != null ? gVar.a(obj) : true);
        }
    }

    /* loaded from: classes.dex */
    public static final class b {

        /* loaded from: classes.dex */
        static final class a extends kotlin.jvm.internal.v implements dn.p {

            /* renamed from: p, reason: collision with root package name */
            public static final a f18890p = new a();

            a() {
                super(2);
            }

            @Override // dn.p
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final Map invoke(i1.l lVar, f0 f0Var) {
                Map c10 = f0Var.c();
                if (c10.isEmpty()) {
                    return null;
                }
                return c10;
            }
        }

        /* renamed from: g0.f0$b$b, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        static final class C0418b extends kotlin.jvm.internal.v implements dn.l {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ i1.g f18891p;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0418b(i1.g gVar) {
                super(1);
                this.f18891p = gVar;
            }

            @Override // dn.l
            /* renamed from: a, reason: merged with bridge method [inline-methods] */
            public final f0 invoke(Map map) {
                return new f0(this.f18891p, map);
            }
        }

        private b() {
        }

        public /* synthetic */ b(kotlin.jvm.internal.k kVar) {
            this();
        }

        public final i1.j a(i1.g gVar) {
            return i1.k.a(a.f18890p, new C0418b(gVar));
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class c extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ Object f18893q;

        /* loaded from: classes.dex */
        public static final class a implements y0.l0 {

            /* renamed from: a, reason: collision with root package name */
            final /* synthetic */ f0 f18894a;

            /* renamed from: b, reason: collision with root package name */
            final /* synthetic */ Object f18895b;

            public a(f0 f0Var, Object obj) {
                this.f18894a = f0Var;
                this.f18895b = obj;
            }

            @Override // y0.l0
            public void a() {
                this.f18894a.f18888c.add(this.f18895b);
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(Object obj) {
            super(1);
            this.f18893q = obj;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final y0.l0 invoke(y0.m0 m0Var) {
            f0.this.f18888c.remove(this.f18893q);
            return new a(f0.this, this.f18893q);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class d extends kotlin.jvm.internal.v implements dn.p {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ Object f18897q;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ dn.p f18898r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ int f18899s;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(Object obj, dn.p pVar, int i10) {
            super(2);
            this.f18897q = obj;
            this.f18898r = pVar;
            this.f18899s = i10;
        }

        public final void a(y0.m mVar, int i10) {
            f0.this.b(this.f18897q, this.f18898r, mVar, l2.a(this.f18899s | 1));
        }

        @Override // dn.p
        public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
            a((y0.m) obj, ((Number) obj2).intValue());
            return rm.n0.f34904a;
        }
    }

    public f0(i1.g gVar) {
        q1 d10;
        this.f18886a = gVar;
        d10 = s3.d(null, null, 2, null);
        this.f18887b = d10;
        this.f18888c = new LinkedHashSet();
    }

    @Override // i1.g
    public boolean a(Object obj) {
        return this.f18886a.a(obj);
    }

    @Override // i1.d
    public void b(Object obj, dn.p pVar, y0.m mVar, int i10) {
        int i11;
        y0.m r10 = mVar.r(-697180401);
        if ((i10 & 6) == 0) {
            i11 = (r10.m(obj) ? 4 : 2) | i10;
        } else {
            i11 = i10;
        }
        if ((i10 & 48) == 0) {
            i11 |= r10.m(pVar) ? 32 : 16;
        }
        if ((i10 & 384) == 0) {
            i11 |= r10.m(this) ? 256 : 128;
        }
        if ((i11 & 147) == 146 && r10.v()) {
            r10.A();
        } else {
            if (y0.p.H()) {
                y0.p.Q(-697180401, i11, -1, "androidx.compose.foundation.lazy.layout.LazySaveableStateHolder.SaveableStateProvider (LazySaveableStateHolder.kt:82)");
            }
            i1.d h10 = h();
            if (h10 == null) {
                throw new IllegalArgumentException("null wrappedHolder".toString());
            }
            int i12 = i11 & 14;
            h10.b(obj, pVar, r10, (i11 & 112) | i12);
            boolean m10 = r10.m(this) | r10.m(obj);
            Object f10 = r10.f();
            if (m10 || f10 == y0.m.f51621a.a()) {
                f10 = new c(obj);
                r10.I(f10);
            }
            y0.p0.a(obj, (dn.l) f10, r10, i12);
            if (y0.p.H()) {
                y0.p.P();
            }
        }
        x2 y10 = r10.y();
        if (y10 != null) {
            y10.a(new d(obj, pVar, i10));
        }
    }

    @Override // i1.g
    public Map c() {
        i1.d h10 = h();
        if (h10 != null) {
            Iterator it = this.f18888c.iterator();
            while (it.hasNext()) {
                h10.f(it.next());
            }
        }
        return this.f18886a.c();
    }

    @Override // i1.g
    public Object d(String str) {
        return this.f18886a.d(str);
    }

    @Override // i1.g
    public g.a e(String str, dn.a aVar) {
        return this.f18886a.e(str, aVar);
    }

    @Override // i1.d
    public void f(Object obj) {
        i1.d h10 = h();
        if (h10 == null) {
            throw new IllegalArgumentException("null wrappedHolder".toString());
        }
        h10.f(obj);
    }

    public final i1.d h() {
        return (i1.d) this.f18887b.getValue();
    }

    public final void i(i1.d dVar) {
        this.f18887b.setValue(dVar);
    }

    public f0(i1.g gVar, Map map) {
        this(i1.i.a(map, new a(gVar)));
    }
}
