package defpackage;

import j$.util.DesugarCollections;
import java.util.HashMap;
import java.util.Map;

/* renamed from: ᵺᵾⁱ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5158 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final int f19218;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final HashMap f19219 = new HashMap();

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int f19220 = 64;

    public C5158(int i) {
        this.f19218 = i;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static String m10635(int i, String str) {
        if (str != null) {
            str = str.trim();
            if (str.length() > i) {
                return str.substring(0, i);
            }
        }
        return str;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final synchronized boolean m10636(String str) {
        String strM10635 = m10635(this.f19218, "com.crashlytics.version-control-info");
        if (this.f19219.size() >= this.f19220 && !this.f19219.containsKey(strM10635)) {
            return false;
        }
        String strM106352 = m10635(this.f19218, str);
        String str2 = (String) this.f19219.get(strM10635);
        if (str2 == null ? strM106352 == null : str2.equals(strM106352)) {
            return false;
        }
        this.f19219.put(strM10635, strM106352);
        return true;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final synchronized Map m10637() {
        return DesugarCollections.unmodifiableMap(new HashMap(this.f19219));
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final synchronized void m10638(Map map) {
        try {
            for (Map.Entry entry : map.entrySet()) {
                String str = (String) entry.getKey();
                if (str == null) {
                    throw new IllegalArgumentException("Custom attribute key must not be null.");
                }
                String strM10635 = m10635(this.f19218, str);
                if (this.f19219.size() < this.f19220 || this.f19219.containsKey(strM10635)) {
                    String str2 = (String) entry.getValue();
                    this.f19219.put(strM10635, str2 == null ? "" : m10635(this.f19218, str2));
                }
            }
        } catch (Throwable th) {
            throw th;
        }
    }
}
