dphelper 3.3.3 → 3.3.4
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/index.cjs +326 -276
- package/index.js +326 -276
- package/package.json +1 -1
- package/types/dphelper.d.ts +3 -1
package/index.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
var e =
|
|
1
|
+
var e = globalThis.dphelper;
|
|
2
2
|
|
|
3
|
-
if (
|
|
3
|
+
if (e && e.version && e.version < "3.3.4") try {
|
|
4
4
|
delete globalThis.dphelper;
|
|
5
|
-
} catch {
|
|
5
|
+
} catch {
|
|
6
|
+
console.debug("Could not delete existing dphelper (likely non-configurable)");
|
|
7
|
+
}
|
|
6
8
|
|
|
7
|
-
var
|
|
9
|
+
var t = Object.getOwnPropertyDescriptor(globalThis, "dphelper");
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
t && !t.configurable ? t.writable ? void 0 === globalThis.dphelper && (globalThis.dphelper = {}) : console.debug("dphelper already defined on globalThis and is not writable/configurable") : Object.defineProperty(globalThis, "dphelper", {
|
|
10
12
|
value: globalThis.dphelper || {},
|
|
11
13
|
writable: !0,
|
|
12
14
|
configurable: !0,
|
|
@@ -26,7 +28,7 @@ o && !o.configurable ? o.writable && void 0 === globalThis.dphelper && (globalTh
|
|
|
26
28
|
writable: !0
|
|
27
29
|
},
|
|
28
30
|
version: {
|
|
29
|
-
value:
|
|
31
|
+
value: "3.3.4",
|
|
30
32
|
configurable: !0,
|
|
31
33
|
writable: !0
|
|
32
34
|
},
|
|
@@ -42,9 +44,9 @@ o && !o.configurable ? o.writable && void 0 === globalThis.dphelper && (globalTh
|
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
46
|
|
|
45
|
-
var
|
|
47
|
+
var o = globalThis.dphelper;
|
|
46
48
|
|
|
47
|
-
Object.defineProperty(
|
|
49
|
+
Object.defineProperty(o, "setProps", {
|
|
48
50
|
value: (e, t, o) => {
|
|
49
51
|
Object.defineProperty(e, t.name, o || {
|
|
50
52
|
writable: !1,
|
|
@@ -55,63 +57,63 @@ Object.defineProperty(a, "setProps", {
|
|
|
55
57
|
writable: !1,
|
|
56
58
|
configurable: !1,
|
|
57
59
|
enumerable: !1
|
|
58
|
-
}), Object.defineProperty(
|
|
60
|
+
}), Object.defineProperty(o, "setDescription", {
|
|
59
61
|
value: (e, t) => {
|
|
60
|
-
Object.defineProperties(
|
|
62
|
+
Object.defineProperties(o, {
|
|
61
63
|
[e.name]: {
|
|
62
64
|
value: t,
|
|
63
65
|
writable: !1,
|
|
64
66
|
configurable: !1,
|
|
65
67
|
enumerable: !1
|
|
66
68
|
}
|
|
67
|
-
}), Object.keys(t).map(t => (Object.defineProperties(
|
|
69
|
+
}), Object.keys(t).map(t => (Object.defineProperties(o[e.name], {
|
|
68
70
|
[t]: {
|
|
69
71
|
writable: !1,
|
|
70
72
|
configurable: !1,
|
|
71
73
|
enumerable: !1
|
|
72
74
|
}
|
|
73
|
-
}), null)),
|
|
75
|
+
}), null)), o.setProps(o, e, {
|
|
74
76
|
writable: !1,
|
|
75
77
|
configurable: !1,
|
|
76
78
|
enumerable: !1
|
|
77
|
-
}),
|
|
79
|
+
}), o._list.scripts.push(e);
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
82
|
|
|
81
|
-
var
|
|
83
|
+
var a = e => null === e || "object" != typeof e, n = e => null === e ? "null" : "string" == typeof e ? e.includes(",") || e.includes(":") || e.includes('"') || e.includes("\n") || e.trim() !== e ? `"${e.replace(/"/g, '\\"')}"` : e || '""' : String(e), r = (e, t = 0) => {
|
|
82
84
|
const o = " ".repeat(t);
|
|
83
|
-
if (
|
|
85
|
+
if (a(e)) return n(e);
|
|
84
86
|
if (Array.isArray(e)) {
|
|
85
87
|
if (0 === e.length) return "[0]:";
|
|
86
88
|
const t = e[0];
|
|
87
|
-
if (
|
|
89
|
+
if (a(t) || Array.isArray(t)) return `[${e.length}]: ` + e.map(n).join(",");
|
|
88
90
|
{
|
|
89
91
|
const a = Object.keys(t);
|
|
90
|
-
let
|
|
92
|
+
let r = `[${e.length}]{${a.join(",")}}:`;
|
|
91
93
|
for (const t of e) {
|
|
92
|
-
const e = a.map(e =>
|
|
93
|
-
|
|
94
|
+
const e = a.map(e => n(t[e])).join(",");
|
|
95
|
+
r += `\n${o} ${e}`;
|
|
94
96
|
}
|
|
95
|
-
return
|
|
97
|
+
return r;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
return Object.entries(e).map(([e,
|
|
100
|
+
return Object.entries(e).map(([e, i]) => {
|
|
99
101
|
const s = e.includes(" ") || e.includes(":") ? `"${e}"` : e;
|
|
100
|
-
if (!
|
|
101
|
-
const e = i
|
|
102
|
+
if (!a(i)) {
|
|
103
|
+
const e = r(i, t + 1);
|
|
102
104
|
return e.startsWith("[") ? `${s}${e}` : `${s}:\n ${o}${e}`;
|
|
103
105
|
}
|
|
104
|
-
return `${s}: ${
|
|
106
|
+
return `${s}: ${n(i)}`;
|
|
105
107
|
}).join(`\n${o}`);
|
|
106
|
-
},
|
|
108
|
+
}, i = {
|
|
107
109
|
tokenCount: e => {
|
|
108
|
-
const t = "string" == typeof e ? e :
|
|
110
|
+
const t = "string" == typeof e ? e : r(e);
|
|
109
111
|
if (!t) return 0;
|
|
110
112
|
const o = t.trim().split(/\s+/).length, a = t.length;
|
|
111
113
|
return Math.ceil((a / 4 + 1.3 * o) / 2);
|
|
112
114
|
},
|
|
113
115
|
smartSanitize: e => e ? e.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g, "[EMAIL]").replace(/(?:\+?\d{1,3}[- ]?)?\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}/g, "[PHONE]").replace(/\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b/g, "[CREDIT_CARD]").replace(/\b\d{3}-\d{2}-\d{4}\b/g, "[SSN]") : "",
|
|
114
|
-
toon: e =>
|
|
116
|
+
toon: e => r(e),
|
|
115
117
|
toonToJson: e => {
|
|
116
118
|
if (!e) return null;
|
|
117
119
|
const t = e.split("\n").filter(e => "" !== e.trim()), o = {}, a = [ {
|
|
@@ -188,7 +190,7 @@ var n = e => null === e || "object" != typeof e, r = e => null === e ? "null" :
|
|
|
188
190
|
},
|
|
189
191
|
prompt: (e, t) => e.replace(/{{(.*?)}}/g, (e, o) => {
|
|
190
192
|
const a = t[o.trim()];
|
|
191
|
-
return void 0 !== a ? "object" == typeof a ?
|
|
193
|
+
return void 0 !== a ? "object" == typeof a ? r(a) : String(a) : `{{${o}}}`;
|
|
192
194
|
}),
|
|
193
195
|
schema: e => {
|
|
194
196
|
const t = e => null === e ? "any" : Array.isArray(e) ? e.length > 0 && "object" == typeof e[0] ? `Array<{${Object.keys(e[0]).map(o => `${o}:${t(e[0][o])}`).join(", ")}}>` : "Array<primitive>" : typeof e;
|
|
@@ -212,8 +214,8 @@ var n = e => null === e || "object" != typeof e, r = e => null === e ? "null" :
|
|
|
212
214
|
node: "undefined" != typeof process ? process.version : "unknown",
|
|
213
215
|
arch: "undefined" != typeof process ? process.arch : "unknown"
|
|
214
216
|
};
|
|
215
|
-
const o =
|
|
216
|
-
return
|
|
217
|
+
const o = r(t);
|
|
218
|
+
return i.smartSanitize(o);
|
|
217
219
|
}
|
|
218
220
|
};
|
|
219
221
|
|
|
@@ -333,9 +335,9 @@ dphelper?.setDescription({
|
|
|
333
335
|
env: "both",
|
|
334
336
|
subCommand: []
|
|
335
337
|
} ]
|
|
336
|
-
},
|
|
338
|
+
}, i);
|
|
337
339
|
|
|
338
|
-
var
|
|
340
|
+
var s = {
|
|
339
341
|
name: "anchor",
|
|
340
342
|
active: !0,
|
|
341
343
|
subCommand: [ {
|
|
@@ -351,7 +353,7 @@ var l = {
|
|
|
351
353
|
env: "client",
|
|
352
354
|
subCommand: []
|
|
353
355
|
} ]
|
|
354
|
-
},
|
|
356
|
+
}, l = {
|
|
355
357
|
toOnClick: e => {
|
|
356
358
|
const t = document.querySelector(e);
|
|
357
359
|
if (!t) return;
|
|
@@ -371,9 +373,9 @@ var l = {
|
|
|
371
373
|
}
|
|
372
374
|
};
|
|
373
375
|
|
|
374
|
-
dphelper?.setDescription(
|
|
376
|
+
dphelper?.setDescription(s, l);
|
|
375
377
|
|
|
376
|
-
var
|
|
378
|
+
var c = {
|
|
377
379
|
find: (e, t) => {
|
|
378
380
|
if (Array.isArray(e)) {
|
|
379
381
|
for (const o of e) {
|
|
@@ -708,15 +710,15 @@ dphelper?.setDescription({
|
|
|
708
710
|
env: "both",
|
|
709
711
|
subCommand: []
|
|
710
712
|
} ]
|
|
711
|
-
},
|
|
713
|
+
}, c);
|
|
712
714
|
|
|
713
|
-
var
|
|
715
|
+
var d = {
|
|
714
716
|
play: (e, t = "", o = !1) => {
|
|
715
717
|
if (e) {
|
|
716
718
|
if (!document.querySelector(`#audio_${e}`)) {
|
|
717
719
|
const a = document.createElement("audio");
|
|
718
720
|
a.id = `audio_${e}`, a.dataset.dphelper = "audio", a.src = t + e, a.loop = o, document.body.appendChild(a),
|
|
719
|
-
a.load(), a.play()?.catch?.(e =>
|
|
721
|
+
a.load(), a.play()?.catch?.(e => console.error("Error playing audio:", e));
|
|
720
722
|
}
|
|
721
723
|
} else document.querySelectorAll("audio[data-dphelper='audio']").forEach(e => e.remove());
|
|
722
724
|
}
|
|
@@ -738,9 +740,9 @@ dphelper?.setDescription({
|
|
|
738
740
|
env: "client",
|
|
739
741
|
subCommand: []
|
|
740
742
|
} ]
|
|
741
|
-
},
|
|
743
|
+
}, d);
|
|
742
744
|
|
|
743
|
-
var
|
|
745
|
+
var p = {
|
|
744
746
|
cache: e => {
|
|
745
747
|
if ("string" != typeof e) throw new Error("The provided URI must be a string");
|
|
746
748
|
return e.concat(/\?/.test(e) ? "&" : "?", "t=", Math.random().toString(36).substring(2));
|
|
@@ -763,9 +765,9 @@ dphelper?.setDescription({
|
|
|
763
765
|
env: "both",
|
|
764
766
|
subCommand: []
|
|
765
767
|
} ]
|
|
766
|
-
},
|
|
768
|
+
}, p);
|
|
767
769
|
|
|
768
|
-
var
|
|
770
|
+
var u = {
|
|
769
771
|
"1xx": {
|
|
770
772
|
code: "1xx",
|
|
771
773
|
message: "Information",
|
|
@@ -1216,7 +1218,7 @@ var m = {
|
|
|
1216
1218
|
message: "Network Read Timeout Error",
|
|
1217
1219
|
description: "Used by some HTTP proxies to signal a network read timeout behind the proxy to a client in front of the proxy."
|
|
1218
1220
|
}
|
|
1219
|
-
},
|
|
1221
|
+
}, m = {
|
|
1220
1222
|
interlock: e => {
|
|
1221
1223
|
const t = new BroadcastChannel("dp_interlock");
|
|
1222
1224
|
let o = 1;
|
|
@@ -1249,7 +1251,7 @@ var m = {
|
|
|
1249
1251
|
});
|
|
1250
1252
|
},
|
|
1251
1253
|
zoom: () => Math.round(100 * devicePixelRatio),
|
|
1252
|
-
status: e =>
|
|
1254
|
+
status: e => u[e] || "Unknown status"
|
|
1253
1255
|
};
|
|
1254
1256
|
|
|
1255
1257
|
dphelper?.setDescription({
|
|
@@ -1364,9 +1366,9 @@ dphelper?.setDescription({
|
|
|
1364
1366
|
env: "client",
|
|
1365
1367
|
subCommand: []
|
|
1366
1368
|
} ]
|
|
1367
|
-
},
|
|
1369
|
+
}, m);
|
|
1368
1370
|
|
|
1369
|
-
var
|
|
1371
|
+
var h = {
|
|
1370
1372
|
version: (e, t, o) => {
|
|
1371
1373
|
if (!e || !t) return Number.NaN;
|
|
1372
1374
|
const a = o?.lex, n = o?.zero;
|
|
@@ -1402,9 +1404,9 @@ dphelper?.setDescription({
|
|
|
1402
1404
|
env: "both",
|
|
1403
1405
|
subCommand: []
|
|
1404
1406
|
} ]
|
|
1405
|
-
},
|
|
1407
|
+
}, h);
|
|
1406
1408
|
|
|
1407
|
-
var
|
|
1409
|
+
var v = {
|
|
1408
1410
|
hex: e => {
|
|
1409
1411
|
let t = Number.parseInt(e.toString(), 10);
|
|
1410
1412
|
return Number.isNaN(t) ? "00" : (t = Math.round(Math.max(0, Math.min(255, t))),
|
|
@@ -1495,9 +1497,9 @@ dphelper?.setDescription({
|
|
|
1495
1497
|
env: "client",
|
|
1496
1498
|
subCommand: []
|
|
1497
1499
|
} ]
|
|
1498
|
-
},
|
|
1500
|
+
}, v);
|
|
1499
1501
|
|
|
1500
|
-
var
|
|
1502
|
+
var f = {
|
|
1501
1503
|
set: e => {
|
|
1502
1504
|
const t = new Date;
|
|
1503
1505
|
if (t.setTime(t.getTime() + 31536e6), !e.name) return;
|
|
@@ -1582,9 +1584,9 @@ dphelper?.setDescription({
|
|
|
1582
1584
|
env: "client",
|
|
1583
1585
|
subCommand: []
|
|
1584
1586
|
} ]
|
|
1585
|
-
},
|
|
1587
|
+
}, f);
|
|
1586
1588
|
|
|
1587
|
-
var
|
|
1589
|
+
var b = {
|
|
1588
1590
|
name: "coords",
|
|
1589
1591
|
active: !0,
|
|
1590
1592
|
subCommand: [ {
|
|
@@ -1672,15 +1674,15 @@ var g = {
|
|
|
1672
1674
|
env: "client",
|
|
1673
1675
|
subCommand: []
|
|
1674
1676
|
} ]
|
|
1675
|
-
},
|
|
1677
|
+
}, g = 6371e3, y = {
|
|
1676
1678
|
degreesToRadians: e => e * Math.PI / 180,
|
|
1677
1679
|
latToMeters: e => {
|
|
1678
1680
|
if (!Array.isArray(e)) return;
|
|
1679
|
-
return
|
|
1681
|
+
return g * Math.cos(e[0]) * Math.cos(e[1]) / 1e3;
|
|
1680
1682
|
},
|
|
1681
1683
|
toVector: e => {
|
|
1682
1684
|
if (!Array.isArray(e)) return;
|
|
1683
|
-
return [
|
|
1685
|
+
return [ g * Math.cos(e[1] * Math.PI / 180) * Math.cos(e[0] * Math.PI / 180), g * Math.cos(e[1] * Math.PI / 180) * Math.sin(e[0] * Math.PI / 180), g * Math.sin(e[2] * Math.PI / 180) ];
|
|
1684
1686
|
},
|
|
1685
1687
|
convertToDecDegrees: (e, t, o, a) => {
|
|
1686
1688
|
let n = e + t / 60 + o / 3600;
|
|
@@ -1688,7 +1690,7 @@ var g = {
|
|
|
1688
1690
|
},
|
|
1689
1691
|
distance: (e, t) => {
|
|
1690
1692
|
if (!Array.isArray(e) || !Array.isArray(t)) return;
|
|
1691
|
-
const o = e[0] * Math.PI / 180, a = t[0] * Math.PI / 180, n = (t[0] - e[0]) * Math.PI / 180, r = (t[1] - e[1]) * Math.PI / 180, i = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(o) * Math.cos(a) * Math.sin(r / 2) * Math.sin(r / 2), s = 2 * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i)), l =
|
|
1693
|
+
const o = e[0] * Math.PI / 180, a = t[0] * Math.PI / 180, n = (t[0] - e[0]) * Math.PI / 180, r = (t[1] - e[1]) * Math.PI / 180, i = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(o) * Math.cos(a) * Math.sin(r / 2) * Math.sin(r / 2), s = 2 * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i)), l = g * s;
|
|
1692
1694
|
return {
|
|
1693
1695
|
km: Number((l / 1e3).toFixed(2)),
|
|
1694
1696
|
mi: Number((l / 1e3 * .621371).toFixed(2)),
|
|
@@ -1708,27 +1710,29 @@ var g = {
|
|
|
1708
1710
|
}
|
|
1709
1711
|
};
|
|
1710
1712
|
|
|
1711
|
-
dphelper?.setDescription(
|
|
1712
|
-
|
|
1713
|
-
"undefined" != typeof __DPH_VERSION__ ? __DPH_VERSION__ : globalThis.dphelper;
|
|
1713
|
+
dphelper?.setDescription(b, y);
|
|
1714
1714
|
|
|
1715
|
-
var w = globalThis.dphelper;
|
|
1715
|
+
var D = "3.3.4", w = "dphelper", x = globalThis.dphelper;
|
|
1716
1716
|
|
|
1717
|
-
|
|
1717
|
+
x?.setDescription?.({
|
|
1718
1718
|
name: "credits",
|
|
1719
1719
|
active: !0,
|
|
1720
1720
|
subCommand: []
|
|
1721
|
-
}, () => {
|
|
1721
|
+
}, () => {
|
|
1722
|
+
console.groupCollapsed(`%c${w} v${D}%c`, "color:orange", ""), console.debug(`%c${w} v${D}%c by Dario Passariello started`, "color:orange", ""),
|
|
1723
|
+
console.debug(`name: %c${w}`, "color:orange", ""), console.debug(`version: %c${D}`, "color:orange", ""),
|
|
1724
|
+
console.groupEnd();
|
|
1725
|
+
});
|
|
1722
1726
|
|
|
1723
|
-
var
|
|
1727
|
+
var C = {
|
|
1724
1728
|
en: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
|
|
1725
1729
|
it: [ "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" ]
|
|
1726
|
-
},
|
|
1730
|
+
}, S = {
|
|
1727
1731
|
days: (e = "en") => ({
|
|
1728
1732
|
en: [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
|
|
1729
1733
|
it: [ "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato", "domenica" ]
|
|
1730
1734
|
}[e]),
|
|
1731
|
-
months: (e = "en") =>
|
|
1735
|
+
months: (e = "en") => C[e],
|
|
1732
1736
|
year: () => (new Date).getFullYear(),
|
|
1733
1737
|
toIso: (e, t = "en") => {
|
|
1734
1738
|
e || (e = "");
|
|
@@ -1787,7 +1791,7 @@ var x = {
|
|
|
1787
1791
|
try {
|
|
1788
1792
|
return `${e.getFullYear()}${e.getMonth().toString().length > 1 ? e.getMonth() + 1 : `0${e.getMonth() + 1}`}\n ${e.getDate().toString().length > 1 ? e.getDate() : `0${e.getDate()}`}_${e.getHours()}${e.getMinutes()}${e.getSeconds()}`;
|
|
1789
1793
|
} catch (t) {
|
|
1790
|
-
return e;
|
|
1794
|
+
return console.error(t), e;
|
|
1791
1795
|
}
|
|
1792
1796
|
},
|
|
1793
1797
|
isoToHuman: (e, t = "@") => {
|
|
@@ -1820,7 +1824,8 @@ var x = {
|
|
|
1820
1824
|
},
|
|
1821
1825
|
collection: ({date: e = new Date, type: t = "", locale: o = "en-US"}) => {
|
|
1822
1826
|
let a;
|
|
1823
|
-
switch (t)
|
|
1827
|
+
switch (!e && t && o && console.debug('\n "toDateString" -> Tue Jan 02 2024\n "toISOString" -> 2024-01-02T18:44:43.590Z\n "toJSON" -> 2024-01-02T18:44:43.590Z\n "toLocaleDateString" -> 1/2/2024\n "toLocaleString" -> 1/2/2024, 11:44:43 AM\n "toLocaleTimeString" -> 11:44:43 AM\n "toString" -> Tue Jan 02 2024 11:44:43 GMT-0700 (Mountain Standard Time)\n "toISOStringShort" -> 2024-01-02\n "toLocaleString (en-GB)" -> 02/01/2024, 11:47:56 am\n '),
|
|
1828
|
+
t) {
|
|
1824
1829
|
case "toDateString":
|
|
1825
1830
|
a = e.toDateString();
|
|
1826
1831
|
break;
|
|
@@ -2129,9 +2134,9 @@ dphelper?.setDescription({
|
|
|
2129
2134
|
env: "both",
|
|
2130
2135
|
subCommand: []
|
|
2131
2136
|
} ]
|
|
2132
|
-
},
|
|
2137
|
+
}, S);
|
|
2133
2138
|
|
|
2134
|
-
var
|
|
2139
|
+
var M = {
|
|
2135
2140
|
select: (e = "body") => {
|
|
2136
2141
|
try {
|
|
2137
2142
|
if ("undefined" == typeof document) return;
|
|
@@ -2145,8 +2150,10 @@ var S = {
|
|
|
2145
2150
|
e.addEventListener("dragstart", e => (e.preventDefault(), !1));
|
|
2146
2151
|
});
|
|
2147
2152
|
};
|
|
2148
|
-
t.addEventListener("mousedown", o);
|
|
2149
|
-
} catch (e) {
|
|
2153
|
+
t.addEventListener("mousedown", o), console.debug("%cSelection Disabled: %ctrue", "color:orange", "");
|
|
2154
|
+
} catch (e) {
|
|
2155
|
+
console.debug("dphelper.disable.select:", e);
|
|
2156
|
+
}
|
|
2150
2157
|
},
|
|
2151
2158
|
spellCheck: (e = 5e3) => {
|
|
2152
2159
|
setInterval(() => {
|
|
@@ -2159,35 +2166,45 @@ var S = {
|
|
|
2159
2166
|
if ("undefined" == typeof document) return;
|
|
2160
2167
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2161
2168
|
t && "function" == typeof t.addEventListener && t.addEventListener("contextmenu", e => e.preventDefault());
|
|
2162
|
-
} catch (e) {
|
|
2169
|
+
} catch (e) {
|
|
2170
|
+
console.debug("dphelper.disable.rightClick:", e);
|
|
2171
|
+
}
|
|
2163
2172
|
},
|
|
2164
2173
|
copy: (e = "body") => {
|
|
2165
2174
|
try {
|
|
2166
2175
|
if ("undefined" == typeof document) return;
|
|
2167
2176
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2168
2177
|
t && "function" == typeof t.addEventListener && t.addEventListener("copy", e => e.preventDefault());
|
|
2169
|
-
} catch (e) {
|
|
2178
|
+
} catch (e) {
|
|
2179
|
+
console.debug("dphelper.disable.copy:", e);
|
|
2180
|
+
}
|
|
2170
2181
|
},
|
|
2171
2182
|
paste: (e = "body") => {
|
|
2172
2183
|
try {
|
|
2173
2184
|
if ("undefined" == typeof document) return;
|
|
2174
2185
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2175
2186
|
t && "function" == typeof t.addEventListener && t.addEventListener("paste", e => e.preventDefault());
|
|
2176
|
-
} catch (e) {
|
|
2187
|
+
} catch (e) {
|
|
2188
|
+
console.debug("dphelper.disable.paste:", e);
|
|
2189
|
+
}
|
|
2177
2190
|
},
|
|
2178
2191
|
cut: (e = "body") => {
|
|
2179
2192
|
try {
|
|
2180
2193
|
if ("undefined" == typeof document) return;
|
|
2181
2194
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2182
2195
|
t && "function" == typeof t.addEventListener && t.addEventListener("cut", e => e.preventDefault());
|
|
2183
|
-
} catch (e) {
|
|
2196
|
+
} catch (e) {
|
|
2197
|
+
console.debug("dphelper.disable.cut:", e);
|
|
2198
|
+
}
|
|
2184
2199
|
},
|
|
2185
2200
|
drag: (e = "body") => {
|
|
2186
2201
|
try {
|
|
2187
2202
|
if ("undefined" == typeof document) return;
|
|
2188
2203
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2189
2204
|
t && "function" == typeof t.addEventListener && t.addEventListener("dragstart", e => e.preventDefault());
|
|
2190
|
-
} catch (e) {
|
|
2205
|
+
} catch (e) {
|
|
2206
|
+
console.debug("dphelper.disable.drag:", e);
|
|
2207
|
+
}
|
|
2191
2208
|
}
|
|
2192
2209
|
};
|
|
2193
2210
|
|
|
@@ -2279,18 +2296,18 @@ dphelper?.setDescription?.({
|
|
|
2279
2296
|
env: "client",
|
|
2280
2297
|
subCommand: []
|
|
2281
2298
|
} ]
|
|
2282
|
-
},
|
|
2299
|
+
}, M);
|
|
2283
2300
|
|
|
2284
|
-
var
|
|
2301
|
+
var P = {}, k = {
|
|
2285
2302
|
set: (e, t = {}) => dispatchEvent(new CustomEvent(String(e), t)),
|
|
2286
2303
|
listen: (e, t) => {
|
|
2287
|
-
|
|
2304
|
+
P[e] && P[e].length > 0 && dphelper.dispatch.remove(e);
|
|
2288
2305
|
const o = e => t ? setTimeout(() => t(e), 0) : null;
|
|
2289
|
-
window.addEventListener(e, o),
|
|
2306
|
+
window.addEventListener(e, o), P[e] || (P[e] = []), P[e].push(o);
|
|
2290
2307
|
},
|
|
2291
2308
|
remove: e => {
|
|
2292
|
-
const t =
|
|
2293
|
-
t && (t.forEach(t => window.removeEventListener(e, t)), delete
|
|
2309
|
+
const t = P[e];
|
|
2310
|
+
t && (t.forEach(t => window.removeEventListener(e, t)), delete P[e]);
|
|
2294
2311
|
}
|
|
2295
2312
|
};
|
|
2296
2313
|
|
|
@@ -2334,9 +2351,9 @@ dphelper?.setDescription({
|
|
|
2334
2351
|
env: "client",
|
|
2335
2352
|
subCommand: []
|
|
2336
2353
|
} ]
|
|
2337
|
-
},
|
|
2354
|
+
}, k);
|
|
2338
2355
|
|
|
2339
|
-
var
|
|
2356
|
+
var T = {
|
|
2340
2357
|
fitScale: (e, t = 1, o = !1) => addEventListener("resize", a => dphelper.element.scaleBasedOnWindow(e, t, o)),
|
|
2341
2358
|
scaleBasedOnWindow: (e, t, o) => {
|
|
2342
2359
|
if (!e) return;
|
|
@@ -2363,9 +2380,9 @@ dphelper?.setDescription({
|
|
|
2363
2380
|
env: "client",
|
|
2364
2381
|
subCommand: []
|
|
2365
2382
|
} ]
|
|
2366
|
-
},
|
|
2383
|
+
}, T);
|
|
2367
2384
|
|
|
2368
|
-
var
|
|
2385
|
+
var A = {
|
|
2369
2386
|
list: e => window.getEventListeners(e),
|
|
2370
2387
|
multi: (e, t, o) => {
|
|
2371
2388
|
const a = t.split(" ");
|
|
@@ -2377,7 +2394,9 @@ var T = {
|
|
|
2377
2394
|
if (navigator.clipboard) try {
|
|
2378
2395
|
const t = e.target;
|
|
2379
2396
|
t && (await navigator.clipboard.writeText(t.textContent || ""), alert("Copied"));
|
|
2380
|
-
} catch (e) {
|
|
2397
|
+
} catch (e) {
|
|
2398
|
+
console.error("Can't copy the value", e);
|
|
2399
|
+
}
|
|
2381
2400
|
});
|
|
2382
2401
|
},
|
|
2383
2402
|
onDrag: e => {
|
|
@@ -2465,25 +2484,26 @@ dphelper?.setDescription({
|
|
|
2465
2484
|
env: "client",
|
|
2466
2485
|
subCommand: []
|
|
2467
2486
|
} ]
|
|
2468
|
-
},
|
|
2487
|
+
}, A);
|
|
2469
2488
|
|
|
2470
|
-
var
|
|
2489
|
+
var N = async (e, t = {}, o = 3, a = 1e3) => {
|
|
2471
2490
|
try {
|
|
2472
2491
|
const a = await globalThis.fetch(e, t);
|
|
2473
2492
|
if (!a.ok && o > 0) throw new Error(a.statusText);
|
|
2474
2493
|
return a;
|
|
2475
2494
|
} catch (n) {
|
|
2476
2495
|
if (0 === o) throw n;
|
|
2477
|
-
return
|
|
2496
|
+
return console.warn(`[dphelper] Fetch failed, retrying in ${a}ms... (${o} retries left)`),
|
|
2497
|
+
await new Promise(e => setTimeout(e, a)), N(e, t, o - 1, 2 * a);
|
|
2478
2498
|
}
|
|
2479
|
-
},
|
|
2499
|
+
}, E = (e, t) => N(e, t);
|
|
2480
2500
|
|
|
2481
|
-
|
|
2501
|
+
E.get = (e, t) => N(e, {
|
|
2482
2502
|
...t,
|
|
2483
2503
|
method: "GET"
|
|
2484
|
-
}),
|
|
2504
|
+
}), E.post = (e, t, o = {}) => {
|
|
2485
2505
|
const a = "object" == typeof t && null !== t;
|
|
2486
|
-
return
|
|
2506
|
+
return N(e, {
|
|
2487
2507
|
...o,
|
|
2488
2508
|
method: "POST",
|
|
2489
2509
|
headers: {
|
|
@@ -2522,9 +2542,9 @@ N.get = (e, t) => A(e, {
|
|
|
2522
2542
|
env: "both",
|
|
2523
2543
|
subCommand: []
|
|
2524
2544
|
} ]
|
|
2525
|
-
},
|
|
2545
|
+
}, E);
|
|
2526
2546
|
|
|
2527
|
-
var
|
|
2547
|
+
var $ = {
|
|
2528
2548
|
serialize: e => {
|
|
2529
2549
|
const t = "string" == typeof e ? document.querySelector(e) : e;
|
|
2530
2550
|
if (!t) return {};
|
|
@@ -2764,9 +2784,9 @@ dphelper?.setDescription({
|
|
|
2764
2784
|
env: "client",
|
|
2765
2785
|
subCommand: []
|
|
2766
2786
|
} ]
|
|
2767
|
-
},
|
|
2787
|
+
}, $);
|
|
2768
2788
|
|
|
2769
|
-
var
|
|
2789
|
+
var q = {
|
|
2770
2790
|
currency: (e, t = "en-US", o = "USD") => new Intl.NumberFormat(t, {
|
|
2771
2791
|
style: "currency",
|
|
2772
2792
|
currency: o
|
|
@@ -2806,9 +2826,9 @@ dphelper?.setDescription({
|
|
|
2806
2826
|
env: "both",
|
|
2807
2827
|
subCommand: []
|
|
2808
2828
|
} ]
|
|
2809
|
-
},
|
|
2829
|
+
}, q);
|
|
2810
2830
|
|
|
2811
|
-
var
|
|
2831
|
+
var j = {
|
|
2812
2832
|
counter: (e, t, o) => e ? t && o ? e.items && Array.isArray(e.items) ? e.items.filter(e => e[t] === o).length : Object.keys(e).length : 0 : null,
|
|
2813
2833
|
toCsv: e => {
|
|
2814
2834
|
const t = e, o = (e, t) => null === t ? "" : t, a = Object.keys(t[0]), n = t.map(e => a.map(t => JSON.stringify(e[t], o)).join(","));
|
|
@@ -2825,7 +2845,7 @@ var $ = {
|
|
|
2825
2845
|
try {
|
|
2826
2846
|
JSON.parse(e);
|
|
2827
2847
|
} catch (e) {
|
|
2828
|
-
return !1;
|
|
2848
|
+
return console.warn(e), !1;
|
|
2829
2849
|
}
|
|
2830
2850
|
return !0;
|
|
2831
2851
|
},
|
|
@@ -2833,7 +2853,7 @@ var $ = {
|
|
|
2833
2853
|
try {
|
|
2834
2854
|
return JSON.parse(e);
|
|
2835
2855
|
} catch (e) {
|
|
2836
|
-
return "Json not parsable";
|
|
2856
|
+
return console.warn(e), "Json not parsable";
|
|
2837
2857
|
}
|
|
2838
2858
|
},
|
|
2839
2859
|
sanitize: e => {
|
|
@@ -2937,9 +2957,9 @@ dphelper?.setDescription({
|
|
|
2937
2957
|
env: "both",
|
|
2938
2958
|
subCommand: []
|
|
2939
2959
|
} ]
|
|
2940
|
-
},
|
|
2960
|
+
}, j);
|
|
2941
2961
|
|
|
2942
|
-
var
|
|
2962
|
+
var O = {
|
|
2943
2963
|
all: (e, t = "") => {
|
|
2944
2964
|
if (e) if (t && !window.cacheName && (window.cacheName = []), "object" != typeof e || e.keys) {
|
|
2945
2965
|
if ("function" == typeof e && e.keys) for (const o of e.keys()) t && window.cacheName.push(o),
|
|
@@ -2950,15 +2970,17 @@ var j = {
|
|
|
2950
2970
|
fileToElement: async (e, t) => {
|
|
2951
2971
|
try {
|
|
2952
2972
|
const o = await dphelper.load.file(t), a = document.querySelector(e);
|
|
2953
|
-
a
|
|
2954
|
-
} catch (e) {
|
|
2973
|
+
a ? a.innerHTML = dphelper.sanitize.html(o) : console.error(`Element not found: ${e}`);
|
|
2974
|
+
} catch (e) {
|
|
2975
|
+
console.error("Error loading file to element:", e);
|
|
2976
|
+
}
|
|
2955
2977
|
},
|
|
2956
2978
|
script: (e, t = "html") => {
|
|
2957
2979
|
const o = document.querySelector(t);
|
|
2958
2980
|
if (o) for (const t of e) {
|
|
2959
2981
|
const e = document.createElement("script");
|
|
2960
2982
|
e.src = t, e.async = !0, e.defer = !0, o.appendChild(e);
|
|
2961
|
-
}
|
|
2983
|
+
} else console.error(`Element not found: ${t}`);
|
|
2962
2984
|
},
|
|
2963
2985
|
toJson: (e, t = "") => {
|
|
2964
2986
|
const o = {};
|
|
@@ -3041,33 +3063,33 @@ dphelper?.setDescription?.({
|
|
|
3041
3063
|
env: "client",
|
|
3042
3064
|
subCommand: []
|
|
3043
3065
|
} ]
|
|
3044
|
-
},
|
|
3066
|
+
}, O);
|
|
3045
3067
|
|
|
3046
|
-
var
|
|
3068
|
+
var L = {
|
|
3047
3069
|
log: []
|
|
3048
|
-
},
|
|
3049
|
-
list: () =>
|
|
3070
|
+
}, I = {
|
|
3071
|
+
list: () => L.log,
|
|
3050
3072
|
reg: e => {
|
|
3051
|
-
|
|
3073
|
+
L.log.push({
|
|
3052
3074
|
type: "reg",
|
|
3053
3075
|
message: e
|
|
3054
|
-
}),
|
|
3076
|
+
}), L.log.length > 1e3 && L.log.shift();
|
|
3055
3077
|
},
|
|
3056
3078
|
debug: e => {
|
|
3057
|
-
|
|
3079
|
+
L.log.push({
|
|
3058
3080
|
type: "debug",
|
|
3059
3081
|
message: e
|
|
3060
|
-
}),
|
|
3082
|
+
}), L.log.length > 1e3 && L.log.shift();
|
|
3061
3083
|
},
|
|
3062
3084
|
error: e => {
|
|
3063
|
-
|
|
3085
|
+
L.log.push({
|
|
3064
3086
|
type: "error",
|
|
3065
3087
|
message: e
|
|
3066
|
-
}),
|
|
3088
|
+
}), L.log.length > 1e3 && L.log.shift();
|
|
3067
3089
|
}
|
|
3068
3090
|
};
|
|
3069
3091
|
|
|
3070
|
-
Object.defineProperty(
|
|
3092
|
+
Object.defineProperty(L, "log", {
|
|
3071
3093
|
writable: !1,
|
|
3072
3094
|
enumerable: !1,
|
|
3073
3095
|
configurable: !1
|
|
@@ -3123,9 +3145,9 @@ Object.defineProperty(O, "log", {
|
|
|
3123
3145
|
env: "both",
|
|
3124
3146
|
subCommand: []
|
|
3125
3147
|
} ]
|
|
3126
|
-
},
|
|
3148
|
+
}, I);
|
|
3127
3149
|
|
|
3128
|
-
var
|
|
3150
|
+
var R = {
|
|
3129
3151
|
rnd: () => Math.floor(1e5 + Math.random() * dphelper.math.tmr()),
|
|
3130
3152
|
tmr: () => Math.round(dphelper.date.epoch() / 1e3),
|
|
3131
3153
|
isOdd: e => Number(e) % 2 != 0,
|
|
@@ -3204,9 +3226,9 @@ dphelper?.setDescription({
|
|
|
3204
3226
|
env: "both",
|
|
3205
3227
|
subCommand: []
|
|
3206
3228
|
} ]
|
|
3207
|
-
},
|
|
3229
|
+
}, R);
|
|
3208
3230
|
|
|
3209
|
-
var
|
|
3231
|
+
var z = {
|
|
3210
3232
|
lock: e => {
|
|
3211
3233
|
if (!e) return;
|
|
3212
3234
|
const t = window, o = e.split(".");
|
|
@@ -3263,9 +3285,9 @@ dphelper?.setDescription({
|
|
|
3263
3285
|
env: "client",
|
|
3264
3286
|
subCommand: []
|
|
3265
3287
|
} ]
|
|
3266
|
-
},
|
|
3288
|
+
}, z);
|
|
3267
3289
|
|
|
3268
|
-
var
|
|
3290
|
+
var F = {
|
|
3269
3291
|
load: async e => {
|
|
3270
3292
|
const t = document.body;
|
|
3271
3293
|
let o = e.startsWith("/") ? e.split("/")[1] || "home" : e;
|
|
@@ -3289,6 +3311,7 @@ var z = {
|
|
|
3289
3311
|
l && l.length > 0 && (t.className = t.className.replace(/path-\w+/g, "").trim(),
|
|
3290
3312
|
t.classList.add(`path-${l[l.length - 1]}`)), globalThis.dphelper.navigation.ajax_running && dphelper.navigation.ajax();
|
|
3291
3313
|
} catch (t) {
|
|
3314
|
+
console.error("Navigation error:", t);
|
|
3292
3315
|
const o = window.location.origin;
|
|
3293
3316
|
if (e.startsWith("/") && !e.startsWith("//") && !e.match(/^[a-zA-Z]:/)) {
|
|
3294
3317
|
new URL(e, o).href.startsWith(o) && (window.location.href = e);
|
|
@@ -3351,9 +3374,9 @@ dphelper?.setDescription({
|
|
|
3351
3374
|
env: "client",
|
|
3352
3375
|
subCommand: []
|
|
3353
3376
|
} ]
|
|
3354
|
-
},
|
|
3377
|
+
}, F);
|
|
3355
3378
|
|
|
3356
|
-
var
|
|
3379
|
+
var U = {
|
|
3357
3380
|
smartFetch: async (e, t = {}, o = 3, a = 1e3) => {
|
|
3358
3381
|
try {
|
|
3359
3382
|
const a = await globalThis.fetch(e, t);
|
|
@@ -3361,7 +3384,8 @@ var _ = {
|
|
|
3361
3384
|
return a;
|
|
3362
3385
|
} catch (n) {
|
|
3363
3386
|
if (0 === o) throw n;
|
|
3364
|
-
return
|
|
3387
|
+
return console.warn(`[dphelper.net] Fetch failed, retrying in ${a}ms... (${o} retries left)`, n),
|
|
3388
|
+
await new Promise(e => setTimeout(e, a)), U.smartFetch(e, t, o - 1, 2 * a);
|
|
3365
3389
|
}
|
|
3366
3390
|
}
|
|
3367
3391
|
};
|
|
@@ -3382,9 +3406,9 @@ dphelper?.setDescription({
|
|
|
3382
3406
|
env: "both",
|
|
3383
3407
|
subCommand: []
|
|
3384
3408
|
} ]
|
|
3385
|
-
},
|
|
3409
|
+
}, U);
|
|
3386
3410
|
|
|
3387
|
-
var
|
|
3411
|
+
var _ = {
|
|
3388
3412
|
replaceNullObjects: e => {
|
|
3389
3413
|
const t = {
|
|
3390
3414
|
...e
|
|
@@ -3425,7 +3449,7 @@ var F = {
|
|
|
3425
3449
|
try {
|
|
3426
3450
|
return JSON.parse(e);
|
|
3427
3451
|
} catch (t) {
|
|
3428
|
-
return e;
|
|
3452
|
+
return console.error(t), e;
|
|
3429
3453
|
}
|
|
3430
3454
|
},
|
|
3431
3455
|
isObject: e => "object" == typeof e && null !== e,
|
|
@@ -3551,9 +3575,9 @@ dphelper?.setDescription({
|
|
|
3551
3575
|
env: "both",
|
|
3552
3576
|
subCommand: []
|
|
3553
3577
|
} ]
|
|
3554
|
-
},
|
|
3578
|
+
}, _);
|
|
3555
3579
|
|
|
3556
|
-
var
|
|
3580
|
+
var H = {
|
|
3557
3581
|
rail: () => (location.href.split("?")[0] || "").replace(location.protocol, "").replace(location.host, "").replace(location.hash, "").split("/").filter(e => e),
|
|
3558
3582
|
hash: () => {
|
|
3559
3583
|
const e = location.hash.replace("#", "").split("/");
|
|
@@ -3605,9 +3629,9 @@ dphelper?.setDescription({
|
|
|
3605
3629
|
env: "both",
|
|
3606
3630
|
subCommand: []
|
|
3607
3631
|
} ]
|
|
3608
|
-
},
|
|
3632
|
+
}, H);
|
|
3609
3633
|
|
|
3610
|
-
var
|
|
3634
|
+
var J = {
|
|
3611
3635
|
check: e => null != e && (e instanceof Promise || "[object Promise]" === Object.prototype.toString.call(e) || "object" == typeof e && "function" == typeof e.then)
|
|
3612
3636
|
};
|
|
3613
3637
|
|
|
@@ -3627,7 +3651,7 @@ dphelper?.setDescription({
|
|
|
3627
3651
|
env: "both",
|
|
3628
3652
|
subCommand: []
|
|
3629
3653
|
} ]
|
|
3630
|
-
},
|
|
3654
|
+
}, J);
|
|
3631
3655
|
|
|
3632
3656
|
dphelper?.setDescription({
|
|
3633
3657
|
name: "sanitize",
|
|
@@ -3649,7 +3673,7 @@ dphelper?.setDescription({
|
|
|
3649
3673
|
html: e => "string" != typeof e ? "" : e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/")
|
|
3650
3674
|
});
|
|
3651
3675
|
|
|
3652
|
-
var
|
|
3676
|
+
var B = "dphelper_popup_positions", Y = (e, t, o, a) => `${e}x${t}@${o},${a}`, G = () => {
|
|
3653
3677
|
const e = [];
|
|
3654
3678
|
return e.push({
|
|
3655
3679
|
id: "primary",
|
|
@@ -3666,8 +3690,8 @@ var J = "dphelper_popup_positions", B = (e, t, o, a) => `${e}x${t}@${o},${a}`, Y
|
|
|
3666
3690
|
top: window.screenTop,
|
|
3667
3691
|
isPrimary: !1
|
|
3668
3692
|
}), e;
|
|
3669
|
-
},
|
|
3670
|
-
const o =
|
|
3693
|
+
}, W = (e, t) => {
|
|
3694
|
+
const o = G();
|
|
3671
3695
|
for (const a of o) if (e >= a.left && e < a.left + a.width && t >= a.top && t < a.top + a.height) return a;
|
|
3672
3696
|
if (!o.length) return {
|
|
3673
3697
|
id: "default",
|
|
@@ -3683,21 +3707,23 @@ var J = "dphelper_popup_positions", B = (e, t, o, a) => `${e}x${t}@${o},${a}`, Y
|
|
|
3683
3707
|
s < n && (n = s, a = r);
|
|
3684
3708
|
}
|
|
3685
3709
|
return a;
|
|
3686
|
-
},
|
|
3710
|
+
}, V = () => {
|
|
3687
3711
|
try {
|
|
3688
|
-
const e = localStorage.getItem(
|
|
3712
|
+
const e = localStorage.getItem(B);
|
|
3689
3713
|
if (e) return JSON.parse(e);
|
|
3690
|
-
} catch (e) {
|
|
3714
|
+
} catch (e) {
|
|
3715
|
+
console.warn("[dphelper] Failed to parse popup storage:", e);
|
|
3716
|
+
}
|
|
3691
3717
|
return {
|
|
3692
3718
|
monitors: [],
|
|
3693
3719
|
popups: {}
|
|
3694
3720
|
};
|
|
3695
|
-
},
|
|
3721
|
+
}, Z = (e, t) => {
|
|
3696
3722
|
if ("undefined" == typeof window) return;
|
|
3697
|
-
const o = t || window, a = o.screenX || o.screenLeft || 0, n = o.screenY || o.screenTop || 0, r = o.outerWidth || 800, i = o.outerHeight || 600, s =
|
|
3723
|
+
const o = t || window, a = o.screenX || o.screenLeft || 0, n = o.screenY || o.screenTop || 0, r = o.outerWidth || 800, i = o.outerHeight || 600, s = G(), l = W(a, n), {relX: c, relY: d} = ((e, t, o) => ({
|
|
3698
3724
|
relX: e - o.left,
|
|
3699
3725
|
relY: t - o.top
|
|
3700
|
-
}))(a, n, l), p =
|
|
3726
|
+
}))(a, n, l), p = Y(l.width, l.height, l.left, l.top), u = V();
|
|
3701
3727
|
u.monitors = s, u.popups[e] = {
|
|
3702
3728
|
id: e,
|
|
3703
3729
|
monitorId: l.id,
|
|
@@ -3706,14 +3732,15 @@ var J = "dphelper_popup_positions", B = (e, t, o, a) => `${e}x${t}@${o},${a}`, Y
|
|
|
3706
3732
|
width: r,
|
|
3707
3733
|
height: i,
|
|
3708
3734
|
monitorFingerprint: p
|
|
3709
|
-
}, localStorage.setItem(
|
|
3710
|
-
},
|
|
3735
|
+
}, localStorage.setItem(B, JSON.stringify(u));
|
|
3736
|
+
}, K = e => {
|
|
3711
3737
|
if ("undefined" == typeof window) return null;
|
|
3712
|
-
const t =
|
|
3738
|
+
const t = V().popups[e];
|
|
3713
3739
|
if (!t) return null;
|
|
3714
|
-
const o =
|
|
3740
|
+
const o = G(), a = o.find(e => Y(e.width, e.height, e.left, e.top) === t.monitorFingerprint);
|
|
3715
3741
|
let n;
|
|
3716
|
-
n = a
|
|
3742
|
+
a ? n = a : (console.warn(`[dphelper] Monitor changed, restoring popup "${e}" on closest available monitor`),
|
|
3743
|
+
n = W(t.left + (o[0]?.left || 0), t.top + (o[0]?.top || 0)));
|
|
3717
3744
|
const {left: r, top: i} = (s = t.left, l = t.top, {
|
|
3718
3745
|
left: (c = n).left + s,
|
|
3719
3746
|
top: c.top + l
|
|
@@ -3725,19 +3752,19 @@ var J = "dphelper_popup_positions", B = (e, t, o, a) => `${e}x${t}@${o},${a}`, Y
|
|
|
3725
3752
|
width: t.width,
|
|
3726
3753
|
height: t.height
|
|
3727
3754
|
};
|
|
3728
|
-
},
|
|
3729
|
-
const t =
|
|
3730
|
-
delete t.popups[e], localStorage.setItem(
|
|
3731
|
-
},
|
|
3732
|
-
localStorage.removeItem(
|
|
3733
|
-
},
|
|
3755
|
+
}, X = e => {
|
|
3756
|
+
const t = V();
|
|
3757
|
+
delete t.popups[e], localStorage.setItem(B, JSON.stringify(t));
|
|
3758
|
+
}, Q = () => V().popups, ee = () => {
|
|
3759
|
+
localStorage.removeItem(B);
|
|
3760
|
+
}, te = () => W(window.screenX || 0, window.screenY || 0), oe = {
|
|
3734
3761
|
fullScreen: e => {
|
|
3735
3762
|
const t = document.querySelector(e);
|
|
3736
3763
|
t.requestFullscreen ? t.requestFullscreen() : t.mozRequestFullScreen ? t.mozRequestFullScreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen && t.msRequestFullscreen();
|
|
3737
3764
|
},
|
|
3738
3765
|
toggle: e => {
|
|
3739
3766
|
const t = document, o = t.querySelector(e);
|
|
3740
|
-
o
|
|
3767
|
+
o ? t.fullscreenElement || t.mozFullScreenElement || t.webkitFullscreenElement ? t.exitFullscreen ? t.exitFullscreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.webkitExitFullscreen ? t.webkitExitFullscreen() : t.msExitFullscreen && t.msExitFullscreen() : o.requestFullscreen ? o.requestFullscreen() : o.mozRequestFullScreen ? o.mozRequestFullScreen() : o.webkitRequestFullscreen ? o.webkitRequestFullscreen() : o.msRequestFullscreen && o.msRequestFullscreen() : console.error(`Element not found: ${e}`);
|
|
3741
3768
|
},
|
|
3742
3769
|
info: () => ({
|
|
3743
3770
|
width: screen.width,
|
|
@@ -3749,16 +3776,16 @@ var J = "dphelper_popup_positions", B = (e, t, o, a) => `${e}x${t}@${o},${a}`, Y
|
|
|
3749
3776
|
}),
|
|
3750
3777
|
popup: {
|
|
3751
3778
|
save: (e, t) => {
|
|
3752
|
-
|
|
3779
|
+
Z(e, t);
|
|
3753
3780
|
},
|
|
3754
|
-
restore: e =>
|
|
3781
|
+
restore: e => K(e),
|
|
3755
3782
|
remove: e => {
|
|
3756
|
-
|
|
3783
|
+
X(e);
|
|
3757
3784
|
},
|
|
3758
|
-
list: () =>
|
|
3759
|
-
getCurrentMonitor: () =>
|
|
3785
|
+
list: () => Q(),
|
|
3786
|
+
getCurrentMonitor: () => te(),
|
|
3760
3787
|
clear: () => {
|
|
3761
|
-
|
|
3788
|
+
ee();
|
|
3762
3789
|
}
|
|
3763
3790
|
}
|
|
3764
3791
|
};
|
|
@@ -3875,9 +3902,9 @@ dphelper?.setDescription({
|
|
|
3875
3902
|
env: "client",
|
|
3876
3903
|
subCommand: []
|
|
3877
3904
|
} ]
|
|
3878
|
-
},
|
|
3905
|
+
}, oe);
|
|
3879
3906
|
|
|
3880
|
-
var
|
|
3907
|
+
var ae = {
|
|
3881
3908
|
custom: (e, t) => {
|
|
3882
3909
|
t.color_1 = t?.color_1 || "black", t.color_1_hover = t?.color_1_hover || "black",
|
|
3883
3910
|
t.color_2 = t?.color_2 || "transparent", t.color_3 = t?.color_3 || "rgba(30,150,255,.5)",
|
|
@@ -3904,7 +3931,7 @@ var oe = {
|
|
|
3904
3931
|
e.style.width = 0;
|
|
3905
3932
|
});
|
|
3906
3933
|
} catch (e) {
|
|
3907
|
-
return;
|
|
3934
|
+
return void console.error(e);
|
|
3908
3935
|
} else o.style.width = "0%";
|
|
3909
3936
|
},
|
|
3910
3937
|
position: {
|
|
@@ -3918,7 +3945,9 @@ var oe = {
|
|
|
3918
3945
|
if (localStorage.getItem(e)) try {
|
|
3919
3946
|
const t = localStorage.getItem(e), o = "string" == typeof e ? document.querySelector(e) : e;
|
|
3920
3947
|
o && t && (o.scrollTop = t[0], o.scrollLeft = t[1]);
|
|
3921
|
-
} catch (e) {
|
|
3948
|
+
} catch (e) {
|
|
3949
|
+
console.error("Error getting scroll position:", e);
|
|
3950
|
+
}
|
|
3922
3951
|
}
|
|
3923
3952
|
},
|
|
3924
3953
|
smooth: (e, t, o) => {
|
|
@@ -4025,16 +4054,16 @@ dphelper?.setDescription({
|
|
|
4025
4054
|
env: "client",
|
|
4026
4055
|
subCommand: []
|
|
4027
4056
|
} ]
|
|
4028
|
-
},
|
|
4057
|
+
}, ae);
|
|
4029
4058
|
|
|
4030
|
-
var
|
|
4031
|
-
const o =
|
|
4059
|
+
var ne = new TextEncoder, re = new TextDecoder, ie = async (e, t) => {
|
|
4060
|
+
const o = ne.encode(t), a = await crypto.subtle.importKey("raw", o, {
|
|
4032
4061
|
name: "HMAC",
|
|
4033
4062
|
hash: "SHA-256"
|
|
4034
|
-
}, !1, [ "sign" ]), n = await crypto.subtle.sign("HMAC", a,
|
|
4063
|
+
}, !1, [ "sign" ]), n = await crypto.subtle.sign("HMAC", a, ne.encode(e));
|
|
4035
4064
|
return Array.from(new Uint8Array(n)).map(e => e.toString(16).padStart(2, "0")).join("");
|
|
4036
|
-
},
|
|
4037
|
-
const a = await crypto.subtle.importKey("raw",
|
|
4065
|
+
}, se = async (e, t, o) => {
|
|
4066
|
+
const a = await crypto.subtle.importKey("raw", ne.encode(e), "PBKDF2", !1, [ "deriveBits", "deriveKey" ]);
|
|
4038
4067
|
return crypto.subtle.deriveKey({
|
|
4039
4068
|
name: "PBKDF2",
|
|
4040
4069
|
salt: t.buffer,
|
|
@@ -4044,11 +4073,11 @@ var ae = new TextEncoder, ne = new TextDecoder, re = async (e, t) => {
|
|
|
4044
4073
|
name: "AES-GCM",
|
|
4045
4074
|
length: 256
|
|
4046
4075
|
}, !1, [ "encrypt", "decrypt" ]);
|
|
4047
|
-
},
|
|
4048
|
-
const o = crypto.getRandomValues(new Uint8Array(16)), a = crypto.getRandomValues(new Uint8Array(12)), n = await
|
|
4076
|
+
}, le = async (e, t) => {
|
|
4077
|
+
const o = crypto.getRandomValues(new Uint8Array(16)), a = crypto.getRandomValues(new Uint8Array(12)), n = await se(t, new Uint8Array(o.buffer), 1e5), r = await crypto.subtle.encrypt({
|
|
4049
4078
|
name: "AES-GCM",
|
|
4050
4079
|
iv: new Uint8Array(a.buffer)
|
|
4051
|
-
}, n,
|
|
4080
|
+
}, n, ne.encode(e)), i = new Uint8Array(o.length + a.length + r.byteLength);
|
|
4052
4081
|
return i.set(o, 0), i.set(a, o.length), i.set(new Uint8Array(r), o.length + a.length),
|
|
4053
4082
|
(e => {
|
|
4054
4083
|
const t = new Uint8Array(e);
|
|
@@ -4056,24 +4085,25 @@ var ae = new TextEncoder, ne = new TextDecoder, re = async (e, t) => {
|
|
|
4056
4085
|
for (let e = 0; e < t.byteLength; e++) o += String.fromCharCode(t[e]);
|
|
4057
4086
|
return btoa(o);
|
|
4058
4087
|
})(i.buffer);
|
|
4059
|
-
},
|
|
4088
|
+
}, ce = async (e, t) => {
|
|
4060
4089
|
try {
|
|
4061
4090
|
const o = new Uint8Array((e => {
|
|
4062
4091
|
const t = atob(e), o = new Uint8Array(t.length);
|
|
4063
4092
|
for (let e = 0; e < t.length; e++) o[e] = t.charCodeAt(e);
|
|
4064
4093
|
return o.buffer;
|
|
4065
|
-
})(e)), a = o.slice(0, 16), n = o.slice(16, 28), r = o.slice(28), i = await
|
|
4094
|
+
})(e)), a = o.slice(0, 16), n = o.slice(16, 28), r = o.slice(28), i = await se(t, new Uint8Array(a.buffer), 1e5), s = await crypto.subtle.decrypt({
|
|
4066
4095
|
name: "AES-GCM",
|
|
4067
4096
|
iv: new Uint8Array(n.buffer)
|
|
4068
4097
|
}, i, r);
|
|
4069
|
-
return
|
|
4098
|
+
return re.decode(s);
|
|
4070
4099
|
} catch {
|
|
4071
4100
|
return "";
|
|
4072
4101
|
}
|
|
4073
|
-
},
|
|
4102
|
+
}, de = -1, pe = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Y", "Z" ], ue = {
|
|
4074
4103
|
uuid: {
|
|
4075
4104
|
byVal: e => {
|
|
4076
|
-
if (!e) return ""
|
|
4105
|
+
if (!e) return console.warn("You need to pass a value to obtain a fixed uuid"),
|
|
4106
|
+
"";
|
|
4077
4107
|
const t = dphelper.security.SHA256_Hex(e);
|
|
4078
4108
|
return [ t.slice(0, 8), t.slice(8, 4), `4${t.slice(12, 3)}`, `8${t.slice(15, 3)}`, t.slice(18, 12) ].join("-");
|
|
4079
4109
|
},
|
|
@@ -4087,32 +4117,34 @@ var ae = new TextEncoder, ne = new TextDecoder, re = async (e, t) => {
|
|
|
4087
4117
|
const a = crypto.getRandomValues(new Uint8Array(16)), n = Array.from(a).map(e => e.toString(16).padStart(2, "0")).join(""), r = (new TextEncoder).encode(t.toLowerCase() + e.toLowerCase() + n), i = await crypto.subtle.digest(o, r.buffer);
|
|
4088
4118
|
return n + Array.from(new Uint8Array(i)).map(e => e.toString(16).padStart(2, "0")).join("");
|
|
4089
4119
|
},
|
|
4090
|
-
crypt: async (e, t, o = "AES") => "AES" !== o ? "
|
|
4091
|
-
|
|
4120
|
+
crypt: async (e, t, o = "AES") => "AES" !== o ? (console.warn("Only AES mode is supported in Web Crypto API"),
|
|
4121
|
+
"") : le(e, t),
|
|
4122
|
+
deCrypt: async (e, t, o = "AES") => "AES" !== o ? (console.warn("Only AES mode is supported in Web Crypto API"),
|
|
4123
|
+
"") : ce(e, t),
|
|
4092
4124
|
AES_KeyGen: async e => {
|
|
4093
4125
|
const t = e || crypto.randomUUID(), o = crypto.getRandomValues(new Uint8Array(16)), a = Array.from(o).map(e => e.toString(16).padStart(2, "0")).join(""), n = await crypto.subtle.deriveBits({
|
|
4094
4126
|
name: "PBKDF2",
|
|
4095
4127
|
salt: o.buffer,
|
|
4096
4128
|
iterations: 6e5,
|
|
4097
4129
|
hash: "SHA-256"
|
|
4098
|
-
}, await crypto.subtle.importKey("raw",
|
|
4130
|
+
}, await crypto.subtle.importKey("raw", ne.encode(t), "PBKDF2", !1, [ "deriveBits" ]), 512);
|
|
4099
4131
|
return a + Array.from(new Uint8Array(n)).map(e => e.toString(16).padStart(2, "0")).join("");
|
|
4100
4132
|
},
|
|
4101
4133
|
SHA256_Hex: async e => (async e => {
|
|
4102
|
-
const t =
|
|
4134
|
+
const t = ne.encode(e), o = await crypto.subtle.digest("SHA-256", t);
|
|
4103
4135
|
return Array.from(new Uint8Array(o)).map(e => e.toString(16).padStart(2, "0")).join("");
|
|
4104
4136
|
})(e),
|
|
4105
4137
|
ulid: () => {
|
|
4106
4138
|
const e = new Uint8Array(16), t = new DataView(e.buffer, 0, 6), o = new Uint8Array(e.buffer, 6, 10), a = new Array(26), n = Date.now();
|
|
4107
|
-
if (n ===
|
|
4139
|
+
if (n === de) for (let e = 9; e >= 0; e--) {
|
|
4108
4140
|
if (void 0 !== o[e] && o[e]++ < 255) break;
|
|
4109
|
-
} else
|
|
4141
|
+
} else de = n, t.setUint16(0, n / 4294967296 | 0), t.setUint32(2, 0 | n), window.crypto.getRandomValues(o);
|
|
4110
4142
|
return (e => {
|
|
4111
|
-
a[0] =
|
|
4112
|
-
for (let t = 0; t < 3; t++) a[8 * t + 2] =
|
|
4113
|
-
a[8 * t + 4] =
|
|
4114
|
-
a[8 * t + 6] =
|
|
4115
|
-
a[8 * t + 8] =
|
|
4143
|
+
a[0] = pe[e[0] >> 5], a[1] = pe[31 & e[0]];
|
|
4144
|
+
for (let t = 0; t < 3; t++) a[8 * t + 2] = pe[e[5 * t + 1] >> 3], a[8 * t + 3] = pe[31 & (e[5 * t + 1] << 2 | e[5 * t + 2] >> 6)],
|
|
4145
|
+
a[8 * t + 4] = pe[e[5 * t + 2] >> 1 & 31], a[8 * t + 5] = pe[31 & (e[5 * t + 2] << 4 | e[5 * t + 3] >> 4)],
|
|
4146
|
+
a[8 * t + 6] = pe[31 & (e[5 * t + 3] << 1 | e[5 * t + 4] >> 7)], a[8 * t + 7] = pe[e[5 * t + 4] >> 2 & 31],
|
|
4147
|
+
a[8 * t + 8] = pe[31 & (e[5 * t + 4] << 3 | e[5 * t + 5] >> 5)], a[8 * t + 9] = pe[31 & e[5 * t + 5]];
|
|
4116
4148
|
return a.join("");
|
|
4117
4149
|
})(e);
|
|
4118
4150
|
},
|
|
@@ -4127,7 +4159,7 @@ var ae = new TextEncoder, ne = new TextDecoder, re = async (e, t) => {
|
|
|
4127
4159
|
return dphelper.security.SHA256_Hex(i);
|
|
4128
4160
|
},
|
|
4129
4161
|
saveEncrypted: async (e, t, o) => {
|
|
4130
|
-
const a = await dphelper.security.crypt(t, o), n = await
|
|
4162
|
+
const a = await dphelper.security.crypt(t, o), n = await ie(a, o);
|
|
4131
4163
|
localStorage.setItem(e, JSON.stringify({
|
|
4132
4164
|
d: a,
|
|
4133
4165
|
h: n,
|
|
@@ -4138,17 +4170,18 @@ var ae = new TextEncoder, ne = new TextDecoder, re = async (e, t) => {
|
|
|
4138
4170
|
const o = localStorage.getItem(e);
|
|
4139
4171
|
if (!o) return null;
|
|
4140
4172
|
try {
|
|
4141
|
-
const
|
|
4142
|
-
if (
|
|
4143
|
-
const o = await
|
|
4144
|
-
return
|
|
4173
|
+
const a = JSON.parse(o);
|
|
4174
|
+
if (a && a.h && a.d) {
|
|
4175
|
+
const o = await ie(a.d, t);
|
|
4176
|
+
return a.h !== o ? (console.error(`[dphelper] Security Alert: Data tampering detected for key "${e}"`),
|
|
4177
|
+
null) : dphelper.security.deCrypt(a.d, t);
|
|
4145
4178
|
}
|
|
4146
4179
|
return dphelper.security.deCrypt(o, t);
|
|
4147
|
-
} catch (
|
|
4180
|
+
} catch (a) {
|
|
4148
4181
|
try {
|
|
4149
4182
|
return dphelper.security.deCrypt(o, t);
|
|
4150
|
-
} catch (
|
|
4151
|
-
return null;
|
|
4183
|
+
} catch (t) {
|
|
4184
|
+
return console.warn(`[dphelper] Persistence Error for key "${e}":`, t), null;
|
|
4152
4185
|
}
|
|
4153
4186
|
}
|
|
4154
4187
|
}
|
|
@@ -4313,9 +4346,9 @@ dphelper?.setDescription({
|
|
|
4313
4346
|
env: "both",
|
|
4314
4347
|
subCommand: []
|
|
4315
4348
|
} ]
|
|
4316
|
-
},
|
|
4349
|
+
}, ue);
|
|
4317
4350
|
|
|
4318
|
-
var
|
|
4351
|
+
var me = {
|
|
4319
4352
|
keys: (e, t) => {
|
|
4320
4353
|
const o = e.which ? e.which : e.keyCode;
|
|
4321
4354
|
t || (t = {
|
|
@@ -4361,14 +4394,14 @@ dphelper?.setDescription({
|
|
|
4361
4394
|
env: "client",
|
|
4362
4395
|
subCommand: []
|
|
4363
4396
|
} ]
|
|
4364
|
-
},
|
|
4397
|
+
}, me);
|
|
4365
4398
|
|
|
4366
|
-
var
|
|
4399
|
+
var he = {
|
|
4367
4400
|
ws: {}
|
|
4368
|
-
},
|
|
4401
|
+
}, ve = {
|
|
4369
4402
|
info: () => "Created by Dario Passariello",
|
|
4370
4403
|
start: (e, t, o = "general") => {
|
|
4371
|
-
|
|
4404
|
+
he.ws = {}, dphelper.socket.connect(t, o), dphelper.socket.receive(e, o);
|
|
4372
4405
|
},
|
|
4373
4406
|
conn: (e, t, o) => {
|
|
4374
4407
|
if (e && t) try {
|
|
@@ -4376,15 +4409,15 @@ var me = {
|
|
|
4376
4409
|
try {
|
|
4377
4410
|
a = new URL(t);
|
|
4378
4411
|
} catch {
|
|
4379
|
-
if (t.startsWith("/") || t.startsWith("ws") || t.startsWith("wss")) return;
|
|
4412
|
+
if (t.startsWith("/") || t.startsWith("ws") || t.startsWith("wss")) return void console.error("Invalid WebSocket URL");
|
|
4380
4413
|
a = new URL(t, window.location.origin);
|
|
4381
4414
|
}
|
|
4382
|
-
if ("ws:" === a.protocol) return;
|
|
4415
|
+
if ("ws:" === a.protocol) return void console.error("Insecure WebSocket protocol 'ws://' - must use 'wss://'");
|
|
4383
4416
|
const n = new WebSocket(t);
|
|
4384
4417
|
return n.binaryType = "blob", n.onmessage = e => {}, [ n, e, o ];
|
|
4385
4418
|
} catch (e) {
|
|
4386
|
-
return;
|
|
4387
|
-
}
|
|
4419
|
+
return void console.error(e);
|
|
4420
|
+
} else console.debug("please use connect!");
|
|
4388
4421
|
},
|
|
4389
4422
|
connect: (e, t) => {
|
|
4390
4423
|
e && dphelper.socket.open(dphelper.security.uuid.v5, e, t);
|
|
@@ -4393,30 +4426,36 @@ var me = {
|
|
|
4393
4426
|
if (e) try {
|
|
4394
4427
|
const a = dphelper.socket.conn(e, t, o);
|
|
4395
4428
|
if (!a) return;
|
|
4396
|
-
|
|
4429
|
+
he.ws[o] = a, -1 === dphelper._list.sockets.indexOf(a[0]) && dphelper._list.sockets.push(a[0]),
|
|
4397
4430
|
a[0].onopen = () => dphelper.log.reg(`${e} connected`), a[0].onclose = e => dphelper.log.debug(e.wasClean ? "Disconnected" : `Connection break: ${e.reason || e.code}`),
|
|
4398
4431
|
a[0].onerror = e => dphelper.log?.error(e);
|
|
4399
|
-
} catch (e) {
|
|
4432
|
+
} catch (e) {
|
|
4433
|
+
console.error(e);
|
|
4434
|
+
}
|
|
4400
4435
|
},
|
|
4401
4436
|
send: (e, t, o) => {
|
|
4402
|
-
if (
|
|
4403
|
-
const a =
|
|
4437
|
+
if (he.ws[o]?.[1] && e) try {
|
|
4438
|
+
const a = he.ws[o];
|
|
4404
4439
|
if (!a) return;
|
|
4405
4440
|
const n = a[0], r = a[1], i = t ? JSON.stringify({
|
|
4406
4441
|
[t]: `(${r}:${e})`
|
|
4407
4442
|
}) : e;
|
|
4408
4443
|
n.send(i);
|
|
4409
|
-
} catch (e) {
|
|
4444
|
+
} catch (e) {
|
|
4445
|
+
console.error(e);
|
|
4446
|
+
}
|
|
4410
4447
|
},
|
|
4411
4448
|
ping: e => {
|
|
4412
|
-
if (
|
|
4413
|
-
const t =
|
|
4449
|
+
if (he.ws[e]?.[1]) try {
|
|
4450
|
+
const t = he.ws[e];
|
|
4414
4451
|
t?.[0]?.send('{"debug":"__ping__"}');
|
|
4415
|
-
} catch (e) {
|
|
4452
|
+
} catch (e) {
|
|
4453
|
+
console.error(e);
|
|
4454
|
+
}
|
|
4416
4455
|
},
|
|
4417
4456
|
receive: (e, t) => {
|
|
4418
|
-
if (
|
|
4419
|
-
const o =
|
|
4457
|
+
if (he.ws[t]?.[1]) try {
|
|
4458
|
+
const o = he.ws[t];
|
|
4420
4459
|
o[0].onmessage = async t => {
|
|
4421
4460
|
try {
|
|
4422
4461
|
if (e) {
|
|
@@ -4429,11 +4468,13 @@ var me = {
|
|
|
4429
4468
|
} catch (e) {}
|
|
4430
4469
|
dphelper.log.reg(t.data);
|
|
4431
4470
|
};
|
|
4432
|
-
} catch (e) {
|
|
4471
|
+
} catch (e) {
|
|
4472
|
+
console.error(e);
|
|
4473
|
+
}
|
|
4433
4474
|
},
|
|
4434
4475
|
keepAlive: e => {
|
|
4435
4476
|
try {
|
|
4436
|
-
const t =
|
|
4477
|
+
const t = he.ws[e];
|
|
4437
4478
|
if (!t) return;
|
|
4438
4479
|
let o;
|
|
4439
4480
|
const a = t[0], n = (t = 5e3) => {
|
|
@@ -4444,9 +4485,13 @@ var me = {
|
|
|
4444
4485
|
a.onopen = () => setInterval(n, 3e4), a.onmessage = e => {
|
|
4445
4486
|
try {
|
|
4446
4487
|
return void ("__ping__" === Object.values(JSON.parse(e.data))[0] && r());
|
|
4447
|
-
} catch (e) {
|
|
4488
|
+
} catch (e) {
|
|
4489
|
+
console.error(e);
|
|
4490
|
+
}
|
|
4448
4491
|
};
|
|
4449
|
-
} catch (e) {
|
|
4492
|
+
} catch (e) {
|
|
4493
|
+
console.error(e);
|
|
4494
|
+
}
|
|
4450
4495
|
},
|
|
4451
4496
|
check: () => {
|
|
4452
4497
|
dphelper._list.sockets = dphelper._list.sockets.filter(e => e.readyState !== WebSocket.CLOSED);
|
|
@@ -4578,9 +4623,9 @@ dphelper?.setDescription({
|
|
|
4578
4623
|
env: "client",
|
|
4579
4624
|
subCommand: []
|
|
4580
4625
|
} ]
|
|
4581
|
-
},
|
|
4626
|
+
}, ve), dphelper?.socket?.check();
|
|
4582
4627
|
|
|
4583
|
-
var
|
|
4628
|
+
var fe = {
|
|
4584
4629
|
open: (e, t = {}) => {
|
|
4585
4630
|
const o = {
|
|
4586
4631
|
message: [],
|
|
@@ -4650,9 +4695,9 @@ dphelper?.setDescription({
|
|
|
4650
4695
|
env: "client",
|
|
4651
4696
|
subCommand: []
|
|
4652
4697
|
} ]
|
|
4653
|
-
},
|
|
4698
|
+
}, fe);
|
|
4654
4699
|
|
|
4655
|
-
var
|
|
4700
|
+
var be = {
|
|
4656
4701
|
init: (e, t, o, a) => {
|
|
4657
4702
|
e.querySelector("svg") && dphelper.svg.removeConnection(e), t = [ dphelper.svg.setConnector(t[0], t[1]), t[1] ],
|
|
4658
4703
|
o = [ dphelper.svg.setConnector(o[0], o[1]), o[1] ];
|
|
@@ -4932,9 +4977,9 @@ dphelper?.setDescription({
|
|
|
4932
4977
|
env: "client",
|
|
4933
4978
|
subCommand: []
|
|
4934
4979
|
} ]
|
|
4935
|
-
},
|
|
4980
|
+
}, be), dphelper?.svg?.check();
|
|
4936
4981
|
|
|
4937
|
-
var
|
|
4982
|
+
var ge = {
|
|
4938
4983
|
pulse: (e, t) => {
|
|
4939
4984
|
if ("undefined" == typeof BroadcastChannel) return {
|
|
4940
4985
|
emit: () => {},
|
|
@@ -4945,7 +4990,9 @@ var be = {
|
|
|
4945
4990
|
if (e.origin === window.location.origin || !e.origin) try {
|
|
4946
4991
|
const o = e.data;
|
|
4947
4992
|
!o || "object" != typeof o || o.__proto__ || o.constructor || t(o);
|
|
4948
|
-
} catch (e) {
|
|
4993
|
+
} catch (e) {
|
|
4994
|
+
console.warn("[dphelper] Invalid message received in pulse:", e);
|
|
4995
|
+
}
|
|
4949
4996
|
}, {
|
|
4950
4997
|
emit: e => o.postMessage(e),
|
|
4951
4998
|
stop: () => o.close()
|
|
@@ -4961,7 +5008,9 @@ var be = {
|
|
|
4961
5008
|
if (e.origin === window.location.origin || !e.origin) try {
|
|
4962
5009
|
const o = e.data;
|
|
4963
5010
|
!o || "object" != typeof o || o.__proto__ || o.constructor || t(o);
|
|
4964
|
-
} catch (e) {
|
|
5011
|
+
} catch (e) {
|
|
5012
|
+
console.warn("[dphelper] Invalid message received in tab:", e);
|
|
5013
|
+
}
|
|
4965
5014
|
}, {
|
|
4966
5015
|
post: e => o.postMessage(e),
|
|
4967
5016
|
close: () => o.close()
|
|
@@ -5030,7 +5079,7 @@ dphelper?.setDescription({
|
|
|
5030
5079
|
env: "client",
|
|
5031
5080
|
subCommand: []
|
|
5032
5081
|
} ]
|
|
5033
|
-
},
|
|
5082
|
+
}, ge);
|
|
5034
5083
|
|
|
5035
5084
|
dphelper?.setDescription({
|
|
5036
5085
|
name: "system",
|
|
@@ -5059,7 +5108,7 @@ dphelper?.setDescription({
|
|
|
5059
5108
|
}
|
|
5060
5109
|
});
|
|
5061
5110
|
|
|
5062
|
-
var
|
|
5111
|
+
var ye = {
|
|
5063
5112
|
name: "text",
|
|
5064
5113
|
active: !0,
|
|
5065
5114
|
subCommand: [ {
|
|
@@ -5206,7 +5255,7 @@ var ge = {
|
|
|
5206
5255
|
creationDate: "20250612",
|
|
5207
5256
|
lastMod: "20250612"
|
|
5208
5257
|
} ]
|
|
5209
|
-
},
|
|
5258
|
+
}, De = {
|
|
5210
5259
|
trim: (e, t, o, a) => e.charAt(0) === t ? e.substring(o, a) : e,
|
|
5211
5260
|
capitalize: e => e.toLowerCase().replace(/\b\w/g, e => e.toUpperCase()),
|
|
5212
5261
|
lower: e => e.toLowerCase(),
|
|
@@ -5237,9 +5286,9 @@ var ge = {
|
|
|
5237
5286
|
}
|
|
5238
5287
|
};
|
|
5239
5288
|
|
|
5240
|
-
dphelper?.setDescription(
|
|
5289
|
+
dphelper?.setDescription(ye, De);
|
|
5241
5290
|
|
|
5242
|
-
var
|
|
5291
|
+
var we = {
|
|
5243
5292
|
sleep: e => new Promise(t => setTimeout(t, e)),
|
|
5244
5293
|
percentage: (e, t) => {
|
|
5245
5294
|
function o(e) {
|
|
@@ -5278,9 +5327,9 @@ dphelper?.setDescription({
|
|
|
5278
5327
|
env: "both",
|
|
5279
5328
|
subCommand: []
|
|
5280
5329
|
} ]
|
|
5281
|
-
},
|
|
5330
|
+
}, we);
|
|
5282
5331
|
|
|
5283
|
-
var
|
|
5332
|
+
var xe = {
|
|
5284
5333
|
getip: () => {
|
|
5285
5334
|
fetch("https://api.ipify.org?format=json").then(e => e.json()).then(e => e.ip);
|
|
5286
5335
|
},
|
|
@@ -5350,9 +5399,9 @@ dphelper?.setDescription({
|
|
|
5350
5399
|
env: "both",
|
|
5351
5400
|
subCommand: []
|
|
5352
5401
|
} ]
|
|
5353
|
-
},
|
|
5402
|
+
}, xe);
|
|
5354
5403
|
|
|
5355
|
-
var
|
|
5404
|
+
var Ce = {
|
|
5356
5405
|
convertMatrixToScale: e => {
|
|
5357
5406
|
const t = e.split("(");
|
|
5358
5407
|
if (t.length < 2) return 0;
|
|
@@ -5379,34 +5428,36 @@ dphelper?.setDescription({
|
|
|
5379
5428
|
env: "both",
|
|
5380
5429
|
subCommand: []
|
|
5381
5430
|
} ]
|
|
5382
|
-
},
|
|
5431
|
+
}, Ce);
|
|
5383
5432
|
|
|
5384
|
-
var
|
|
5433
|
+
var Se = new Map, Me = {
|
|
5385
5434
|
add: (e, t) => {
|
|
5386
|
-
|
|
5435
|
+
Se.has(e) || Se.set(e, new Set), Se.get(e).add(t);
|
|
5387
5436
|
},
|
|
5388
5437
|
on: (e, t) => {
|
|
5389
|
-
|
|
5438
|
+
Me.add(e, t);
|
|
5390
5439
|
},
|
|
5391
5440
|
emit: (e, ...t) => {
|
|
5392
|
-
const o =
|
|
5393
|
-
o && o.forEach(
|
|
5441
|
+
const o = Se.get(e);
|
|
5442
|
+
o && o.forEach(o => {
|
|
5394
5443
|
try {
|
|
5395
|
-
|
|
5396
|
-
} catch (
|
|
5444
|
+
o(...t);
|
|
5445
|
+
} catch (t) {
|
|
5446
|
+
console.error(`Error in trigger callback for event '${e}':`, t);
|
|
5447
|
+
}
|
|
5397
5448
|
});
|
|
5398
5449
|
},
|
|
5399
5450
|
remove: e => {
|
|
5400
|
-
|
|
5451
|
+
Se.delete(e);
|
|
5401
5452
|
},
|
|
5402
5453
|
off: (e, t) => {
|
|
5403
|
-
const o =
|
|
5454
|
+
const o = Se.get(e);
|
|
5404
5455
|
o && o.delete(t);
|
|
5405
5456
|
},
|
|
5406
5457
|
clear: () => {
|
|
5407
|
-
|
|
5458
|
+
Se.clear();
|
|
5408
5459
|
},
|
|
5409
|
-
list: () => Array.from(
|
|
5460
|
+
list: () => Array.from(Se.keys())
|
|
5410
5461
|
};
|
|
5411
5462
|
|
|
5412
5463
|
dphelper?.setDescription({
|
|
@@ -5461,9 +5512,9 @@ dphelper?.setDescription({
|
|
|
5461
5512
|
env: "client",
|
|
5462
5513
|
subCommand: []
|
|
5463
5514
|
} ]
|
|
5464
|
-
},
|
|
5515
|
+
}, Me);
|
|
5465
5516
|
|
|
5466
|
-
var
|
|
5517
|
+
var Pe = {
|
|
5467
5518
|
of: e => typeof e,
|
|
5468
5519
|
instOfObj: e => e instanceof Object,
|
|
5469
5520
|
isNull: e => t => !e(t),
|
|
@@ -5522,9 +5573,9 @@ dphelper?.setDescription({
|
|
|
5522
5573
|
env: "both",
|
|
5523
5574
|
subCommand: []
|
|
5524
5575
|
} ]
|
|
5525
|
-
},
|
|
5576
|
+
}, Pe);
|
|
5526
5577
|
|
|
5527
|
-
var
|
|
5578
|
+
var ke = {
|
|
5528
5579
|
anchorContext: () => {
|
|
5529
5580
|
if ("undefined" == typeof window || "undefined" == typeof localStorage) return;
|
|
5530
5581
|
const e = `dp_anchor_${btoa(location.pathname).replace(/=/g, "")}`;
|
|
@@ -5549,7 +5600,9 @@ var Pe = {
|
|
|
5549
5600
|
const t = e.id ? document.getElementById(e.id) : document.querySelector(`[name="${e.name}"]`);
|
|
5550
5601
|
t && (t.value = e.value);
|
|
5551
5602
|
});
|
|
5552
|
-
} catch (e) {
|
|
5603
|
+
} catch (e) {
|
|
5604
|
+
console.warn("dphelper: anchorContext restoration failed.");
|
|
5605
|
+
}
|
|
5553
5606
|
})();
|
|
5554
5607
|
},
|
|
5555
5608
|
fps: (e = !0) => {
|
|
@@ -5645,9 +5698,9 @@ dphelper?.setDescription({
|
|
|
5645
5698
|
env: "client",
|
|
5646
5699
|
subCommand: []
|
|
5647
5700
|
} ]
|
|
5648
|
-
},
|
|
5701
|
+
}, ke);
|
|
5649
5702
|
|
|
5650
|
-
var
|
|
5703
|
+
var Te = !1, Ae = !1, Ne = {
|
|
5651
5704
|
enhancement: () => {
|
|
5652
5705
|
window.offScreenBuffering = "auto", dphelper.window.animationframe();
|
|
5653
5706
|
},
|
|
@@ -5662,23 +5715,23 @@ var ke = !1, Te = !1, Ae = {
|
|
|
5662
5715
|
const t = "You have made some changes which you might want to save.", o = e => (e.preventDefault(),
|
|
5663
5716
|
t), a = e ? document.querySelector(e) : null;
|
|
5664
5717
|
a && a.addEventListener("input", () => {
|
|
5665
|
-
"" !== a.value ? (
|
|
5718
|
+
"" !== a.value ? (Te = !0, addEventListener("beforeunload", o, {
|
|
5666
5719
|
capture: !0
|
|
5667
|
-
})) : (
|
|
5720
|
+
})) : (Te = !1, removeEventListener("beforeunload", o, {
|
|
5668
5721
|
capture: !0
|
|
5669
5722
|
}));
|
|
5670
|
-
}), !1 ===
|
|
5723
|
+
}), !1 === Ae && (document.body.addEventListener("click", e => {
|
|
5671
5724
|
const o = e.target;
|
|
5672
|
-
if (o && "img" === o.tagName.toLowerCase() && !0 ===
|
|
5673
|
-
if (!0 === confirm(t)) return void (
|
|
5725
|
+
if (o && "img" === o.tagName.toLowerCase() && !0 === Te) {
|
|
5726
|
+
if (!0 === confirm(t)) return void (Te = !1);
|
|
5674
5727
|
e.preventDefault();
|
|
5675
5728
|
}
|
|
5676
|
-
}),
|
|
5677
|
-
if (!0 ===
|
|
5678
|
-
return !0 === confirm(t) ? void (
|
|
5729
|
+
}), Ae = !0), addEventListener("popstate", e => {
|
|
5730
|
+
if (!0 === Te) {
|
|
5731
|
+
return !0 === confirm(t) ? void (Te = !1) : (e.stopImmediatePropagation(), void e.preventDefault());
|
|
5679
5732
|
}
|
|
5680
5733
|
}), onbeforeunload = e => {
|
|
5681
|
-
if (!0 ===
|
|
5734
|
+
if (!0 === Te) return e.preventDefault(), e.returnValue = t;
|
|
5682
5735
|
};
|
|
5683
5736
|
},
|
|
5684
5737
|
purge: (e = document, t = 1e4) => {
|
|
@@ -5807,19 +5860,16 @@ dphelper?.setDescription({
|
|
|
5807
5860
|
env: "client",
|
|
5808
5861
|
subCommand: []
|
|
5809
5862
|
} ]
|
|
5810
|
-
},
|
|
5863
|
+
}, Ne);
|
|
5811
5864
|
|
|
5812
|
-
var
|
|
5865
|
+
var Ee = setInterval(() => {
|
|
5866
|
+
if (dphelper._list) return;
|
|
5813
5867
|
dphelper._list || (dphelper._list = {
|
|
5814
5868
|
sockets: [],
|
|
5815
5869
|
scripts: []
|
|
5816
5870
|
});
|
|
5817
5871
|
const e = dphelper?.socket?.list(), t = [];
|
|
5818
|
-
e && (e.map(e => (t.push(e.url), !1)), dphelper._list.sockets = t, t && clearInterval(
|
|
5872
|
+
e && (e.map(e => (t.push(e.url), !1)), dphelper._list.sockets = t, t && clearInterval(Ee));
|
|
5819
5873
|
}, 1e3);
|
|
5820
5874
|
|
|
5821
|
-
Object.preventExtensions(dphelper), Object.seal(dphelper);
|
|
5822
|
-
|
|
5823
|
-
var qe = dphelper;
|
|
5824
|
-
|
|
5825
|
-
module.exports = qe;
|
|
5875
|
+
Object.preventExtensions(dphelper), Object.seal(dphelper);
|