package ng;

import java.util.Map;
import kotlin.jvm.internal.t;
import org.json.JSONObject;
import rm.c0;
import sm.q0;

/* loaded from: classes4.dex */
public final class d {

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

    /* renamed from: a, reason: collision with root package name */
    private final String f29958a;

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

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

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

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

        public final d a(wg.d dataEntity) {
            JSONObject jSONObject;
            t.g(dataEntity, "dataEntity");
            String a10 = dataEntity.a();
            if (a10 == null) {
                a10 = "";
            }
            try {
                jSONObject = new JSONObject(a10);
            } catch (Exception unused) {
                jSONObject = new JSONObject();
            }
            String optString = jSONObject.optString("payload");
            t.f(optString, "jsonObject.optString(PAYLOAD)");
            long optLong = jSONObject.optLong("timestamp");
            String optString2 = jSONObject.optString("eventIdentifier");
            t.f(optString2, "jsonObject.optString(EVENT_IDENTIFIER)");
            return new d(optString, optLong, optString2);
        }
    }

    public d(String payload, long j10, String eventIdentifier) {
        t.g(payload, "payload");
        t.g(eventIdentifier, "eventIdentifier");
        this.f29958a = payload;
        this.f29959b = j10;
        this.f29960c = eventIdentifier;
    }

    public final String a() {
        return this.f29960c;
    }

    public final String b() {
        return this.f29958a;
    }

    public final long c() {
        return this.f29959b;
    }

    public final wg.d d() {
        Map l10;
        String str;
        l10 = q0.l(c0.a("payload", this.f29958a), c0.a("timestamp", Long.valueOf(this.f29959b)), c0.a("eventIdentifier", this.f29960c));
        try {
            str = new JSONObject(l10).toString();
        } catch (Exception unused) {
            str = "";
        }
        t.f(str, "try {\n            JSONOb…     EMPTY_JSON\n        }");
        return new wg.d(str);
    }
}
