package coil.request;

import E3.v;
import J4.c;
import J4.e;
import V4.AbstractC0786y;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.ColorSpace;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.widget.ImageView;
import androidx.lifecycle.InterfaceC1113w;
import androidx.lifecycle.r;
import coil.decode.Decoder;
import coil.fetch.Fetcher;
import coil.memory.MemoryCache;
import coil.request.Parameters;
import coil.size.Dimension;
import coil.size.DisplaySizeResolver;
import coil.size.Precision;
import coil.size.Scale;
import coil.size.Size;
import coil.size.SizeResolver;
import coil.size.SizeResolvers;
import coil.size.Sizes;
import coil.size.ViewSizeResolver;
import coil.size.ViewSizeResolvers;
import coil.target.ImageViewTarget;
import coil.target.Target;
import coil.target.ViewTarget;
import coil.transform.Transformation;
import coil.transition.CrossfadeTransition;
import coil.transition.Transition;
import coil.util.Collections;
import coil.util.Contexts;
import coil.util.Requests;
import coil.util.Utils;
import com.google.android.recaptcha.internal.a;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.jvm.internal.h;
import kotlin.jvm.internal.o;
import okhttp3.Headers;
import q.AbstractC2761L;
import w4.C3137A;
import w4.InterfaceC3141c;
import w4.k;
import x4.AbstractC3229F;
import x4.AbstractC3250p;
import x4.y;

/* JADX INFO: loaded from: classes.dex */
public final class ImageRequest {
    private final boolean allowConversionToBitmap;
    private final boolean allowHardware;
    private final boolean allowRgb565;
    private final Bitmap.Config bitmapConfig;
    private final ColorSpace colorSpace;
    private final Context context;
    private final Object data;
    private final AbstractC0786y decoderDispatcher;
    private final Decoder.Factory decoderFactory;
    private final DefaultRequestOptions defaults;
    private final DefinedRequestOptions defined;
    private final String diskCacheKey;
    private final CachePolicy diskCachePolicy;
    private final Drawable errorDrawable;
    private final Integer errorResId;
    private final Drawable fallbackDrawable;
    private final Integer fallbackResId;
    private final AbstractC0786y fetcherDispatcher;
    private final k fetcherFactory;
    private final Headers headers;
    private final AbstractC0786y interceptorDispatcher;
    private final r lifecycle;
    private final Listener listener;
    private final MemoryCache.Key memoryCacheKey;
    private final CachePolicy memoryCachePolicy;
    private final CachePolicy networkCachePolicy;
    private final Parameters parameters;
    private final Drawable placeholderDrawable;
    private final MemoryCache.Key placeholderMemoryCacheKey;
    private final Integer placeholderResId;
    private final Precision precision;
    private final boolean premultipliedAlpha;
    private final Scale scale;
    private final SizeResolver sizeResolver;
    private final Tags tags;
    private final Target target;
    private final AbstractC0786y transformationDispatcher;
    private final List<Transformation> transformations;
    private final Transition.Factory transitionFactory;

    public static final class Builder {
        private boolean allowConversionToBitmap;
        private Boolean allowHardware;
        private Boolean allowRgb565;
        private Bitmap.Config bitmapConfig;
        private ColorSpace colorSpace;
        private final Context context;
        private Object data;
        private AbstractC0786y decoderDispatcher;
        private Decoder.Factory decoderFactory;
        private DefaultRequestOptions defaults;
        private String diskCacheKey;
        private CachePolicy diskCachePolicy;
        private Drawable errorDrawable;
        private Integer errorResId;
        private Drawable fallbackDrawable;
        private Integer fallbackResId;
        private AbstractC0786y fetcherDispatcher;
        private k fetcherFactory;
        private Headers.Builder headers;
        private AbstractC0786y interceptorDispatcher;
        private r lifecycle;
        private Listener listener;
        private MemoryCache.Key memoryCacheKey;
        private CachePolicy memoryCachePolicy;
        private CachePolicy networkCachePolicy;
        private Parameters.Builder parameters;
        private Drawable placeholderDrawable;
        private MemoryCache.Key placeholderMemoryCacheKey;
        private Integer placeholderResId;
        private Precision precision;
        private boolean premultipliedAlpha;
        private r resolvedLifecycle;
        private Scale resolvedScale;
        private SizeResolver resolvedSizeResolver;
        private Scale scale;
        private SizeResolver sizeResolver;
        private Map<Class<?>, Object> tags;
        private Target target;
        private AbstractC0786y transformationDispatcher;
        private List<? extends Transformation> transformations;
        private Transition.Factory transitionFactory;

        /* JADX WARN: Multi-variable type inference failed */
        public Builder(ImageRequest imageRequest) {
            this(imageRequest, null, 2, 0 == true ? 1 : 0);
        }

