bc-deeplib 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CREDITS.md +13 -0
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/3rd_party_types/bcmodsdk.d.ts +184 -0
- package/dist/3rd_party_types/declarations.d.ts +4 -0
- package/dist/deeplib.d.ts +538 -0
- package/dist/deeplib.js +2582 -0
- package/dist/deeplib.js.map +7 -0
- package/dist/index.js +2556 -0
- package/dist/index.js.map +7 -0
- package/dist/public/dl_images/arrow_left.svg +1 -0
- package/dist/public/dl_images/arrow_right.svg +1 -0
- package/dist/public/dl_images/bug.svg +1 -0
- package/dist/public/dl_images/clipboard_export.svg +19 -0
- package/dist/public/dl_images/clipboard_import.svg +19 -0
- package/dist/public/dl_images/cog.svg +1 -0
- package/dist/public/dl_images/exit.svg +1 -0
- package/dist/public/dl_images/file_export.svg +12 -0
- package/dist/public/dl_images/file_import.svg +12 -0
- package/dist/public/dl_images/git.svg +10 -0
- package/dist/public/dl_images/notebook.svg +1 -0
- package/dist/public/dl_images/round_arrow_left.svg +1 -0
- package/dist/public/dl_images/round_arrow_right.svg +1 -0
- package/dist/public/dl_images/round_transfer.svg +7 -0
- package/dist/public/dl_images/transfer.svg +1 -0
- package/dist/public/dl_images/trash_bin.svg +1 -0
- package/dist/public/dl_translations/en.lang +17 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vendored_types/bcmodsdk.d.ts +184 -0
- package/dist/vendored_types/declarations.d.ts +5 -0
- package/lib/build.d.ts +32 -0
- package/lib/build.js +236 -0
- package/package.json +41 -24
- package/.types/declarations.d.ts +0 -15
- package/.types/elements.d.ts +0 -38
- package/.types/type-override.d.ts +0 -3
- package/public/styles/DeepLib.css +0 -206
- package/public/styles/Gratitude.css +0 -23
package/dist/deeplib.js
ADDED
|
@@ -0,0 +1,2582 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// node_modules/.pnpm/bondage-club-mod-sdk@1.2.0/node_modules/bondage-club-mod-sdk/dist/bcmodsdk.js
|
|
29
|
+
var require_bcmodsdk = __commonJS({
|
|
30
|
+
"node_modules/.pnpm/bondage-club-mod-sdk@1.2.0/node_modules/bondage-club-mod-sdk/dist/bcmodsdk.js"(exports) {
|
|
31
|
+
var bcModSdk = function() {
|
|
32
|
+
"use strict";
|
|
33
|
+
const o = "1.2.0";
|
|
34
|
+
function e(o2) {
|
|
35
|
+
alert("Mod ERROR:\n" + o2);
|
|
36
|
+
const e2 = new Error(o2);
|
|
37
|
+
throw console.error(e2), e2;
|
|
38
|
+
}
|
|
39
|
+
__name(e, "e");
|
|
40
|
+
const t = new TextEncoder();
|
|
41
|
+
function n(o2) {
|
|
42
|
+
return !!o2 && "object" == typeof o2 && !Array.isArray(o2);
|
|
43
|
+
}
|
|
44
|
+
__name(n, "n");
|
|
45
|
+
function r(o2) {
|
|
46
|
+
const e2 = /* @__PURE__ */ new Set();
|
|
47
|
+
return o2.filter((o3) => !e2.has(o3) && e2.add(o3));
|
|
48
|
+
}
|
|
49
|
+
__name(r, "r");
|
|
50
|
+
const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
51
|
+
function c(o2) {
|
|
52
|
+
a.has(o2) || (a.add(o2), console.warn(o2));
|
|
53
|
+
}
|
|
54
|
+
__name(c, "c");
|
|
55
|
+
function s(o2) {
|
|
56
|
+
const e2 = [], t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Set();
|
|
57
|
+
for (const r3 of f.values()) {
|
|
58
|
+
const i3 = r3.patching.get(o2.name);
|
|
59
|
+
if (i3) {
|
|
60
|
+
e2.push(...i3.hooks);
|
|
61
|
+
for (const [e3, a2] of i3.patches.entries()) t2.has(e3) && t2.get(e3) !== a2 && c(`ModSDK: Mod '${r3.name}' is patching function ${o2.name} with same pattern that is already applied by different mod, but with different pattern:
|
|
62
|
+
Pattern:
|
|
63
|
+
${e3}
|
|
64
|
+
Patch1:
|
|
65
|
+
${t2.get(e3) || ""}
|
|
66
|
+
Patch2:
|
|
67
|
+
${a2}`), t2.set(e3, a2), n2.add(r3.name);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
e2.sort((o3, e3) => e3.priority - o3.priority);
|
|
71
|
+
const r2 = function(o3, e3) {
|
|
72
|
+
if (0 === e3.size) return o3;
|
|
73
|
+
let t3 = o3.toString().replaceAll("\r\n", "\n");
|
|
74
|
+
for (const [n3, r3] of e3.entries()) t3.includes(n3) || c(`ModSDK: Patching ${o3.name}: Patch ${n3} not applied`), t3 = t3.replaceAll(n3, r3);
|
|
75
|
+
return (0, eval)(`(${t3})`);
|
|
76
|
+
}(o2.original, t2);
|
|
77
|
+
let i2 = /* @__PURE__ */ __name(function(e3) {
|
|
78
|
+
var t3, i3;
|
|
79
|
+
const a2 = null === (i3 = (t3 = m.errorReporterHooks).hookChainExit) || void 0 === i3 ? void 0 : i3.call(t3, o2.name, n2), c2 = r2.apply(this, e3);
|
|
80
|
+
return null == a2 || a2(), c2;
|
|
81
|
+
}, "i");
|
|
82
|
+
for (let t3 = e2.length - 1; t3 >= 0; t3--) {
|
|
83
|
+
const n3 = e2[t3], r3 = i2;
|
|
84
|
+
i2 = /* @__PURE__ */ __name(function(e3) {
|
|
85
|
+
var t4, i3;
|
|
86
|
+
const a2 = null === (i3 = (t4 = m.errorReporterHooks).hookEnter) || void 0 === i3 ? void 0 : i3.call(t4, o2.name, n3.mod), c2 = n3.hook.apply(this, [e3, (o3) => {
|
|
87
|
+
if (1 !== arguments.length || !Array.isArray(e3)) throw new Error(`Mod ${n3.mod} failed to call next hook: Expected args to be array, got ${typeof o3}`);
|
|
88
|
+
return r3.call(this, o3);
|
|
89
|
+
}]);
|
|
90
|
+
return null == a2 || a2(), c2;
|
|
91
|
+
}, "i");
|
|
92
|
+
}
|
|
93
|
+
return { hooks: e2, patches: t2, patchesSources: n2, enter: i2, final: r2 };
|
|
94
|
+
}
|
|
95
|
+
__name(s, "s");
|
|
96
|
+
function l(o2, e2 = false) {
|
|
97
|
+
let r2 = i.get(o2);
|
|
98
|
+
if (r2) e2 && (r2.precomputed = s(r2));
|
|
99
|
+
else {
|
|
100
|
+
let e3 = window;
|
|
101
|
+
const a2 = o2.split(".");
|
|
102
|
+
for (let t2 = 0; t2 < a2.length - 1; t2++) if (e3 = e3[a2[t2]], !n(e3)) throw new Error(`ModSDK: Function ${o2} to be patched not found; ${a2.slice(0, t2 + 1).join(".")} is not object`);
|
|
103
|
+
const c2 = e3[a2[a2.length - 1]];
|
|
104
|
+
if ("function" != typeof c2) throw new Error(`ModSDK: Function ${o2} to be patched not found`);
|
|
105
|
+
const l2 = function(o3) {
|
|
106
|
+
let e4 = -1;
|
|
107
|
+
for (const n2 of t.encode(o3)) {
|
|
108
|
+
let o4 = 255 & (e4 ^ n2);
|
|
109
|
+
for (let e5 = 0; e5 < 8; e5++) o4 = 1 & o4 ? -306674912 ^ o4 >>> 1 : o4 >>> 1;
|
|
110
|
+
e4 = e4 >>> 8 ^ o4;
|
|
111
|
+
}
|
|
112
|
+
return ((-1 ^ e4) >>> 0).toString(16).padStart(8, "0").toUpperCase();
|
|
113
|
+
}(c2.toString().replaceAll("\r\n", "\n")), d2 = { name: o2, original: c2, originalHash: l2 };
|
|
114
|
+
r2 = Object.assign(Object.assign({}, d2), { precomputed: s(d2), router: /* @__PURE__ */ __name(() => {
|
|
115
|
+
}, "router"), context: e3, contextProperty: a2[a2.length - 1] }), r2.router = /* @__PURE__ */ function(o3) {
|
|
116
|
+
return function(...e4) {
|
|
117
|
+
return o3.precomputed.enter.apply(this, [e4]);
|
|
118
|
+
};
|
|
119
|
+
}(r2), i.set(o2, r2), e3[r2.contextProperty] = r2.router;
|
|
120
|
+
}
|
|
121
|
+
return r2;
|
|
122
|
+
}
|
|
123
|
+
__name(l, "l");
|
|
124
|
+
function d() {
|
|
125
|
+
for (const o2 of i.values()) o2.precomputed = s(o2);
|
|
126
|
+
}
|
|
127
|
+
__name(d, "d");
|
|
128
|
+
function p() {
|
|
129
|
+
const o2 = /* @__PURE__ */ new Map();
|
|
130
|
+
for (const [e2, t2] of i) o2.set(e2, { name: e2, original: t2.original, originalHash: t2.originalHash, sdkEntrypoint: t2.router, currentEntrypoint: t2.context[t2.contextProperty], hookedByMods: r(t2.precomputed.hooks.map((o3) => o3.mod)), patchedByMods: Array.from(t2.precomputed.patchesSources) });
|
|
131
|
+
return o2;
|
|
132
|
+
}
|
|
133
|
+
__name(p, "p");
|
|
134
|
+
const f = /* @__PURE__ */ new Map();
|
|
135
|
+
function u(o2) {
|
|
136
|
+
f.get(o2.name) !== o2 && e(`Failed to unload mod '${o2.name}': Not registered`), f.delete(o2.name), o2.loaded = false, d();
|
|
137
|
+
}
|
|
138
|
+
__name(u, "u");
|
|
139
|
+
function g(o2, t2) {
|
|
140
|
+
o2 && "object" == typeof o2 || e("Failed to register mod: Expected info object, got " + typeof o2), "string" == typeof o2.name && o2.name || e("Failed to register mod: Expected name to be non-empty string, got " + typeof o2.name);
|
|
141
|
+
let r2 = `'${o2.name}'`;
|
|
142
|
+
"string" == typeof o2.fullName && o2.fullName || e(`Failed to register mod ${r2}: Expected fullName to be non-empty string, got ${typeof o2.fullName}`), r2 = `'${o2.fullName} (${o2.name})'`, "string" != typeof o2.version && e(`Failed to register mod ${r2}: Expected version to be string, got ${typeof o2.version}`), o2.repository || (o2.repository = void 0), void 0 !== o2.repository && "string" != typeof o2.repository && e(`Failed to register mod ${r2}: Expected repository to be undefined or string, got ${typeof o2.version}`), null == t2 && (t2 = {}), t2 && "object" == typeof t2 || e(`Failed to register mod ${r2}: Expected options to be undefined or object, got ${typeof t2}`);
|
|
143
|
+
const i2 = true === t2.allowReplace, a2 = f.get(o2.name);
|
|
144
|
+
a2 && (a2.allowReplace && i2 || e(`Refusing to load mod ${r2}: it is already loaded and doesn't allow being replaced.
|
|
145
|
+
Was the mod loaded multiple times?`), u(a2));
|
|
146
|
+
const c2 = /* @__PURE__ */ __name((o3) => {
|
|
147
|
+
let e2 = g2.patching.get(o3.name);
|
|
148
|
+
return e2 || (e2 = { hooks: [], patches: /* @__PURE__ */ new Map() }, g2.patching.set(o3.name, e2)), e2;
|
|
149
|
+
}, "c"), s2 = /* @__PURE__ */ __name((o3, t3) => (...n2) => {
|
|
150
|
+
var i3, a3;
|
|
151
|
+
const c3 = null === (a3 = (i3 = m.errorReporterHooks).apiEndpointEnter) || void 0 === a3 ? void 0 : a3.call(i3, o3, g2.name);
|
|
152
|
+
g2.loaded || e(`Mod ${r2} attempted to call SDK function after being unloaded`);
|
|
153
|
+
const s3 = t3(...n2);
|
|
154
|
+
return null == c3 || c3(), s3;
|
|
155
|
+
}, "s"), p2 = { unload: s2("unload", () => u(g2)), hookFunction: s2("hookFunction", (o3, t3, n2) => {
|
|
156
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
157
|
+
const i3 = l(o3), a3 = c2(i3);
|
|
158
|
+
"number" != typeof t3 && e(`Mod ${r2} failed to hook function '${o3}': Expected priority number, got ${typeof t3}`), "function" != typeof n2 && e(`Mod ${r2} failed to hook function '${o3}': Expected hook function, got ${typeof n2}`);
|
|
159
|
+
const s3 = { mod: g2.name, priority: t3, hook: n2 };
|
|
160
|
+
return a3.hooks.push(s3), d(), () => {
|
|
161
|
+
const o4 = a3.hooks.indexOf(s3);
|
|
162
|
+
o4 >= 0 && (a3.hooks.splice(o4, 1), d());
|
|
163
|
+
};
|
|
164
|
+
}), patchFunction: s2("patchFunction", (o3, t3) => {
|
|
165
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
166
|
+
const i3 = l(o3), a3 = c2(i3);
|
|
167
|
+
n(t3) || e(`Mod ${r2} failed to patch function '${o3}': Expected patches object, got ${typeof t3}`);
|
|
168
|
+
for (const [n2, i4] of Object.entries(t3)) "string" == typeof i4 ? a3.patches.set(n2, i4) : null === i4 ? a3.patches.delete(n2) : e(`Mod ${r2} failed to patch function '${o3}': Invalid format of patch '${n2}'`);
|
|
169
|
+
d();
|
|
170
|
+
}), removePatches: s2("removePatches", (o3) => {
|
|
171
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
172
|
+
const t3 = l(o3);
|
|
173
|
+
c2(t3).patches.clear(), d();
|
|
174
|
+
}), callOriginal: s2("callOriginal", (o3, t3, n2) => {
|
|
175
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to call a function: Expected function name string, got ${typeof o3}`);
|
|
176
|
+
const i3 = l(o3);
|
|
177
|
+
return Array.isArray(t3) || e(`Mod ${r2} failed to call a function: Expected args array, got ${typeof t3}`), i3.original.apply(null != n2 ? n2 : globalThis, t3);
|
|
178
|
+
}), getOriginalHash: s2("getOriginalHash", (o3) => {
|
|
179
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to get hash: Expected function name string, got ${typeof o3}`);
|
|
180
|
+
return l(o3).originalHash;
|
|
181
|
+
}) }, g2 = { name: o2.name, fullName: o2.fullName, version: o2.version, repository: o2.repository, allowReplace: i2, api: p2, loaded: true, patching: /* @__PURE__ */ new Map() };
|
|
182
|
+
return f.set(o2.name, g2), Object.freeze(p2);
|
|
183
|
+
}
|
|
184
|
+
__name(g, "g");
|
|
185
|
+
function h() {
|
|
186
|
+
const o2 = [];
|
|
187
|
+
for (const e2 of f.values()) o2.push({ name: e2.name, fullName: e2.fullName, version: e2.version, repository: e2.repository });
|
|
188
|
+
return o2;
|
|
189
|
+
}
|
|
190
|
+
__name(h, "h");
|
|
191
|
+
let m;
|
|
192
|
+
const y = void 0 === window.bcModSdk ? window.bcModSdk = function() {
|
|
193
|
+
const e2 = { version: o, apiVersion: 1, registerMod: g, getModsInfo: h, getPatchingInfo: p, errorReporterHooks: Object.seal({ apiEndpointEnter: null, hookEnter: null, hookChainExit: null }) };
|
|
194
|
+
return m = e2, Object.freeze(e2);
|
|
195
|
+
}() : (n(window.bcModSdk) || e("Failed to init Mod SDK: Name already in use"), 1 !== window.bcModSdk.apiVersion && e(`Failed to init Mod SDK: Different version already loaded ('1.2.0' vs '${window.bcModSdk.version}')`), window.bcModSdk.version !== o && alert(`Mod SDK warning: Loading different but compatible versions ('1.2.0' vs '${window.bcModSdk.version}')
|
|
196
|
+
One of mods you are using is using an old version of SDK. It will work for now but please inform author to update`), window.bcModSdk);
|
|
197
|
+
return "undefined" != typeof exports && (Object.defineProperty(exports, "__esModule", { value: true }), exports.default = y), y;
|
|
198
|
+
}();
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// src/base/base_module.ts
|
|
203
|
+
var BaseModule = class {
|
|
204
|
+
static {
|
|
205
|
+
__name(this, "BaseModule");
|
|
206
|
+
}
|
|
207
|
+
get settingsScreen() {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
get settingsStorage() {
|
|
211
|
+
return this.constructor.name;
|
|
212
|
+
}
|
|
213
|
+
get settings() {
|
|
214
|
+
const modName = ModSdkManager.ModInfo.name;
|
|
215
|
+
if (!this.settingsStorage) return {};
|
|
216
|
+
if (!modStorage.playerStorage) {
|
|
217
|
+
Player[modName] = {};
|
|
218
|
+
this.registerDefaultSettings();
|
|
219
|
+
} else if (!modStorage.playerStorage[this.settingsStorage]) this.registerDefaultSettings();
|
|
220
|
+
return modStorage.playerStorage[this.settingsStorage];
|
|
221
|
+
}
|
|
222
|
+
set settings(value) {
|
|
223
|
+
const modName = ModSdkManager.ModInfo.name;
|
|
224
|
+
const storage = new ModStorage(modName);
|
|
225
|
+
if (!this.settingsStorage) return;
|
|
226
|
+
if (!storage.playerStorage) {
|
|
227
|
+
Player[modName] = {};
|
|
228
|
+
this.registerDefaultSettings();
|
|
229
|
+
} else if (!storage.playerStorage[this.settingsStorage]) this.registerDefaultSettings();
|
|
230
|
+
storage.playerStorage[this.settingsStorage] = value;
|
|
231
|
+
}
|
|
232
|
+
init() {
|
|
233
|
+
this.registerDefaultSettings();
|
|
234
|
+
}
|
|
235
|
+
registerDefaultSettings() {
|
|
236
|
+
const storage = this.settingsStorage;
|
|
237
|
+
const defaults = this.defaultSettings;
|
|
238
|
+
if (!storage || !defaults) return;
|
|
239
|
+
Player[ModSdkManager.ModInfo.name][storage] = Object.assign(defaults, Player[ModSdkManager.ModInfo.name][storage] ?? {});
|
|
240
|
+
}
|
|
241
|
+
get defaultSettings() {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
load() {
|
|
245
|
+
}
|
|
246
|
+
run() {
|
|
247
|
+
}
|
|
248
|
+
unload() {
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// src/base/base_subscreen.ts
|
|
253
|
+
function getCurrentSubscreen() {
|
|
254
|
+
return GUI.instance && GUI.instance.currentSubscreen;
|
|
255
|
+
}
|
|
256
|
+
__name(getCurrentSubscreen, "getCurrentSubscreen");
|
|
257
|
+
function setSubscreen(subscreen) {
|
|
258
|
+
if (!GUI.instance) {
|
|
259
|
+
throw new Error("Attempt to set subscreen before init");
|
|
260
|
+
}
|
|
261
|
+
GUI.instance.currentSubscreen = subscreen;
|
|
262
|
+
return GUI.instance.currentSubscreen;
|
|
263
|
+
}
|
|
264
|
+
__name(setSubscreen, "setSubscreen");
|
|
265
|
+
var BaseSubscreen = class _BaseSubscreen {
|
|
266
|
+
static {
|
|
267
|
+
__name(this, "BaseSubscreen");
|
|
268
|
+
}
|
|
269
|
+
static currentElements = [];
|
|
270
|
+
static currentPage = 1;
|
|
271
|
+
options;
|
|
272
|
+
module;
|
|
273
|
+
constructor(subscreenOptions, module) {
|
|
274
|
+
if (module) this.module = module;
|
|
275
|
+
this.options = subscreenOptions || {};
|
|
276
|
+
}
|
|
277
|
+
get name() {
|
|
278
|
+
return "UNKNOWN";
|
|
279
|
+
}
|
|
280
|
+
get icon() {
|
|
281
|
+
return "";
|
|
282
|
+
}
|
|
283
|
+
get subscreenName() {
|
|
284
|
+
return this.constructor.name;
|
|
285
|
+
}
|
|
286
|
+
setSubscreen(screen) {
|
|
287
|
+
return setSubscreen(screen);
|
|
288
|
+
}
|
|
289
|
+
get settings() {
|
|
290
|
+
return this.module.settings;
|
|
291
|
+
}
|
|
292
|
+
set settings(value) {
|
|
293
|
+
this.module.settings = value;
|
|
294
|
+
}
|
|
295
|
+
get pageStructure() {
|
|
296
|
+
return [[]];
|
|
297
|
+
}
|
|
298
|
+
get currentPage() {
|
|
299
|
+
return this.pageStructure[Math.min(_BaseSubscreen.currentPage - 1, this.pageStructure.length - 1)];
|
|
300
|
+
}
|
|
301
|
+
changePage(page, setLabel) {
|
|
302
|
+
const totalPages = this.pageStructure.length;
|
|
303
|
+
if (page > totalPages) page = 1;
|
|
304
|
+
if (page < 1) page = totalPages;
|
|
305
|
+
_BaseSubscreen.currentPage = page;
|
|
306
|
+
this.managePageElementsVisibility();
|
|
307
|
+
setLabel(`${_BaseSubscreen.currentPage} of ${this.pageStructure.length}`);
|
|
308
|
+
}
|
|
309
|
+
managePageElementsVisibility() {
|
|
310
|
+
this.pageStructure.forEach((item, ix) => {
|
|
311
|
+
if (ix != _BaseSubscreen.currentPage - 1) {
|
|
312
|
+
item.forEach((setting) => {
|
|
313
|
+
domUtil.hide(`${setting.id}-container`);
|
|
314
|
+
});
|
|
315
|
+
} else {
|
|
316
|
+
item.forEach((setting) => {
|
|
317
|
+
domUtil.unhide(`${setting.id}-container`);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
load() {
|
|
323
|
+
for (const module of modules()) {
|
|
324
|
+
if (!module.settingsScreen) continue;
|
|
325
|
+
if (!module.settings || !Object.keys(module.settings).length) module.registerDefaultSettings();
|
|
326
|
+
}
|
|
327
|
+
_BaseSubscreen.currentPage = 1;
|
|
328
|
+
layoutElement.createSubscreenDiv();
|
|
329
|
+
const settingsElement = layoutElement.createSettingsDiv();
|
|
330
|
+
layoutElement.appendToSubscreenDiv(settingsElement);
|
|
331
|
+
const menu = ElementMenu.Create("deeplib-nav-menu", []);
|
|
332
|
+
layoutElement.appendToSubscreenDiv(menu);
|
|
333
|
+
if (this.pageStructure.length > 1) {
|
|
334
|
+
const backNext = advancedElement.createBackNext({
|
|
335
|
+
id: "deeplib-page-back-next",
|
|
336
|
+
next: /* @__PURE__ */ __name(({ setLabel }) => this.changePage(_BaseSubscreen.currentPage + 1, setLabel), "next"),
|
|
337
|
+
initialNextTooltip: getText("settings.button.next_button_hint"),
|
|
338
|
+
back: /* @__PURE__ */ __name(({ setLabel }) => this.changePage(_BaseSubscreen.currentPage - 1, setLabel), "back"),
|
|
339
|
+
initialPrevTooltip: getText("settings.button.prev_button_hint"),
|
|
340
|
+
initialLabel: `${_BaseSubscreen.currentPage} of ${this.pageStructure.length}`
|
|
341
|
+
});
|
|
342
|
+
ElementMenu.PrependItem(menu, backNext);
|
|
343
|
+
}
|
|
344
|
+
const subscreenTitle = advancedElement.createLabel({
|
|
345
|
+
id: "deeplib-subscreen-title",
|
|
346
|
+
label: getText(`${this.name}.title`).replace("$ModVersion", ModSdkManager.ModInfo.version)
|
|
347
|
+
});
|
|
348
|
+
layoutElement.appendToSubscreenDiv(subscreenTitle);
|
|
349
|
+
if (this.name !== "mainmenu") {
|
|
350
|
+
const exitButton = advancedElement.createButton({
|
|
351
|
+
id: "deeplib-exit",
|
|
352
|
+
size: [90, 90],
|
|
353
|
+
image: `${PUBLIC_URL}/dl_images/exit.svg`,
|
|
354
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
355
|
+
this.exit();
|
|
356
|
+
}, "onClick"),
|
|
357
|
+
tooltip: getText("settings.button.back_button_hint")
|
|
358
|
+
});
|
|
359
|
+
ElementMenu.AppendButton(menu, exitButton);
|
|
360
|
+
}
|
|
361
|
+
const tooltip = advancedElement.createTooltip();
|
|
362
|
+
layoutElement.appendToSubscreenDiv(tooltip);
|
|
363
|
+
this.pageStructure.forEach(
|
|
364
|
+
(s) => s.forEach((item) => {
|
|
365
|
+
let element;
|
|
366
|
+
switch (item.type) {
|
|
367
|
+
case "text":
|
|
368
|
+
case "number":
|
|
369
|
+
case "color":
|
|
370
|
+
element = advancedElement.createInput(item);
|
|
371
|
+
break;
|
|
372
|
+
case "checkbox":
|
|
373
|
+
element = advancedElement.createCheckbox(item);
|
|
374
|
+
break;
|
|
375
|
+
case "button":
|
|
376
|
+
element = advancedElement.createButton(item);
|
|
377
|
+
break;
|
|
378
|
+
case "label":
|
|
379
|
+
element = advancedElement.createLabel(item);
|
|
380
|
+
break;
|
|
381
|
+
case "custom":
|
|
382
|
+
element = advancedElement.createCustom(item);
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
layoutElement.appendToSettingsDiv(element);
|
|
386
|
+
})
|
|
387
|
+
);
|
|
388
|
+
this.managePageElementsVisibility();
|
|
389
|
+
CharacterAppearanceForceUpCharacter = Player.MemberNumber ?? -1;
|
|
390
|
+
}
|
|
391
|
+
run() {
|
|
392
|
+
if (this.options.drawCharacter) DrawCharacter(Player, 50, 50, 0.9, false);
|
|
393
|
+
}
|
|
394
|
+
click() {
|
|
395
|
+
}
|
|
396
|
+
exit() {
|
|
397
|
+
CharacterAppearanceForceUpCharacter = -1;
|
|
398
|
+
CharacterLoadCanvas(Player);
|
|
399
|
+
setSubscreen("mainmenu");
|
|
400
|
+
modStorage.save();
|
|
401
|
+
}
|
|
402
|
+
resize(onLoad = false) {
|
|
403
|
+
const offset = this.options.drawCharacter ? 0 : 380;
|
|
404
|
+
const subscreen = layoutElement.getSubscreenDiv();
|
|
405
|
+
const settingsDiv = layoutElement.getSettingsDiv();
|
|
406
|
+
ElementSetPosition(subscreen || "", 0, 0);
|
|
407
|
+
ElementSetSize(subscreen || "", 2e3, 1e3);
|
|
408
|
+
ElementSetFontSize(subscreen || "", "auto");
|
|
409
|
+
if (this.name === "mainmenu") {
|
|
410
|
+
ElementSetPosition(settingsDiv || "", 530 - offset, 170);
|
|
411
|
+
ElementSetSize(settingsDiv || "", 600 + offset, 660);
|
|
412
|
+
} else {
|
|
413
|
+
ElementSetPosition(settingsDiv || "", 530 - offset, 170);
|
|
414
|
+
ElementSetSize(settingsDiv || "", 1e3 + offset, 660);
|
|
415
|
+
}
|
|
416
|
+
ElementSetPosition("deeplib-subscreen-title", 530 - offset, 75);
|
|
417
|
+
ElementSetSize("deeplib-subscreen-title", 800, 60);
|
|
418
|
+
ElementSetPosition("deeplib-nav-menu", 1905, 75, "top-right");
|
|
419
|
+
ElementSetSize("deeplib-nav-menu", null, 90);
|
|
420
|
+
ElementSetPosition(advancedElement.getTooltip() || "", 250, 850);
|
|
421
|
+
ElementSetSize(advancedElement.getTooltip() || "", 1500, 70);
|
|
422
|
+
_BaseSubscreen.currentElements.forEach((item) => {
|
|
423
|
+
const options = item[1];
|
|
424
|
+
domUtil.autoSetPosition(options.id, options.position);
|
|
425
|
+
domUtil.autoSetSize(options.id, options.size);
|
|
426
|
+
});
|
|
427
|
+
if (settingsDiv) {
|
|
428
|
+
if (domUtil.hasOverflow(settingsDiv)?.vertical) {
|
|
429
|
+
settingsDiv.classList.add("deeplib-overflow-box");
|
|
430
|
+
} else {
|
|
431
|
+
settingsDiv.classList.remove("deeplib-overflow-box");
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
unload() {
|
|
436
|
+
_BaseSubscreen.currentElements = [];
|
|
437
|
+
layoutElement.removeSubscreenDiv();
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// src/styles/index.scss
|
|
442
|
+
var styles_default = `.deeplib-subscreen,
|
|
443
|
+
.deeplib-modal {
|
|
444
|
+
--deeplib-background-color: var(--tmd-main, white);
|
|
445
|
+
--deeplib-element-color: var(--tmd-element, white);
|
|
446
|
+
--deeplib-element-hover-color: var(--tmd-element-hover, cyan);
|
|
447
|
+
--deeplib-blocked-color: var(--tmd-blocked, red);
|
|
448
|
+
--deeplib-text-color: var(--tmd-text, black);
|
|
449
|
+
--deeplib-icon-color: var(--tmd-accent, white);
|
|
450
|
+
--deeplib-icon-hover-color: var(--tmd-accent-hover, cyan);
|
|
451
|
+
--deeplib-border-color: var(--tmd-accent, black);
|
|
452
|
+
--deeplib-border-width: min(0.2vh, 0.1vw);
|
|
453
|
+
--deeplib-border-width: min(0.2dvh, 0.1dvw);
|
|
454
|
+
--deeplib-border-radius: min(1vh, 0.5vw);
|
|
455
|
+
--deeplib-border-radius: min(1dvh, 0.5dvw);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.deeplib-button {
|
|
459
|
+
color: var(--deeplib-text-color);
|
|
460
|
+
width: 100%;
|
|
461
|
+
height: 100%;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.deeplib-button.button-styling,
|
|
465
|
+
.deeplib-button.button-styling::before {
|
|
466
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.deeplib-button img {
|
|
470
|
+
position: absolute;
|
|
471
|
+
top: 0%;
|
|
472
|
+
left: 0%;
|
|
473
|
+
width: 100%;
|
|
474
|
+
height: 100%;
|
|
475
|
+
background-position: left;
|
|
476
|
+
background-color: var(--deeplib-icon-color);
|
|
477
|
+
background-blend-mode: multiply;
|
|
478
|
+
background-size: contain;
|
|
479
|
+
mask-position: left;
|
|
480
|
+
mask-size: contain;
|
|
481
|
+
background-repeat: no-repeat;
|
|
482
|
+
mask-repeat: no-repeat;
|
|
483
|
+
color: transparent;
|
|
484
|
+
background-image: var(--image);
|
|
485
|
+
mask-image: var(--image);
|
|
486
|
+
pointer-events: none;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.deeplib-button:hover img {
|
|
490
|
+
background-color: var(--deeplib-icon-hover-color);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.deeplib-button .button-label {
|
|
494
|
+
background-color: transparent !important;
|
|
495
|
+
color: var(--deeplib-text-color);
|
|
496
|
+
font-size: min(3.6dvh, 1.8dvw);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.deeplib-button .button-tooltip {
|
|
500
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
#deeplib-page-label {
|
|
504
|
+
display: flex;
|
|
505
|
+
align-items: center;
|
|
506
|
+
justify-content: center;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
#deeplib-subscreen-title {
|
|
510
|
+
text-align: left;
|
|
511
|
+
color: var(--deeplib-text-color);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.deeplib-text {
|
|
515
|
+
color: var(--deeplib-text-color);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.deeplib-subscreen {
|
|
519
|
+
padding: 0;
|
|
520
|
+
margin: 0;
|
|
521
|
+
pointer-events: none;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.deeplib-subscreen * {
|
|
525
|
+
box-sizing: border-box;
|
|
526
|
+
pointer-events: all;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.deeplib-settings {
|
|
530
|
+
display: grid;
|
|
531
|
+
grid-auto-rows: min-content;
|
|
532
|
+
padding: min(1dvh, 0.5dvw);
|
|
533
|
+
gap: 0.3em;
|
|
534
|
+
overflow-y: scroll;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.deeplib-misc {
|
|
538
|
+
display: flex;
|
|
539
|
+
align-items: center;
|
|
540
|
+
flex-direction: column-reverse;
|
|
541
|
+
gap: min(1vh, 0.5vw);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.deeplib-tooltip {
|
|
545
|
+
background-color: var(--deeplib-element-color);
|
|
546
|
+
color: var(--deeplib-text-color);
|
|
547
|
+
display: flex;
|
|
548
|
+
align-items: center;
|
|
549
|
+
justify-content: center;
|
|
550
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
551
|
+
padding: min(1vh, 0.5vw);
|
|
552
|
+
font-size: 0.8em;
|
|
553
|
+
border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.deeplib-overflow-box {
|
|
557
|
+
border: var(--deeplib-border-color) solid var(--deeplib-border-width);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.deeplib-prev-next {
|
|
561
|
+
display: flex;
|
|
562
|
+
align-items: center;
|
|
563
|
+
justify-content: space-between;
|
|
564
|
+
flex-direction: row;
|
|
565
|
+
gap: min(2dvh, 1dvw);
|
|
566
|
+
background-color: var(--deeplib-element-color);
|
|
567
|
+
color: var(--deeplib-text-color);
|
|
568
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
569
|
+
border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);
|
|
570
|
+
}
|
|
571
|
+
.deeplib-prev-next .deeplib-prev-next-button {
|
|
572
|
+
height: 100%;
|
|
573
|
+
aspect-ratio: 1;
|
|
574
|
+
}
|
|
575
|
+
.deeplib-prev-next .deeplib-prev-next-button:hover {
|
|
576
|
+
background-color: var(--deeplib-element-hover-color);
|
|
577
|
+
border-radius: var(--deeplib-border-radius);
|
|
578
|
+
}
|
|
579
|
+
.deeplib-prev-next .deeplib-prev-next-label {
|
|
580
|
+
white-space: nowrap;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
#deeplib-nav-menu {
|
|
584
|
+
display: flex;
|
|
585
|
+
flex-direction: row;
|
|
586
|
+
gap: min(2dvh, 1dvw);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.deeplib-checkbox-container {
|
|
590
|
+
display: flex;
|
|
591
|
+
flex-direction: row;
|
|
592
|
+
align-items: center;
|
|
593
|
+
gap: 0.3em;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.deeplib-checkbox-container input.deeplib-input {
|
|
597
|
+
width: min(5vh, 2.5vw);
|
|
598
|
+
height: min(5vh, 2.5vw);
|
|
599
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.deeplib-checkbox-container input.deeplib-input[type=checkbox]:checked::before {
|
|
603
|
+
width: 80%;
|
|
604
|
+
height: 80%;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.deeplib-input-container {
|
|
608
|
+
display: flex;
|
|
609
|
+
flex-direction: row;
|
|
610
|
+
align-items: center;
|
|
611
|
+
gap: 0.3em;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.deeplib-input-container:has(label.deeplib-text) {
|
|
615
|
+
margin-top: min(1vh, 0.5vw);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.deeplib-input-container input.deeplib-input {
|
|
619
|
+
font-size: 0.6em;
|
|
620
|
+
padding: 5px 0;
|
|
621
|
+
background-color: transparent;
|
|
622
|
+
outline: none;
|
|
623
|
+
padding-left: min(1vh, 0.5vw);
|
|
624
|
+
padding-right: min(1vh, 0.5vw);
|
|
625
|
+
min-height: min(5dvh, 2.5dvw);
|
|
626
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.deeplib-input-container input.deeplib-input[type=color] {
|
|
630
|
+
padding: 0px;
|
|
631
|
+
width: min(5vh, 2.5vw);
|
|
632
|
+
height: min(5vh, 2.5vw);
|
|
633
|
+
border-radius: 0px;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.deeplib-input-container input.deeplib-input[type=color]:disabled {
|
|
637
|
+
border: var(--deeplib-blocked-color) solid var(--deeplib-border-width);
|
|
638
|
+
cursor: not-allowed;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
input::-webkit-outer-spin-button,
|
|
642
|
+
input::-webkit-inner-spin-button {
|
|
643
|
+
-webkit-appearance: none;
|
|
644
|
+
margin: 0;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
input[type=number] {
|
|
648
|
+
appearance: textfield;
|
|
649
|
+
-moz-appearance: textfield;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.deeplib-highlight-text {
|
|
653
|
+
font-weight: bold;
|
|
654
|
+
color: rgb(203, 185, 23);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
#TextAreaChatLog[data-colortheme=dark] div.ChatMessage.deeplib-message,
|
|
658
|
+
#TextAreaChatLog[data-colortheme=dark2] div.ChatMessage.deeplib-message {
|
|
659
|
+
background-color: var(--deeplib-element-color);
|
|
660
|
+
border: min(0.2dvh, 0.1dvw) solid var(--deeplib-border-color);
|
|
661
|
+
color: var(--deeplib-text-color);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
#TextAreaChatLog div.ChatMessage.deeplib-message {
|
|
665
|
+
background-color: #eee;
|
|
666
|
+
border: min(0.2dvh, 0.1dvw) solid #440171;
|
|
667
|
+
color: #111;
|
|
668
|
+
padding-left: min(0.6dvh, 0.3dvw);
|
|
669
|
+
display: block;
|
|
670
|
+
white-space: normal;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
#TextAreaChatLog[data-colortheme=dark] div.ChatMessage.deeplib-message a,
|
|
674
|
+
#TextAreaChatLog[data-colortheme=dark2] div.ChatMessage.deeplib-message a {
|
|
675
|
+
color: var(--deeplib-text-color);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
#TextAreaChatLog div.ChatMessage.deeplib-message a {
|
|
679
|
+
cursor: pointer;
|
|
680
|
+
font-weight: bold;
|
|
681
|
+
color: #111;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.deeplib-modal {
|
|
685
|
+
position: fixed;
|
|
686
|
+
top: 10%;
|
|
687
|
+
left: 50%;
|
|
688
|
+
transform: translateX(-50%);
|
|
689
|
+
z-index: 1001;
|
|
690
|
+
display: flex;
|
|
691
|
+
flex-direction: column;
|
|
692
|
+
justify-content: center;
|
|
693
|
+
align-items: center;
|
|
694
|
+
gap: 0.5em;
|
|
695
|
+
width: max(50dvw, 25dvh);
|
|
696
|
+
font-size: min(4dvh, 2dvw);
|
|
697
|
+
padding: min(2dvh, 1dvw);
|
|
698
|
+
background-color: var(--deeplib-element-color);
|
|
699
|
+
border-radius: min(1.2dvh, 0.6dvw);
|
|
700
|
+
border: min(0.2dvh, 0.1dvw) solid var(--deeplib-border-color);
|
|
701
|
+
color: var(--deeplib-text-color);
|
|
702
|
+
}
|
|
703
|
+
.deeplib-modal .deeplib-modal-input {
|
|
704
|
+
width: 100%;
|
|
705
|
+
font-size: min(2.6dvh, 1.8dvw);
|
|
706
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
707
|
+
padding: min(1dvh, 0.5dvw);
|
|
708
|
+
}
|
|
709
|
+
.deeplib-modal input.deeplib-modal-input {
|
|
710
|
+
max-width: max(50dvh, 25dvw);
|
|
711
|
+
}
|
|
712
|
+
.deeplib-modal .deeplib-modal-button-container {
|
|
713
|
+
display: flex;
|
|
714
|
+
flex-direction: row;
|
|
715
|
+
justify-content: flex-end;
|
|
716
|
+
gap: 0.5em;
|
|
717
|
+
width: 100%;
|
|
718
|
+
}
|
|
719
|
+
.deeplib-modal .deeplib-modal-button-container .deeplib-button {
|
|
720
|
+
font-size: 0.8em;
|
|
721
|
+
display: flex;
|
|
722
|
+
width: auto;
|
|
723
|
+
padding: min(0.4vh, 0.2vw) min(2vh, 1vw);
|
|
724
|
+
}
|
|
725
|
+
.deeplib-modal .deeplib-modal-button-container .deeplib-button .button-label {
|
|
726
|
+
display: contents;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.deeplib-modal-blocker {
|
|
730
|
+
z-index: 1000;
|
|
731
|
+
position: fixed;
|
|
732
|
+
top: 0;
|
|
733
|
+
left: 0;
|
|
734
|
+
width: 100dvw;
|
|
735
|
+
height: 100dvh;
|
|
736
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
737
|
+
}
|
|
738
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiL21lZGlhL0Rlby9OVk1FL1N0dWZmL0NvZGUvQkMvQkMtRGVlcExpYi9zcmMvc3R5bGVzIiwic291cmNlcyI6WyJ2YXJzLnNjc3MiLCJidXR0b25zLnNjc3MiLCJlbGVtZW50cy5zY3NzIiwiaW5wdXRzLnNjc3MiLCJtZXNzYWdlcy5zY3NzIiwibW9kYWwuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoi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0dG9uIHtcbiAgICAgIGZvbnQtc2l6ZTogMC44ZW07XG4gICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgd2lkdGg6IGF1dG87XG4gICAgICBwYWRkaW5nOiBtaW4oMC40dmgsIDAuMnZ3KSBtaW4oMnZoLCAxdncpO1xuXG4gICAgICAuYnV0dG9uLWxhYmVsIHtcbiAgICAgICAgZGlzcGxheTogY29udGVudHM7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi5kZWVwbGliLW1vZGFsLWJsb2NrZXIge1xuICB6LWluZGV4OiAxMDAwO1xuICBwb3NpdGlvbjogZml4ZWQ7XG4gIHRvcDogMDtcbiAgbGVmdDogMDtcbiAgd2lkdGg6IDEwMGR2dztcbiAgaGVpZ2h0OiAxMDBkdmg7XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMCwgMCwgMCwgMC41KTtcbn1cbiJdfQ== */`;
|
|
739
|
+
|
|
740
|
+
// src/base/initialization.ts
|
|
741
|
+
var modStorage;
|
|
742
|
+
function initMod(options) {
|
|
743
|
+
const sdk = new ModSdkManager(options.modInfo.info, options.modInfo.options);
|
|
744
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
745
|
+
modStorage = new ModStorage(ModSdkManager.ModInfo.name);
|
|
746
|
+
Style.injectInline("deeplib-style", styles_default);
|
|
747
|
+
deepLibLogger.debug(`Init wait for ${MOD_NAME}`);
|
|
748
|
+
if (CurrentScreen == null || CurrentScreen === "Login") {
|
|
749
|
+
options.beforeLogin?.();
|
|
750
|
+
const removeHook = sdk.hookFunction("LoginResponse", 0, (args, next) => {
|
|
751
|
+
deepLibLogger.debug(`Init for ${MOD_NAME}! LoginResponse caught: `, args);
|
|
752
|
+
next(args);
|
|
753
|
+
const response = args[0];
|
|
754
|
+
if (response === "InvalidNamePassword") return next(args);
|
|
755
|
+
if (response && typeof response.Name === "string" && typeof response.AccountName === "string") {
|
|
756
|
+
init(options);
|
|
757
|
+
removeHook();
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
} else {
|
|
761
|
+
deepLibLogger.debug(`Already logged in, initing ${MOD_NAME}`);
|
|
762
|
+
init(options);
|
|
763
|
+
}
|
|
764
|
+
return { sdk };
|
|
765
|
+
}
|
|
766
|
+
__name(initMod, "initMod");
|
|
767
|
+
async function init(options) {
|
|
768
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
769
|
+
const MOD_VERSION = ModSdkManager.ModInfo.version;
|
|
770
|
+
if (window[MOD_NAME + "Loaded"]) return;
|
|
771
|
+
modStorage.load();
|
|
772
|
+
if (options.pathToTranslationsFolder) {
|
|
773
|
+
await Localization.init({
|
|
774
|
+
pathToTranslationsFolder: options.pathToTranslationsFolder
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
if (options.modules && !initModules(options.modules)) {
|
|
778
|
+
unloadMod();
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (options.migrators) {
|
|
782
|
+
for (const m of options.migrators) {
|
|
783
|
+
VersionModule.registerMigrator(m);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
await options.initFunction?.();
|
|
787
|
+
if (options.mainMenuOptions)
|
|
788
|
+
MainMenu.setOptions(options.mainMenuOptions);
|
|
789
|
+
VersionModule.checkVersionUpdate();
|
|
790
|
+
for (const m of modules()) {
|
|
791
|
+
if (m.defaultSettings && hasGetter(m, "defaultSettings") && m.settings && hasSetter(m, "settings")) {
|
|
792
|
+
if (Object.entries(m.defaultSettings).length === 0) continue;
|
|
793
|
+
m.settings = deepMergeMatchingProperties(m.defaultSettings, m.settings);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
window[MOD_NAME + "Loaded"] = true;
|
|
797
|
+
deepLibLogger.log(`Loaded ${MOD_NAME}! Version: ${MOD_VERSION}`);
|
|
798
|
+
}
|
|
799
|
+
__name(init, "init");
|
|
800
|
+
function initModules(modulesToRegister) {
|
|
801
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
802
|
+
for (const module of modulesToRegister) {
|
|
803
|
+
registerModule(module);
|
|
804
|
+
}
|
|
805
|
+
for (const module of modules()) {
|
|
806
|
+
module.init();
|
|
807
|
+
}
|
|
808
|
+
for (const module of modules()) {
|
|
809
|
+
module.load();
|
|
810
|
+
}
|
|
811
|
+
for (const module of modules()) {
|
|
812
|
+
module.run();
|
|
813
|
+
}
|
|
814
|
+
deepLibLogger.debug(`Modules Loaded for ${MOD_NAME}.`);
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
__name(initModules, "initModules");
|
|
818
|
+
function unloadMod() {
|
|
819
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
820
|
+
unloadModules();
|
|
821
|
+
delete window[MOD_NAME + "Loaded"];
|
|
822
|
+
deepLibLogger.debug(`Unloaded ${MOD_NAME}.`);
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
__name(unloadMod, "unloadMod");
|
|
826
|
+
function unloadModules() {
|
|
827
|
+
for (const module of modules()) {
|
|
828
|
+
module.unload();
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
__name(unloadModules, "unloadModules");
|
|
832
|
+
|
|
833
|
+
// src/base/modules.ts
|
|
834
|
+
var modulesMap = /* @__PURE__ */ new Map();
|
|
835
|
+
function modules() {
|
|
836
|
+
return [...modulesMap.values()];
|
|
837
|
+
}
|
|
838
|
+
__name(modules, "modules");
|
|
839
|
+
function registerModule(module) {
|
|
840
|
+
modulesMap.set(module.constructor.name, module);
|
|
841
|
+
return module;
|
|
842
|
+
}
|
|
843
|
+
__name(registerModule, "registerModule");
|
|
844
|
+
function getModule(moduleType) {
|
|
845
|
+
return modulesMap.get(moduleType);
|
|
846
|
+
}
|
|
847
|
+
__name(getModule, "getModule");
|
|
848
|
+
|
|
849
|
+
// src/migrators/base_migrator.ts
|
|
850
|
+
var BaseMigrator2 = class {
|
|
851
|
+
static {
|
|
852
|
+
__name(this, "BaseMigrator");
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
// src/modules/gui.ts
|
|
857
|
+
var GUI = class _GUI extends BaseModule {
|
|
858
|
+
static {
|
|
859
|
+
__name(this, "GUI");
|
|
860
|
+
}
|
|
861
|
+
static instance = null;
|
|
862
|
+
_subscreens;
|
|
863
|
+
_mainMenu;
|
|
864
|
+
_currentSubscreen = null;
|
|
865
|
+
_modButtonOptions;
|
|
866
|
+
get subscreens() {
|
|
867
|
+
return this._subscreens;
|
|
868
|
+
}
|
|
869
|
+
get mainMenu() {
|
|
870
|
+
return this._mainMenu;
|
|
871
|
+
}
|
|
872
|
+
get currentSubscreen() {
|
|
873
|
+
return this._currentSubscreen;
|
|
874
|
+
}
|
|
875
|
+
set currentSubscreen(subscreen) {
|
|
876
|
+
if (this._currentSubscreen) {
|
|
877
|
+
this._currentSubscreen.unload();
|
|
878
|
+
}
|
|
879
|
+
if (typeof subscreen === "string") {
|
|
880
|
+
const scr = this._subscreens?.find((s) => s.name === subscreen);
|
|
881
|
+
if (!scr) throw `Failed to find screen name ${subscreen}`;
|
|
882
|
+
this._currentSubscreen = scr;
|
|
883
|
+
} else {
|
|
884
|
+
this._currentSubscreen = subscreen;
|
|
885
|
+
}
|
|
886
|
+
PreferenceMessage = "";
|
|
887
|
+
PreferencePageCurrent = 1;
|
|
888
|
+
if (this._currentSubscreen) {
|
|
889
|
+
this._currentSubscreen.load();
|
|
890
|
+
this._currentSubscreen.resize(true);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
constructor(modButtonOptions) {
|
|
894
|
+
super();
|
|
895
|
+
if (_GUI.instance) {
|
|
896
|
+
throw new Error("Duplicate initialization");
|
|
897
|
+
}
|
|
898
|
+
for (const module of modules()) {
|
|
899
|
+
if (!module.settingsScreen) continue;
|
|
900
|
+
}
|
|
901
|
+
this._mainMenu = new MainMenu(this);
|
|
902
|
+
this._subscreens = [this._mainMenu];
|
|
903
|
+
this._modButtonOptions = modButtonOptions;
|
|
904
|
+
_GUI.instance = this;
|
|
905
|
+
}
|
|
906
|
+
get defaultSettings() {
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
load() {
|
|
910
|
+
for (const module of modules()) {
|
|
911
|
+
if (!module.settingsScreen) continue;
|
|
912
|
+
this._subscreens.push(new module.settingsScreen({}, module));
|
|
913
|
+
}
|
|
914
|
+
this._mainMenu.subscreens = this._subscreens;
|
|
915
|
+
PreferenceRegisterExtensionSetting({
|
|
916
|
+
Identifier: this._modButtonOptions.Identifier,
|
|
917
|
+
ButtonText: this._modButtonOptions.ButtonText,
|
|
918
|
+
Image: this._modButtonOptions.Image,
|
|
919
|
+
load: this._modButtonOptions.load || (() => {
|
|
920
|
+
setSubscreen(new MainMenu(this));
|
|
921
|
+
}),
|
|
922
|
+
run: this._modButtonOptions.run || (() => {
|
|
923
|
+
if (this._currentSubscreen) {
|
|
924
|
+
MainCanvas.textAlign = "left";
|
|
925
|
+
this._currentSubscreen.run();
|
|
926
|
+
MainCanvas.textAlign = "center";
|
|
927
|
+
const newCanvasPosition = [MainCanvas.canvas.offsetLeft, MainCanvas.canvas.offsetTop, MainCanvas.canvas.clientWidth, MainCanvas.canvas.clientHeight];
|
|
928
|
+
if (!CommonArraysEqual(newCanvasPosition, DrawCanvasPosition)) {
|
|
929
|
+
DrawCanvasPosition = newCanvasPosition;
|
|
930
|
+
this._currentSubscreen.resize(false);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}),
|
|
934
|
+
click: this._modButtonOptions.click || (() => {
|
|
935
|
+
if (this._currentSubscreen) {
|
|
936
|
+
this._currentSubscreen.click();
|
|
937
|
+
}
|
|
938
|
+
}),
|
|
939
|
+
exit: this._modButtonOptions.exit || (() => {
|
|
940
|
+
if (this._currentSubscreen) {
|
|
941
|
+
this._currentSubscreen.exit();
|
|
942
|
+
}
|
|
943
|
+
}),
|
|
944
|
+
unload: this._modButtonOptions.unload || (() => {
|
|
945
|
+
if (this._currentSubscreen) {
|
|
946
|
+
this._currentSubscreen.unload();
|
|
947
|
+
}
|
|
948
|
+
})
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// src/modules/version.ts
|
|
954
|
+
var VersionModule = class _VersionModule extends BaseModule {
|
|
955
|
+
static {
|
|
956
|
+
__name(this, "VersionModule");
|
|
957
|
+
}
|
|
958
|
+
static isItNewVersion = false;
|
|
959
|
+
static Version;
|
|
960
|
+
static NewVersionMessage = "";
|
|
961
|
+
static Migrators = [];
|
|
962
|
+
load() {
|
|
963
|
+
_VersionModule.Version = ModSdkManager.ModInfo.version;
|
|
964
|
+
ModSdkManager.prototype.hookFunction(
|
|
965
|
+
"ChatRoomSync",
|
|
966
|
+
HookPriority.Observe,
|
|
967
|
+
(args, next) => {
|
|
968
|
+
next(args);
|
|
969
|
+
if (modStorage.playerStorage.GlobalModule.doShowNewVersionMessage && _VersionModule.isItNewVersion) {
|
|
970
|
+
_VersionModule.sendNewVersionMessage();
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
"VersionModule"
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
static checkVersionUpdate() {
|
|
977
|
+
const PreviousVersion = _VersionModule.loadVersion();
|
|
978
|
+
const CurrentVersion = _VersionModule.Version;
|
|
979
|
+
if (_VersionModule.isNewVersion(PreviousVersion, CurrentVersion)) {
|
|
980
|
+
_VersionModule.isItNewVersion = true;
|
|
981
|
+
_VersionModule.checkVersionMigration();
|
|
982
|
+
_VersionModule.saveVersion();
|
|
983
|
+
}
|
|
984
|
+
modStorage.save();
|
|
985
|
+
}
|
|
986
|
+
static checkVersionMigration() {
|
|
987
|
+
const PreviousVersion = _VersionModule.loadVersion();
|
|
988
|
+
for (const migrator of _VersionModule.Migrators) {
|
|
989
|
+
if (_VersionModule.isNewVersion(PreviousVersion, migrator.MigrationVersion)) {
|
|
990
|
+
migrator.Migrate();
|
|
991
|
+
deepLibLogger.info(`Migrating ${ModSdkManager.ModInfo.name} from ${PreviousVersion} to ${migrator.MigrationVersion} with ${migrator.constructor.name}`);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
static registerMigrator(migrator) {
|
|
996
|
+
_VersionModule.Migrators.push(migrator);
|
|
997
|
+
_VersionModule.Migrators.sort((a, b) => a.MigrationVersion.localeCompare(b.MigrationVersion));
|
|
998
|
+
}
|
|
999
|
+
static setNewVersionMessage(newVersionMessage) {
|
|
1000
|
+
_VersionModule.NewVersionMessage = newVersionMessage;
|
|
1001
|
+
}
|
|
1002
|
+
static sendNewVersionMessage() {
|
|
1003
|
+
sendLocalMessage("deeplib-new-version", _VersionModule.NewVersionMessage);
|
|
1004
|
+
}
|
|
1005
|
+
static isNewVersion(current, candidate) {
|
|
1006
|
+
if (current !== void 0) {
|
|
1007
|
+
const CURRENT_ = current.split("."), CANDIDATE_ = candidate.split(".");
|
|
1008
|
+
for (let i = 0; i < 3; i++) {
|
|
1009
|
+
if (CURRENT_[i] === CANDIDATE_[i]) {
|
|
1010
|
+
continue;
|
|
1011
|
+
}
|
|
1012
|
+
return CANDIDATE_[i] > CURRENT_[i];
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if (current === void 0 || current === "" || !current) {
|
|
1016
|
+
return true;
|
|
1017
|
+
}
|
|
1018
|
+
return false;
|
|
1019
|
+
}
|
|
1020
|
+
static saveVersion() {
|
|
1021
|
+
if (modStorage.playerStorage) {
|
|
1022
|
+
Player[ModSdkManager.ModInfo.name].Version = _VersionModule.Version;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
static loadVersion() {
|
|
1026
|
+
return modStorage.playerStorage?.Version;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// src/screens/debug.ts
|
|
1031
|
+
var GuiDebug = class extends BaseSubscreen {
|
|
1032
|
+
static {
|
|
1033
|
+
__name(this, "GuiDebug");
|
|
1034
|
+
}
|
|
1035
|
+
get name() {
|
|
1036
|
+
return "debug";
|
|
1037
|
+
}
|
|
1038
|
+
get pageStructure() {
|
|
1039
|
+
return [
|
|
1040
|
+
[
|
|
1041
|
+
{
|
|
1042
|
+
type: "button",
|
|
1043
|
+
id: "test-deeplib-big-button",
|
|
1044
|
+
size: [405, 80],
|
|
1045
|
+
label: "Big Button",
|
|
1046
|
+
tooltip: "This is a big button",
|
|
1047
|
+
image: "Icons/Exit.png",
|
|
1048
|
+
onClick() {
|
|
1049
|
+
deepLibLogger.info("Big Button Clicked");
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
type: "button",
|
|
1054
|
+
id: "test-deeplib-small-button",
|
|
1055
|
+
size: [90, 90],
|
|
1056
|
+
tooltip: "This is a small button",
|
|
1057
|
+
image: "Icons/Exit.png",
|
|
1058
|
+
onClick() {
|
|
1059
|
+
deepLibLogger.info("Small Button Clicked");
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
type: "checkbox",
|
|
1064
|
+
id: "test-deeplib-checkbox",
|
|
1065
|
+
label: "Checkbox",
|
|
1066
|
+
description: "This is a checkbox",
|
|
1067
|
+
setElementValue() {
|
|
1068
|
+
return true;
|
|
1069
|
+
},
|
|
1070
|
+
setSettingValue(val) {
|
|
1071
|
+
deepLibLogger.info("Checkbox value:", val);
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
type: "text",
|
|
1076
|
+
id: "test-deeplib-text-input",
|
|
1077
|
+
label: "Input",
|
|
1078
|
+
description: "This is a text input",
|
|
1079
|
+
setElementValue() {
|
|
1080
|
+
return "Input Value";
|
|
1081
|
+
},
|
|
1082
|
+
setSettingValue(val) {
|
|
1083
|
+
deepLibLogger.info("Input value:", val);
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
type: "number",
|
|
1088
|
+
id: "test-deeplib-number-input",
|
|
1089
|
+
label: "Input",
|
|
1090
|
+
description: "This is a number input",
|
|
1091
|
+
setElementValue() {
|
|
1092
|
+
return "123";
|
|
1093
|
+
},
|
|
1094
|
+
setSettingValue(val) {
|
|
1095
|
+
deepLibLogger.info("Input value:", val);
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
type: "label",
|
|
1100
|
+
id: "test-deeplib-label",
|
|
1101
|
+
label: "Label",
|
|
1102
|
+
description: "This is a label"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
[
|
|
1106
|
+
{
|
|
1107
|
+
type: "button",
|
|
1108
|
+
id: "test-deeplib-big-button2",
|
|
1109
|
+
size: [405, 80],
|
|
1110
|
+
label: "Big Button",
|
|
1111
|
+
tooltip: "This is a big button",
|
|
1112
|
+
image: "Icons/Prev.png",
|
|
1113
|
+
onClick() {
|
|
1114
|
+
deepLibLogger.info("Big Button Clicked");
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
type: "button",
|
|
1119
|
+
id: "test-deeplib-small-button2",
|
|
1120
|
+
size: [90, 90],
|
|
1121
|
+
tooltip: "This is a small button",
|
|
1122
|
+
image: "Icons/Next.png",
|
|
1123
|
+
onClick() {
|
|
1124
|
+
deepLibLogger.info("Small Button Clicked");
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
type: "checkbox",
|
|
1129
|
+
id: "test-deeplib-checkbox2",
|
|
1130
|
+
label: "Checkbox",
|
|
1131
|
+
description: "This is a checkbox",
|
|
1132
|
+
setElementValue() {
|
|
1133
|
+
return true;
|
|
1134
|
+
},
|
|
1135
|
+
setSettingValue(val) {
|
|
1136
|
+
deepLibLogger.info("Checkbox value:", val);
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
type: "text",
|
|
1141
|
+
id: "test-deeplib-text-input2",
|
|
1142
|
+
label: "Input",
|
|
1143
|
+
description: "This is a text input",
|
|
1144
|
+
setElementValue() {
|
|
1145
|
+
return "Input Value";
|
|
1146
|
+
},
|
|
1147
|
+
setSettingValue(val) {
|
|
1148
|
+
deepLibLogger.info("Input value:", val);
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
type: "number",
|
|
1153
|
+
id: "test-deeplib-number-input2",
|
|
1154
|
+
label: "Input",
|
|
1155
|
+
description: "This is a number input",
|
|
1156
|
+
setElementValue() {
|
|
1157
|
+
return "123";
|
|
1158
|
+
},
|
|
1159
|
+
setSettingValue(val) {
|
|
1160
|
+
deepLibLogger.info("Input value:", val);
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
type: "label",
|
|
1165
|
+
id: "test-deeplib-label2",
|
|
1166
|
+
label: "Label",
|
|
1167
|
+
description: "This is a label"
|
|
1168
|
+
}
|
|
1169
|
+
]
|
|
1170
|
+
];
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
// src/utilities/common.ts
|
|
1175
|
+
function deepMerge(target, source) {
|
|
1176
|
+
if (target === void 0) return source;
|
|
1177
|
+
if (source === void 0) return target;
|
|
1178
|
+
if (typeof target !== "object" || typeof source !== "object") {
|
|
1179
|
+
return source;
|
|
1180
|
+
}
|
|
1181
|
+
for (const key of Object.keys(source)) {
|
|
1182
|
+
if (Array.isArray(source[key]) && Array.isArray(target[key])) {
|
|
1183
|
+
target[key] = [...target[key], ...source[key]];
|
|
1184
|
+
} else if (typeof source[key] === "object" && source[key] !== null) {
|
|
1185
|
+
target[key] = deepMerge(target[key] || {}, source[key]);
|
|
1186
|
+
} else {
|
|
1187
|
+
target[key] = source[key];
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return target;
|
|
1191
|
+
}
|
|
1192
|
+
__name(deepMerge, "deepMerge");
|
|
1193
|
+
function shuffleArray(array) {
|
|
1194
|
+
const temp = JSON.parse(JSON.stringify(array));
|
|
1195
|
+
const ret = [];
|
|
1196
|
+
while (temp.length > 0) {
|
|
1197
|
+
const d = Math.floor(Math.random() * temp.length);
|
|
1198
|
+
ret.push(temp[d]);
|
|
1199
|
+
temp.splice(d, 1);
|
|
1200
|
+
}
|
|
1201
|
+
return ret;
|
|
1202
|
+
}
|
|
1203
|
+
__name(shuffleArray, "shuffleArray");
|
|
1204
|
+
function exportToGlobal(name, value) {
|
|
1205
|
+
const keys = name.split(".");
|
|
1206
|
+
let current = globalThis;
|
|
1207
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1208
|
+
if (!current[keys[i]]) {
|
|
1209
|
+
current[keys[i]] = {};
|
|
1210
|
+
}
|
|
1211
|
+
current = current[keys[i]];
|
|
1212
|
+
}
|
|
1213
|
+
current[keys[keys.length - 1]] = value;
|
|
1214
|
+
}
|
|
1215
|
+
__name(exportToGlobal, "exportToGlobal");
|
|
1216
|
+
function deepMergeMatchingProperties(mergeTo, mergeFrom) {
|
|
1217
|
+
const mergedObject = { ...mergeTo };
|
|
1218
|
+
for (const key in mergeFrom) {
|
|
1219
|
+
if (mergeFrom[key] !== null && typeof mergeFrom[key] === "object") {
|
|
1220
|
+
mergedObject[key] = deepMergeMatchingProperties(mergedObject[key] || {}, mergeFrom[key]);
|
|
1221
|
+
} else if (key in mergedObject) {
|
|
1222
|
+
mergedObject[key] = mergeFrom[key];
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return mergedObject;
|
|
1226
|
+
}
|
|
1227
|
+
__name(deepMergeMatchingProperties, "deepMergeMatchingProperties");
|
|
1228
|
+
function hasGetter(obj, prop) {
|
|
1229
|
+
while (obj && obj !== Object.prototype) {
|
|
1230
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1231
|
+
if (descriptor?.get) return true;
|
|
1232
|
+
obj = Object.getPrototypeOf(obj);
|
|
1233
|
+
}
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1236
|
+
__name(hasGetter, "hasGetter");
|
|
1237
|
+
function hasSetter(obj, prop) {
|
|
1238
|
+
while (obj && obj !== Object.prototype) {
|
|
1239
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1240
|
+
if (descriptor?.set) return true;
|
|
1241
|
+
obj = Object.getPrototypeOf(obj);
|
|
1242
|
+
}
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
__name(hasSetter, "hasSetter");
|
|
1246
|
+
|
|
1247
|
+
// src/utilities/elements/advanced_elements.ts
|
|
1248
|
+
var advancedElement = {
|
|
1249
|
+
createButton: elementCreateButton,
|
|
1250
|
+
createCheckbox: elementCreateCheckbox,
|
|
1251
|
+
createInput: elementCreateInput,
|
|
1252
|
+
createLabel: elementCreateLabel,
|
|
1253
|
+
createCustom: elementCreateCustom,
|
|
1254
|
+
createTooltip: elementCreateTooltip,
|
|
1255
|
+
getTooltip: elementGetTooltip,
|
|
1256
|
+
setTooltip: elementSetTooltip,
|
|
1257
|
+
createBackNext: elementPrevNext
|
|
1258
|
+
};
|
|
1259
|
+
function elementCreateButton(options) {
|
|
1260
|
+
const elem = document.getElementById(options.id);
|
|
1261
|
+
if (elem) return elem;
|
|
1262
|
+
options.type = "button";
|
|
1263
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1264
|
+
const button = ElementButton.Create(
|
|
1265
|
+
options.htmlOptions?.id ?? options.id,
|
|
1266
|
+
options.htmlOptions?.onClick ?? options?.onClick ?? (() => {
|
|
1267
|
+
}),
|
|
1268
|
+
deepMerge({
|
|
1269
|
+
tooltip: options.tooltip,
|
|
1270
|
+
label: options.label,
|
|
1271
|
+
labelPosition: "center"
|
|
1272
|
+
}, options.htmlOptions?.options),
|
|
1273
|
+
deepMerge({
|
|
1274
|
+
button: {
|
|
1275
|
+
classList: ["deeplib-button"],
|
|
1276
|
+
attributes: {
|
|
1277
|
+
disabled
|
|
1278
|
+
},
|
|
1279
|
+
children: [
|
|
1280
|
+
options.image ? {
|
|
1281
|
+
tag: "img",
|
|
1282
|
+
attributes: {
|
|
1283
|
+
id: `${options.id}-image`,
|
|
1284
|
+
alt: "",
|
|
1285
|
+
decoding: "async",
|
|
1286
|
+
loading: "lazy",
|
|
1287
|
+
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
1288
|
+
// 1x1 transparent image to get rid of broken image
|
|
1289
|
+
},
|
|
1290
|
+
style: {
|
|
1291
|
+
"--image": `url("${options.image}")`
|
|
1292
|
+
}
|
|
1293
|
+
} : void 0
|
|
1294
|
+
]
|
|
1295
|
+
}
|
|
1296
|
+
}, options.htmlOptions?.htmlOptions ?? {})
|
|
1297
|
+
);
|
|
1298
|
+
BaseSubscreen.currentElements.push([button, options]);
|
|
1299
|
+
return button;
|
|
1300
|
+
}
|
|
1301
|
+
__name(elementCreateButton, "elementCreateButton");
|
|
1302
|
+
function elementCreateCheckbox(options) {
|
|
1303
|
+
const elem = document.getElementById(options.id);
|
|
1304
|
+
if (elem) return elem;
|
|
1305
|
+
options.type = "checkbox";
|
|
1306
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1307
|
+
const retElem = ElementCreate({
|
|
1308
|
+
tag: "div",
|
|
1309
|
+
classList: ["deeplib-checkbox-container"],
|
|
1310
|
+
attributes: {
|
|
1311
|
+
id: `${options.id}-container`
|
|
1312
|
+
},
|
|
1313
|
+
children: [
|
|
1314
|
+
deepMerge({
|
|
1315
|
+
tag: "input",
|
|
1316
|
+
classList: ["checkbox", "deeplib-input"],
|
|
1317
|
+
attributes: {
|
|
1318
|
+
type: "checkbox",
|
|
1319
|
+
id: options.id,
|
|
1320
|
+
disabled,
|
|
1321
|
+
checked: options?.setElementValue?.() || void 0
|
|
1322
|
+
}
|
|
1323
|
+
}, options.htmlOptions),
|
|
1324
|
+
{
|
|
1325
|
+
tag: "label",
|
|
1326
|
+
classList: ["deeplib-text"],
|
|
1327
|
+
attributes: {
|
|
1328
|
+
for: options.id
|
|
1329
|
+
},
|
|
1330
|
+
children: [options.label]
|
|
1331
|
+
}
|
|
1332
|
+
],
|
|
1333
|
+
eventListeners: {
|
|
1334
|
+
change: /* @__PURE__ */ __name(() => {
|
|
1335
|
+
options?.setSettingValue?.(document.getElementById(options.id)?.checked);
|
|
1336
|
+
}, "change")
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
if (options.description) {
|
|
1340
|
+
retElem.addEventListener("mouseover", () => {
|
|
1341
|
+
elementSetTooltip(options.description || "");
|
|
1342
|
+
});
|
|
1343
|
+
retElem.addEventListener("mouseout", () => {
|
|
1344
|
+
elementSetTooltip("");
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1348
|
+
return retElem;
|
|
1349
|
+
}
|
|
1350
|
+
__name(elementCreateCheckbox, "elementCreateCheckbox");
|
|
1351
|
+
function elementCreateCustom(options) {
|
|
1352
|
+
const elem = document.getElementById(options.id);
|
|
1353
|
+
if (elem) return elem;
|
|
1354
|
+
options.type = "custom";
|
|
1355
|
+
const retElem = ElementCreate(options.htmlOptions);
|
|
1356
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1357
|
+
return retElem;
|
|
1358
|
+
}
|
|
1359
|
+
__name(elementCreateCustom, "elementCreateCustom");
|
|
1360
|
+
function elementCreateInput(options) {
|
|
1361
|
+
const elem = document.getElementById(options.id);
|
|
1362
|
+
if (elem) return elem;
|
|
1363
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1364
|
+
const retElem = ElementCreate({
|
|
1365
|
+
tag: "div",
|
|
1366
|
+
classList: ["deeplib-input-container"],
|
|
1367
|
+
attributes: {
|
|
1368
|
+
id: `${options.id}-container`
|
|
1369
|
+
},
|
|
1370
|
+
children: [
|
|
1371
|
+
deepMerge({
|
|
1372
|
+
tag: "input",
|
|
1373
|
+
classList: ["deeplib-input"],
|
|
1374
|
+
attributes: {
|
|
1375
|
+
type: options.type,
|
|
1376
|
+
id: options.id,
|
|
1377
|
+
placeholder: " ",
|
|
1378
|
+
disabled,
|
|
1379
|
+
value: options?.setElementValue?.() || void 0
|
|
1380
|
+
}
|
|
1381
|
+
}, options.htmlOptions),
|
|
1382
|
+
options.label ? {
|
|
1383
|
+
tag: "label",
|
|
1384
|
+
classList: ["deeplib-text"],
|
|
1385
|
+
attributes: {
|
|
1386
|
+
for: options.id
|
|
1387
|
+
},
|
|
1388
|
+
children: [options.label]
|
|
1389
|
+
} : void 0
|
|
1390
|
+
],
|
|
1391
|
+
eventListeners: {
|
|
1392
|
+
input: /* @__PURE__ */ __name(() => {
|
|
1393
|
+
options?.setSettingValue?.(document.getElementById(options.id)?.value);
|
|
1394
|
+
}, "input")
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
if (options.description) {
|
|
1398
|
+
retElem.addEventListener("mouseover", () => {
|
|
1399
|
+
elementSetTooltip(options.description || "");
|
|
1400
|
+
});
|
|
1401
|
+
retElem.addEventListener("mouseout", () => {
|
|
1402
|
+
elementSetTooltip("");
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1406
|
+
return retElem;
|
|
1407
|
+
}
|
|
1408
|
+
__name(elementCreateInput, "elementCreateInput");
|
|
1409
|
+
function elementCreateLabel(options) {
|
|
1410
|
+
const elem = document.getElementById(options.id);
|
|
1411
|
+
if (elem) return elem;
|
|
1412
|
+
options.type = "label";
|
|
1413
|
+
const retElem = ElementCreate(deepMerge({
|
|
1414
|
+
tag: "span",
|
|
1415
|
+
classList: ["deeplib-label", "deeplib-text"],
|
|
1416
|
+
attributes: {
|
|
1417
|
+
id: options.id
|
|
1418
|
+
},
|
|
1419
|
+
children: [
|
|
1420
|
+
options.label
|
|
1421
|
+
]
|
|
1422
|
+
}, options.htmlOptions));
|
|
1423
|
+
if (options.description) {
|
|
1424
|
+
retElem.addEventListener("mouseover", () => {
|
|
1425
|
+
elementSetTooltip(options.description || "");
|
|
1426
|
+
});
|
|
1427
|
+
retElem.addEventListener("mouseout", () => {
|
|
1428
|
+
elementSetTooltip("");
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1432
|
+
return retElem;
|
|
1433
|
+
}
|
|
1434
|
+
__name(elementCreateLabel, "elementCreateLabel");
|
|
1435
|
+
function elementCreateTooltip() {
|
|
1436
|
+
const element = ElementCreate({
|
|
1437
|
+
tag: "div",
|
|
1438
|
+
classList: ["deeplib-tooltip"],
|
|
1439
|
+
attributes: {
|
|
1440
|
+
id: "deeplib-tooltip"
|
|
1441
|
+
},
|
|
1442
|
+
style: {
|
|
1443
|
+
display: "none"
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
return element;
|
|
1447
|
+
}
|
|
1448
|
+
__name(elementCreateTooltip, "elementCreateTooltip");
|
|
1449
|
+
function elementGetTooltip() {
|
|
1450
|
+
return document.getElementById("deeplib-tooltip") ?? void 0;
|
|
1451
|
+
}
|
|
1452
|
+
__name(elementGetTooltip, "elementGetTooltip");
|
|
1453
|
+
function elementSetTooltip(text) {
|
|
1454
|
+
const element = document.getElementById("deeplib-tooltip");
|
|
1455
|
+
if (!element) return false;
|
|
1456
|
+
element.innerHTML = text;
|
|
1457
|
+
if (text === "") element.style.display = "none";
|
|
1458
|
+
else element.style.display = "";
|
|
1459
|
+
return true;
|
|
1460
|
+
}
|
|
1461
|
+
__name(elementSetTooltip, "elementSetTooltip");
|
|
1462
|
+
function elementPrevNext(options) {
|
|
1463
|
+
const elem = document.getElementById(options.id);
|
|
1464
|
+
if (elem) return elem;
|
|
1465
|
+
const setLabel = /* @__PURE__ */ __name((label) => {
|
|
1466
|
+
const elem2 = document.getElementById(`${options.id}-label`);
|
|
1467
|
+
if (!elem2) return false;
|
|
1468
|
+
elem2.textContent = label;
|
|
1469
|
+
}, "setLabel");
|
|
1470
|
+
const setPrevTooltip = /* @__PURE__ */ __name((tooltip) => {
|
|
1471
|
+
const elem2 = document.getElementById(`deeplib-prev-next-${options.id}-prev-button-tooltip`);
|
|
1472
|
+
if (!elem2) return false;
|
|
1473
|
+
elem2.textContent = tooltip;
|
|
1474
|
+
}, "setPrevTooltip");
|
|
1475
|
+
const setNextTooltip = /* @__PURE__ */ __name((tooltip) => {
|
|
1476
|
+
const elem2 = document.getElementById(`deeplib-prev-next-${options.id}-next-button-tooltip`);
|
|
1477
|
+
if (!elem2) return false;
|
|
1478
|
+
elem2.textContent = tooltip;
|
|
1479
|
+
}, "setNextTooltip");
|
|
1480
|
+
const retElem = ElementCreate({
|
|
1481
|
+
tag: "div",
|
|
1482
|
+
classList: ["deeplib-prev-next"],
|
|
1483
|
+
attributes: {
|
|
1484
|
+
id: options.id
|
|
1485
|
+
},
|
|
1486
|
+
children: [
|
|
1487
|
+
advancedElement.createButton({
|
|
1488
|
+
id: `deeplib-prev-next-${options.id}-prev-button`,
|
|
1489
|
+
image: `${PUBLIC_URL}/dl_images/arrow_left.svg`,
|
|
1490
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1491
|
+
options.back({
|
|
1492
|
+
setLabel,
|
|
1493
|
+
setBackTooltip: setPrevTooltip,
|
|
1494
|
+
setNextTooltip
|
|
1495
|
+
});
|
|
1496
|
+
}, "onClick"),
|
|
1497
|
+
tooltip: options.initialPrevTooltip,
|
|
1498
|
+
htmlOptions: {
|
|
1499
|
+
htmlOptions: {
|
|
1500
|
+
button: {
|
|
1501
|
+
classList: ["deeplib-prev-next-button"]
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
options: {
|
|
1505
|
+
noStyling: true
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}),
|
|
1509
|
+
advancedElement.createLabel({
|
|
1510
|
+
id: `${options.id}-label`,
|
|
1511
|
+
label: options.initialLabel,
|
|
1512
|
+
htmlOptions: {
|
|
1513
|
+
classList: ["deeplib-prev-next-label"]
|
|
1514
|
+
}
|
|
1515
|
+
}),
|
|
1516
|
+
advancedElement.createButton({
|
|
1517
|
+
id: `deeplib-prev-next-${options.id}-next-button`,
|
|
1518
|
+
image: `${PUBLIC_URL}/dl_images/arrow_right.svg`,
|
|
1519
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1520
|
+
options.next({
|
|
1521
|
+
setLabel,
|
|
1522
|
+
setBackTooltip: setPrevTooltip,
|
|
1523
|
+
setNextTooltip
|
|
1524
|
+
});
|
|
1525
|
+
}, "onClick"),
|
|
1526
|
+
tooltip: options.initialNextTooltip,
|
|
1527
|
+
htmlOptions: {
|
|
1528
|
+
htmlOptions: {
|
|
1529
|
+
button: {
|
|
1530
|
+
classList: ["deeplib-prev-next-button"]
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
options: {
|
|
1534
|
+
noStyling: true
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
})
|
|
1538
|
+
]
|
|
1539
|
+
});
|
|
1540
|
+
return retElem;
|
|
1541
|
+
}
|
|
1542
|
+
__name(elementPrevNext, "elementPrevNext");
|
|
1543
|
+
var Modal = class _Modal {
|
|
1544
|
+
constructor(opts) {
|
|
1545
|
+
this.opts = opts;
|
|
1546
|
+
opts ??= {};
|
|
1547
|
+
opts.closeOnBackdrop ??= true;
|
|
1548
|
+
const promptId = `modal-prompt-${Date.now()}`;
|
|
1549
|
+
this.dialog = ElementCreate({
|
|
1550
|
+
tag: "dialog",
|
|
1551
|
+
classList: ["deeplib-modal"],
|
|
1552
|
+
attributes: {
|
|
1553
|
+
role: "dialog",
|
|
1554
|
+
"aria-modal": "true",
|
|
1555
|
+
"aria-labelledby": promptId
|
|
1556
|
+
},
|
|
1557
|
+
style: {
|
|
1558
|
+
fontFamily: CommonGetFontName()
|
|
1559
|
+
},
|
|
1560
|
+
children: [
|
|
1561
|
+
opts.prompt,
|
|
1562
|
+
{
|
|
1563
|
+
tag: "div",
|
|
1564
|
+
classList: ["deeplib-modal-prompt"],
|
|
1565
|
+
attributes: {
|
|
1566
|
+
id: promptId
|
|
1567
|
+
},
|
|
1568
|
+
children: [
|
|
1569
|
+
opts.input ? this.renderInput(opts.input) : void 0
|
|
1570
|
+
]
|
|
1571
|
+
},
|
|
1572
|
+
this.renderButtons()
|
|
1573
|
+
]
|
|
1574
|
+
});
|
|
1575
|
+
this.blocker = this.createBlocker();
|
|
1576
|
+
this.renderButtons();
|
|
1577
|
+
document.body.append(this.createBlocker(), this.dialog);
|
|
1578
|
+
this.setupFocusTrap();
|
|
1579
|
+
if (opts.timeoutMs) {
|
|
1580
|
+
this.timeoutId = window.setTimeout(() => this.close("timeout"), opts.timeoutMs);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
static {
|
|
1584
|
+
__name(this, "Modal");
|
|
1585
|
+
}
|
|
1586
|
+
dialog;
|
|
1587
|
+
blocker;
|
|
1588
|
+
inputEl;
|
|
1589
|
+
timeoutId;
|
|
1590
|
+
static queue = [];
|
|
1591
|
+
static processing = false;
|
|
1592
|
+
show() {
|
|
1593
|
+
return _Modal.enqueue(this);
|
|
1594
|
+
}
|
|
1595
|
+
static async alert(msg, timeoutMs) {
|
|
1596
|
+
await new _Modal({ prompt: msg, buttons: [{ action: "close", text: "OK" }], timeoutMs }).show();
|
|
1597
|
+
}
|
|
1598
|
+
static async confirm(msg) {
|
|
1599
|
+
const [action] = await new _Modal({ prompt: msg, buttons: [{ text: "Cancel", action: "cancel" }, { text: "OK", action: "ok" }] }).show();
|
|
1600
|
+
return action === "ok";
|
|
1601
|
+
}
|
|
1602
|
+
static async prompt(msg, defaultValue = "") {
|
|
1603
|
+
const [action, value] = await new _Modal({ prompt: msg, timeoutMs: 0, input: { type: "input", defaultValue }, buttons: [{ text: "Cancel", action: "cancel" }, { text: "Submit", action: "submit" }] }).show();
|
|
1604
|
+
return action === "submit" ? value : null;
|
|
1605
|
+
}
|
|
1606
|
+
renderInput(cfg) {
|
|
1607
|
+
const el = document.createElement(cfg.type);
|
|
1608
|
+
el.classList.add("deeplib-modal-input");
|
|
1609
|
+
if (cfg.placeholder) el.placeholder = cfg.placeholder;
|
|
1610
|
+
if (cfg.readOnly) el.readOnly = true;
|
|
1611
|
+
if (cfg.defaultValue) el.value = cfg.defaultValue;
|
|
1612
|
+
if (cfg.type === "textarea") el.rows = 5;
|
|
1613
|
+
el.addEventListener("input", () => {
|
|
1614
|
+
const err = cfg.validate?.(el.value);
|
|
1615
|
+
el.setCustomValidity(err || "");
|
|
1616
|
+
});
|
|
1617
|
+
this.inputEl = el;
|
|
1618
|
+
return el;
|
|
1619
|
+
}
|
|
1620
|
+
renderButtons() {
|
|
1621
|
+
const container = document.createElement("div");
|
|
1622
|
+
container.classList.add("deeplib-modal-button-container");
|
|
1623
|
+
const btns = this.opts.buttons ? [...this.opts.buttons] : [];
|
|
1624
|
+
btns.forEach((b) => {
|
|
1625
|
+
const btn = advancedElement.createButton({
|
|
1626
|
+
label: b.text,
|
|
1627
|
+
id: `deeplib-modal-${b.action}`,
|
|
1628
|
+
disabled: b.disabled,
|
|
1629
|
+
onClick: /* @__PURE__ */ __name(() => this.close(b.action), "onClick")
|
|
1630
|
+
});
|
|
1631
|
+
container.append(btn);
|
|
1632
|
+
});
|
|
1633
|
+
return container;
|
|
1634
|
+
}
|
|
1635
|
+
createBlocker() {
|
|
1636
|
+
const blocker = document.createElement("div");
|
|
1637
|
+
blocker.classList.add("deeplib-modal-blocker");
|
|
1638
|
+
blocker.title = "Click to close";
|
|
1639
|
+
if (this.opts.closeOnBackdrop !== false)
|
|
1640
|
+
blocker.addEventListener("click", () => this.close("close"));
|
|
1641
|
+
return blocker;
|
|
1642
|
+
}
|
|
1643
|
+
setupFocusTrap() {
|
|
1644
|
+
const focusable = 'button, [href], input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
1645
|
+
const elements = Array.from(this.dialog.querySelectorAll(focusable));
|
|
1646
|
+
const first = elements[0];
|
|
1647
|
+
const last = elements[elements.length - 1];
|
|
1648
|
+
this.dialog.addEventListener("keydown", (e) => {
|
|
1649
|
+
if (e.key === "Tab") {
|
|
1650
|
+
if (elements.length === 0) {
|
|
1651
|
+
e.preventDefault();
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
if (e.shiftKey) {
|
|
1655
|
+
if (document.activeElement === first) {
|
|
1656
|
+
last.focus();
|
|
1657
|
+
e.preventDefault();
|
|
1658
|
+
}
|
|
1659
|
+
} else {
|
|
1660
|
+
if (document.activeElement === last) {
|
|
1661
|
+
first.focus();
|
|
1662
|
+
e.preventDefault();
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
} else if (e.key === "Escape") {
|
|
1666
|
+
e.stopPropagation();
|
|
1667
|
+
this.close("close");
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
window.requestAnimationFrame(() => {
|
|
1671
|
+
(this.inputEl || first)?.focus();
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
close(action) {
|
|
1675
|
+
if (this.timeoutId) clearTimeout(this.timeoutId);
|
|
1676
|
+
this.dialog.close();
|
|
1677
|
+
this.dialog.remove();
|
|
1678
|
+
this.blocker.remove();
|
|
1679
|
+
document.body.querySelector(".deeplib-modal-blocker")?.remove();
|
|
1680
|
+
const value = this.inputEl?.value ?? "";
|
|
1681
|
+
this.resolve([action, value]);
|
|
1682
|
+
_Modal.dequeue();
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* An internal function where we will save promise function.
|
|
1686
|
+
*/
|
|
1687
|
+
resolve = /* @__PURE__ */ __name(() => {
|
|
1688
|
+
}, "resolve");
|
|
1689
|
+
/** A function that adds a modal to the queue and returns a promise */
|
|
1690
|
+
static enqueue(modal) {
|
|
1691
|
+
_Modal.queue.push(modal);
|
|
1692
|
+
if (!_Modal.processing) _Modal.dequeue();
|
|
1693
|
+
return new Promise((resolve) => modal.resolve = resolve);
|
|
1694
|
+
}
|
|
1695
|
+
/** A function that processes the queue, removing the first modal */
|
|
1696
|
+
static dequeue() {
|
|
1697
|
+
const modal = _Modal.queue.shift();
|
|
1698
|
+
if (modal) {
|
|
1699
|
+
_Modal.processing = true;
|
|
1700
|
+
modal.dialog.show();
|
|
1701
|
+
} else {
|
|
1702
|
+
_Modal.processing = false;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
window.Modal = Modal;
|
|
1707
|
+
|
|
1708
|
+
// src/screens/main_menu.ts
|
|
1709
|
+
var MainMenu = class _MainMenu extends BaseSubscreen {
|
|
1710
|
+
static {
|
|
1711
|
+
__name(this, "MainMenu");
|
|
1712
|
+
}
|
|
1713
|
+
subscreens = [];
|
|
1714
|
+
static options = {};
|
|
1715
|
+
get name() {
|
|
1716
|
+
return "mainmenu";
|
|
1717
|
+
}
|
|
1718
|
+
constructor(module) {
|
|
1719
|
+
super({ drawCharacter: true }, module);
|
|
1720
|
+
this.subscreens = module.subscreens;
|
|
1721
|
+
}
|
|
1722
|
+
load() {
|
|
1723
|
+
if (!GUI.instance?.currentSubscreen) {
|
|
1724
|
+
this.setSubscreen(this);
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
super.load();
|
|
1728
|
+
const exitButton = advancedElement.createButton({
|
|
1729
|
+
id: "exit",
|
|
1730
|
+
size: [90, 90],
|
|
1731
|
+
image: `${PUBLIC_URL}/dl_images/exit.svg`,
|
|
1732
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1733
|
+
this.exit();
|
|
1734
|
+
}, "onClick"),
|
|
1735
|
+
tooltip: getText("settings.button.back_button_hint")
|
|
1736
|
+
});
|
|
1737
|
+
const menu = document.getElementById("deeplib-nav-menu");
|
|
1738
|
+
if (menu) {
|
|
1739
|
+
ElementMenu.AppendButton(menu, exitButton);
|
|
1740
|
+
}
|
|
1741
|
+
for (const screen of this.subscreens) {
|
|
1742
|
+
if (screen.name == "mainmenu") continue;
|
|
1743
|
+
const button = advancedElement.createButton({
|
|
1744
|
+
id: `${screen.name}-button`,
|
|
1745
|
+
image: screen.icon,
|
|
1746
|
+
label: getText(`mainmenu.button.${screen.name}`),
|
|
1747
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1748
|
+
this.setSubscreen(screen);
|
|
1749
|
+
}, "onClick"),
|
|
1750
|
+
size: [null, 90]
|
|
1751
|
+
});
|
|
1752
|
+
layoutElement.appendToSettingsDiv(button);
|
|
1753
|
+
}
|
|
1754
|
+
const miscDiv = layoutElement.createMiscDiv();
|
|
1755
|
+
layoutElement.appendToSubscreenDiv(miscDiv);
|
|
1756
|
+
if (_MainMenu.options.wikiLink) {
|
|
1757
|
+
const wikiButton = advancedElement.createButton({
|
|
1758
|
+
id: "deeplib-wiki-button",
|
|
1759
|
+
image: `${PUBLIC_URL}/dl_images/notebook.svg`,
|
|
1760
|
+
label: getText("mainmenu.button.wiki"),
|
|
1761
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1762
|
+
window.open(_MainMenu.options.wikiLink, "_blank");
|
|
1763
|
+
}, "onClick"),
|
|
1764
|
+
size: [null, 80]
|
|
1765
|
+
});
|
|
1766
|
+
layoutElement.appendToMiscDiv(wikiButton);
|
|
1767
|
+
}
|
|
1768
|
+
if (_MainMenu.options.repoLink) {
|
|
1769
|
+
const repoButton = advancedElement.createButton({
|
|
1770
|
+
id: "deeplib-repo-button",
|
|
1771
|
+
image: `${PUBLIC_URL}/dl_images/git.svg`,
|
|
1772
|
+
label: getText("mainmenu.button.repo"),
|
|
1773
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1774
|
+
window.open(_MainMenu.options.repoLink, "_blank");
|
|
1775
|
+
}, "onClick"),
|
|
1776
|
+
size: [null, 80]
|
|
1777
|
+
});
|
|
1778
|
+
layoutElement.appendToMiscDiv(repoButton);
|
|
1779
|
+
}
|
|
1780
|
+
if (_MainMenu.options.resetSubscreen) {
|
|
1781
|
+
const resetButton = advancedElement.createButton({
|
|
1782
|
+
id: "deeplib-reset-button",
|
|
1783
|
+
image: `${PUBLIC_URL}/dl_images/trash_bin.svg`,
|
|
1784
|
+
label: getText("mainmenu.button.reset"),
|
|
1785
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1786
|
+
this.setSubscreen(_MainMenu.options.resetSubscreen);
|
|
1787
|
+
}, "onClick"),
|
|
1788
|
+
size: [null, 80]
|
|
1789
|
+
});
|
|
1790
|
+
layoutElement.appendToMiscDiv(resetButton);
|
|
1791
|
+
}
|
|
1792
|
+
if (_MainMenu.options.importExportSubscreen) {
|
|
1793
|
+
const importExportButton = advancedElement.createButton({
|
|
1794
|
+
id: "deeplib-import-export-button",
|
|
1795
|
+
image: `${PUBLIC_URL}/dl_images/transfer.svg`,
|
|
1796
|
+
label: getText("mainmenu.button.import_export"),
|
|
1797
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1798
|
+
this.setSubscreen(_MainMenu.options.importExportSubscreen);
|
|
1799
|
+
}, "onClick"),
|
|
1800
|
+
size: [null, 80]
|
|
1801
|
+
});
|
|
1802
|
+
layoutElement.appendToMiscDiv(importExportButton);
|
|
1803
|
+
}
|
|
1804
|
+
if (IS_DEBUG) {
|
|
1805
|
+
const debugButton = advancedElement.createButton({
|
|
1806
|
+
id: "deeplib-debug-button",
|
|
1807
|
+
image: `${PUBLIC_URL}/dl_images/bug.svg`,
|
|
1808
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1809
|
+
this.setSubscreen(new GuiDebug());
|
|
1810
|
+
}, "onClick"),
|
|
1811
|
+
size: [90, 90]
|
|
1812
|
+
});
|
|
1813
|
+
if (menu) {
|
|
1814
|
+
ElementMenu.PrependItem(menu, debugButton);
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
run() {
|
|
1819
|
+
super.run();
|
|
1820
|
+
}
|
|
1821
|
+
click() {
|
|
1822
|
+
}
|
|
1823
|
+
exit() {
|
|
1824
|
+
CharacterAppearanceForceUpCharacter = -1;
|
|
1825
|
+
CharacterLoadCanvas(Player);
|
|
1826
|
+
this.setSubscreen(null);
|
|
1827
|
+
PreferenceSubscreenExtensionsClear();
|
|
1828
|
+
}
|
|
1829
|
+
resize() {
|
|
1830
|
+
super.resize();
|
|
1831
|
+
ElementSetPosition("deeplib-misc", 1905, 930, "bottom-right");
|
|
1832
|
+
ElementSetSize("deeplib-misc", 405, null);
|
|
1833
|
+
}
|
|
1834
|
+
static setOptions(mainMenuOptions) {
|
|
1835
|
+
_MainMenu.options = mainMenuOptions;
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
// src/screens/import_export.ts
|
|
1840
|
+
var GuiImportExport = class extends BaseSubscreen {
|
|
1841
|
+
static {
|
|
1842
|
+
__name(this, "GuiImportExport");
|
|
1843
|
+
}
|
|
1844
|
+
importExportOptions;
|
|
1845
|
+
get name() {
|
|
1846
|
+
return "import-export";
|
|
1847
|
+
}
|
|
1848
|
+
constructor(importExportOptions) {
|
|
1849
|
+
super({ drawCharacter: true });
|
|
1850
|
+
this.importExportOptions = importExportOptions;
|
|
1851
|
+
}
|
|
1852
|
+
load() {
|
|
1853
|
+
super.load();
|
|
1854
|
+
const importFromFileButton = advancedElement.createButton({
|
|
1855
|
+
id: "deeplib-import-file-button",
|
|
1856
|
+
size: [600, 90],
|
|
1857
|
+
image: `${PUBLIC_URL}/dl_images/file_import.svg`,
|
|
1858
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1859
|
+
this.dataImport("file");
|
|
1860
|
+
}, "onClick"),
|
|
1861
|
+
label: getText("import-export.button.import_file")
|
|
1862
|
+
});
|
|
1863
|
+
layoutElement.appendToSettingsDiv(importFromFileButton);
|
|
1864
|
+
const exportToFileButton = advancedElement.createButton({
|
|
1865
|
+
id: "deeplib-export-file-button",
|
|
1866
|
+
size: [600, 90],
|
|
1867
|
+
image: `${PUBLIC_URL}/dl_images/file_export.svg`,
|
|
1868
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1869
|
+
this.dataExport("file");
|
|
1870
|
+
}, "onClick"),
|
|
1871
|
+
label: getText("import-export.button.export_file")
|
|
1872
|
+
});
|
|
1873
|
+
layoutElement.appendToSettingsDiv(exportToFileButton);
|
|
1874
|
+
const importFromClipboardButton = advancedElement.createButton({
|
|
1875
|
+
id: "deeplib-import-clipboard-button",
|
|
1876
|
+
size: [600, 90],
|
|
1877
|
+
image: `${PUBLIC_URL}/dl_images/clipboard_import.svg`,
|
|
1878
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1879
|
+
this.dataImport("clipboard");
|
|
1880
|
+
}, "onClick"),
|
|
1881
|
+
label: getText("import-export.button.import_clipboard")
|
|
1882
|
+
});
|
|
1883
|
+
layoutElement.appendToSettingsDiv(importFromClipboardButton);
|
|
1884
|
+
const exportToClipboardButton = advancedElement.createButton({
|
|
1885
|
+
id: "deeplib-export-clipboard-button",
|
|
1886
|
+
size: [600, 90],
|
|
1887
|
+
image: `${PUBLIC_URL}/dl_images/clipboard_export.svg`,
|
|
1888
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1889
|
+
this.dataExport("clipboard");
|
|
1890
|
+
}, "onClick"),
|
|
1891
|
+
label: getText("import-export.button.export_clipboard")
|
|
1892
|
+
});
|
|
1893
|
+
layoutElement.appendToSettingsDiv(exportToClipboardButton);
|
|
1894
|
+
}
|
|
1895
|
+
resize() {
|
|
1896
|
+
super.resize();
|
|
1897
|
+
}
|
|
1898
|
+
async dataExport(transferMethod) {
|
|
1899
|
+
try {
|
|
1900
|
+
const data = LZString.compressToBase64(JSON.stringify(modStorage.playerStorage));
|
|
1901
|
+
if (transferMethod === "clipboard") {
|
|
1902
|
+
await this.exportToClipboard(data);
|
|
1903
|
+
} else if (transferMethod === "file") {
|
|
1904
|
+
await this.exportToFile(data, "themed_settings");
|
|
1905
|
+
}
|
|
1906
|
+
this.importExportOptions.onExport?.();
|
|
1907
|
+
ToastManager.success("Data exported successfully.");
|
|
1908
|
+
} catch (error) {
|
|
1909
|
+
ToastManager.error("Data export failed.");
|
|
1910
|
+
deepLibLogger.error(`Data export failed for ${ModSdkManager.ModInfo.name}.`, error);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
async dataImport(transferMethod) {
|
|
1914
|
+
try {
|
|
1915
|
+
let importedData = "";
|
|
1916
|
+
if (transferMethod === "clipboard") {
|
|
1917
|
+
importedData = await this.importFromClipboard() ?? null;
|
|
1918
|
+
} else if (transferMethod === "file") {
|
|
1919
|
+
importedData = await this.importFromFile() ?? null;
|
|
1920
|
+
}
|
|
1921
|
+
if (!importedData) {
|
|
1922
|
+
throw new Error("No data imported.");
|
|
1923
|
+
}
|
|
1924
|
+
const data = JSON.parse(LZString.decompressFromBase64(importedData) ?? "");
|
|
1925
|
+
if (!data) {
|
|
1926
|
+
throw new Error("Invalid data.");
|
|
1927
|
+
}
|
|
1928
|
+
modStorage.playerStorage = data;
|
|
1929
|
+
this.importExportOptions.onImport?.();
|
|
1930
|
+
ToastManager.success("Data imported successfully.");
|
|
1931
|
+
} catch (error) {
|
|
1932
|
+
ToastManager.error("Data import failed.");
|
|
1933
|
+
deepLibLogger.error(`Data import failed for ${ModSdkManager.ModInfo.name}.`, error);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
async exportToFile(data, defaultFileName) {
|
|
1937
|
+
const CUSTOM_EXTENSION = this.importExportOptions.customFileExtension.startsWith(".") ? this.importExportOptions.customFileExtension : "." + this.importExportOptions.customFileExtension;
|
|
1938
|
+
const suggestedName = defaultFileName.endsWith(CUSTOM_EXTENSION) ? defaultFileName : defaultFileName + CUSTOM_EXTENSION;
|
|
1939
|
+
if ("showSaveFilePicker" in window) {
|
|
1940
|
+
try {
|
|
1941
|
+
const handle = await window.showSaveFilePicker({
|
|
1942
|
+
suggestedName,
|
|
1943
|
+
types: [
|
|
1944
|
+
{
|
|
1945
|
+
description: "Custom Data Files",
|
|
1946
|
+
accept: { "text/plain": [CUSTOM_EXTENSION] }
|
|
1947
|
+
}
|
|
1948
|
+
]
|
|
1949
|
+
});
|
|
1950
|
+
const writable = await handle.createWritable();
|
|
1951
|
+
await writable.write(data);
|
|
1952
|
+
await writable.close();
|
|
1953
|
+
} catch (error) {
|
|
1954
|
+
throw new Error("File save cancelled or failed: " + error.message);
|
|
1955
|
+
}
|
|
1956
|
+
} else {
|
|
1957
|
+
const fileName = await Modal.prompt("Enter file name", suggestedName);
|
|
1958
|
+
if (fileName === null) {
|
|
1959
|
+
return;
|
|
1960
|
+
} else if (fileName === "") {
|
|
1961
|
+
throw new Error("File name cannot be empty.");
|
|
1962
|
+
}
|
|
1963
|
+
const blob = new Blob([data], { type: "text/plain" });
|
|
1964
|
+
const link = ElementCreate({
|
|
1965
|
+
tag: "a",
|
|
1966
|
+
attributes: {
|
|
1967
|
+
href: URL.createObjectURL(blob),
|
|
1968
|
+
download: fileName.endsWith(CUSTOM_EXTENSION) ? fileName : fileName + CUSTOM_EXTENSION
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
link.click();
|
|
1972
|
+
URL.revokeObjectURL(link.href);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
async importFromFile() {
|
|
1976
|
+
const CUSTOM_EXTENSION = this.importExportOptions.customFileExtension.startsWith(".") ? this.importExportOptions.customFileExtension : "." + this.importExportOptions.customFileExtension;
|
|
1977
|
+
async function importFromFileInternal(file) {
|
|
1978
|
+
if (!file.name.endsWith(CUSTOM_EXTENSION)) {
|
|
1979
|
+
throw new Error(`Invalid file type. Expected a ${CUSTOM_EXTENSION} file.`);
|
|
1980
|
+
}
|
|
1981
|
+
return new Promise((resolve, reject) => {
|
|
1982
|
+
const reader = new FileReader();
|
|
1983
|
+
reader.onload = () => resolve(reader.result);
|
|
1984
|
+
reader.onerror = () => reject(new Error("Failed to read file."));
|
|
1985
|
+
reader.readAsText(file);
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
__name(importFromFileInternal, "importFromFileInternal");
|
|
1989
|
+
if ("showOpenFilePicker" in window) {
|
|
1990
|
+
try {
|
|
1991
|
+
const [fileHandle] = await window.showOpenFilePicker({
|
|
1992
|
+
types: [
|
|
1993
|
+
{
|
|
1994
|
+
description: "Custom Data Files",
|
|
1995
|
+
accept: { "text/plain": [CUSTOM_EXTENSION] }
|
|
1996
|
+
}
|
|
1997
|
+
],
|
|
1998
|
+
multiple: false
|
|
1999
|
+
});
|
|
2000
|
+
const file = await fileHandle.getFile();
|
|
2001
|
+
return await importFromFileInternal(file);
|
|
2002
|
+
} catch (error) {
|
|
2003
|
+
throw new Error("File selection cancelled or failed: " + error.message);
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
2006
|
+
return new Promise((resolve, reject) => {
|
|
2007
|
+
const input = document.createElement("input");
|
|
2008
|
+
input.type = "file";
|
|
2009
|
+
input.accept = CUSTOM_EXTENSION;
|
|
2010
|
+
input.onchange = async (event) => {
|
|
2011
|
+
const file = event.target.files?.[0];
|
|
2012
|
+
if (file) {
|
|
2013
|
+
try {
|
|
2014
|
+
const data = await importFromFileInternal(file);
|
|
2015
|
+
resolve(data);
|
|
2016
|
+
} catch (error) {
|
|
2017
|
+
reject(error);
|
|
2018
|
+
}
|
|
2019
|
+
} else {
|
|
2020
|
+
reject(new Error("No file selected."));
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
input.click();
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
async exportToClipboard(data) {
|
|
2028
|
+
return navigator.clipboard.writeText(data).catch((error) => {
|
|
2029
|
+
throw new Error("Failed to copy data to clipboard." + error);
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
async importFromClipboard() {
|
|
2033
|
+
return Modal.prompt("Enter data to import").catch((error) => {
|
|
2034
|
+
throw new Error("Failed to read data from clipboard." + error);
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
// src/utilities/data.ts
|
|
2040
|
+
var ModStorage = class _ModStorage {
|
|
2041
|
+
static {
|
|
2042
|
+
__name(this, "ModStorage");
|
|
2043
|
+
}
|
|
2044
|
+
static _instance = null;
|
|
2045
|
+
modName;
|
|
2046
|
+
constructor(modName) {
|
|
2047
|
+
if (!_ModStorage._instance) {
|
|
2048
|
+
_ModStorage._instance = this;
|
|
2049
|
+
this.modName = modName;
|
|
2050
|
+
}
|
|
2051
|
+
this.modName ??= modName;
|
|
2052
|
+
return _ModStorage._instance;
|
|
2053
|
+
}
|
|
2054
|
+
get playerStorage() {
|
|
2055
|
+
return Player[this.modName];
|
|
2056
|
+
}
|
|
2057
|
+
set playerStorage(value) {
|
|
2058
|
+
Player[this.modName] = value;
|
|
2059
|
+
}
|
|
2060
|
+
get extensionStorage() {
|
|
2061
|
+
return Player.ExtensionSettings[this.modName];
|
|
2062
|
+
}
|
|
2063
|
+
set extensionStorage(value) {
|
|
2064
|
+
Player.ExtensionSettings[this.modName] = value;
|
|
2065
|
+
}
|
|
2066
|
+
setLocalStorage(key, value) {
|
|
2067
|
+
localStorage.setItem(`${this.modName}_${key}`, _ModStorage.dataCompress(value));
|
|
2068
|
+
}
|
|
2069
|
+
getLocalStorage(key) {
|
|
2070
|
+
const data = localStorage.getItem(`${this.modName}_${key}`);
|
|
2071
|
+
if (!data) return null;
|
|
2072
|
+
return _ModStorage.dataDecompress(data);
|
|
2073
|
+
}
|
|
2074
|
+
load() {
|
|
2075
|
+
if (this.extensionStorage) {
|
|
2076
|
+
const parsed = _ModStorage.dataDecompress(this.extensionStorage || "");
|
|
2077
|
+
if (parsed === null || !Object.hasOwn(parsed, "Version")) {
|
|
2078
|
+
this.playerStorage = {};
|
|
2079
|
+
} else {
|
|
2080
|
+
this.playerStorage = parsed;
|
|
2081
|
+
}
|
|
2082
|
+
;
|
|
2083
|
+
} else {
|
|
2084
|
+
this.playerStorage = {};
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
save() {
|
|
2088
|
+
if (!this.extensionStorage) this.extensionStorage = "";
|
|
2089
|
+
this.extensionStorage = _ModStorage.dataCompress(this.playerStorage);
|
|
2090
|
+
ServerPlayerExtensionSettingsSync(this.modName);
|
|
2091
|
+
}
|
|
2092
|
+
static dataDecompress(string) {
|
|
2093
|
+
const d = LZString.decompressFromBase64(string);
|
|
2094
|
+
let data = null;
|
|
2095
|
+
try {
|
|
2096
|
+
const decoded = JSON.parse(d);
|
|
2097
|
+
data = decoded;
|
|
2098
|
+
} catch (error) {
|
|
2099
|
+
deepLibLogger.error(error);
|
|
2100
|
+
}
|
|
2101
|
+
return data;
|
|
2102
|
+
}
|
|
2103
|
+
static dataCompress(object) {
|
|
2104
|
+
return LZString.compressToBase64(JSON.stringify(object));
|
|
2105
|
+
}
|
|
2106
|
+
};
|
|
2107
|
+
|
|
2108
|
+
// src/utilities/elements/element_helpers.ts
|
|
2109
|
+
var domUtil = {
|
|
2110
|
+
autoSetPosition,
|
|
2111
|
+
autoSetSize,
|
|
2112
|
+
hide,
|
|
2113
|
+
unhide,
|
|
2114
|
+
hasOverflow
|
|
2115
|
+
};
|
|
2116
|
+
function autoSetPosition(_, position) {
|
|
2117
|
+
let xPos = void 0;
|
|
2118
|
+
let yPos = void 0;
|
|
2119
|
+
if (Array.isArray(position)) {
|
|
2120
|
+
xPos = position[0];
|
|
2121
|
+
yPos = position[1];
|
|
2122
|
+
} else if (typeof position === "function") {
|
|
2123
|
+
const result = position();
|
|
2124
|
+
xPos = result[0];
|
|
2125
|
+
yPos = result[1];
|
|
2126
|
+
}
|
|
2127
|
+
if (xPos !== void 0 && yPos !== void 0) ElementSetPosition(_, xPos, yPos);
|
|
2128
|
+
}
|
|
2129
|
+
__name(autoSetPosition, "autoSetPosition");
|
|
2130
|
+
function autoSetSize(_, size) {
|
|
2131
|
+
let width = void 0;
|
|
2132
|
+
let height = void 0;
|
|
2133
|
+
if (Array.isArray(size)) {
|
|
2134
|
+
width = size[0];
|
|
2135
|
+
height = size[1];
|
|
2136
|
+
} else if (typeof size === "function") {
|
|
2137
|
+
const result = size();
|
|
2138
|
+
width = result[0];
|
|
2139
|
+
height = result[1];
|
|
2140
|
+
}
|
|
2141
|
+
if (width !== void 0 && height !== void 0) ElementSetSize(_, width, height);
|
|
2142
|
+
}
|
|
2143
|
+
__name(autoSetSize, "autoSetSize");
|
|
2144
|
+
function hide(_) {
|
|
2145
|
+
const element = ElementWrap(_);
|
|
2146
|
+
if (!element) return;
|
|
2147
|
+
element.style.display = "none";
|
|
2148
|
+
}
|
|
2149
|
+
__name(hide, "hide");
|
|
2150
|
+
function unhide(_) {
|
|
2151
|
+
const element = ElementWrap(_);
|
|
2152
|
+
if (!element) return;
|
|
2153
|
+
element.style.display = "";
|
|
2154
|
+
}
|
|
2155
|
+
__name(unhide, "unhide");
|
|
2156
|
+
function hasOverflow(el) {
|
|
2157
|
+
const element = ElementWrap(el);
|
|
2158
|
+
if (!element) return null;
|
|
2159
|
+
const vertical = element.scrollHeight > element.clientHeight;
|
|
2160
|
+
const horizontal = element.scrollWidth > element.clientWidth;
|
|
2161
|
+
return {
|
|
2162
|
+
any: vertical || horizontal,
|
|
2163
|
+
vertical,
|
|
2164
|
+
horizontal
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
__name(hasOverflow, "hasOverflow");
|
|
2168
|
+
|
|
2169
|
+
// src/utilities/elements/layout_elements.ts
|
|
2170
|
+
var layoutElement = {
|
|
2171
|
+
createSubscreenDiv: elementCreateSubscreenDiv,
|
|
2172
|
+
getSubscreenDiv: elementGetSubscreenDiv,
|
|
2173
|
+
appendToSubscreenDiv: elementAppendToSubscreenDiv,
|
|
2174
|
+
removeSubscreenDiv: elementRemoveSubscreenDiv,
|
|
2175
|
+
createSettingsDiv: elementCreateSettingsDiv,
|
|
2176
|
+
getSettingsDiv: elementGetSettingsDiv,
|
|
2177
|
+
appendToSettingsDiv: elementAppendToSettingsDiv,
|
|
2178
|
+
removeSettingsDiv: elementRemoveSettingsDiv,
|
|
2179
|
+
createMiscDiv: elementCreateMiscDiv,
|
|
2180
|
+
getMiscDiv: elementGetMiscDiv,
|
|
2181
|
+
appendToMiscDiv: elementAppendToMiscDiv,
|
|
2182
|
+
removeMiscDiv: elementRemoveMiscDiv
|
|
2183
|
+
};
|
|
2184
|
+
function elementCreateSubscreenDiv() {
|
|
2185
|
+
const subscreenDiv = elementGetSubscreenDiv();
|
|
2186
|
+
if (subscreenDiv) {
|
|
2187
|
+
console.error("Subscreen already exists");
|
|
2188
|
+
return subscreenDiv;
|
|
2189
|
+
}
|
|
2190
|
+
const div = document.createElement("div");
|
|
2191
|
+
div.id = "deeplib-subscreen";
|
|
2192
|
+
div.classList.add("deeplib-subscreen", "HideOnPopup");
|
|
2193
|
+
return document.body.appendChild(div);
|
|
2194
|
+
}
|
|
2195
|
+
__name(elementCreateSubscreenDiv, "elementCreateSubscreenDiv");
|
|
2196
|
+
function elementGetSubscreenDiv() {
|
|
2197
|
+
return document.getElementById("deeplib-subscreen") ?? void 0;
|
|
2198
|
+
}
|
|
2199
|
+
__name(elementGetSubscreenDiv, "elementGetSubscreenDiv");
|
|
2200
|
+
function elementRemoveSubscreenDiv() {
|
|
2201
|
+
return elementGetSubscreenDiv()?.remove();
|
|
2202
|
+
}
|
|
2203
|
+
__name(elementRemoveSubscreenDiv, "elementRemoveSubscreenDiv");
|
|
2204
|
+
function elementAppendToSubscreenDiv(...element) {
|
|
2205
|
+
return elementGetSubscreenDiv()?.append(...element);
|
|
2206
|
+
}
|
|
2207
|
+
__name(elementAppendToSubscreenDiv, "elementAppendToSubscreenDiv");
|
|
2208
|
+
function elementCreateSettingsDiv() {
|
|
2209
|
+
const settingsDiv = elementGetSettingsDiv();
|
|
2210
|
+
if (settingsDiv) {
|
|
2211
|
+
console.error("Settings screen already exists");
|
|
2212
|
+
return settingsDiv;
|
|
2213
|
+
}
|
|
2214
|
+
const div = document.createElement("div");
|
|
2215
|
+
div.id = "deeplib-settings";
|
|
2216
|
+
div.classList.add("deeplib-settings");
|
|
2217
|
+
return div;
|
|
2218
|
+
}
|
|
2219
|
+
__name(elementCreateSettingsDiv, "elementCreateSettingsDiv");
|
|
2220
|
+
function elementGetSettingsDiv() {
|
|
2221
|
+
return document.getElementById("deeplib-settings") ?? void 0;
|
|
2222
|
+
}
|
|
2223
|
+
__name(elementGetSettingsDiv, "elementGetSettingsDiv");
|
|
2224
|
+
function elementAppendToSettingsDiv(...element) {
|
|
2225
|
+
return elementGetSettingsDiv()?.append(...element);
|
|
2226
|
+
}
|
|
2227
|
+
__name(elementAppendToSettingsDiv, "elementAppendToSettingsDiv");
|
|
2228
|
+
function elementRemoveSettingsDiv() {
|
|
2229
|
+
return elementGetSettingsDiv()?.remove();
|
|
2230
|
+
}
|
|
2231
|
+
__name(elementRemoveSettingsDiv, "elementRemoveSettingsDiv");
|
|
2232
|
+
function elementCreateMiscDiv() {
|
|
2233
|
+
const miscDiv = elementGetMiscDiv();
|
|
2234
|
+
if (miscDiv) {
|
|
2235
|
+
console.error("Settings screen already exists");
|
|
2236
|
+
return miscDiv;
|
|
2237
|
+
}
|
|
2238
|
+
const div = document.createElement("div");
|
|
2239
|
+
div.id = "deeplib-misc";
|
|
2240
|
+
div.classList.add("deeplib-misc");
|
|
2241
|
+
return div;
|
|
2242
|
+
}
|
|
2243
|
+
__name(elementCreateMiscDiv, "elementCreateMiscDiv");
|
|
2244
|
+
function elementGetMiscDiv() {
|
|
2245
|
+
return document.getElementById("deeplib-misc");
|
|
2246
|
+
}
|
|
2247
|
+
__name(elementGetMiscDiv, "elementGetMiscDiv");
|
|
2248
|
+
function elementAppendToMiscDiv(...element) {
|
|
2249
|
+
return elementGetMiscDiv()?.append(...element);
|
|
2250
|
+
}
|
|
2251
|
+
__name(elementAppendToMiscDiv, "elementAppendToMiscDiv");
|
|
2252
|
+
function elementRemoveMiscDiv() {
|
|
2253
|
+
return elementGetMiscDiv()?.remove();
|
|
2254
|
+
}
|
|
2255
|
+
__name(elementRemoveMiscDiv, "elementRemoveMiscDiv");
|
|
2256
|
+
|
|
2257
|
+
// src/utilities/logger.ts
|
|
2258
|
+
var Logger = class _Logger extends Array {
|
|
2259
|
+
static {
|
|
2260
|
+
__name(this, "Logger");
|
|
2261
|
+
}
|
|
2262
|
+
ModName = "DeepLib";
|
|
2263
|
+
constructor(modName) {
|
|
2264
|
+
super();
|
|
2265
|
+
if (modName) {
|
|
2266
|
+
this.ModName = modName;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
_Log(level, ...args) {
|
|
2270
|
+
const logEntry = {
|
|
2271
|
+
logLevel: level,
|
|
2272
|
+
args: [...args],
|
|
2273
|
+
// trace: arguments.callee.caller.toString().split('\n'),
|
|
2274
|
+
date: new Date(Date.now())
|
|
2275
|
+
// `[${this.ModName}] ${formattedArgs}`
|
|
2276
|
+
};
|
|
2277
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
2278
|
+
if (userAgent.includes("chrome") || userAgent.includes("firefox")) {
|
|
2279
|
+
const color = _Logger.colorizeLog(level);
|
|
2280
|
+
args.forEach((arg) => {
|
|
2281
|
+
if (typeof arg === "string") {
|
|
2282
|
+
arg = `
|
|
2283
|
+
%c${arg}`;
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
console.log(`%c${this.ModName}:`, color, ...args);
|
|
2287
|
+
} else {
|
|
2288
|
+
console.log(`${this.ModName}:`, ...args);
|
|
2289
|
+
}
|
|
2290
|
+
this.push(logEntry);
|
|
2291
|
+
}
|
|
2292
|
+
info(...args) {
|
|
2293
|
+
this._Log("info", ...args);
|
|
2294
|
+
}
|
|
2295
|
+
log(...args) {
|
|
2296
|
+
this._Log("log", ...args);
|
|
2297
|
+
}
|
|
2298
|
+
warn(...args) {
|
|
2299
|
+
this._Log("warn", ...args);
|
|
2300
|
+
}
|
|
2301
|
+
error(...args) {
|
|
2302
|
+
this._Log("error", ...args);
|
|
2303
|
+
}
|
|
2304
|
+
debug(...args) {
|
|
2305
|
+
this._Log("debug", ...args);
|
|
2306
|
+
}
|
|
2307
|
+
static colorizeLog(logLevel) {
|
|
2308
|
+
const colors = {
|
|
2309
|
+
info: "color: #32CCCC",
|
|
2310
|
+
log: "color: #CCCC32",
|
|
2311
|
+
warn: "color: #eec355",
|
|
2312
|
+
error: "color: #750b0b",
|
|
2313
|
+
debug: "color: #9E4BCF"
|
|
2314
|
+
};
|
|
2315
|
+
return colors[logLevel];
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
var deepLibLogger = new Logger();
|
|
2319
|
+
|
|
2320
|
+
// src/utilities/messages.ts
|
|
2321
|
+
function sendLocalMessage(id, message, timeoutInSeconds) {
|
|
2322
|
+
const element = ElementCreate({
|
|
2323
|
+
tag: "div",
|
|
2324
|
+
classList: ["ChatMessage", "deeplib-message", "ChatMessageNonDialogue"],
|
|
2325
|
+
attributes: {
|
|
2326
|
+
id: id ?? `DEEPLIB_LOCAL_MESSAGE_${Date.now()}`,
|
|
2327
|
+
"data-time": ChatRoomCurrentTime(),
|
|
2328
|
+
"data-sender": Player.MemberNumber?.toString()
|
|
2329
|
+
},
|
|
2330
|
+
children: [
|
|
2331
|
+
{
|
|
2332
|
+
tag: "span",
|
|
2333
|
+
classList: ["deeplib-text"],
|
|
2334
|
+
innerHTML: message.replaceAll("\n ", "")
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
tag: "br"
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
tag: "a",
|
|
2341
|
+
classList: ["deeplib-text"],
|
|
2342
|
+
attributes: {
|
|
2343
|
+
href: "#"
|
|
2344
|
+
},
|
|
2345
|
+
innerHTML: "<b>Close (Click)</b>",
|
|
2346
|
+
eventListeners: {
|
|
2347
|
+
click: /* @__PURE__ */ __name(() => {
|
|
2348
|
+
element.remove();
|
|
2349
|
+
}, "click")
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
]
|
|
2353
|
+
});
|
|
2354
|
+
ChatRoomAppendChat(element);
|
|
2355
|
+
if (!timeoutInSeconds) return;
|
|
2356
|
+
setTimeout(() => element.remove(), timeoutInSeconds * 1e3);
|
|
2357
|
+
}
|
|
2358
|
+
__name(sendLocalMessage, "sendLocalMessage");
|
|
2359
|
+
function sendActionMessage(msg, target = void 0, dictionary = []) {
|
|
2360
|
+
if (!msg) return;
|
|
2361
|
+
ServerSend("ChatRoomChat", {
|
|
2362
|
+
Content: "DEEPLIB_CUSTOM_ACTION",
|
|
2363
|
+
Type: "Action",
|
|
2364
|
+
Target: target ?? void 0,
|
|
2365
|
+
Dictionary: [
|
|
2366
|
+
{ Tag: 'MISSING TEXT IN "Interface.csv": DEEPLIB_CUSTOM_ACTION', Text: msg },
|
|
2367
|
+
...dictionary
|
|
2368
|
+
]
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
__name(sendActionMessage, "sendActionMessage");
|
|
2372
|
+
|
|
2373
|
+
// src/utilities/sdk.ts
|
|
2374
|
+
var import_bondage_club_mod_sdk = __toESM(require_bcmodsdk(), 1);
|
|
2375
|
+
var rawSdk = import_bondage_club_mod_sdk.default;
|
|
2376
|
+
var bcModSdkRef = rawSdk.default ?? rawSdk;
|
|
2377
|
+
var HookPriority = {
|
|
2378
|
+
Observe: 0,
|
|
2379
|
+
AddBehavior: 1,
|
|
2380
|
+
ModifyBehavior: 5,
|
|
2381
|
+
OverrideBehavior: 10,
|
|
2382
|
+
Top: 100
|
|
2383
|
+
};
|
|
2384
|
+
var ModSdkManager = class _ModSdkManager {
|
|
2385
|
+
static {
|
|
2386
|
+
__name(this, "ModSdkManager");
|
|
2387
|
+
}
|
|
2388
|
+
static SDK;
|
|
2389
|
+
static patchedFunctions = /* @__PURE__ */ new Map();
|
|
2390
|
+
static ModInfo;
|
|
2391
|
+
constructor(info, options) {
|
|
2392
|
+
_ModSdkManager.SDK = bcModSdkRef.registerMod(info, options);
|
|
2393
|
+
_ModSdkManager.ModInfo = info;
|
|
2394
|
+
}
|
|
2395
|
+
initPatchableFunction(target) {
|
|
2396
|
+
let result = _ModSdkManager.patchedFunctions.get(target);
|
|
2397
|
+
if (!result) {
|
|
2398
|
+
result = {
|
|
2399
|
+
name: target,
|
|
2400
|
+
hooks: []
|
|
2401
|
+
};
|
|
2402
|
+
_ModSdkManager.patchedFunctions.set(target, result);
|
|
2403
|
+
}
|
|
2404
|
+
return result;
|
|
2405
|
+
}
|
|
2406
|
+
hookFunction(target, priority, hook, module = null) {
|
|
2407
|
+
const data = this.initPatchableFunction(target);
|
|
2408
|
+
if (data.hooks.some((h) => h.hook === hook)) {
|
|
2409
|
+
return () => null;
|
|
2410
|
+
}
|
|
2411
|
+
const removeCallback = _ModSdkManager.SDK?.hookFunction(target, priority, hook);
|
|
2412
|
+
data.hooks.push({
|
|
2413
|
+
hook,
|
|
2414
|
+
priority,
|
|
2415
|
+
module,
|
|
2416
|
+
removeCallback
|
|
2417
|
+
});
|
|
2418
|
+
data.hooks.sort((a, b) => b.priority - a.priority);
|
|
2419
|
+
return removeCallback;
|
|
2420
|
+
}
|
|
2421
|
+
patchFunction(target, patches) {
|
|
2422
|
+
_ModSdkManager.SDK?.patchFunction(target, patches);
|
|
2423
|
+
}
|
|
2424
|
+
unpatchFunction(target) {
|
|
2425
|
+
_ModSdkManager.SDK?.removePatches(target);
|
|
2426
|
+
}
|
|
2427
|
+
removeHookByModule(target, module) {
|
|
2428
|
+
const data = this.initPatchableFunction(target);
|
|
2429
|
+
for (let i = data.hooks.length - 1; i >= 0; i--) {
|
|
2430
|
+
if (data.hooks[i].module === module) {
|
|
2431
|
+
data.hooks[i].removeCallback();
|
|
2432
|
+
data.hooks.splice(i, 1);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
return true;
|
|
2436
|
+
}
|
|
2437
|
+
removeAllHooksByModule(module) {
|
|
2438
|
+
for (const data of _ModSdkManager.patchedFunctions.values()) {
|
|
2439
|
+
for (let i = data.hooks.length - 1; i >= 0; i--) {
|
|
2440
|
+
if (data.hooks[i].module === module) {
|
|
2441
|
+
data.hooks[i].removeCallback();
|
|
2442
|
+
data.hooks.splice(i, 1);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
return true;
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
// src/utilities/style.ts
|
|
2451
|
+
var Style = {
|
|
2452
|
+
injectInline(styleId, styleSource) {
|
|
2453
|
+
const isStyleLoaded = document.getElementById(styleId);
|
|
2454
|
+
if (isStyleLoaded) return;
|
|
2455
|
+
const styleElement = document.createElement("style");
|
|
2456
|
+
styleElement.id = styleId;
|
|
2457
|
+
styleElement.appendChild(document.createTextNode(styleSource));
|
|
2458
|
+
document.head.appendChild(styleElement);
|
|
2459
|
+
},
|
|
2460
|
+
injectEmbed(styleId, styleLink) {
|
|
2461
|
+
const isStyleLoaded = document.getElementById(styleId);
|
|
2462
|
+
if (isStyleLoaded) return;
|
|
2463
|
+
const styleElement = document.createElement("link");
|
|
2464
|
+
styleElement.id = styleId;
|
|
2465
|
+
styleElement.rel = "stylesheet";
|
|
2466
|
+
styleElement.href = styleLink;
|
|
2467
|
+
document.head.appendChild(styleElement);
|
|
2468
|
+
},
|
|
2469
|
+
eject(id) {
|
|
2470
|
+
const style = document.getElementById(id);
|
|
2471
|
+
if (!style) return;
|
|
2472
|
+
style.remove();
|
|
2473
|
+
},
|
|
2474
|
+
reload(styleId, styleSource) {
|
|
2475
|
+
Style.eject(styleId);
|
|
2476
|
+
Style.injectInline(styleId, styleSource);
|
|
2477
|
+
},
|
|
2478
|
+
async fetch(link) {
|
|
2479
|
+
return fetch(link).then((res) => res.text());
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
// src/utilities/translation.ts
|
|
2484
|
+
var Localization = class _Localization {
|
|
2485
|
+
static {
|
|
2486
|
+
__name(this, "Localization");
|
|
2487
|
+
}
|
|
2488
|
+
static LibTranslation = {};
|
|
2489
|
+
static ModTranslation = {};
|
|
2490
|
+
static PathToModTranslation;
|
|
2491
|
+
static PathToLibTranslation = `${PUBLIC_URL}/dl_translations/`;
|
|
2492
|
+
static initialized = false;
|
|
2493
|
+
static async init(initOptions) {
|
|
2494
|
+
if (_Localization.initialized) return;
|
|
2495
|
+
_Localization.initialized = true;
|
|
2496
|
+
_Localization.PathToModTranslation = initOptions.pathToTranslationsFolder.endsWith("/") ? initOptions.pathToTranslationsFolder : initOptions.pathToTranslationsFolder + "/";
|
|
2497
|
+
const lang = TranslationLanguage.toLowerCase();
|
|
2498
|
+
const libTranslation = await _Localization.fetchLanguageFile(_Localization.PathToLibTranslation, lang);
|
|
2499
|
+
if (lang === "en") {
|
|
2500
|
+
_Localization.LibTranslation = libTranslation;
|
|
2501
|
+
} else {
|
|
2502
|
+
const fallbackTranslation = await _Localization.fetchLanguageFile(_Localization.PathToLibTranslation, "en");
|
|
2503
|
+
_Localization.LibTranslation = { ...fallbackTranslation, ...libTranslation };
|
|
2504
|
+
}
|
|
2505
|
+
const modTranslation = await _Localization.fetchLanguageFile(_Localization.PathToModTranslation, lang);
|
|
2506
|
+
if (lang === "en") {
|
|
2507
|
+
_Localization.ModTranslation = modTranslation;
|
|
2508
|
+
} else {
|
|
2509
|
+
const fallbackTranslation = await _Localization.fetchLanguageFile(_Localization.PathToModTranslation, "en");
|
|
2510
|
+
_Localization.ModTranslation = { ...fallbackTranslation, ...modTranslation };
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
static getTextMod(srcTag) {
|
|
2514
|
+
return _Localization.ModTranslation?.[srcTag] || void 0;
|
|
2515
|
+
}
|
|
2516
|
+
static getTextLib(srcTag) {
|
|
2517
|
+
return _Localization.LibTranslation?.[srcTag] || void 0;
|
|
2518
|
+
}
|
|
2519
|
+
static async fetchLanguageFile(baseUrl, lang) {
|
|
2520
|
+
const response = await fetch(`${baseUrl}${lang}.lang`);
|
|
2521
|
+
if (lang !== "en" && !response.ok) {
|
|
2522
|
+
return this.fetchLanguageFile(baseUrl, "en");
|
|
2523
|
+
}
|
|
2524
|
+
const langFileContent = await response.text();
|
|
2525
|
+
return this.parseLanguageFile(langFileContent);
|
|
2526
|
+
}
|
|
2527
|
+
static parseLanguageFile(content) {
|
|
2528
|
+
const translations = {};
|
|
2529
|
+
const lines = content.split("\n");
|
|
2530
|
+
for (const line of lines) {
|
|
2531
|
+
const trimmed = line.trim();
|
|
2532
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
2533
|
+
const [key, ...rest] = trimmed.split("=");
|
|
2534
|
+
translations[key.trim()] = rest.join("=").trim();
|
|
2535
|
+
}
|
|
2536
|
+
return translations;
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
var getText = /* @__PURE__ */ __name((srcTag) => {
|
|
2540
|
+
return Localization.getTextMod(srcTag) || Localization.getTextLib(srcTag) || srcTag;
|
|
2541
|
+
}, "getText");
|
|
2542
|
+
export {
|
|
2543
|
+
BaseMigrator2 as BaseMigrator,
|
|
2544
|
+
BaseModule,
|
|
2545
|
+
BaseSubscreen,
|
|
2546
|
+
GUI,
|
|
2547
|
+
GuiDebug,
|
|
2548
|
+
GuiImportExport,
|
|
2549
|
+
HookPriority,
|
|
2550
|
+
Localization,
|
|
2551
|
+
Logger,
|
|
2552
|
+
MainMenu,
|
|
2553
|
+
ModSdkManager,
|
|
2554
|
+
ModStorage,
|
|
2555
|
+
Modal,
|
|
2556
|
+
Style,
|
|
2557
|
+
VersionModule,
|
|
2558
|
+
advancedElement,
|
|
2559
|
+
deepLibLogger,
|
|
2560
|
+
deepMerge,
|
|
2561
|
+
deepMergeMatchingProperties,
|
|
2562
|
+
domUtil,
|
|
2563
|
+
exportToGlobal,
|
|
2564
|
+
getCurrentSubscreen,
|
|
2565
|
+
getModule,
|
|
2566
|
+
getText,
|
|
2567
|
+
hasGetter,
|
|
2568
|
+
hasSetter,
|
|
2569
|
+
init,
|
|
2570
|
+
initMod,
|
|
2571
|
+
layoutElement,
|
|
2572
|
+
modStorage,
|
|
2573
|
+
modules,
|
|
2574
|
+
modulesMap,
|
|
2575
|
+
registerModule,
|
|
2576
|
+
sendActionMessage,
|
|
2577
|
+
sendLocalMessage,
|
|
2578
|
+
setSubscreen,
|
|
2579
|
+
shuffleArray,
|
|
2580
|
+
unloadMod
|
|
2581
|
+
};
|
|
2582
|
+
//# sourceMappingURL=deeplib.js.map
|