e"in n && (n.writable = !0),
Object.defineProperty(t, ie(n.key), n)
}
}
function ie(t) {
var e = function(t, e) {
if ("object" != ne(t) || !t)
return t;
var r = t[Symbol.toPrimitive];
if (void 0 !== r) {
var n = r.call(t, "string");
if ("object" != ne(n))
return n;
throw new TypeError("@@toPrimitive must return a primitive value.")
}
return String(t)
}(t);
return "symbol" == ne(e) ? e : String(e)
}
function ae(t, e) {
return ae = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
return t.__proto__ = e,
t
}
,
ae(t, e)
}
function se(t) {
return se = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
return t.__proto__ || Object.getPrototypeOf(t)
}
,
se(t)
}
const ce = function(t) {
!function(t, e) {
if ("function" != typeof e && null !== e)
throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}),
Object.defineProperty(t, "prototype", {
writable: !1
}),
e && ae(t, e)
}(a, t);
var e, r, n, o, i = (n = a,
o = function() {
if ("undefined" == typeof Reflect || !Reflect.construct)
return !1;
if (Reflect.construct.sham)
return !1;
if ("function" == typeof Proxy)
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}
))),
!0
} catch (t) {
return !1
}
}(),
function() {
var t, e = se(n);
if (o) {
var r = se(this).constructor;
t = Reflect.construct(e, arguments, r)
} else
t = e.apply(this, arguments);
return function(t, e) {
if (e && ("object" === ne(e) || "function" == typeof e))
return e;
if (void 0 !== e)
throw new TypeError("Derived constructors may only return object or undefined");
return function(t) {
if (void 0 === t)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t
}(t)
}(this, t)
}
);
function a() {
return function(t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function")
}(this, a),
i.apply(this, arguments)
}
return e = a,
r = [{
key: "defaultType",
get: function() {
return this._platformBridge.defaultStorageType
}
}, {
key: "isSupported",
value: function(t) {
if (t) {
var e = t[this._platformBridge.platformId];
if (e)
return this.isSupported(e)
}
return this._platformBridge.isStorageSupported(t)
}
}, {
key: "isAvailable",
value: function(t) {
if (t) {
var e = t[this._platformBridge.platformId];
if (e)
return this.isSupported(e)
}
return this._platformBridge.isStorageAvailable(t)
}
}, {
key: "get",
value: function(t, e) {
var r = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
if (e) {
var n = e[this._platformBridge.platformId];
if (n)
return this.get(t, n, r)
}
var o = e;
return o || (o = this.defaultType),
this._platformBridge.isStorageAvailable(o) ? Array.isArray(t) && 0 === t.length ? Promise.resolve([]) : this._platformBridge.getDataFromStorage(t, o, r) : Promise.reject()
}
}, {
key: "set",
value: function(t, e, r) {
if (r) {
var n = r[this._platformBridge.platformId];
if (n)
return this.set(t, e, n)
}
var o = r;
if (o || (o = this.defaultType),
!this._platformBridge.isStorageAvailable(o))
return Promise.reject();
if (Array.isArray(t)) {
if (!Array.isArray(e))
return Promise.reject(new Error("Value must be an array when key is an array"));
if (t.length !== e.length)
return Promise.reject(new Error("Key and value arrays must have the same length"));
if (0 === t.length)
return Promise.resolve()
}
return this._platformBridge.setDataToStorage(t, e, o)
}
}, {
key: "delete",
value: function(t, e) {
if (e) {
var r = e[ |