        public static /* synthetic */ Builder listener$default(Builder builder, c cVar, c cVar2, e eVar, e eVar2, int i6, Object obj) {
            if ((i6 & 1) != 0) {
                cVar = new c() { // from class: coil.request.ImageRequest$Builder$listener$1
                    public final void invoke(ImageRequest imageRequest) {
                    }

                    @Override // J4.c
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
                        invoke((ImageRequest) obj2);
                        return C3137A.f25453a;
                    }
                };
            }
            if ((i6 & 2) != 0) {
                cVar2 = new c() { // from class: coil.request.ImageRequest$Builder$listener$2
                    public final void invoke(ImageRequest imageRequest) {
                    }

                    @Override // J4.c
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
                        invoke((ImageRequest) obj2);
                        return C3137A.f25453a;
                    }
                };
            }
            if ((i6 & 4) != 0) {
                eVar = new e() { // from class: coil.request.ImageRequest$Builder$listener$3
                    public final void invoke(ImageRequest imageRequest, ErrorResult errorResult) {
                    }

                    @Override // J4.e
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2, Object obj3) {
                        invoke((ImageRequest) obj2, (ErrorResult) obj3);
                        return C3137A.f25453a;
                    }
                };
            }
            if ((i6 & 8) != 0) {
                eVar2 = new e() { // from class: coil.request.ImageRequest$Builder$listener$4
                    public final void invoke(ImageRequest imageRequest, SuccessResult successResult) {
                    }

                    @Override // J4.e
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2, Object obj3) {
                        invoke((ImageRequest) obj2, (SuccessResult) obj3);
                        return C3137A.f25453a;
                    }
                };
            }
            return builder.listener(new ImageRequest$Builder$listener$5(cVar, cVar2, eVar, eVar2));
        }

        private final void resetResolvedScale() {
            this.resolvedScale = null;
        }

        private final void resetResolvedValues() {
            this.resolvedLifecycle = null;
            this.resolvedSizeResolver = null;
            this.resolvedScale = null;
        }

        private final r resolveLifecycle() {
            Target target = this.target;
            r lifecycle = Contexts.getLifecycle(target instanceof ViewTarget ? ((ViewTarget) target).getView().getContext() : this.context);
            return lifecycle == null ? GlobalLifecycle.INSTANCE : lifecycle;
        }

        private final Scale resolveScale() {
            View view;
            SizeResolver sizeResolver = this.sizeResolver;
            View view2 = null;
            ViewSizeResolver viewSizeResolver = sizeResolver instanceof ViewSizeResolver ? (ViewSizeResolver) sizeResolver : null;
            if (viewSizeResolver == null || (view = viewSizeResolver.getView()) == null) {
                Target target = this.target;
                ViewTarget viewTarget = target instanceof ViewTarget ? (ViewTarget) target : null;
                if (viewTarget != null) {
                    view2 = viewTarget.getView();
                }
            } else {
                view2 = view;
            }
            return view2 instanceof ImageView ? Utils.getScale((ImageView) view2) : Scale.FIT;
        }

        private final SizeResolver resolveSizeResolver() {
            ImageView.ScaleType scaleType;
            Target target = this.target;
            if (!(target instanceof ViewTarget)) {
                return new DisplaySizeResolver(this.context);
            }
            View view = ((ViewTarget) target).getView();
            return ((view instanceof ImageView) && ((scaleType = ((ImageView) view).getScaleType()) == ImageView.ScaleType.CENTER || scaleType == ImageView.ScaleType.MATRIX)) ? SizeResolvers.create(Size.ORIGINAL) : ViewSizeResolvers.create$default(view, false, 2, null);
        }

        public static /* synthetic */ Builder setParameter$default(Builder builder, String str, Object obj, String str2, int i6, Object obj2) {
            if ((i6 & 4) != 0) {
                str2 = obj != null ? obj.toString() : null;
            }
            return builder.setParameter(str, obj, str2);
        }

        public static /* synthetic */ Builder target$default(Builder builder, c cVar, c cVar2, c cVar3, int i6, Object obj) {
            if ((i6 & 1) != 0) {
                cVar = new c() { // from class: coil.request.ImageRequest$Builder$target$1
                    public final void invoke(Drawable drawable) {
                    }

                    @Override // J4.c
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
                        invoke((Drawable) obj2);
                        return C3137A.f25453a;
                    }
                };
            }
            if ((i6 & 2) != 0) {
                cVar2 = new c() { // from class: coil.request.ImageRequest$Builder$target$2
                    public final void invoke(Drawable drawable) {
                    }

                    @Override // J4.c
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
                        invoke((Drawable) obj2);
                        return C3137A.f25453a;
                    }
                };
            }
            if ((i6 & 4) != 0) {
                cVar3 = new c() { // from class: coil.request.ImageRequest$Builder$target$3
                    public final void invoke(Drawable drawable) {
                    }

                    @Override // J4.c
                    public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
                        invoke((Drawable) obj2);
                        return C3137A.f25453a;
                    }
                };
            }
            return builder.target(new ImageRequest$Builder$target$4(cVar, cVar2, cVar3));
        }

        public final Builder addHeader(String str, String str2) {
            Headers.Builder builder = this.headers;
            if (builder == null) {
                builder = new Headers.Builder();
                this.headers = builder;
            }
            builder.a(str, str2);
            return this;
        }

        public final Builder allowConversionToBitmap(boolean z6) {
            this.allowConversionToBitmap = z6;
            return this;
        }

        public final Builder allowHardware(boolean z6) {
            this.allowHardware = Boolean.valueOf(z6);
            return this;
        }

        public final Builder allowRgb565(boolean z6) {
            this.allowRgb565 = Boolean.valueOf(z6);
            return this;
        }

        public final Builder bitmapConfig(Bitmap.Config config) {
            this.bitmapConfig = config;
            return this;
        }

        public final ImageRequest build() {
            Context context = this.context;
            Object obj = this.data;
            if (obj == null) {
                obj = NullRequestData.INSTANCE;
            }
            Object obj2 = obj;
            Target target = this.target;
            Listener listener = this.listener;
            MemoryCache.Key key = this.memoryCacheKey;
            String str = this.diskCacheKey;
            Bitmap.Config bitmapConfig = this.bitmapConfig;
            if (bitmapConfig == null) {
                bitmapConfig = this.defaults.getBitmapConfig();
            }
            Bitmap.Config config = bitmapConfig;
            ColorSpace colorSpace = this.colorSpace;
            Precision precision = this.precision;
            if (precision == null) {
                precision = this.defaults.getPrecision();
            }
            Precision precision2 = precision;
            k kVar = this.fetcherFactory;
            Decoder.Factory factory = this.decoderFactory;
            List<? extends Transformation> list = this.transformations;
            Transition.Factory transitionFactory = this.transitionFactory;
            if (transitionFactory == null) {
                transitionFactory = this.defaults.getTransitionFactory();
            }
            Transition.Factory factory2 = transitionFactory;
            Headers.Builder builder = this.headers;
            Headers headersOrEmpty = Utils.orEmpty(builder != null ? builder.e() : null);
            Map<Class<?>, ? extends Object> map = this.tags;
            Tags tagsOrEmpty = Utils.orEmpty(map != null ? Tags.Companion.from(map) : null);
            boolean z6 = this.allowConversionToBitmap;
            Boolean bool = this.allowHardware;
            boolean zBooleanValue = bool != null ? bool.booleanValue() : this.defaults.getAllowHardware();
            Boolean bool2 = this.allowRgb565;
            boolean zBooleanValue2 = bool2 != null ? bool2.booleanValue() : this.defaults.getAllowRgb565();
            boolean z7 = this.premultipliedAlpha;
            CachePolicy memoryCachePolicy = this.memoryCachePolicy;
            if (memoryCachePolicy == null) {
                memoryCachePolicy = this.defaults.getMemoryCachePolicy();
            }
            CachePolicy cachePolicy = memoryCachePolicy;
            CachePolicy diskCachePolicy = this.diskCachePolicy;
            if (diskCachePolicy == null) {
                diskCachePolicy = this.defaults.getDiskCachePolicy();
            }
            CachePolicy cachePolicy2 = diskCachePolicy;
            CachePolicy networkCachePolicy = this.networkCachePolicy;
            if (networkCachePolicy == null) {
                networkCachePolicy = this.defaults.getNetworkCachePolicy();
            }
            CachePolicy cachePolicy3 = networkCachePolicy;
            AbstractC0786y interceptorDispatcher = this.interceptorDispatcher;
            if (interceptorDispatcher == null) {
                interceptorDispatcher = this.defaults.getInterceptorDispatcher();
            }
            AbstractC0786y abstractC0786y = interceptorDispatcher;
            AbstractC0786y fetcherDispatcher = this.fetcherDispatcher;
            if (fetcherDispatcher == null) {
                fetcherDispatcher = this.defaults.getFetcherDispatcher();
            }
            AbstractC0786y abstractC0786y2 = fetcherDispatcher;
            AbstractC0786y decoderDispatcher = this.decoderDispatcher;
            if (decoderDispatcher == null) {
                decoderDispatcher = this.defaults.getDecoderDispatcher();
            }
            AbstractC0786y abstractC0786y3 = decoderDispatcher;
            AbstractC0786y transformationDispatcher = this.transformationDispatcher;
            if (transformationDispatcher == null) {
                transformationDispatcher = this.defaults.getTransformationDispatcher();
            }
            AbstractC0786y abstractC0786y4 = transformationDispatcher;
            r rVarResolveLifecycle = this.lifecycle;
            if (rVarResolveLifecycle == null && (rVarResolveLifecycle = this.resolvedLifecycle) == null) {
                rVarResolveLifecycle = resolveLifecycle();
            }
            r rVar = rVarResolveLifecycle;
            SizeResolver sizeResolverResolveSizeResolver = this.sizeResolver;
            if (sizeResolverResolveSizeResolver == null && (sizeResolverResolveSizeResolver = this.resolvedSizeResolver) == null) {
                sizeResolverResolveSizeResolver = resolveSizeResolver();
            }
            SizeResolver sizeResolver = sizeResolverResolveSizeResolver;
            Scale scaleResolveScale = this.scale;
            if (scaleResolveScale == null && (scaleResolveScale = this.resolvedScale) == null) {
                scaleResolveScale = resolveScale();
            }
            Scale scale = scaleResolveScale;
            Parameters.Builder builder2 = this.parameters;
            return new ImageRequest(context, obj2, target, listener, key, str, config, colorSpace, precision2, kVar, factory, list, factory2, headersOrEmpty, tagsOrEmpty, z6, zBooleanValue, zBooleanValue2, z7, cachePolicy, cachePolicy2, cachePolicy3, abstractC0786y, abstractC0786y2, abstractC0786y3, abstractC0786y4, rVar, sizeResolver, scale, Utils.orEmpty(builder2 != null ? builder2.build() : null), this.placeholderMemoryCacheKey, this.placeholderResId, this.placeholderDrawable, this.errorResId, this.errorDrawable, this.fallbackResId, this.fallbackDrawable, new DefinedRequestOptions(this.lifecycle, this.sizeResolver, this.scale, this.interceptorDispatcher, this.fetcherDispatcher, this.decoderDispatcher, this.transformationDispatcher, this.transitionFactory, this.precision, this.bitmapConfig, this.allowHardware, this.allowRgb565, this.memoryCachePolicy, this.diskCachePolicy, this.networkCachePolicy), this.defaults, null);
        }

        public final Builder colorSpace(ColorSpace colorSpace) {
            this.colorSpace = colorSpace;
            return this;
        }

        public final Builder crossfade(boolean z6) {
            return crossfade(z6 ? 100 : 0);
        }

        public final Builder data(Object obj) {
            this.data = obj;
            return this;
        }

        @InterfaceC3141c
        public final Builder decoder(Decoder decoder) {
            Utils.unsupported();
            throw new v();
        }

        public final Builder decoderDispatcher(AbstractC0786y abstractC0786y) {
            this.decoderDispatcher = abstractC0786y;
            return this;
        }

        public final Builder decoderFactory(Decoder.Factory factory) {
            this.decoderFactory = factory;
            return this;
        }

        public final Builder defaults(DefaultRequestOptions defaultRequestOptions) {
            this.defaults = defaultRequestOptions;
            resetResolvedScale();
            return this;
        }

        public final Builder diskCacheKey(String str) {
            this.diskCacheKey = str;
            return this;
        }

        public final Builder diskCachePolicy(CachePolicy cachePolicy) {
            this.diskCachePolicy = cachePolicy;
            return this;
        }

        public final Builder dispatcher(AbstractC0786y abstractC0786y) {
            this.fetcherDispatcher = abstractC0786y;
            this.decoderDispatcher = abstractC0786y;
            this.transformationDispatcher = abstractC0786y;
            return this;
        }

        public final Builder error(int i6) {
            this.errorResId = Integer.valueOf(i6);
            this.errorDrawable = null;
            return this;
        }

        public final Builder fallback(int i6) {
            this.fallbackResId = Integer.valueOf(i6);
            this.fallbackDrawable = null;
            return this;
        }

        @InterfaceC3141c
        public final Builder fetcher(Fetcher fetcher) {
            Utils.unsupported();
            throw new v();
        }

        public final Builder fetcherDispatcher(AbstractC0786y abstractC0786y) {
            this.fetcherDispatcher = abstractC0786y;
            return this;
        }

        public final <T> Builder fetcherFactory(Fetcher.Factory<T> factory, Class<T> cls) {
            this.fetcherFactory = new k(factory, cls);
            return this;
        }

        public final Builder headers(Headers headers) {
            this.headers = headers.j();
            return this;
        }

        public final Builder interceptorDispatcher(AbstractC0786y abstractC0786y) {
            this.interceptorDispatcher = abstractC0786y;
            return this;
        }

        public final Builder lifecycle(InterfaceC1113w interfaceC1113w) {
            return lifecycle(interfaceC1113w != null ? interfaceC1113w.getLifecycle() : null);
        }

        public final Builder listener(c cVar, c cVar2, e eVar, e eVar2) {
            return listener(new ImageRequest$Builder$listener$5(cVar, cVar2, eVar, eVar2));
        }

        /* JADX WARN: Multi-variable type inference failed */
        public final Builder memoryCacheKey(String str) {
            MemoryCache.Key key = null;
            Object[] objArr = 0;
            Object[] objArr2 = 0;
            if (str != null) {
                key = new MemoryCache.Key(str, objArr2 == true ? 1 : 0, 2, objArr == true ? 1 : 0);
            }
            return memoryCacheKey(key);
        }

        public final Builder memoryCachePolicy(CachePolicy cachePolicy) {
            this.memoryCachePolicy = cachePolicy;
            return this;
        }

        public final Builder networkCachePolicy(CachePolicy cachePolicy) {
            this.networkCachePolicy = cachePolicy;
            return this;
        }

        public final Builder parameters(Parameters parameters) {
            this.parameters = parameters.newBuilder();
            return this;
        }

        public final Builder placeholder(int i6) {
            this.placeholderResId = Integer.valueOf(i6);
            this.placeholderDrawable = null;
            return this;
        }

        /* JADX WARN: Multi-variable type inference failed */
        public final Builder placeholderMemoryCacheKey(String str) {
            MemoryCache.Key key = null;
            Object[] objArr = 0;
            Object[] objArr2 = 0;
            if (str != null) {
                key = new MemoryCache.Key(str, objArr2 == true ? 1 : 0, 2, objArr == true ? 1 : 0);
            }
            return placeholderMemoryCacheKey(key);
        }

        public final Builder precision(Precision precision) {
            this.precision = precision;
            return this;
        }

        public final Builder premultipliedAlpha(boolean z6) {
            this.premultipliedAlpha = z6;
            return this;
        }

        public final Builder removeHeader(String str) {
            Headers.Builder builder = this.headers;
            if (builder != null) {
                builder.g(str);
            }
            return this;
        }

        public final Builder removeParameter(String str) {
            Parameters.Builder builder = this.parameters;
            if (builder != null) {
                builder.remove(str);
            }
            return this;
        }

        public final Builder scale(Scale scale) {
            this.scale = scale;
            return this;
        }

        public final Builder setHeader(String str, String str2) {
            Headers.Builder builder = this.headers;
            if (builder == null) {
                builder = new Headers.Builder();
                this.headers = builder;
            }
            builder.h(str, str2);
            return this;
        }

        public final Builder setParameter(String str, Object obj) {
            return setParameter$default(this, str, obj, null, 4, null);
        }

        public final Builder size(int i6) {
            return size(i6, i6);
        }

        public final <T> Builder tag(T t6) {
            o.m();
            throw null;
        }

        public final Builder tags(Tags tags) {
            this.tags = AbstractC3229F.I(tags.asMap());
            return this;
        }

        public final Builder target(ImageView imageView) {
            return target(new ImageViewTarget(imageView));
        }

        public final Builder transformationDispatcher(AbstractC0786y abstractC0786y) {
            this.transformationDispatcher = abstractC0786y;
            return this;
        }

        public final Builder transformations(Transformation... transformationArr) {
            return transformations(AbstractC3250p.X(transformationArr));
        }

        @InterfaceC3141c
        public final Builder transition(Transition transition) {
            Utils.unsupported();
            throw new v();
        }

        public final Builder transitionFactory(Transition.Factory factory) {
            this.transitionFactory = factory;
            return this;
        }

        public Builder(Context context) {
            this.context = context;
            this.defaults = Requests.getDEFAULT_REQUEST_OPTIONS();
            this.data = null;
            this.target = null;
            this.listener = null;
            this.memoryCacheKey = null;
            this.diskCacheKey = null;
            this.bitmapConfig = null;
            if (Build.VERSION.SDK_INT >= 26) {
                this.colorSpace = null;
            }
            this.precision = null;
            this.fetcherFactory = null;
            this.decoderFactory = null;
            this.transformations = y.f26065a;
            this.transitionFactory = null;
            this.headers = null;
            this.tags = null;
            this.allowConversionToBitmap = true;
            this.allowHardware = null;
            this.allowRgb565 = null;
            this.premultipliedAlpha = true;
            this.memoryCachePolicy = null;
            this.diskCachePolicy = null;
            this.networkCachePolicy = null;
            this.interceptorDispatcher = null;
            this.fetcherDispatcher = null;
            this.decoderDispatcher = null;
            this.transformationDispatcher = null;
            this.parameters = null;
            this.placeholderMemoryCacheKey = null;
            this.placeholderResId = null;
            this.placeholderDrawable = null;
            this.errorResId = null;
            this.errorDrawable = null;
            this.fallbackResId = null;
            this.fallbackDrawable = null;
            this.lifecycle = null;
            this.sizeResolver = null;
            this.scale = null;
            this.resolvedLifecycle = null;
            this.resolvedSizeResolver = null;
            this.resolvedScale = null;
        }

        public final Builder crossfade(int i6) {
            Transition.Factory factory;
            if (i6 > 0) {
                factory = new CrossfadeTransition.Factory(i6, false, 2, null);
            } else {
                factory = Transition.Factory.NONE;
            }
            transitionFactory(factory);
            return this;
        }

        public final Builder lifecycle(r rVar) {
            this.lifecycle = rVar;
            return this;
        }

        public final Builder listener(Listener listener) {
            this.listener = listener;
            return this;
        }

        public final Builder memoryCacheKey(MemoryCache.Key key) {
            this.memoryCacheKey = key;
            return this;
        }

        public final Builder placeholderMemoryCacheKey(MemoryCache.Key key) {
            this.placeholderMemoryCacheKey = key;
            return this;
        }

        public final Builder setParameter(String str, Object obj, String str2) {
            Parameters.Builder builder = this.parameters;
            if (builder == null) {
                builder = new Parameters.Builder();
                this.parameters = builder;
            }
            builder.set(str, obj, str2);
            return this;
        }

        public final Builder size(int i6, int i7) {
            return size(Sizes.Size(i6, i7));
        }

        public final <T> Builder tag(Class<? super T> cls, T t6) {
            if (t6 == null) {
                Map<Class<?>, Object> map = this.tags;
                if (map != null) {
                    map.remove(cls);
                }
                return this;
            }
            Map linkedHashMap = this.tags;
            if (linkedHashMap == null) {
                linkedHashMap = new LinkedHashMap();
                this.tags = linkedHashMap;
            }
            T tCast = cls.cast(t6);
            o.e(tCast);
            linkedHashMap.put(cls, tCast);
            return this;
        }

        public final Builder target(c cVar, c cVar2, c cVar3) {
            return target(new ImageRequest$Builder$target$4(cVar, cVar2, cVar3));
        }

        public final Builder transformations(List<? extends Transformation> list) {
            this.transformations = Collections.toImmutableList(list);
            return this;
        }

        public final Builder error(Drawable drawable) {
            this.errorDrawable = drawable;
            this.errorResId = 0;
            return this;
        }

        public final Builder fallback(Drawable drawable) {
            this.fallbackDrawable = drawable;
            this.fallbackResId = 0;
            return this;
        }

        public final <T> Builder fetcherFactory(Fetcher.Factory<T> factory) {
            o.m();
            throw null;
        }

        public final Builder placeholder(Drawable drawable) {
            this.placeholderDrawable = drawable;
            this.placeholderResId = 0;
            return this;
        }

        public final Builder size(Dimension dimension, Dimension dimension2) {
            return size(new Size(dimension, dimension2));
        }

        public final Builder target(Target target) {
            this.target = target;
            resetResolvedValues();
            return this;
        }

        public final Builder size(Size size) {
            return size(SizeResolvers.create(size));
        }

        public final Builder size(SizeResolver sizeResolver) {
            this.sizeResolver = sizeResolver;
            resetResolvedValues();
            return this;
        }

        public Builder(ImageRequest imageRequest, Context context) {
            this.context = context;
            this.defaults = imageRequest.getDefaults();
            this.data = imageRequest.getData();
            this.target = imageRequest.getTarget();
            this.listener = imageRequest.getListener();
            this.memoryCacheKey = imageRequest.getMemoryCacheKey();
            this.diskCacheKey = imageRequest.getDiskCacheKey();
            this.bitmapConfig = imageRequest.getDefined().getBitmapConfig();
            if (Build.VERSION.SDK_INT >= 26) {
                this.colorSpace = imageRequest.getColorSpace();
            }
            this.precision = imageRequest.getDefined().getPrecision();
            this.fetcherFactory = imageRequest.getFetcherFactory();
            this.decoderFactory = imageRequest.getDecoderFactory();
            this.transformations = imageRequest.getTransformations();
            this.transitionFactory = imageRequest.getDefined().getTransitionFactory();
            this.headers = imageRequest.getHeaders().j();
            this.tags = AbstractC3229F.I(imageRequest.getTags().asMap());
            this.allowConversionToBitmap = imageRequest.getAllowConversionToBitmap();
            this.allowHardware = imageRequest.getDefined().getAllowHardware();
            this.allowRgb565 = imageRequest.getDefined().getAllowRgb565();
            this.premultipliedAlpha = imageRequest.getPremultipliedAlpha();
            this.memoryCachePolicy = imageRequest.getDefined().getMemoryCachePolicy();
            this.diskCachePolicy = imageRequest.getDefined().getDiskCachePolicy();
            this.networkCachePolicy = imageRequest.getDefined().getNetworkCachePolicy();
            this.interceptorDispatcher = imageRequest.getDefined().getInterceptorDispatcher();
            this.fetcherDispatcher = imageRequest.getDefined().getFetcherDispatcher();
            this.decoderDispatcher = imageRequest.getDefined().getDecoderDispatcher();
            this.transformationDispatcher = imageRequest.getDefined().getTransformationDispatcher();
            this.parameters = imageRequest.getParameters().newBuilder();
            this.placeholderMemoryCacheKey = imageRequest.getPlaceholderMemoryCacheKey();
            this.placeholderResId = imageRequest.placeholderResId;
            this.placeholderDrawable = imageRequest.placeholderDrawable;
            this.errorResId = imageRequest.errorResId;
            this.errorDrawable = imageRequest.errorDrawable;
            this.fallbackResId = imageRequest.fallbackResId;
            this.fallbackDrawable = imageRequest.fallbackDrawable;
            this.lifecycle = imageRequest.getDefined().getLifecycle();
            this.sizeResolver = imageRequest.getDefined().getSizeResolver();
            this.scale = imageRequest.getDefined().getScale();
            if (imageRequest.getContext() == context) {
                this.resolvedLifecycle = imageRequest.getLifecycle();
                this.resolvedSizeResolver = imageRequest.getSizeResolver();
                this.resolvedScale = imageRequest.getScale();
            } else {
                this.resolvedLifecycle = null;
                this.resolvedSizeResolver = null;
                this.resolvedScale = null;
            }
        }

        public /* synthetic */ Builder(ImageRequest imageRequest, Context context, int i6, h hVar) {
            this(imageRequest, (i6 & 2) != 0 ? imageRequest.getContext() : context);
        }
    }

    public interface Listener {

        public static final class DefaultImpls {
            @Deprecated
            public static void onCancel(Listener listener, ImageRequest imageRequest) {
                Listener.super.onCancel(imageRequest);
            }

            @Deprecated
            public static void onError(Listener listener, ImageRequest imageRequest, ErrorResult errorResult) {
                Listener.super.onError(imageRequest, errorResult);
            }

            @Deprecated
            public static void onStart(Listener listener, ImageRequest imageRequest) {
                Listener.super.onStart(imageRequest);
            }

            @Deprecated
            public static void onSuccess(Listener listener, ImageRequest imageRequest, SuccessResult successResult) {
                Listener.super.onSuccess(imageRequest, successResult);
            }
        }

        default void onCancel(ImageRequest imageRequest) {
        }

        default void onError(ImageRequest imageRequest, ErrorResult errorResult) {
        }

        default void onStart(ImageRequest imageRequest) {
        }

        default void onSuccess(ImageRequest imageRequest, SuccessResult successResult) {
        }
    }

    public /* synthetic */ ImageRequest(Context context, Object obj, Target target, Listener listener, MemoryCache.Key key, String str, Bitmap.Config config, ColorSpace colorSpace, Precision precision, k kVar, Decoder.Factory factory, List list, Transition.Factory factory2, Headers headers, Tags tags, boolean z6, boolean z7, boolean z8, boolean z9, CachePolicy cachePolicy, CachePolicy cachePolicy2, CachePolicy cachePolicy3, AbstractC0786y abstractC0786y, AbstractC0786y abstractC0786y2, AbstractC0786y abstractC0786y3, AbstractC0786y abstractC0786y4, r rVar, SizeResolver sizeResolver, Scale scale, Parameters parameters, MemoryCache.Key key2, Integer num, Drawable drawable, Integer num2, Drawable drawable2, Integer num3, Drawable drawable3, DefinedRequestOptions definedRequestOptions, DefaultRequestOptions defaultRequestOptions, h hVar) {
        this(context, obj, target, listener, key, str, config, colorSpace, precision, kVar, factory, list, factory2, headers, tags, z6, z7, z8, z9, cachePolicy, cachePolicy2, cachePolicy3, abstractC0786y, abstractC0786y2, abstractC0786y3, abstractC0786y4, rVar, sizeResolver, scale, parameters, key2, num, drawable, num2, drawable2, num3, drawable3, definedRequestOptions, defaultRequestOptions);
    }

    public static /* synthetic */ Builder newBuilder$default(ImageRequest imageRequest, Context context, int i6, Object obj) {
        if ((i6 & 1) != 0) {
            context = imageRequest.context;
        }
        return imageRequest.newBuilder(context);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof ImageRequest)) {
            return false;
        }
        ImageRequest imageRequest = (ImageRequest) obj;
        if (o.c(this.context, imageRequest.context) && o.c(this.data, imageRequest.data) && o.c(this.target, imageRequest.target) && o.c(this.listener, imageRequest.listener) && o.c(this.memoryCacheKey, imageRequest.memoryCacheKey) && o.c(this.diskCacheKey, imageRequest.diskCacheKey) && this.bitmapConfig == imageRequest.bitmapConfig) {
            return (Build.VERSION.SDK_INT < 26 || o.c(this.colorSpace, imageRequest.colorSpace)) && this.precision == imageRequest.precision && o.c(this.fetcherFactory, imageRequest.fetcherFactory) && o.c(this.decoderFactory, imageRequest.decoderFactory) && o.c(this.transformations, imageRequest.transformations) && o.c(this.transitionFactory, imageRequest.transitionFactory) && o.c(this.headers, imageRequest.headers) && o.c(this.tags, imageRequest.tags) && this.allowConversionToBitmap == imageRequest.allowConversionToBitmap && this.allowHardware == imageRequest.allowHardware && this.allowRgb565 == imageRequest.allowRgb565 && this.premultipliedAlpha == imageRequest.premultipliedAlpha && this.memoryCachePolicy == imageRequest.memoryCachePolicy && this.diskCachePolicy == imageRequest.diskCachePolicy && this.networkCachePolicy == imageRequest.networkCachePolicy && o.c(this.interceptorDispatcher, imageRequest.interceptorDispatcher) && o.c(this.fetcherDispatcher, imageRequest.fetcherDispatcher) && o.c(this.decoderDispatcher, imageRequest.decoderDispatcher) && o.c(this.transformationDispatcher, imageRequest.transformationDispatcher) && o.c(this.placeholderMemoryCacheKey, imageRequest.placeholderMemoryCacheKey) && o.c(this.placeholderResId, imageRequest.placeholderResId) && o.c(this.placeholderDrawable, imageRequest.placeholderDrawable) && o.c(this.errorResId, imageRequest.errorResId) && o.c(this.errorDrawable, imageRequest.errorDrawable) && o.c(this.fallbackResId, imageRequest.fallbackResId) && o.c(this.fallbackDrawable, imageRequest.fallbackDrawable) && o.c(this.lifecycle, imageRequest.lifecycle) && o.c(this.sizeResolver, imageRequest.sizeResolver) && this.scale == imageRequest.scale && o.c(this.parameters, imageRequest.parameters) && o.c(this.defined, imageRequest.defined) && o.c(this.defaults, imageRequest.defaults);
        }
        return false;
    }

    public final boolean getAllowConversionToBitmap() {
        return this.allowConversionToBitmap;
    }

    public final boolean getAllowHardware() {
        return this.allowHardware;
    }

    public final boolean getAllowRgb565() {
        return this.allowRgb565;
    }

    public final Bitmap.Config getBitmapConfig() {
        return this.bitmapConfig;
    }

    public final ColorSpace getColorSpace() {
        return this.colorSpace;
    }

    public final Context getContext() {
        return this.context;
    }

    public final Object getData() {
        return this.data;
    }

    public final AbstractC0786y getDecoderDispatcher() {
        return this.decoderDispatcher;
    }

    public final Decoder.Factory getDecoderFactory() {
        return this.decoderFactory;
    }

    public final DefaultRequestOptions getDefaults() {
        return this.defaults;
    }

    public final DefinedRequestOptions getDefined() {
        return this.defined;
    }

    public final String getDiskCacheKey() {
        return this.diskCacheKey;
    }

    public final CachePolicy getDiskCachePolicy() {
        return this.diskCachePolicy;
    }

    public final Drawable getError() {
        return Requests.getDrawableCompat(this, this.errorDrawable, this.errorResId, this.defaults.getError());
    }

    public final Drawable getFallback() {
        return Requests.getDrawableCompat(this, this.fallbackDrawable, this.fallbackResId, this.defaults.getFallback());
    }

    public final AbstractC0786y getFetcherDispatcher() {
        return this.fetcherDispatcher;
    }

    public final k getFetcherFactory() {
        return this.fetcherFactory;
    }

    public final Headers getHeaders() {
        return this.headers;
    }

    public final AbstractC0786y getInterceptorDispatcher() {
        return this.interceptorDispatcher;
    }

    public final r getLifecycle() {
        return this.lifecycle;
    }

    public final Listener getListener() {
        return this.listener;
    }

    public final MemoryCache.Key getMemoryCacheKey() {
        return this.memoryCacheKey;
    }

    public final CachePolicy getMemoryCachePolicy() {
        return this.memoryCachePolicy;
    }

    public final CachePolicy getNetworkCachePolicy() {
        return this.networkCachePolicy;
    }

    public final Parameters getParameters() {
        return this.parameters;
    }

    public final Drawable getPlaceholder() {
        return Requests.getDrawableCompat(this, this.placeholderDrawable, this.placeholderResId, this.defaults.getPlaceholder());
    }

    public final MemoryCache.Key getPlaceholderMemoryCacheKey() {
        return this.placeholderMemoryCacheKey;
    }

    public final Precision getPrecision() {
        return this.precision;
    }

    public final boolean getPremultipliedAlpha() {
        return this.premultipliedAlpha;
    }

    public final Scale getScale() {
        return this.scale;
    }

    public final SizeResolver getSizeResolver() {
        return this.sizeResolver;
    }

    public final Tags getTags() {
        return this.tags;
    }

    public final Target getTarget() {
        return this.target;
    }

    public final AbstractC0786y getTransformationDispatcher() {
        return this.transformationDispatcher;
    }

    public final List<Transformation> getTransformations() {
        return this.transformations;
    }

    public final Transition.Factory getTransitionFactory() {
        return this.transitionFactory;
    }

    public int hashCode() {
        int iHashCode = (this.data.hashCode() + (this.context.hashCode() * 31)) * 31;
        Target target = this.target;
        int iHashCode2 = (iHashCode + (target != null ? target.hashCode() : 0)) * 31;
        Listener listener = this.listener;
        int iHashCode3 = (iHashCode2 + (listener != null ? listener.hashCode() : 0)) * 31;
        MemoryCache.Key key = this.memoryCacheKey;
        int iHashCode4 = (iHashCode3 + (key != null ? key.hashCode() : 0)) * 31;
        String str = this.diskCacheKey;
        int iHashCode5 = (this.bitmapConfig.hashCode() + ((iHashCode4 + (str != null ? str.hashCode() : 0)) * 31)) * 31;
        ColorSpace colorSpace = this.colorSpace;
        int iHashCode6 = (this.precision.hashCode() + ((iHashCode5 + (colorSpace != null ? colorSpace.hashCode() : 0)) * 31)) * 31;
        k kVar = this.fetcherFactory;
        int iHashCode7 = (iHashCode6 + (kVar != null ? kVar.hashCode() : 0)) * 31;
        Decoder.Factory factory = this.decoderFactory;
        int iHashCode8 = (this.parameters.hashCode() + ((this.scale.hashCode() + ((this.sizeResolver.hashCode() + ((this.lifecycle.hashCode() + ((this.transformationDispatcher.hashCode() + ((this.decoderDispatcher.hashCode() + ((this.fetcherDispatcher.hashCode() + ((this.interceptorDispatcher.hashCode() + ((this.networkCachePolicy.hashCode() + ((this.diskCachePolicy.hashCode() + ((this.memoryCachePolicy.hashCode() + a.f(a.f(a.f(a.f((this.tags.hashCode() + ((((this.transitionFactory.hashCode() + AbstractC2761L.c(this.transformations, (iHashCode7 + (factory != null ? factory.hashCode() : 0)) * 31, 31)) * 31) + Arrays.hashCode(this.headers.f22021a)) * 31)) * 31, 31, this.allowConversionToBitmap), 31, this.allowHardware), 31, this.allowRgb565), 31, this.premultipliedAlpha)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31;
        MemoryCache.Key key2 = this.placeholderMemoryCacheKey;
        int iHashCode9 = (iHashCode8 + (key2 != null ? key2.hashCode() : 0)) * 31;
        Integer num = this.placeholderResId;
        int iHashCode10 = (iHashCode9 + (num != null ? num.hashCode() : 0)) * 31;
        Drawable drawable = this.placeholderDrawable;
        int iHashCode11 = (iHashCode10 + (drawable != null ? drawable.hashCode() : 0)) * 31;
        Integer num2 = this.errorResId;
        int iHashCode12 = (iHashCode11 + (num2 != null ? num2.hashCode() : 0)) * 31;
        Drawable drawable2 = this.errorDrawable;
        int iHashCode13 = (iHashCode12 + (drawable2 != null ? drawable2.hashCode() : 0)) * 31;
        Integer num3 = this.fallbackResId;
        int iHashCode14 = (iHashCode13 + (num3 != null ? num3.hashCode() : 0)) * 31;
        Drawable drawable3 = this.fallbackDrawable;
        int iHashCode15 = drawable3 != null ? drawable3.hashCode() : 0;
        return this.defaults.hashCode() + ((this.defined.hashCode() + ((iHashCode14 + iHashCode15) * 31)) * 31);
    }

    public final Builder newBuilder() {
        return newBuilder$default(this, null, 1, null);
    }

    /* JADX WARN: Multi-variable type inference failed */
    private ImageRequest(Context context, Object obj, Target target, Listener listener, MemoryCache.Key key, String str, Bitmap.Config config, ColorSpace colorSpace, Precision precision, k kVar, Decoder.Factory factory, List<? extends Transformation> list, Transition.Factory factory2, Headers headers, Tags tags, boolean z6, boolean z7, boolean z8, boolean z9, CachePolicy cachePolicy, CachePolicy cachePolicy2, CachePolicy cachePolicy3, AbstractC0786y abstractC0786y, AbstractC0786y abstractC0786y2, AbstractC0786y abstractC0786y3, AbstractC0786y abstractC0786y4, r rVar, SizeResolver sizeResolver, Scale scale, Parameters parameters, MemoryCache.Key key2, Integer num, Drawable drawable, Integer num2, Drawable drawable2, Integer num3, Drawable drawable3, DefinedRequestOptions definedRequestOptions, DefaultRequestOptions defaultRequestOptions) {
        this.context = context;
        this.data = obj;
        this.target = target;
        this.listener = listener;
        this.memoryCacheKey = key;
        this.diskCacheKey = str;
        this.bitmapConfig = config;
        this.colorSpace = colorSpace;
        this.precision = precision;
        this.fetcherFactory = kVar;
        this.decoderFactory = factory;
        this.transformations = list;
        this.transitionFactory = factory2;
        this.headers = headers;
        this.tags = tags;
        this.allowConversionToBitmap = z6;
        this.allowHardware = z7;
        this.allowRgb565 = z8;
        this.premultipliedAlpha = z9;
        this.memoryCachePolicy = cachePolicy;
        this.diskCachePolicy = cachePolicy2;
        this.networkCachePolicy = cachePolicy3;
        this.interceptorDispatcher = abstractC0786y;
        this.fetcherDispatcher = abstractC0786y2;
        this.decoderDispatcher = abstractC0786y3;
        this.transformationDispatcher = abstractC0786y4;
        this.lifecycle = rVar;
        this.sizeResolver = sizeResolver;
        this.scale = scale;
        this.parameters = parameters;
        this.placeholderMemoryCacheKey = key2;
        this.placeholderResId = num;
        this.placeholderDrawable = drawable;
        this.errorResId = num2;
        this.errorDrawable = drawable2;
        this.fallbackResId = num3;
        this.fallbackDrawable = drawable3;
        this.defined = definedRequestOptions;
        this.defaults = defaultRequestOptions;
    }

    public final Builder newBuilder(Context context) {
        return new Builder(this, context);
    }
}
