var econda;
(function (econda) {
    var env;
    (function (env) {
        var AbstractStorage = (function () {
            function AbstractStorage() {
            }
            AbstractStorage.prototype.isAvailable = function () {
                if (typeof this.storage() != 'undefined' && typeof this.storage().getItem == 'function') {
                    try {
                        this.storage().setItem("isAvailableTest", "someValue");
                        this.storage().removeItem("isAvailableTest");
                    }
                    catch (e) {
                        if (e.message && e.message.toLowerCase().indexOf("quota") > -1) {
                            return false;
                        }
                    }
                    return true;
                }
                else {
                    return false;
                }
            };
            AbstractStorage.prototype.setItem = function (key, data) {
                this.isAvailable() && this.storage().setItem(key, data);
            };
            AbstractStorage.prototype.getItem = function (key) {
                if (this.isAvailable()) {
                    return this.storage().getItem(key);
                }
                return null;
            };
            AbstractStorage.prototype.removeItem = function (key) {
                this.isAvailable() && this.storage().removeItem(key);
            };
            return AbstractStorage;
        }());
        env.AbstractStorage = AbstractStorage;
    })(env = econda.env || (econda.env = {}));
})(econda || (econda = {}));