package x9;

import ca.canadapost.core.data.flex.model.FlexLocation;
import ck.l;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;

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

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

    /* loaded from: classes.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }

        public final FlexLocation.FlexLocationItem.FlexOrApl a(String json) {
            t.g(json, "json");
            try {
                FlexLocation.FlexLocationItem.Apl apl = (FlexLocation.FlexLocationItem.Apl) new com.google.gson.d().j(json, FlexLocation.FlexLocationItem.Apl.class);
                return !l.a(apl.getLockerType()) ? apl : (FlexLocation.FlexLocationItem.FlexOrApl) new com.google.gson.d().j(json, FlexLocation.FlexLocationItem.Flex.class);
            } catch (Throwable unused) {
                return null;
            }
        }

        public final String b(FlexLocation.FlexLocationItem.FlexOrApl flexOrApl) {
            t.g(flexOrApl, "flexOrApl");
            String u10 = new com.google.gson.d().u(flexOrApl);
            t.f(u10, "toJson(...)");
            return u10;
        }
    }
}
