package com.sistemasolton.itranvias.data.preferences;

import android.content.Context;
import androidx.datastore.core.DataStore;
import androidx.datastore.preferences.PreferenceDataStoreDelegateKt;
import androidx.datastore.preferences.core.Preferences;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.PropertyReference1Impl;
import kotlin.jvm.internal.Reflection;
import kotlin.properties.ReadOnlyProperty;
import kotlin.reflect.KProperty;

/* JADX INFO: compiled from: createDataStore.android.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000 \n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0003\u001a\u000e\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u0005\u001a\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"%\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003*\u00020\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007\"\u000e\u0010\n\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000¨\u0006\u000f"}, d2 = {"DATASTORE_FILE_NAME", "", "dataStore", "Landroidx/datastore/core/DataStore;", "Landroidx/datastore/preferences/core/Preferences;", "Landroid/content/Context;", "getDataStore", "(Landroid/content/Context;)Landroidx/datastore/core/DataStore;", "dataStore$delegate", "Lkotlin/properties/ReadOnlyProperty;", "applicationContext", "initDataStore", "", "context", "createDataStore", "composeApp_release"}, k = 2, mv = {2, 1, 0}, xi = 48)
public final class CreateDataStore_androidKt {
    private static Context applicationContext;
    static final /* synthetic */ KProperty<Object>[] $$delegatedProperties = {Reflection.property1(new PropertyReference1Impl(CreateDataStore_androidKt.class, "dataStore", "getDataStore(Landroid/content/Context;)Landroidx/datastore/core/DataStore;", 1))};
    private static final String DATASTORE_FILE_NAME = "itranvias_preferences";
    private static final ReadOnlyProperty dataStore$delegate = PreferenceDataStoreDelegateKt.preferencesDataStore$default(DATASTORE_FILE_NAME, null, null, null, 14, null);

    private static final DataStore<Preferences> getDataStore(Context context) {
        return (DataStore) dataStore$delegate.getValue(context, $$delegatedProperties[0]);
    }

    public static final void initDataStore(Context context) {
        Intrinsics.checkNotNullParameter(context, "context");
        if (applicationContext == null) {
            applicationContext = context.getApplicationContext();
        }
    }

    public static final DataStore<Preferences> createDataStore() {
        Context context = applicationContext;
        if (context == null) {
            throw new IllegalStateException("DataStore not initialized. Call initDataStore(context) from MainActivity.onCreate()");
        }
        if (context == null) {
            Intrinsics.throwUninitializedPropertyAccessException("applicationContext");
            context = null;
        }
        return getDataStore(context);
    }
}