import { r as registerInstance, d as createEvent } from './core-3f33e631.js';
import { L as LocalStorage, a as SessionStorage } from './storage-68b7162a.js';

const StateStore = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /**
         * The key for what is being stored
         */
        this.storeKey = 'anjState';
        /**
         * The type of storage to use.
         * Options are `"local"` or `"sessions"` Defaults to session.
         */
        this.type = 'session';
        this.anjStateStoreDidLoad = createEvent(this, "anjStateStoreDidLoad", 7);
    }
    componentWillLoad() {
        this.store = this.type === 'local' ? new LocalStorage() : new SessionStorage();
    }
    componentDidLoad() {
        this.anjStateStoreDidLoad.emit();
    }
    async get() {
        return this.store.getItem(this.storeKey);
    }
    async set(data) {
        return this.store.setItem(this.storeKey, data);
    }
    async clear() {
        return this.store.removeItem(this.storeKey);
    }
};

export { StateStore as anj_state_store };
