mogultv/storage-a8ac7bd3.js

944 lines
35 KiB
JavaScript

function e(e) {
if (e.__esModule) return e;
var r = Object.defineProperty({}, "__esModule", {
value: !0
});
return Object.keys(e).forEach((function(s) {
var n = Object.getOwnPropertyDescriptor(e, s);
Object.defineProperty(r, s, n.get ? n : {
enumerable: !0,
get: function() {
return e[s]
}
});
})), r
}
var r = {
exports: {}
};
(function(e) {
if ("undefined" == typeof browser || Object.getPrototypeOf(browser) !== Object.prototype) {
const r = "The message port closed before a response was received.",
s = "Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)",
n = e => {
const n = {
alarms: {
clear: {
minArgs: 0,
maxArgs: 1
},
clearAll: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
}
},
bookmarks: {
create: {
minArgs: 1,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 1
},
getChildren: {
minArgs: 1,
maxArgs: 1
},
getRecent: {
minArgs: 1,
maxArgs: 1
},
getSubTree: {
minArgs: 1,
maxArgs: 1
},
getTree: {
minArgs: 0,
maxArgs: 0
},
move: {
minArgs: 2,
maxArgs: 2
},
remove: {
minArgs: 1,
maxArgs: 1
},
removeTree: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
},
update: {
minArgs: 2,
maxArgs: 2
}
},
browserAction: {
disable: {
minArgs: 0,
maxArgs: 1,
fallbackToNoCallback: !0
},
enable: {
minArgs: 0,
maxArgs: 1,
fallbackToNoCallback: !0
},
getBadgeBackgroundColor: {
minArgs: 1,
maxArgs: 1
},
getBadgeText: {
minArgs: 1,
maxArgs: 1
},
getPopup: {
minArgs: 1,
maxArgs: 1
},
getTitle: {
minArgs: 1,
maxArgs: 1
},
openPopup: {
minArgs: 0,
maxArgs: 0
},
setBadgeBackgroundColor: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setBadgeText: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setIcon: {
minArgs: 1,
maxArgs: 1
},
setPopup: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setTitle: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
browsingData: {
remove: {
minArgs: 2,
maxArgs: 2
},
removeCache: {
minArgs: 1,
maxArgs: 1
},
removeCookies: {
minArgs: 1,
maxArgs: 1
},
removeDownloads: {
minArgs: 1,
maxArgs: 1
},
removeFormData: {
minArgs: 1,
maxArgs: 1
},
removeHistory: {
minArgs: 1,
maxArgs: 1
},
removeLocalStorage: {
minArgs: 1,
maxArgs: 1
},
removePasswords: {
minArgs: 1,
maxArgs: 1
},
removePluginData: {
minArgs: 1,
maxArgs: 1
},
settings: {
minArgs: 0,
maxArgs: 0
}
},
commands: {
getAll: {
minArgs: 0,
maxArgs: 0
}
},
contextMenus: {
remove: {
minArgs: 1,
maxArgs: 1
},
removeAll: {
minArgs: 0,
maxArgs: 0
},
update: {
minArgs: 2,
maxArgs: 2
}
},
cookies: {
get: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 1,
maxArgs: 1
},
getAllCookieStores: {
minArgs: 0,
maxArgs: 0
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
},
devtools: {
inspectedWindow: {
eval: {
minArgs: 1,
maxArgs: 2,
singleCallbackArg: !1
}
},
panels: {
create: {
minArgs: 3,
maxArgs: 3,
singleCallbackArg: !0
},
elements: {
createSidebarPane: {
minArgs: 1,
maxArgs: 1
}
}
}
},
downloads: {
cancel: {
minArgs: 1,
maxArgs: 1
},
download: {
minArgs: 1,
maxArgs: 1
},
erase: {
minArgs: 1,
maxArgs: 1
},
getFileIcon: {
minArgs: 1,
maxArgs: 2
},
open: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
pause: {
minArgs: 1,
maxArgs: 1
},
removeFile: {
minArgs: 1,
maxArgs: 1
},
resume: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
},
show: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
extension: {
isAllowedFileSchemeAccess: {
minArgs: 0,
maxArgs: 0
},
isAllowedIncognitoAccess: {
minArgs: 0,
maxArgs: 0
}
},
history: {
addUrl: {
minArgs: 1,
maxArgs: 1
},
deleteAll: {
minArgs: 0,
maxArgs: 0
},
deleteRange: {
minArgs: 1,
maxArgs: 1
},
deleteUrl: {
minArgs: 1,
maxArgs: 1
},
getVisits: {
minArgs: 1,
maxArgs: 1
},
search: {
minArgs: 1,
maxArgs: 1
}
},
i18n: {
detectLanguage: {
minArgs: 1,
maxArgs: 1
},
getAcceptLanguages: {
minArgs: 0,
maxArgs: 0
}
},
identity: {
launchWebAuthFlow: {
minArgs: 1,
maxArgs: 1
}
},
idle: {
queryState: {
minArgs: 1,
maxArgs: 1
}
},
management: {
get: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
},
getSelf: {
minArgs: 0,
maxArgs: 0
},
setEnabled: {
minArgs: 2,
maxArgs: 2
},
uninstallSelf: {
minArgs: 0,
maxArgs: 1
}
},
notifications: {
clear: {
minArgs: 1,
maxArgs: 1
},
create: {
minArgs: 1,
maxArgs: 2
},
getAll: {
minArgs: 0,
maxArgs: 0
},
getPermissionLevel: {
minArgs: 0,
maxArgs: 0
},
update: {
minArgs: 2,
maxArgs: 2
}
},
pageAction: {
getPopup: {
minArgs: 1,
maxArgs: 1
},
getTitle: {
minArgs: 1,
maxArgs: 1
},
hide: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setIcon: {
minArgs: 1,
maxArgs: 1
},
setPopup: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
setTitle: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
},
show: {
minArgs: 1,
maxArgs: 1,
fallbackToNoCallback: !0
}
},
permissions: {
contains: {
minArgs: 1,
maxArgs: 1
},
getAll: {
minArgs: 0,
maxArgs: 0
},
remove: {
minArgs: 1,
maxArgs: 1
},
request: {
minArgs: 1,
maxArgs: 1
}
},
runtime: {
getBackgroundPage: {
minArgs: 0,
maxArgs: 0
},
getPlatformInfo: {
minArgs: 0,
maxArgs: 0
},
openOptionsPage: {
minArgs: 0,
maxArgs: 0
},
requestUpdateCheck: {
minArgs: 0,
maxArgs: 0
},
sendMessage: {
minArgs: 1,
maxArgs: 3
},
sendNativeMessage: {
minArgs: 2,
maxArgs: 2
},
setUninstallURL: {
minArgs: 1,
maxArgs: 1
}
},
sessions: {
getDevices: {
minArgs: 0,
maxArgs: 1
},
getRecentlyClosed: {
minArgs: 0,
maxArgs: 1
},
restore: {
minArgs: 0,
maxArgs: 1
}
},
storage: {
local: {
clear: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
},
managed: {
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
}
},
sync: {
clear: {
minArgs: 0,
maxArgs: 0
},
get: {
minArgs: 0,
maxArgs: 1
},
getBytesInUse: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
}
},
tabs: {
captureVisibleTab: {
minArgs: 0,
maxArgs: 2
},
create: {
minArgs: 1,
maxArgs: 1
},
detectLanguage: {
minArgs: 0,
maxArgs: 1
},
discard: {
minArgs: 0,
maxArgs: 1
},
duplicate: {
minArgs: 1,
maxArgs: 1
},
executeScript: {
minArgs: 1,
maxArgs: 2
},
get: {
minArgs: 1,
maxArgs: 1
},
getCurrent: {
minArgs: 0,
maxArgs: 0
},
getZoom: {
minArgs: 0,
maxArgs: 1
},
getZoomSettings: {
minArgs: 0,
maxArgs: 1
},
goBack: {
minArgs: 0,
maxArgs: 1
},
goForward: {
minArgs: 0,
maxArgs: 1
},
highlight: {
minArgs: 1,
maxArgs: 1
},
insertCSS: {
minArgs: 1,
maxArgs: 2
},
move: {
minArgs: 2,
maxArgs: 2
},
query: {
minArgs: 1,
maxArgs: 1
},
reload: {
minArgs: 0,
maxArgs: 2
},
remove: {
minArgs: 1,
maxArgs: 1
},
removeCSS: {
minArgs: 1,
maxArgs: 2
},
sendMessage: {
minArgs: 2,
maxArgs: 3
},
setZoom: {
minArgs: 1,
maxArgs: 2
},
setZoomSettings: {
minArgs: 1,
maxArgs: 2
},
update: {
minArgs: 1,
maxArgs: 2
}
},
topSites: {
get: {
minArgs: 0,
maxArgs: 0
}
},
webNavigation: {
getAllFrames: {
minArgs: 1,
maxArgs: 1
},
getFrame: {
minArgs: 1,
maxArgs: 1
}
},
webRequest: {
handlerBehaviorChanged: {
minArgs: 0,
maxArgs: 0
}
},
windows: {
create: {
minArgs: 0,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 2
},
getAll: {
minArgs: 0,
maxArgs: 1
},
getCurrent: {
minArgs: 0,
maxArgs: 1
},
getLastFocused: {
minArgs: 0,
maxArgs: 1
},
remove: {
minArgs: 1,
maxArgs: 1
},
update: {
minArgs: 2,
maxArgs: 2
}
}
};
if (0 === Object.keys(n).length) throw new Error("api-metadata.json has not been included in browser-polyfill");
class g extends WeakMap {
constructor(e, r) {
super(r), this.createItem = e;
}
get(e) {
return this.has(e) || this.set(e, this.createItem(e)), super.get(e)
}
}
const a = e => e && "object" == typeof e && "function" == typeof e.then,
t = (r, s) => (...n) => {
e.runtime.lastError ? r.reject(new Error(e.runtime.lastError.message)) : s.singleCallbackArg || n.length <= 1 && !1 !== s.singleCallbackArg ? r.resolve(n[0]) : r.resolve(n);
},
m = e => 1 == e ? "argument" : "arguments",
i = (e, r) => function(s, ...n) {
if (n.length < r.minArgs) throw new Error(`Expected at least ${r.minArgs} ${m(r.minArgs)} for ${e}(), got ${n.length}`);
if (n.length > r.maxArgs) throw new Error(`Expected at most ${r.maxArgs} ${m(r.maxArgs)} for ${e}(), got ${n.length}`);
return new Promise(((g, a) => {
if (r.fallbackToNoCallback) try {
s[e](...n, t({
resolve: g,
reject: a
}, r));
} catch (a) {
console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `, a), s[e](...n), r.fallbackToNoCallback = !1, r.noCallback = !0, g();
} else r.noCallback ? (s[e](...n), g()) : s[e](...n, t({
resolve: g,
reject: a
}, r));
}))
},
o = (e, r, s) => new Proxy(r, {
apply: (r, n, g) => s.call(n, e, ...g)
});
let A = Function.call.bind(Object.prototype.hasOwnProperty);
const l = (e, r = {}, s = {}) => {
let n = Object.create(null),
g = {
has: (r, s) => s in e || s in n,
get(g, a, t) {
if (a in n) return n[a];
if (!(a in e)) return;
let m = e[a];
if ("function" == typeof m)
if ("function" == typeof r[a]) m = o(e, e[a], r[a]);
else if (A(s, a)) {
let r = i(a, s[a]);
m = o(e, e[a], r);
} else m = m.bind(e);
else if ("object" == typeof m && null !== m && (A(r, a) || A(s, a))) m = l(m, r[a], s[a]);
else {
if (!A(s, "*")) return Object.defineProperty(n, a, {
configurable: !0,
enumerable: !0,
get: () => e[a],
set(r) {
e[a] = r;
}
}), m;
m = l(m, r[a], s["*"]);
}
return n[a] = m, m
},
set: (r, s, g, a) => (s in n ? n[s] = g : e[s] = g, !0),
defineProperty: (e, r, s) => Reflect.defineProperty(n, r, s),
deleteProperty: (e, r) => Reflect.deleteProperty(n, r)
},
a = Object.create(e);
return new Proxy(a, g)
},
c = e => ({
addListener(r, s, ...n) {
r.addListener(e.get(s), ...n);
},
hasListener: (r, s) => r.hasListener(e.get(s)),
removeListener(r, s) {
r.removeListener(e.get(s));
}
}),
x = new g((e => "function" != typeof e ? e : function(r) {
const s = l(r, {}, {
getContent: {
minArgs: 0,
maxArgs: 0
}
});
e(s);
}));
let d = !1;
const u = new g((e => "function" != typeof e ? e : function(r, n, g) {
let t, m, i = !1,
o = new Promise((e => {
t = function(r) {
d || (console.warn(s, (new Error).stack), d = !0), i = !0, e(r);
};
}));
try {
m = e(r, n, t);
} catch (e) {
m = Promise.reject(e);
}
const A = !0 !== m && a(m);
if (!0 !== m && !A && !i) return !1;
const l = e => {
e.then((e => {
g(e);
}), (e => {
let r;
r = e && (e instanceof Error || "string" == typeof e.message) ? e.message : "An unexpected error occurred", g({
__mozWebExtensionPolyfillReject__: !0,
message: r
});
})).catch((e => {
console.error("Failed to send onMessage rejected reply", e);
}));
};
return l(A ? m : o), !0
})),
f = ({
reject: s,
resolve: n
}, g) => {
e.runtime.lastError ? e.runtime.lastError.message === r ? n() : s(new Error(e.runtime.lastError.message)) : g && g.__mozWebExtensionPolyfillReject__ ? s(new Error(g.message)) : n(g);
},
b = (e, r, s, ...n) => {
if (n.length < r.minArgs) throw new Error(`Expected at least ${r.minArgs} ${m(r.minArgs)} for ${e}(), got ${n.length}`);
if (n.length > r.maxArgs) throw new Error(`Expected at most ${r.maxArgs} ${m(r.maxArgs)} for ${e}(), got ${n.length}`);
return new Promise(((e, r) => {
const g = f.bind(null, {
resolve: e,
reject: r
});
n.push(g), s.sendMessage(...n);
}))
},
p = {
devtools: {
network: {
onRequestFinished: c(x)
}
},
runtime: {
onMessage: c(u),
onMessageExternal: c(u),
sendMessage: b.bind(null, "sendMessage", {
minArgs: 1,
maxArgs: 3
})
},
tabs: {
sendMessage: b.bind(null, "sendMessage", {
minArgs: 2,
maxArgs: 3
})
}
},
h = {
clear: {
minArgs: 1,
maxArgs: 1
},
get: {
minArgs: 1,
maxArgs: 1
},
set: {
minArgs: 1,
maxArgs: 1
}
};
return n.privacy = {
network: {
"*": h
},
services: {
"*": h
},
websites: {
"*": h
}
}, l(e, p, n)
};
if ("object" != typeof chrome || !chrome || !chrome.runtime || !chrome.runtime.id) throw new Error("This script should only be loaded in a browser extension.");
e.exports = n(chrome);
} else e.exports = browser;
}(r));
var s = r.exports;
const n = {
auth: {
token: void 0
},
settings: {
theaterMode: !0,
chatBatching: !0,
chatStyles: !0
},
cache: {}
},
g = s.storage.local,
a = Object.fromEntries(Object.keys(n).map((e => [e, new Set])));
s.storage.onChanged.addListener(((e, r) => {
if ("local" !== r) return;
const s = {};
for (const r in e) {
const [n, g] = r.split(".");
s[n] || (s[n] = {}), s[n][g] = e[r].newValue;
}
for (const e in a)
if (s[e])
for (const r of a[e].values()) r.callback(s[e]);
}));
const t = e => ({
get: async function(r) {
const s = e + "." + r,
a = await g.get(s).then((e => e[s]));
return void 0 === a ? n[e][r] : a
},
set: async function(r, s) {
const n = e + "." + r;
await g.set({
[n]: s
});
},
remove: async function(r) {
const s = e + "." + r;
await g.remove(s);
},
subscribe: function(r) {
var s;
const n = {
callback: r,
unsubscribe: () => {
var r;
null === (r = a[e]) || void 0 === r || r.delete(n);
}
};
return null === (s = a[e]) || void 0 === s || s.add(n), g.get().then((r => {
n.callback(Object.fromEntries(Object.keys(r).filter((r => r.startsWith(e + "."))).map((e => [e.split(".")[1], r[e]]))));
})), n
}
}),
m = Object.fromEntries(Object.keys(n).map((e => [e, t(e)])));
export {
e,
m,
n,
s
};