dev-classes 1.4.34 → 1.4.36

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.
@@ -1,4 +1,4 @@
1
- import { ColorProps } from './Color.types';
1
+ import { ColorProps, ColorRgb } from './Color.types';
2
2
  export declare class Color {
3
3
  private static componentToHex;
4
4
  static rgbToHex: ColorProps["rgbToHex"];
@@ -62,14 +62,20 @@ export declare class Color {
62
62
  private static generateNeon;
63
63
  private static generateRGB;
64
64
  private static brightColor;
65
- static hslToHex(hue: number, saturation: number, lightness: number): string;
65
+ static hslToHex: (hue: number, saturation: number, lightness: number) => string;
66
66
  private static generatePleasantColor;
67
67
  static generate: {
68
- rgb: typeof Color.generateRGB;
68
+ rgb: () => ColorRgb;
69
69
  hex: () => string;
70
70
  hexMultiple: (count: number) => string[];
71
- pastelColor: typeof Color.generatePleasantColor;
72
- neonColor: typeof Color.generateNeon;
73
- brightColor: typeof Color.brightColor;
71
+ pastelColor: (config: {
72
+ baseColor?: string;
73
+ saturation?: number;
74
+ lightness?: number;
75
+ hueShift?: number;
76
+ randomize?: boolean;
77
+ }) => string;
78
+ neonColor: () => string;
79
+ brightColor: (factor?: number) => string;
74
80
  };
75
81
  }
package/dist/index.js CHANGED
@@ -1,53 +1,17 @@
1
1
  var k = Object.defineProperty;
2
2
  var P = (r, e, t) => e in r ? k(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var c = (r, e, t) => (P(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- const m = class m {
4
+ const h = class h {
5
5
  static isBrightAndVivid(e) {
6
6
  const [t, s, n] = this.hexToRgb(e), o = this.rgbaToHsla(t, s, n, 1);
7
7
  return o.l >= this.MIN_LIGHTNESS && o.s >= this.MIN_SATURATION;
8
8
  }
9
- static generateNeon() {
10
- const e = [
11
- Math.floor(Math.random() * 128 + 128),
12
- // Яркий канал
13
- Math.floor(Math.random() * 64),
14
- // Темный канал
15
- Math.floor(Math.random() * 64)
16
- // Темный канал
17
- ];
18
- for (let t = e.length - 1; t > 0; t--) {
19
- const s = Math.floor(Math.random() * (t + 1));
20
- [e[t], e[s]] = [e[s], e[t]];
21
- }
22
- return `#${e[0].toString(16).padStart(2, "0")}${e[1].toString(16).padStart(2, "0")}${e[2].toString(16).padStart(2, "0")}`;
23
- }
24
- static generateRGB() {
25
- return Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128));
26
- }
27
- static brightColor(e = 1.3) {
28
- let t = 0, s;
29
- do {
30
- const [n, o, i] = m.generateRGB();
31
- if (s = `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`, s = m.increaseSaturation(s, e), t++, t > 100)
32
- break;
33
- } while (!m.isBrightAndVivid(s));
34
- return s;
35
- }
36
- static hslToHex(e, t, s) {
37
- const n = m.hslaToRgba(e, t, s, 1), [o, i, a] = n.slice(0, 3);
38
- return m.rgbToHex(o, i, a);
39
- }
40
- static generatePleasantColor(e = {}) {
41
- const { baseColor: t, saturation: s = 50, lightness: n = 50, hueShift: o = 0, randomize: i = !1 } = e;
42
- let a, u, l;
43
- return t ? (a = (m.hexaToHsla(t).h + o) % 360, i ? (u = Math.max(30, Math.min(90, s + (Math.random() * 40 - 20))), l = Math.max(40, Math.min(80, n + (Math.random() * 30 - 15)))) : (u = s, l = n)) : (a = Math.floor(Math.random() * 360), u = s + Math.random() * 20, l = n + Math.random() * 20), (a >= 20 && a <= 50 || a >= 60 && a <= 140) && (a = (a + 100) % 360), n < 100 && (u = Math.max(u, 15), l > 95 && (l = 95 - Math.random() * 10), u < 20 && l > 90 && (a = (a + 180) % 360, u = Math.max(25, u))), m.hslToHex(a, u, l);
44
- }
45
9
  };
46
10
  /*Проверить свои методы и возможно исключить т.к. функционал возможно повторяется */
47
- c(m, "componentToHex", (e) => {
11
+ c(h, "componentToHex", (e) => {
48
12
  const s = Math.max(0, Math.min(255, Math.round(e))).toString(16);
49
13
  return s.length == 1 ? "0" + s : s;
50
- }), c(m, "rgbToHex", (e, t, s) => "#" + m.componentToHex(e) + m.componentToHex(t) + m.componentToHex(s)), // static rgbToHex: ColorProps["rgbToHex"] = (r: number, g: number, b: number) => {
14
+ }), c(h, "rgbToHex", (e, t, s) => "#" + h.componentToHex(e) + h.componentToHex(t) + h.componentToHex(s)), // static rgbToHex: ColorProps["rgbToHex"] = (r: number, g: number, b: number) => {
51
15
  // const toHex = (n: number): string => {
52
16
  // const hex = Math.round(n).toString(16);
53
17
  // return hex.length === 1 ? "0" + hex : hex;
@@ -58,7 +22,7 @@ c(m, "componentToHex", (e) => {
58
22
  * r, g, b in [0, 255]
59
23
  * @returns h in [0,360) and s, v in [0,1]
60
24
  */
61
- c(m, "rgbToHsv", (e, t, s) => {
25
+ c(h, "rgbToHsv", (e, t, s) => {
62
26
  e /= 255, t /= 255, s /= 255;
63
27
  const n = Math.max(e, t, s), o = n - Math.min(e, t, s), i = o && (n === e ? (t - s) / o : n == t ? 2 + (s - e) / o : 4 + (e - t) / o);
64
28
  return [60 * (i < 0 ? i + 6 : i), n && o / n, n];
@@ -68,13 +32,13 @@ c(m, "rgbToHsv", (e, t, s) => {
68
32
  * @param v [0, 1]
69
33
  * @returns r, g, b in [0, 255]
70
34
  */
71
- c(m, "hsvToRgb", (e, t, s) => {
35
+ c(h, "hsvToRgb", (e, t, s) => {
72
36
  const n = (o, i = (o + e / 60) % 6) => Math.round((s - s * t * Math.max(Math.min(i, 4 - i, 1), 0)) * 255);
73
37
  return [n(5), n(3), n(1)];
74
38
  }), /**
75
39
  * @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
76
40
  */
77
- c(m, "rgbaToHsla", (e, t, s, n = 1) => {
41
+ c(h, "rgbaToHsla", (e, t, s, n = 1) => {
78
42
  e /= 255, t /= 255, s /= 255;
79
43
  const o = Math.max(e, t, s), i = Math.min(e, t, s);
80
44
  let a = 0, u;
@@ -111,7 +75,7 @@ c(m, "rgbaToHsla", (e, t, s, n = 1) => {
111
75
  * @param {number} l The lightness [0, 1]
112
76
  * @return {Array} The RGB representation [0, 255]
113
77
  */
114
- c(m, "hslaToRgba", (e, t, s, n) => {
78
+ c(h, "hslaToRgba", (e, t, s, n) => {
115
79
  e /= 360, t /= 100, s /= 100;
116
80
  let o, i, a;
117
81
  if (t === 0)
@@ -123,10 +87,10 @@ c(m, "hslaToRgba", (e, t, s, n) => {
123
87
  o = u(f, l, e + 1 / 3), i = u(f, l, e), a = u(f, l, e - 1 / 3);
124
88
  }
125
89
  return [o, i, a, n].map((u) => Math.round(u * 255));
126
- }), c(m, "hslaStringToRgba", (e) => {
90
+ }), c(h, "hslaStringToRgba", (e) => {
127
91
  const t = e.slice(5, -1).split(", "), s = Number(t.pop()), n = t.map((o) => o.endsWith("%") ? +o.slice(0, -1) : +o);
128
- return m.hslaToRgba(n[0], n[1], n[2], s);
129
- }), c(m, "hexaToRgba", (e, t) => {
92
+ return h.hslaToRgba(n[0], n[1], n[2], s);
93
+ }), c(h, "hexaToRgba", (e, t) => {
130
94
  const s = [], n = e[0] === "#" ? 1 : 0;
131
95
  if (e.length === 5 + n && (e = (n ? "#" : "") + "0" + e.slice(n)), e.length === 3 + n)
132
96
  for (let o = n; o < e.length; ++o)
@@ -139,79 +103,108 @@ c(m, "hslaToRgba", (e, t, s, n) => {
139
103
  for (let o = n; o < e.length; o += 2)
140
104
  s.push(parseInt(e.slice(o, o + 2), 16));
141
105
  return t && s.length === 4 && (s[3] = Math.round(s[3] / 255 * 100) / 100), s;
142
- }), c(m, "hexaToHsla", (e) => {
143
- const t = m.hexaToRgba(e);
144
- return m.rgbaToHsla(t[0], t[1], t[2], t[3]);
145
- }), c(m, "hexToRgb", (e) => m.hexaToRgba(e.slice(0, 7))), c(m, "rgbaToHexa", (e) => {
106
+ }), c(h, "hexaToHsla", (e) => {
107
+ const t = h.hexaToRgba(e);
108
+ return h.rgbaToHsla(t[0], t[1], t[2], t[3]);
109
+ }), c(h, "hexToRgb", (e) => h.hexaToRgba(e.slice(0, 7))), c(h, "rgbaToHexa", (e) => {
146
110
  const t = [...e], s = t.pop(), n = Math.round(Math.min(Math.max(s ?? 1, 0), 1) * 255);
147
111
  return "#" + t.map((o) => ("0" + o.toString(16)).slice(-2)).join("") + n.toString(16);
148
- }), c(m, "hslaStringToHexa", (e) => m.rgbaToHexa(m.hslaStringToRgba(e))), c(m, "hslaStringToHex", (e) => m.hslaStringToHexa(e).slice(0, -2)), /**
112
+ }), c(h, "hslaStringToHexa", (e) => h.rgbaToHexa(h.hslaStringToRgba(e))), c(h, "hslaStringToHex", (e) => h.hslaStringToHexa(e).slice(0, -2)), /**
149
113
  * @param weight [0, 1]
150
114
  */
151
- c(m, "mixColors", (e, t, s) => {
115
+ c(h, "mixColors", (e, t, s) => {
152
116
  const n = new Array(3);
153
117
  for (let o = 0; o < 3; ++o) {
154
118
  const i = e[o], a = t[o];
155
119
  n[o] = Math.floor(a + (i - a) * s);
156
120
  }
157
121
  return n;
158
- }), c(m, "getRgbByTypeBrightness", (e) => ({
122
+ }), c(h, "getRgbByTypeBrightness", (e) => ({
159
123
  BT601: [0.299, 0.587, 0.114],
160
124
  BT709: [0.2126, 0.7152, 0.0722],
161
125
  BT2020: [0.2627, 0.678, 0.0593]
162
- })[e]), c(m, "getAverageColor", (e, t) => e.map((s, n) => Math.round((s + t[n]) / 2))), c(m, "getAccentColor", (e, t, s) => {
163
- const n = m.rgbToHsv(...t), o = m.rgbToHsv(...s), i = Math.min(1.5 * n[1] / e[1], 1);
164
- return n[0] = Math.min(360, o[0] - n[0] + e[0]), n[1] = Math.min(1, o[1] * e[1] / n[1]), n[2] = Math.min(1, (o[2] / n[2] + i - 1) * e[2] / i), n[2] < 0.3 ? s : m.hsvToRgb(...n);
165
- }), c(m, "changeColorAccent", (e, t, s, n) => {
166
- const o = m.rgbToHsv(...s);
126
+ })[e]), c(h, "getAverageColor", (e, t) => e.map((s, n) => Math.round((s + t[n]) / 2))), c(h, "getAccentColor", (e, t, s) => {
127
+ const n = h.rgbToHsv(...t), o = h.rgbToHsv(...s), i = Math.min(1.5 * n[1] / e[1], 1);
128
+ return n[0] = Math.min(360, o[0] - n[0] + e[0]), n[1] = Math.min(1, o[1] * e[1] / n[1]), n[2] = Math.min(1, (o[2] / n[2] + i - 1) * e[2] / i), n[2] < 0.3 ? s : h.hsvToRgb(...n);
129
+ }), c(h, "changeColorAccent", (e, t, s, n) => {
130
+ const o = h.rgbToHsv(...s);
167
131
  if (Math.min(Math.abs(o[0] - e[0]), Math.abs(o[0] - e[0] - 360)) > 30)
168
132
  return s;
169
133
  const a = e[1] ? Math.min(1.5 * o[1] / e[1], 1) : 0;
170
134
  o[0] = Math.min(360, o[0] + t[0] - e[0]), o[1] = e[1] ? Math.min(1, o[1] * t[1] / e[1]) : 0, o[2] = e[2] ? Math.min(1, o[2] * (1 - a + a * t[2] / e[2])) : 0;
171
- let u = m.hsvToRgb(...o);
172
- const l = m.calculateBrightness(s), f = m.calculateBrightness(u);
135
+ let u = h.hsvToRgb(...o);
136
+ const l = h.calculateBrightness(s), f = h.calculateBrightness(u);
173
137
  if (n ? l > f : l < f) {
174
138
  const b = 0.4 * l / f + 0.6;
175
- u = m.changeBrightness(u, b);
139
+ u = h.changeBrightness(u, b);
176
140
  }
177
141
  return u;
178
- }), c(m, "changeBrightness", (e, t) => e.map((s) => m.clamp(Math.round(s * t), 0, 255))), c(m, "hexBrightness", (e, t) => {
179
- const s = m.hexToRgb(e), n = m.changeBrightness(s, t), [o, i, a] = n;
180
- return m.rgbToHex(o, i, a);
181
- }), c(m, "getHexColorFromTelegramColor", (e) => {
142
+ }), c(h, "changeBrightness", (e, t) => e.map((s) => h.clamp(Math.round(s * t), 0, 255))), c(h, "hexBrightness", (e, t) => {
143
+ const s = h.hexToRgb(e), n = h.changeBrightness(s, t), [o, i, a] = n;
144
+ return h.rgbToHex(o, i, a);
145
+ }), c(h, "getHexColorFromTelegramColor", (e) => {
182
146
  const t = (e < 0 ? 16777215 + e : e).toString(16);
183
147
  return "#" + (t.length >= 6 ? t : "0".repeat(6 - t.length) + t);
184
- }), c(m, "getRgbColorFromTelegramColor", (e) => m.hexToRgb(m.getHexColorFromTelegramColor(e))), c(m, "rgbaToRgb", (e, t) => {
148
+ }), c(h, "getRgbColorFromTelegramColor", (e) => h.hexToRgb(h.getHexColorFromTelegramColor(e))), c(h, "rgbaToRgb", (e, t) => {
185
149
  const s = e[3];
186
- return e.slice(0, 3).map((n, o) => m.clamp(Math.round((s * (n / 255) + s * (t[o] / 255)) * 255), 0, 255));
187
- }), c(m, "calculateBrightness", (e, t = "BT709") => {
188
- const [s, n, o] = e, i = m.getRgbByTypeBrightness(t);
150
+ return e.slice(0, 3).map((n, o) => h.clamp(Math.round((s * (n / 255) + s * (t[o] / 255)) * 255), 0, 255));
151
+ }), c(h, "calculateBrightness", (e, t = "BT709") => {
152
+ const [s, n, o] = e, i = h.getRgbByTypeBrightness(t);
189
153
  return i[0] * s / 255 + i[1] * n / 255 + i[2] * o / 255;
190
- }), c(m, "getTextColor", (e) => e > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(m, "MIN_SATURATION", 50), c(m, "MIN_LIGHTNESS", 44), c(m, "calculateOpacity", (e, t) => {
154
+ }), c(h, "getTextColor", (e) => e > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(h, "MIN_SATURATION", 50), c(h, "MIN_LIGHTNESS", 44), c(h, "calculateOpacity", (e, t) => {
191
155
  const s = e > 0.5 ? 0 : 1, n = (e - s + t) / t;
192
156
  return +Math.max(0.5, Math.min(0.64, n)).toFixed(2);
193
- }), c(m, "increaseSaturation", (e, t = 1.3) => {
157
+ }), c(h, "increaseSaturation", (e, t = 1.3) => {
194
158
  if (typeof e == "string") {
195
- const s = m.hexToRgb(e), [n, o, i] = m.rgbToHsv(...s), a = Math.min(1, o * t), u = m.hsvToRgb(n, a, i);
196
- return m.rgbToHex(...u);
159
+ const s = h.hexToRgb(e), [n, o, i] = h.rgbToHsv(...s), a = Math.min(1, o * t), u = h.hsvToRgb(n, a, i);
160
+ return h.rgbToHex(...u);
197
161
  } else {
198
- const [s, n, o] = m.rgbToHsv(e[0], e[1], e[2]), i = Math.min(1, n * t);
199
- return m.hsvToRgb(s, i, o);
162
+ const [s, n, o] = h.rgbToHsv(e[0], e[1], e[2]), i = Math.min(1, n * t);
163
+ return h.hsvToRgb(s, i, o);
200
164
  }
201
- }), c(m, "clamp", (e, t, s) => Math.min(s, Math.max(t, e))), c(m, "isHex", (e) => {
165
+ }), c(h, "clamp", (e, t, s) => Math.min(s, Math.max(t, e))), c(h, "isHex", (e) => {
202
166
  if (typeof e != "string")
203
167
  return !1;
204
168
  const t = e.replace(/^#/, "");
205
169
  return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(t);
206
- }), c(m, "generateHex", () => `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`), c(m, "generateHexMultiple", (e) => Array.from({ length: e }, () => m.generateHex())), c(m, "generate", {
207
- rgb: m.generateRGB,
208
- hex: m.generateHex,
209
- hexMultiple: m.generateHexMultiple,
210
- pastelColor: m.generatePleasantColor,
211
- neonColor: m.generateNeon,
212
- brightColor: m.brightColor
170
+ }), c(h, "generateHex", () => `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`), c(h, "generateHexMultiple", (e) => Array.from({ length: e }, () => h.generateHex())), c(h, "generateNeon", () => {
171
+ const e = [
172
+ Math.floor(Math.random() * 128 + 128),
173
+ // Яркий канал
174
+ Math.floor(Math.random() * 64),
175
+ // Темный канал
176
+ Math.floor(Math.random() * 64)
177
+ // Темный канал
178
+ ];
179
+ for (let t = e.length - 1; t > 0; t--) {
180
+ const s = Math.floor(Math.random() * (t + 1));
181
+ [e[t], e[s]] = [e[s], e[t]];
182
+ }
183
+ return `#${e[0].toString(16).padStart(2, "0")}${e[1].toString(16).padStart(2, "0")}${e[2].toString(16).padStart(2, "0")}`;
184
+ }), c(h, "generateRGB", () => Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128))), c(h, "brightColor", (e = 1.3) => {
185
+ let t = 0, s;
186
+ do {
187
+ const [n, o, i] = h.generateRGB();
188
+ if (s = `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`, s = h.increaseSaturation(s, e), t++, t > 100)
189
+ break;
190
+ } while (!h.isBrightAndVivid(s));
191
+ return s;
192
+ }), c(h, "hslToHex", (e, t, s) => {
193
+ const n = h.hslaToRgba(e, t, s, 1), [o, i, a] = n.slice(0, 3);
194
+ return h.rgbToHex(o, i, a);
195
+ }), c(h, "generatePleasantColor", (e = {}) => {
196
+ const { baseColor: t, saturation: s = 50, lightness: n = 50, hueShift: o = 0, randomize: i = !1 } = e;
197
+ let a, u, l;
198
+ return t ? (a = (h.hexaToHsla(t).h + o) % 360, i ? (u = Math.max(30, Math.min(90, s + (Math.random() * 40 - 20))), l = Math.max(40, Math.min(80, n + (Math.random() * 30 - 15)))) : (u = s, l = n)) : (a = Math.floor(Math.random() * 360), u = s + Math.random() * 20, l = n + Math.random() * 20), (a >= 20 && a <= 50 || a >= 60 && a <= 140) && (a = (a + 100) % 360), n < 100 && (u = Math.max(u, 15), l > 95 && (l = 95 - Math.random() * 10), u < 20 && l > 90 && (a = (a + 180) % 360, u = Math.max(25, u))), h.hslToHex(a, u, l);
199
+ }), c(h, "generate", {
200
+ rgb: h.generateRGB,
201
+ hex: h.generateHex,
202
+ hexMultiple: h.generateHexMultiple,
203
+ pastelColor: h.generatePleasantColor,
204
+ neonColor: h.generateNeon,
205
+ brightColor: h.brightColor
213
206
  });
214
- let Color = m;
207
+ let Color = h;
215
208
  const itemsMonths = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], itemsWeek = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], _DateProcessing = class _DateProcessing {
216
209
  };
217
210
  c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
@@ -346,19 +339,19 @@ class DelaysPromise {
346
339
  interval: 5e3
347
340
  });
348
341
  c(this, "startActionEvery", (e, t = this.defaultProps) => {
349
- const s = (h) => {
350
- t != null && t.watchIdInterval && (t == null || t.watchIdInterval(h));
351
- }, n = (h) => {
352
- t != null && t.controlAction && (t == null || t.controlAction(h));
342
+ const s = (m) => {
343
+ t != null && t.watchIdInterval && (t == null || t.watchIdInterval(m));
344
+ }, n = (m) => {
345
+ t != null && t.controlAction && (t == null || t.controlAction(m));
353
346
  };
354
347
  let o = !0, i, a, u;
355
- const l = (h = !0) => {
348
+ const l = (m = !0) => {
356
349
  const w = "Ручное завершение startActionEvery";
357
- o = !1, clearInterval(i), s(null), h ? a && a({ status: h, msg: w + ": (true)" }) : u && u({ status: h, msg: w + ": (false)" });
350
+ o = !1, clearInterval(i), s(null), m ? a && a({ status: m, msg: w + ": (true)" }) : u && u({ status: m, msg: w + ": (false)" });
358
351
  };
359
352
  return {
360
- promise: new Promise((h, w) => {
361
- a = h, u = w;
353
+ promise: new Promise((m, w) => {
354
+ a = m, u = w;
362
355
  let b = 0, d = 0;
363
356
  i = setInterval(
364
357
  () => {
@@ -366,7 +359,7 @@ class DelaysPromise {
366
359
  o = !1, clearInterval(i), s(null), w({ status: !1, msg: Error("Время загрузки истекло") });
367
360
  return;
368
361
  }
369
- e() && (o = !1, clearInterval(i), s(null), h({ status: !0, msg: "cb вернул true" }));
362
+ e() && (o = !1, clearInterval(i), s(null), m({ status: !0, msg: "cb вернул true" }));
370
363
  },
371
364
  t.interval < 200 ? 200 : t.interval
372
365
  ), s(i), n({
@@ -785,16 +778,16 @@ function toFormData(r, e, t) {
785
778
  }
786
779
  return isVisitable(d) ? !0 : (e.append(renderKey(p, g, o), l(d)), !1);
787
780
  }
788
- const h = [], w = Object.assign(predicates, {
781
+ const m = [], w = Object.assign(predicates, {
789
782
  defaultVisitor: f,
790
783
  convertValue: l,
791
784
  isVisitable
792
785
  });
793
786
  function b(d, g) {
794
787
  if (!utils$1.isUndefined(d)) {
795
- if (h.indexOf(d) !== -1)
788
+ if (m.indexOf(d) !== -1)
796
789
  throw Error("Circular reference detected in " + g.join("."));
797
- h.push(d), utils$1.forEach(d, function(D, A) {
790
+ m.push(d), utils$1.forEach(d, function(D, A) {
798
791
  (!(utils$1.isUndefined(D) || D === null) && n.call(
799
792
  e,
800
793
  D,
@@ -802,7 +795,7 @@ function toFormData(r, e, t) {
802
795
  g,
803
796
  w
804
797
  )) === !0 && b(D, g ? g.concat(A) : [A]);
805
- }), h.pop();
798
+ }), m.pop();
806
799
  }
807
800
  }
808
801
  if (!utils$1.isObject(r))
@@ -1118,8 +1111,8 @@ class AxiosHeaders {
1118
1111
  const f = normalizeHeader(u);
1119
1112
  if (!f)
1120
1113
  throw new Error("header name must be a non-empty string");
1121
- const h = utils$1.findKey(n, f);
1122
- (!h || n[h] === void 0 || l === !0 || l === void 0 && n[h] !== !1) && (n[h || u] = normalizeValue(a));
1114
+ const m = utils$1.findKey(n, f);
1115
+ (!m || n[m] === void 0 || l === !0 || l === void 0 && n[m] !== !1) && (n[m || u] = normalizeValue(a));
1123
1116
  }
1124
1117
  const i = (a, u) => utils$1.forEach(a, (l, f) => o(l, f, u));
1125
1118
  if (utils$1.isPlainObject(e) || e instanceof this.constructor)
@@ -1275,9 +1268,9 @@ function speedometer(r, e) {
1275
1268
  return e = e !== void 0 ? e : 1e3, function(u) {
1276
1269
  const l = Date.now(), f = s[o];
1277
1270
  i || (i = l), t[n] = u, s[n] = l;
1278
- let h = o, w = 0;
1279
- for (; h !== n; )
1280
- w += t[h++], h = h % r;
1271
+ let m = o, w = 0;
1272
+ for (; m !== n; )
1273
+ w += t[m++], m = m % r;
1281
1274
  if (n = (n + 1) % r, n === o && (o = (o + 1) % r), l - i < e)
1282
1275
  return;
1283
1276
  const b = f && l - f;
@@ -1290,10 +1283,10 @@ function throttle(r, e) {
1290
1283
  t = f, n = null, o && (clearTimeout(o), o = null), r.apply(null, l);
1291
1284
  };
1292
1285
  return [(...l) => {
1293
- const f = Date.now(), h = f - t;
1294
- h >= s ? i(l, f) : (n = l, o || (o = setTimeout(() => {
1286
+ const f = Date.now(), m = f - t;
1287
+ m >= s ? i(l, f) : (n = l, o || (o = setTimeout(() => {
1295
1288
  o = null, i(n);
1296
- }, s - h)));
1289
+ }, s - m)));
1297
1290
  }, () => n && i(n)];
1298
1291
  }
1299
1292
  const progressEventReducer = (r, e, t = 3) => {
@@ -1302,7 +1295,7 @@ const progressEventReducer = (r, e, t = 3) => {
1302
1295
  return throttle((o) => {
1303
1296
  const i = o.loaded, a = o.lengthComputable ? o.total : void 0, u = i - s, l = n(u), f = i <= a;
1304
1297
  s = i;
1305
- const h = {
1298
+ const m = {
1306
1299
  loaded: i,
1307
1300
  total: a,
1308
1301
  progress: a ? i / a : void 0,
@@ -1313,7 +1306,7 @@ const progressEventReducer = (r, e, t = 3) => {
1313
1306
  lengthComputable: a != null,
1314
1307
  [e ? "download" : "upload"]: !0
1315
1308
  };
1316
- r(h);
1309
+ r(m);
1317
1310
  }, t);
1318
1311
  }, progressEventDecorator = (r, e) => {
1319
1312
  const t = r != null;
@@ -1393,15 +1386,15 @@ const headersToObject = (r) => r instanceof AxiosHeaders$1 ? { ...r } : r;
1393
1386
  function mergeConfig(r, e) {
1394
1387
  e = e || {};
1395
1388
  const t = {};
1396
- function s(l, f, h) {
1397
- return utils$1.isPlainObject(l) && utils$1.isPlainObject(f) ? utils$1.merge.call({ caseless: h }, l, f) : utils$1.isPlainObject(f) ? utils$1.merge({}, f) : utils$1.isArray(f) ? f.slice() : f;
1389
+ function s(l, f, m) {
1390
+ return utils$1.isPlainObject(l) && utils$1.isPlainObject(f) ? utils$1.merge.call({ caseless: m }, l, f) : utils$1.isPlainObject(f) ? utils$1.merge({}, f) : utils$1.isArray(f) ? f.slice() : f;
1398
1391
  }
1399
- function n(l, f, h) {
1392
+ function n(l, f, m) {
1400
1393
  if (utils$1.isUndefined(f)) {
1401
1394
  if (!utils$1.isUndefined(l))
1402
- return s(void 0, l, h);
1395
+ return s(void 0, l, m);
1403
1396
  } else
1404
- return s(l, f, h);
1397
+ return s(l, f, m);
1405
1398
  }
1406
1399
  function o(l, f) {
1407
1400
  if (!utils$1.isUndefined(f))
@@ -1414,10 +1407,10 @@ function mergeConfig(r, e) {
1414
1407
  } else
1415
1408
  return s(void 0, f);
1416
1409
  }
1417
- function a(l, f, h) {
1418
- if (h in e)
1410
+ function a(l, f, m) {
1411
+ if (m in e)
1419
1412
  return s(l, f);
1420
- if (h in r)
1413
+ if (m in r)
1421
1414
  return s(void 0, l);
1422
1415
  }
1423
1416
  const u = {
@@ -1452,8 +1445,8 @@ function mergeConfig(r, e) {
1452
1445
  headers: (l, f) => n(headersToObject(l), headersToObject(f), !0)
1453
1446
  };
1454
1447
  return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(f) {
1455
- const h = u[f] || n, w = h(r[f], e[f], f);
1456
- utils$1.isUndefined(w) && h !== a || (t[f] = w);
1448
+ const m = u[f] || n, w = m(r[f], e[f], f);
1449
+ utils$1.isUndefined(w) && m !== a || (t[f] = w);
1457
1450
  }), t;
1458
1451
  }
1459
1452
  const resolveConfig = (r) => {
@@ -1468,7 +1461,7 @@ const resolveConfig = (r) => {
1468
1461
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
1469
1462
  i.setContentType(void 0);
1470
1463
  else if ((u = i.getContentType()) !== !1) {
1471
- const [l, ...f] = u ? u.split(";").map((h) => h.trim()).filter(Boolean) : [];
1464
+ const [l, ...f] = u ? u.split(";").map((m) => m.trim()).filter(Boolean) : [];
1472
1465
  i.setContentType([l || "multipart/form-data", ...f].join("; "));
1473
1466
  }
1474
1467
  }
@@ -1482,7 +1475,7 @@ const resolveConfig = (r) => {
1482
1475
  const n = resolveConfig(r);
1483
1476
  let o = n.data;
1484
1477
  const i = AxiosHeaders$1.from(n.headers).normalize();
1485
- let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, h, w, b, d;
1478
+ let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, m, w, b, d;
1486
1479
  function g() {
1487
1480
  b && b(), d && d(), n.cancelToken && n.cancelToken.unsubscribe(f), n.signal && n.signal.removeEventListener("abort", f);
1488
1481
  }
@@ -1524,7 +1517,7 @@ const resolveConfig = (r) => {
1524
1517
  )), p = null;
1525
1518
  }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && utils$1.forEach(i.toJSON(), function(O, R) {
1526
1519
  p.setRequestHeader(R, O);
1527
- }), utils$1.isUndefined(n.withCredentials) || (p.withCredentials = !!n.withCredentials), a && a !== "json" && (p.responseType = n.responseType), l && ([w, d] = progressEventReducer(l, !0), p.addEventListener("progress", w)), u && p.upload && ([h, b] = progressEventReducer(u), p.upload.addEventListener("progress", h), p.upload.addEventListener("loadend", b)), (n.cancelToken || n.signal) && (f = (S) => {
1520
+ }), utils$1.isUndefined(n.withCredentials) || (p.withCredentials = !!n.withCredentials), a && a !== "json" && (p.responseType = n.responseType), l && ([w, d] = progressEventReducer(l, !0), p.addEventListener("progress", w)), u && p.upload && ([m, b] = progressEventReducer(u), p.upload.addEventListener("progress", m), p.upload.addEventListener("loadend", b)), (n.cancelToken || n.signal) && (f = (S) => {
1528
1521
  p && (s(!S || S.type ? new CanceledError(null, r, p) : S), p.abort(), p = null);
1529
1522
  }, n.cancelToken && n.cancelToken.subscribe(f), n.signal && (n.signal.aborted ? f() : n.signal.addEventListener("abort", f)));
1530
1523
  const A = parseProtocol(n.url);
@@ -1598,9 +1591,9 @@ const resolveConfig = (r) => {
1598
1591
  a(), u.close();
1599
1592
  return;
1600
1593
  }
1601
- let h = f.byteLength;
1594
+ let m = f.byteLength;
1602
1595
  if (t) {
1603
- let w = o += h;
1596
+ let w = o += m;
1604
1597
  t(w);
1605
1598
  }
1606
1599
  u.enqueue(new Uint8Array(f));
@@ -1669,7 +1662,7 @@ const getBodyLength = async (r) => {
1669
1662
  onUploadProgress: u,
1670
1663
  responseType: l,
1671
1664
  headers: f,
1672
- withCredentials: h = "same-origin",
1665
+ withCredentials: m = "same-origin",
1673
1666
  fetchOptions: w
1674
1667
  } = resolveConfig(r);
1675
1668
  l = l ? (l + "").toLowerCase() : "text";
@@ -1693,7 +1686,7 @@ const getBodyLength = async (r) => {
1693
1686
  s = trackStream(R.body, DEFAULT_CHUNK_SIZE, C, N);
1694
1687
  }
1695
1688
  }
1696
- utils$1.isString(h) || (h = h ? "include" : "omit");
1689
+ utils$1.isString(m) || (m = m ? "include" : "omit");
1697
1690
  const D = "credentials" in Request.prototype;
1698
1691
  d = new Request(e, {
1699
1692
  ...w,
@@ -1702,7 +1695,7 @@ const getBodyLength = async (r) => {
1702
1695
  headers: f.normalize().toJSON(),
1703
1696
  body: s,
1704
1697
  duplex: "half",
1705
- credentials: D ? h : void 0
1698
+ credentials: D ? m : void 0
1706
1699
  });
1707
1700
  let A = await fetch(d);
1708
1701
  const S = supportsResponseStream && (l === "stream" || l === "response");
@@ -1919,17 +1912,17 @@ class Axios {
1919
1912
  this.interceptors.response.forEach(function(g) {
1920
1913
  l.push(g.fulfilled, g.rejected);
1921
1914
  });
1922
- let f, h = 0, w;
1915
+ let f, m = 0, w;
1923
1916
  if (!u) {
1924
1917
  const d = [dispatchRequest.bind(this), void 0];
1925
- for (d.unshift.apply(d, a), d.push.apply(d, l), w = d.length, f = Promise.resolve(t); h < w; )
1926
- f = f.then(d[h++], d[h++]);
1918
+ for (d.unshift.apply(d, a), d.push.apply(d, l), w = d.length, f = Promise.resolve(t); m < w; )
1919
+ f = f.then(d[m++], d[m++]);
1927
1920
  return f;
1928
1921
  }
1929
1922
  w = a.length;
1930
1923
  let b = t;
1931
- for (h = 0; h < w; ) {
1932
- const d = a[h++], g = a[h++];
1924
+ for (m = 0; m < w; ) {
1925
+ const d = a[m++], g = a[m++];
1933
1926
  try {
1934
1927
  b = d(b);
1935
1928
  } catch (p) {
@@ -1942,8 +1935,8 @@ class Axios {
1942
1935
  } catch (d) {
1943
1936
  return Promise.reject(d);
1944
1937
  }
1945
- for (h = 0, w = l.length; h < w; )
1946
- f = f.then(l[h++], l[h++]);
1938
+ for (m = 0, w = l.length; m < w; )
1939
+ f = f.then(l[m++], l[m++]);
1947
1940
  return f;
1948
1941
  }
1949
1942
  getUri(e) {
@@ -2358,9 +2351,9 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
2358
2351
  isErr: !0,
2359
2352
  request: a,
2360
2353
  errExt: { message: l, status: u }
2361
- }, { cordova: h } = window;
2362
- if (h != null && h.cordova && ((w = h == null ? void 0 : h.plugin) != null && w.http)) {
2363
- const { http: b } = h == null ? void 0 : h.plugin;
2354
+ }, { cordova: m } = window;
2355
+ if (m != null && m.cordova && ((w = m == null ? void 0 : m.plugin) != null && w.http)) {
2356
+ const { http: b } = m == null ? void 0 : m.plugin;
2364
2357
  "Content-Type" in (a == null ? void 0 : a.headers) && ((a == null ? void 0 : a.headers["Content-Type"]) === "multipart/form-data" && b.setDataSerializer("urlencoded"), (a == null ? void 0 : a.headers["Content-Type"]) === "application/json" && b.setDataSerializer("json")), b.setRequestTimeout(Number(a.timeout) / 1e3), E.registerRequest.setList({ url: e, options: a }), b.sendRequest(
2365
2358
  e,
2366
2359
  a,
@@ -2564,7 +2557,7 @@ const y = class y {
2564
2557
  };
2565
2558
  if (y.events.publish("fetch", l), u) {
2566
2559
  apiRequest.requestInServer(s, n).then((f) => {
2567
- const h = {
2560
+ const m = {
2568
2561
  isReq: !1,
2569
2562
  isReload: !0,
2570
2563
  isErr: !1,
@@ -2572,16 +2565,16 @@ const y = class y {
2572
2565
  msg: "",
2573
2566
  ...f
2574
2567
  };
2575
- y.events.publish("fetch", h), o(h);
2568
+ y.events.publish("fetch", m), o(m);
2576
2569
  }).catch((f) => {
2577
- const h = {
2570
+ const m = {
2578
2571
  //TODO: Проверить. dataErr не верно возвращает
2579
2572
  isReq: !1,
2580
2573
  isReload: !1,
2581
2574
  keyAction: e,
2582
2575
  ...f
2583
2576
  };
2584
- y.events.publish("fetch", h), i(h);
2577
+ y.events.publish("fetch", m), i(m);
2585
2578
  });
2586
2579
  return;
2587
2580
  }
@@ -2702,7 +2695,7 @@ class NetworkStatusTracker {
2702
2695
  }, { signal: (a = s.online) == null ? void 0 : a.signal }), window.addEventListener("offline", () => {
2703
2696
  this.updateState(!1, e);
2704
2697
  }, { signal: (u = s.offline) == null ? void 0 : u.signal }), (l = this.getConnection()) != null && l.addEventListener && this.getConnection().addEventListener("change", () => {
2705
- const h = this.getConnection(), w = this.getTypeNetwork(h, null), b = this.getIsNetwork(w);
2698
+ const m = this.getConnection(), w = this.getTypeNetwork(m, null), b = this.getIsNetwork(w);
2706
2699
  this.updateState(b, e);
2707
2700
  }, { signal: (f = s.change) == null ? void 0 : f.signal });
2708
2701
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "git+https://github.com/SinGlEBW/dev-classes.git"
12
12
  },
13
13
  "license": "MIT",
14
- "version": "1.4.34",
14
+ "version": "1.4.36",
15
15
  "type": "module",
16
16
  "module": "./dist/index.js",
17
17
  "main": "./dist/index.js",