dev-classes 1.4.22 → 1.4.30

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/README.md CHANGED
@@ -66,8 +66,15 @@ interface ColorProps{
66
66
  calculateOpacity(luminance: number, targetContrast: number): number;
67
67
  clamp(v: number, min: number, max: number): number;
68
68
  isHex(color:string):boolean;
69
- generateHex():string;
70
- generateHexMultiple(count:number):string[];
69
+ isBrightAndVivid: (color: string) => boolean;
70
+ generate: {
71
+ rgb: () => number[];
72
+ hex: () => string;
73
+ hexMultiple: () => string[];
74
+ pastelColor: () => string;
75
+ neonColor: () => string;
76
+ brightColor: () => string;
77
+ };
71
78
  }
72
79
 
73
80
  ```
@@ -20,6 +20,7 @@ export declare class Color {
20
20
  * @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
21
21
  */
22
22
  static rgbaToHsla: ColorProps['rgbaToHsla'];
23
+ private static rgbToHsl;
23
24
  /**
24
25
  * Converts an HSL color value to RGB. Conversion formula
25
26
  * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
@@ -52,9 +53,25 @@ export declare class Color {
52
53
  static rgbaToRgb: ColorProps['rgbaToRgb'];
53
54
  static calculateBrightness: ColorProps['calculateBrightness'];
54
55
  static getTextColor: ColorProps['getTextColor'];
56
+ private static readonly MIN_BRIGHTNESS;
57
+ private static readonly MIN_SATURATION;
58
+ private static readonly MIN_LIGHTNESS;
59
+ static isBrightAndVivid(color: string): boolean;
55
60
  static calculateOpacity: ColorProps['calculateOpacity'];
56
61
  static clamp: ColorProps['clamp'];
57
62
  static isHex: (color: string) => boolean;
58
- static generateHex: ColorProps['generateHex'];
59
- static generateHexMultiple: ColorProps['generateHexMultiple'];
63
+ private static generateHex;
64
+ private static generateHexMultiple;
65
+ private static generatePastel;
66
+ private static generateNeon;
67
+ private static generateRGB;
68
+ private static brightColor;
69
+ static generate: {
70
+ rgb: typeof Color.generateRGB;
71
+ hex: () => string;
72
+ hexMultiple: (count: number) => string[];
73
+ pastelColor: typeof Color.generatePastel;
74
+ neonColor: typeof Color.generateNeon;
75
+ brightColor: typeof Color.brightColor;
76
+ };
60
77
  }
@@ -8,31 +8,38 @@ export interface Color_P {
8
8
  export interface ColorProps {
9
9
  componentToHex: (c: number) => string;
10
10
  rgbToHex(r: number, g: number, b: number): string;
11
- rgbToHsv(r: number, g: number, b: number): Color_P['ColorRgb'];
12
- hsvToRgb(h: number, s: number, v: number): Color_P['ColorRgb'];
13
- rgbaToHsla(r: number, g: number, b: number, a: number): Color_P['ColorHsla'];
14
- hslaToRgba(h: number, s: number, l: number, a: number): Color_P['ColorRgba'];
15
- hslaStringToRgba(hsla: string): Color_P['ColorRgba'];
16
- hexaToRgba(hexa: string, isNormalizeAlpha?: boolean): Color_P['ColorRgba'];
17
- hexToRgb(hex: string): Color_P['ColorRgb'];
18
- hexaToHsla(hexa: string): Color_P['ColorHsla'];
19
- rgbaToHexa(rgba: Color_P['ColorRgba'] | Color_P['ColorRgb']): string;
11
+ rgbToHsv(r: number, g: number, b: number): Color_P["ColorRgb"];
12
+ hsvToRgb(h: number, s: number, v: number): Color_P["ColorRgb"];
13
+ rgbaToHsla(r: number, g: number, b: number, a: number): Color_P["ColorHsla"];
14
+ hslaToRgba(h: number, s: number, l: number, a: number): Color_P["ColorRgba"];
15
+ hslaStringToRgba(hsla: string): Color_P["ColorRgba"];
16
+ hexaToRgba(hexa: string, isNormalizeAlpha?: boolean): Color_P["ColorRgba"];
17
+ hexToRgb(hex: string): Color_P["ColorRgb"];
18
+ hexaToHsla(hexa: string): Color_P["ColorHsla"];
19
+ rgbaToHexa(rgba: Color_P["ColorRgba"] | Color_P["ColorRgb"]): string;
20
20
  hslaStringToHexa(hsla: string): string;
21
21
  hslaStringToHex(hsla: string): string;
22
- mixColors(color1: Color_P['ColorRgb'], color2: Color_P['ColorRgb'], weight: number): Color_P['ColorRgb'];
23
- getRgbByTypeBrightness(type: Color_P['TypeBrightness_OR']): Color_P['ColorRgb'];
24
- getAverageColor(color1: Color_P['ColorRgb'], color2: Color_P['ColorRgb']): Color_P['ColorRgb'];
25
- getAccentColor(baseHsv: number[], baseColor: Color_P['ColorRgb'], elementColor: Color_P['ColorRgb']): Color_P['ColorRgb'];
26
- changeColorAccent(baseHsv: number[], accentHsv: number[], color: Color_P['ColorRgb'], isDarkTheme: boolean): Color_P['ColorRgb'];
27
- changeBrightness(color: Color_P['ColorRgb'], amount: number): Color_P['ColorRgb'];
22
+ mixColors(color1: Color_P["ColorRgb"], color2: Color_P["ColorRgb"], weight: number): Color_P["ColorRgb"];
23
+ getRgbByTypeBrightness(type: Color_P["TypeBrightness_OR"]): Color_P["ColorRgb"];
24
+ getAverageColor(color1: Color_P["ColorRgb"], color2: Color_P["ColorRgb"]): Color_P["ColorRgb"];
25
+ getAccentColor(baseHsv: number[], baseColor: Color_P["ColorRgb"], elementColor: Color_P["ColorRgb"]): Color_P["ColorRgb"];
26
+ changeColorAccent(baseHsv: number[], accentHsv: number[], color: Color_P["ColorRgb"], isDarkTheme: boolean): Color_P["ColorRgb"];
27
+ changeBrightness(color: Color_P["ColorRgb"], amount: number): Color_P["ColorRgb"];
28
28
  hexBrightness(hex: string, amount: number): string;
29
29
  getHexColorFromTelegramColor(color: number): string;
30
- getRgbColorFromTelegramColor(color: number): Color_P['ColorRgb'];
31
- rgbaToRgb(rgba: Color_P['ColorRgba'], bg: Color_P['ColorRgb']): Color_P['ColorRgb'];
32
- calculateBrightness(rgb: Color_P['ColorRgb'], type?: Color_P['TypeBrightness_OR']): number;
33
- getTextColor(luminance: number): Color_P['ColorRgb'];
30
+ getRgbColorFromTelegramColor(color: number): Color_P["ColorRgb"];
31
+ rgbaToRgb(rgba: Color_P["ColorRgba"], bg: Color_P["ColorRgb"]): Color_P["ColorRgb"];
32
+ calculateBrightness(rgb: Color_P["ColorRgb"], type?: Color_P["TypeBrightness_OR"]): number;
33
+ getTextColor(luminance: number): Color_P["ColorRgb"];
34
34
  calculateOpacity(luminance: number, targetContrast: number): number;
35
35
  clamp(v: number, min: number, max: number): number;
36
- generateHex(): string;
37
- generateHexMultiple(count: number): string[];
36
+ isBrightAndVivid: (color: string) => boolean;
37
+ generate: {
38
+ rgb: () => number[];
39
+ hex: () => string;
40
+ hexMultiple: () => string[];
41
+ pastelColor: () => string;
42
+ neonColor: () => string;
43
+ brightColor: () => string;
44
+ };
38
45
  }
package/dist/index.js CHANGED
@@ -1,10 +1,68 @@
1
1
  var v = Object.defineProperty;
2
2
  var P = (r, e, t) => e in r ? v(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 p = class p {
4
+ const m = class m {
5
+ static rgbToHsl(e, t, s) {
6
+ e /= 255, t /= 255, s /= 255;
7
+ const n = Math.max(e, t, s), o = Math.min(e, t, s);
8
+ let i = 0, a = 0;
9
+ const u = (n + o) / 2;
10
+ if (n !== o) {
11
+ const l = n - o;
12
+ switch (a = u > 0.5 ? l / (2 - n - o) : l / (n + o), n) {
13
+ case e:
14
+ i = (t - s) / l + (t < s ? 6 : 0);
15
+ break;
16
+ case t:
17
+ i = (s - e) / l + 2;
18
+ break;
19
+ case s:
20
+ i = (e - t) / l + 4;
21
+ break;
22
+ }
23
+ i /= 6;
24
+ }
25
+ return { h: i, s: a, l: u };
26
+ }
27
+ static isBrightAndVivid(e) {
28
+ debugger;
29
+ const [t, s, n] = this.hexToRgb(e), o = this.rgbToHsl(t, s, n);
30
+ return o.l >= this.MIN_LIGHTNESS && o.s >= this.MIN_SATURATION;
31
+ }
32
+ static generatePastel() {
33
+ const [e, t, s] = this.generateRGB(), n = Math.floor((e + 255) / 2), o = Math.floor((t + 255) / 2), i = Math.floor((s + 255) / 2);
34
+ return `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
35
+ }
36
+ static generateNeon() {
37
+ const e = [
38
+ Math.floor(Math.random() * 128 + 128),
39
+ // Яркий канал
40
+ Math.floor(Math.random() * 64),
41
+ // Темный канал
42
+ Math.floor(Math.random() * 64)
43
+ // Темный канал
44
+ ];
45
+ for (let t = e.length - 1; t > 0; t--) {
46
+ const s = Math.floor(Math.random() * (t + 1));
47
+ [e[t], e[s]] = [e[s], e[t]];
48
+ }
49
+ return `#${e[0].toString(16).padStart(2, "0")}${e[1].toString(16).padStart(2, "0")}${e[2].toString(16).padStart(2, "0")}`;
50
+ }
51
+ static generateRGB() {
52
+ return Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128));
53
+ }
54
+ static brightColor() {
55
+ let e = 0, t;
56
+ do {
57
+ const [s, n, o] = m.generateRGB();
58
+ if (t = `#${s.toString(16).padStart(2, "0")}${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}`, e++, e > 100)
59
+ break;
60
+ } while (!m.isBrightAndVivid(t));
61
+ return t;
62
+ }
5
63
  };
6
64
  /*Проверить свои методы и возможно исключить т.к. функционал возможно повторяется */
7
- c(p, "componentToHex", (e) => {
65
+ c(m, "componentToHex", (e) => {
8
66
  const t = e.toString(16);
9
67
  return t.length == 1 ? "0" + t : t;
10
68
  }), // static getNumberRGB = (getComputedStyleRGB) => {
@@ -14,12 +72,12 @@ c(p, "componentToHex", (e) => {
14
72
  // }
15
73
  // return arrSTRNumber ? arrSTRNumber : [255, 255, 255];
16
74
  // };
17
- c(p, "rgbToHex", (e, t, s) => "#" + p.componentToHex(e) + p.componentToHex(t) + p.componentToHex(s)), /**
75
+ c(m, "rgbToHex", (e, t, s) => "#" + m.componentToHex(e) + m.componentToHex(t) + m.componentToHex(s)), /**
18
76
  * https://stackoverflow.com/a/54070620/6758968
19
77
  * r, g, b in [0, 255]
20
78
  * @returns h in [0,360) and s, v in [0,1]
21
79
  */
22
- c(p, "rgbToHsv", (e, t, s) => {
80
+ c(m, "rgbToHsv", (e, t, s) => {
23
81
  e /= 255, t /= 255, s /= 255;
24
82
  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);
25
83
  return [60 * (i < 0 ? i + 6 : i), n && o / n, n];
@@ -30,13 +88,13 @@ c(p, "rgbToHsv", (e, t, s) => {
30
88
  * @param v [0, 1]
31
89
  * @returns r, g, b in [0, 255]
32
90
  */
33
- c(p, "hsvToRgb", (e, t, s) => {
91
+ c(m, "hsvToRgb", (e, t, s) => {
34
92
  const n = (o, i = (o + e / 60) % 6) => Math.round((s - s * t * Math.max(Math.min(i, 4 - i, 1), 0)) * 255);
35
93
  return [n(5), n(3), n(1)];
36
94
  }), /**
37
95
  * @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
38
96
  */
39
- c(p, "rgbaToHsla", (e, t, s, n = 1) => {
97
+ c(m, "rgbaToHsla", (e, t, s, n = 1) => {
40
98
  e /= 255, t /= 255, s /= 255;
41
99
  const o = Math.max(e, t, s), i = Math.min(e, t, s);
42
100
  let a = 0, u;
@@ -74,22 +132,22 @@ c(p, "rgbaToHsla", (e, t, s, n = 1) => {
74
132
  * @param {number} l The lightness [0, 1]
75
133
  * @return {Array} The RGB representation [0, 255]
76
134
  */
77
- c(p, "hslaToRgba", (e, t, s, n) => {
135
+ c(m, "hslaToRgba", (e, t, s, n) => {
78
136
  e /= 360, t /= 100, s /= 100;
79
137
  let o, i, a;
80
138
  if (t === 0)
81
139
  o = i = a = s;
82
140
  else {
83
- const u = function(y, w, d) {
84
- return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ? y + (w - y) * 6 * d : d < 0.5 ? w : d < 0.6666666666666666 ? y + (w - y) * (0.6666666666666666 - d) * 6 : y;
141
+ const u = function(b, w, d) {
142
+ return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ? b + (w - b) * 6 * d : d < 0.5 ? w : d < 0.6666666666666666 ? b + (w - b) * (0.6666666666666666 - d) * 6 : b;
85
143
  }, l = s < 0.5 ? s * (1 + t) : s + t - s * t, f = 2 * s - l;
86
144
  o = u(f, l, e + 1 / 3), i = u(f, l, e), a = u(f, l, e - 1 / 3);
87
145
  }
88
146
  return [o, i, a, n].map((u) => Math.round(u * 255));
89
- }), c(p, "hslaStringToRgba", (e) => {
147
+ }), c(m, "hslaStringToRgba", (e) => {
90
148
  const t = e.slice(5, -1).split(", "), s = Number(t.pop()), n = t.map((o) => o.endsWith("%") ? +o.slice(0, -1) : +o);
91
- return p.hslaToRgba(n[0], n[1], n[2], s);
92
- }), c(p, "hexaToRgba", (e, t) => {
149
+ return m.hslaToRgba(n[0], n[1], n[2], s);
150
+ }), c(m, "hexaToRgba", (e, t) => {
93
151
  const s = [], n = e[0] === "#" ? 1 : 0;
94
152
  if (e.length === 5 + n && (e = (n ? "#" : "") + "0" + e.slice(n)), e.length === 3 + n)
95
153
  for (let o = n; o < e.length; ++o)
@@ -102,49 +160,49 @@ c(p, "hslaToRgba", (e, t, s, n) => {
102
160
  for (let o = n; o < e.length; o += 2)
103
161
  s.push(parseInt(e.slice(o, o + 2), 16));
104
162
  return t && s.length === 4 && (s[3] = Math.round(s[3] / 255 * 100) / 100), s;
105
- }), c(p, "hexaToHsla", (e) => {
106
- const t = p.hexaToRgba(e);
107
- return p.rgbaToHsla(t[0], t[1], t[2], t[3]);
108
- }), c(p, "hexToRgb", (e) => p.hexaToRgba(e.slice(0, 7))), c(p, "rgbaToHexa", (e) => {
163
+ }), c(m, "hexaToHsla", (e) => {
164
+ const t = m.hexaToRgba(e);
165
+ return m.rgbaToHsla(t[0], t[1], t[2], t[3]);
166
+ }), c(m, "hexToRgb", (e) => m.hexaToRgba(e.slice(0, 7))), c(m, "rgbaToHexa", (e) => {
109
167
  const t = [...e], s = t.pop(), n = Math.round(Math.min(Math.max(s ?? 1, 0), 1) * 255);
110
168
  return "#" + t.map((o) => ("0" + o.toString(16)).slice(-2)).join("") + n.toString(16);
111
- }), c(p, "hslaStringToHexa", (e) => p.rgbaToHexa(p.hslaStringToRgba(e))), c(p, "hslaStringToHex", (e) => p.hslaStringToHexa(e).slice(0, -2)), /**
169
+ }), c(m, "hslaStringToHexa", (e) => m.rgbaToHexa(m.hslaStringToRgba(e))), c(m, "hslaStringToHex", (e) => m.hslaStringToHexa(e).slice(0, -2)), /**
112
170
  * @param weight [0, 1]
113
171
  */
114
- c(p, "mixColors", (e, t, s) => {
172
+ c(m, "mixColors", (e, t, s) => {
115
173
  const n = new Array(3);
116
174
  for (let o = 0; o < 3; ++o) {
117
175
  const i = e[o], a = t[o];
118
176
  n[o] = Math.floor(a + (i - a) * s);
119
177
  }
120
178
  return n;
121
- }), c(p, "getRgbByTypeBrightness", (e) => ({
179
+ }), c(m, "getRgbByTypeBrightness", (e) => ({
122
180
  BT601: [0.299, 0.587, 0.114],
123
181
  BT709: [0.2126, 0.7152, 0.0722],
124
182
  BT2020: [0.2627, 0.678, 0.0593]
125
- })[e]), c(p, "getAverageColor", (e, t) => e.map((s, n) => Math.round((s + t[n]) / 2))), c(p, "getAccentColor", (e, t, s) => {
126
- const n = p.rgbToHsv(...t), o = p.rgbToHsv(...s), i = Math.min(1.5 * n[1] / e[1], 1);
127
- 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 : p.hsvToRgb(...n);
128
- }), c(p, "changeColorAccent", (e, t, s, n) => {
129
- const o = p.rgbToHsv(...s);
183
+ })[e]), c(m, "getAverageColor", (e, t) => e.map((s, n) => Math.round((s + t[n]) / 2))), c(m, "getAccentColor", (e, t, s) => {
184
+ const n = m.rgbToHsv(...t), o = m.rgbToHsv(...s), i = Math.min(1.5 * n[1] / e[1], 1);
185
+ 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);
186
+ }), c(m, "changeColorAccent", (e, t, s, n) => {
187
+ const o = m.rgbToHsv(...s);
130
188
  if (Math.min(Math.abs(o[0] - e[0]), Math.abs(o[0] - e[0] - 360)) > 30)
131
189
  return s;
132
190
  const a = e[1] ? Math.min(1.5 * o[1] / e[1], 1) : 0;
133
191
  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;
134
- let u = p.hsvToRgb(...o);
135
- const l = p.calculateBrightness(s), f = p.calculateBrightness(u);
192
+ let u = m.hsvToRgb(...o);
193
+ const l = m.calculateBrightness(s), f = m.calculateBrightness(u);
136
194
  if (n ? l > f : l < f) {
137
195
  const w = 0.4 * l / f + 0.6;
138
- u = p.changeBrightness(u, w);
196
+ u = m.changeBrightness(u, w);
139
197
  }
140
198
  return u;
141
- }), c(p, "changeBrightness", (e, t) => e.map((s) => p.clamp(Math.round(s * t), 0, 255))), c(p, "hexBrightness", (e, t) => {
142
- const s = p.hexToRgb(e), n = p.changeBrightness(s, t), [o, i, a] = n;
143
- return p.rgbToHex(o, i, a);
144
- }), c(p, "getHexColorFromTelegramColor", (e) => {
199
+ }), c(m, "changeBrightness", (e, t) => e.map((s) => m.clamp(Math.round(s * t), 0, 255))), c(m, "hexBrightness", (e, t) => {
200
+ const s = m.hexToRgb(e), n = m.changeBrightness(s, t), [o, i, a] = n;
201
+ return m.rgbToHex(o, i, a);
202
+ }), c(m, "getHexColorFromTelegramColor", (e) => {
145
203
  const t = (e < 0 ? 16777215 + e : e).toString(16);
146
204
  return "#" + (t.length >= 6 ? t : "0".repeat(6 - t.length) + t);
147
- }), c(p, "getRgbColorFromTelegramColor", (e) => p.hexToRgb(p.getHexColorFromTelegramColor(e))), // static getColorsFromWallPaper(wallPaper) {
205
+ }), c(m, "getRgbColorFromTelegramColor", (e) => m.hexToRgb(m.getHexColorFromTelegramColor(e))), // static getColorsFromWallPaper(wallPaper) {
148
206
  // return wallPaper.settings
149
207
  // ? [
150
208
  // wallPaper.settings.background_color,
@@ -157,22 +215,29 @@ c(p, "mixColors", (e, t, s) => {
157
215
  // .join(",")
158
216
  // : "";
159
217
  // }
160
- c(p, "rgbaToRgb", (e, t) => {
218
+ c(m, "rgbaToRgb", (e, t) => {
161
219
  const s = e[3];
162
- return e.slice(0, 3).map((n, o) => p.clamp(Math.round((s * (n / 255) + s * (t[o] / 255)) * 255), 0, 255));
163
- }), c(p, "calculateBrightness", (e, t = "BT709") => {
164
- const [s, n, o] = e, i = p.getRgbByTypeBrightness(t);
220
+ return e.slice(0, 3).map((n, o) => m.clamp(Math.round((s * (n / 255) + s * (t[o] / 255)) * 255), 0, 255));
221
+ }), c(m, "calculateBrightness", (e, t = "BT709") => {
222
+ const [s, n, o] = e, i = m.getRgbByTypeBrightness(t);
165
223
  return i[0] * s / 255 + i[1] * n / 255 + i[2] * o / 255;
166
- }), c(p, "getTextColor", (e) => e > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(p, "calculateOpacity", (e, t) => {
224
+ }), c(m, "getTextColor", (e) => e > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(m, "MIN_BRIGHTNESS", 0.6), c(m, "MIN_SATURATION", 0.5), c(m, "MIN_LIGHTNESS", 0.4), c(m, "calculateOpacity", (e, t) => {
167
225
  const s = e > 0.5 ? 0 : 1, n = (e - s + t) / t;
168
226
  return +Math.max(0.5, Math.min(0.64, n)).toFixed(2);
169
- }), c(p, "clamp", (e, t, s) => Math.min(s, Math.max(t, e))), c(p, "isHex", (e) => {
227
+ }), c(m, "clamp", (e, t, s) => Math.min(s, Math.max(t, e))), c(m, "isHex", (e) => {
170
228
  if (typeof e != "string")
171
229
  return !1;
172
230
  const t = e.replace(/^#/, "");
173
231
  return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(t);
174
- }), c(p, "generateHex", () => `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`), c(p, "generateHexMultiple", (e) => Array.from({ length: e }, () => p.generateHex()));
175
- let Color = p;
232
+ }), 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", {
233
+ rgb: m.generateRGB,
234
+ hex: m.generateHex,
235
+ hexMultiple: m.generateHexMultiple,
236
+ pastelColor: m.generatePastel,
237
+ neonColor: m.generateNeon,
238
+ brightColor: m.brightColor
239
+ });
240
+ let Color = m;
176
241
  const itemsMonths = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], itemsWeek = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], _DateProcessing = class _DateProcessing {
177
242
  };
178
243
  c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
@@ -314,17 +379,17 @@ class DelaysPromise {
314
379
  };
315
380
  let o = !0, i, a, u;
316
381
  const l = (h = !0) => {
317
- const y = "Ручное завершение startActionEvery";
318
- o = !1, clearInterval(i), s(null), h ? a && a({ status: h, msg: y + ": (true)" }) : u && u({ status: h, msg: y + ": (false)" });
382
+ const b = "Ручное завершение startActionEvery";
383
+ o = !1, clearInterval(i), s(null), h ? a && a({ status: h, msg: b + ": (true)" }) : u && u({ status: h, msg: b + ": (false)" });
319
384
  };
320
385
  return {
321
- promise: new Promise((h, y) => {
322
- a = h, u = y;
386
+ promise: new Promise((h, b) => {
387
+ a = h, u = b;
323
388
  let w = 0, d = 0;
324
389
  i = setInterval(
325
390
  () => {
326
391
  if (w += t.interval, d += 1, t != null && t.cutoffTime && w > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < d) {
327
- o = !1, clearInterval(i), s(null), y({ status: !1, msg: Error("Время загрузки истекло") });
392
+ o = !1, clearInterval(i), s(null), b({ status: !1, msg: Error("Время загрузки истекло") });
328
393
  return;
329
394
  }
330
395
  e() && (o = !1, clearInterval(i), s(null), h({ status: !0, msg: "cb вернул true" }));
@@ -367,22 +432,22 @@ class DelaysPromise {
367
432
  }));
368
433
  }
369
434
  }
370
- const C = class C {
435
+ const $ = class $ {
371
436
  static getDataApplication(e) {
372
- const { applications: t } = C;
437
+ const { applications: t } = $;
373
438
  return t[e] ? t[e] : t.pdf;
374
439
  }
375
440
  };
376
- c(C, "startSrt", "data:application/"), c(C, "applications", {
377
- xls: `${C.startSrt}vnd.ms-excel;`,
378
- xlsx: `${C.startSrt}vnd.openxmlformats-officedocument.spreadsheetml.sheet;`,
379
- pdf: `${C.startSrt}pdf;`,
380
- csv: `${C.startSrt}vnd.ms-excel;`
381
- }), c(C, "download", (e) => {
382
- const { format: t, name: s, base64: n } = e, o = `${C.getDataApplication(t)}base64,${n}`, i = document.createElement("a"), a = `${s}.${t}`;
441
+ c($, "startSrt", "data:application/"), c($, "applications", {
442
+ xls: `${$.startSrt}vnd.ms-excel;`,
443
+ xlsx: `${$.startSrt}vnd.openxmlformats-officedocument.spreadsheetml.sheet;`,
444
+ pdf: `${$.startSrt}pdf;`,
445
+ csv: `${$.startSrt}vnd.ms-excel;`
446
+ }), c($, "download", (e) => {
447
+ const { format: t, name: s, base64: n } = e, o = `${$.getDataApplication(t)}base64,${n}`, i = document.createElement("a"), a = `${s}.${t}`;
383
448
  i.href = o, i.download = a, i.click();
384
449
  });
385
- let File = C;
450
+ let File = $;
386
451
  class NetworkInformation {
387
452
  constructor(e) {
388
453
  c(this, "listNetworkInformation", []);
@@ -715,8 +780,8 @@ function toFormData(r, e, t) {
715
780
  metaTokens: !0,
716
781
  dots: !1,
717
782
  indexes: !1
718
- }, !1, function(g, m) {
719
- return !utils$1.isUndefined(m[g]);
783
+ }, !1, function(g, p) {
784
+ return !utils$1.isUndefined(p[g]);
720
785
  });
721
786
  const s = t.metaTokens, n = t.visitor || f, o = t.dots, i = t.indexes, u = (t.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(e);
722
787
  if (!utils$1.isFunction(n))
@@ -730,23 +795,23 @@ function toFormData(r, e, t) {
730
795
  throw new AxiosError("Blob is not supported. Use a Buffer instead.");
731
796
  return utils$1.isArrayBuffer(d) || utils$1.isTypedArray(d) ? u && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
732
797
  }
733
- function f(d, g, m) {
798
+ function f(d, g, p) {
734
799
  let D = d;
735
- if (d && !m && typeof d == "object") {
800
+ if (d && !p && typeof d == "object") {
736
801
  if (utils$1.endsWith(g, "{}"))
737
802
  g = s ? g : g.slice(0, -2), d = JSON.stringify(d);
738
803
  else if (utils$1.isArray(d) && isFlatArray(d) || (utils$1.isFileList(d) || utils$1.endsWith(g, "[]")) && (D = utils$1.toArray(d)))
739
- return g = removeBrackets(g), D.forEach(function(E, T) {
740
- !(utils$1.isUndefined(E) || E === null) && e.append(
804
+ return g = removeBrackets(g), D.forEach(function(S, T) {
805
+ !(utils$1.isUndefined(S) || S === null) && e.append(
741
806
  // eslint-disable-next-line no-nested-ternary
742
807
  i === !0 ? renderKey([g], T, o) : i === null ? g : g + "[]",
743
- l(E)
808
+ l(S)
744
809
  );
745
810
  }), !1;
746
811
  }
747
- return isVisitable(d) ? !0 : (e.append(renderKey(m, g, o), l(d)), !1);
812
+ return isVisitable(d) ? !0 : (e.append(renderKey(p, g, o), l(d)), !1);
748
813
  }
749
- const h = [], y = Object.assign(predicates, {
814
+ const h = [], b = Object.assign(predicates, {
750
815
  defaultVisitor: f,
751
816
  convertValue: l,
752
817
  isVisitable
@@ -761,7 +826,7 @@ function toFormData(r, e, t) {
761
826
  D,
762
827
  utils$1.isString(A) ? A.trim() : A,
763
828
  g,
764
- y
829
+ b
765
830
  )) === !0 && w(D, g ? g.concat(A) : [A]);
766
831
  }), h.pop();
767
832
  }
@@ -1236,13 +1301,13 @@ function speedometer(r, e) {
1236
1301
  return e = e !== void 0 ? e : 1e3, function(u) {
1237
1302
  const l = Date.now(), f = s[o];
1238
1303
  i || (i = l), t[n] = u, s[n] = l;
1239
- let h = o, y = 0;
1304
+ let h = o, b = 0;
1240
1305
  for (; h !== n; )
1241
- y += t[h++], h = h % r;
1306
+ b += t[h++], h = h % r;
1242
1307
  if (n = (n + 1) % r, n === o && (o = (o + 1) % r), l - i < e)
1243
1308
  return;
1244
1309
  const w = f && l - f;
1245
- return w ? Math.round(y * 1e3 / w) : void 0;
1310
+ return w ? Math.round(b * 1e3 / w) : void 0;
1246
1311
  };
1247
1312
  }
1248
1313
  function throttle(r, e) {
@@ -1413,8 +1478,8 @@ function mergeConfig(r, e) {
1413
1478
  headers: (l, f) => n(headersToObject(l), headersToObject(f), !0)
1414
1479
  };
1415
1480
  return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(f) {
1416
- const h = u[f] || n, y = h(r[f], e[f], f);
1417
- utils$1.isUndefined(y) && h !== a || (t[f] = y);
1481
+ const h = u[f] || n, b = h(r[f], e[f], f);
1482
+ utils$1.isUndefined(b) && h !== a || (t[f] = b);
1418
1483
  }), t;
1419
1484
  }
1420
1485
  const resolveConfig = (r) => {
@@ -1443,57 +1508,57 @@ const resolveConfig = (r) => {
1443
1508
  const n = resolveConfig(r);
1444
1509
  let o = n.data;
1445
1510
  const i = AxiosHeaders$1.from(n.headers).normalize();
1446
- let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, h, y, w, d;
1511
+ let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, h, b, w, d;
1447
1512
  function g() {
1448
1513
  w && w(), d && d(), n.cancelToken && n.cancelToken.unsubscribe(f), n.signal && n.signal.removeEventListener("abort", f);
1449
1514
  }
1450
- let m = new XMLHttpRequest();
1451
- m.open(n.method.toUpperCase(), n.url, !0), m.timeout = n.timeout;
1515
+ let p = new XMLHttpRequest();
1516
+ p.open(n.method.toUpperCase(), n.url, !0), p.timeout = n.timeout;
1452
1517
  function D() {
1453
- if (!m)
1518
+ if (!p)
1454
1519
  return;
1455
- const E = AxiosHeaders$1.from(
1456
- "getAllResponseHeaders" in m && m.getAllResponseHeaders()
1520
+ const S = AxiosHeaders$1.from(
1521
+ "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1457
1522
  ), x = {
1458
- data: !a || a === "text" || a === "json" ? m.responseText : m.response,
1459
- status: m.status,
1460
- statusText: m.statusText,
1461
- headers: E,
1523
+ data: !a || a === "text" || a === "json" ? p.responseText : p.response,
1524
+ status: p.status,
1525
+ statusText: p.statusText,
1526
+ headers: S,
1462
1527
  config: r,
1463
- request: m
1528
+ request: p
1464
1529
  };
1465
- settle(function($) {
1466
- t($), g();
1467
- }, function($) {
1468
- s($), g();
1469
- }, x), m = null;
1530
+ settle(function(C) {
1531
+ t(C), g();
1532
+ }, function(C) {
1533
+ s(C), g();
1534
+ }, x), p = null;
1470
1535
  }
1471
- "onloadend" in m ? m.onloadend = D : m.onreadystatechange = function() {
1472
- !m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(D);
1473
- }, m.onabort = function() {
1474
- m && (s(new AxiosError("Request aborted", AxiosError.ECONNABORTED, r, m)), m = null);
1475
- }, m.onerror = function() {
1476
- s(new AxiosError("Network Error", AxiosError.ERR_NETWORK, r, m)), m = null;
1477
- }, m.ontimeout = function() {
1536
+ "onloadend" in p ? p.onloadend = D : p.onreadystatechange = function() {
1537
+ !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(D);
1538
+ }, p.onabort = function() {
1539
+ p && (s(new AxiosError("Request aborted", AxiosError.ECONNABORTED, r, p)), p = null);
1540
+ }, p.onerror = function() {
1541
+ s(new AxiosError("Network Error", AxiosError.ERR_NETWORK, r, p)), p = null;
1542
+ }, p.ontimeout = function() {
1478
1543
  let T = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
1479
1544
  const x = n.transitional || transitionalDefaults;
1480
1545
  n.timeoutErrorMessage && (T = n.timeoutErrorMessage), s(new AxiosError(
1481
1546
  T,
1482
1547
  x.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
1483
1548
  r,
1484
- m
1485
- )), m = null;
1486
- }, o === void 0 && i.setContentType(null), "setRequestHeader" in m && utils$1.forEach(i.toJSON(), function(T, x) {
1487
- m.setRequestHeader(x, T);
1488
- }), utils$1.isUndefined(n.withCredentials) || (m.withCredentials = !!n.withCredentials), a && a !== "json" && (m.responseType = n.responseType), l && ([y, d] = progressEventReducer(l, !0), m.addEventListener("progress", y)), u && m.upload && ([h, w] = progressEventReducer(u), m.upload.addEventListener("progress", h), m.upload.addEventListener("loadend", w)), (n.cancelToken || n.signal) && (f = (E) => {
1489
- m && (s(!E || E.type ? new CanceledError(null, r, m) : E), m.abort(), m = null);
1549
+ p
1550
+ )), p = null;
1551
+ }, o === void 0 && i.setContentType(null), "setRequestHeader" in p && utils$1.forEach(i.toJSON(), function(T, x) {
1552
+ p.setRequestHeader(x, T);
1553
+ }), utils$1.isUndefined(n.withCredentials) || (p.withCredentials = !!n.withCredentials), a && a !== "json" && (p.responseType = n.responseType), l && ([b, d] = progressEventReducer(l, !0), p.addEventListener("progress", b)), u && p.upload && ([h, w] = progressEventReducer(u), p.upload.addEventListener("progress", h), p.upload.addEventListener("loadend", w)), (n.cancelToken || n.signal) && (f = (S) => {
1554
+ p && (s(!S || S.type ? new CanceledError(null, r, p) : S), p.abort(), p = null);
1490
1555
  }, n.cancelToken && n.cancelToken.subscribe(f), n.signal && (n.signal.aborted ? f() : n.signal.addEventListener("abort", f)));
1491
1556
  const A = parseProtocol(n.url);
1492
1557
  if (A && platform.protocols.indexOf(A) === -1) {
1493
1558
  s(new AxiosError("Unsupported protocol " + A + ":", AxiosError.ERR_BAD_REQUEST, r));
1494
1559
  return;
1495
1560
  }
1496
- m.send(o || null);
1561
+ p.send(o || null);
1497
1562
  });
1498
1563
  }, composeSignals = (r, e) => {
1499
1564
  const { length: t } = r = r ? r.filter(Boolean) : [];
@@ -1561,8 +1626,8 @@ const resolveConfig = (r) => {
1561
1626
  }
1562
1627
  let h = f.byteLength;
1563
1628
  if (t) {
1564
- let y = o += h;
1565
- t(y);
1629
+ let b = o += h;
1630
+ t(b);
1566
1631
  }
1567
1632
  u.enqueue(new Uint8Array(f));
1568
1633
  } catch (l) {
@@ -1631,33 +1696,33 @@ const getBodyLength = async (r) => {
1631
1696
  responseType: l,
1632
1697
  headers: f,
1633
1698
  withCredentials: h = "same-origin",
1634
- fetchOptions: y
1699
+ fetchOptions: b
1635
1700
  } = resolveConfig(r);
1636
1701
  l = l ? (l + "").toLowerCase() : "text";
1637
1702
  let w = composeSignals$1([n, o && o.toAbortSignal()], i), d;
1638
1703
  const g = w && w.unsubscribe && (() => {
1639
1704
  w.unsubscribe();
1640
1705
  });
1641
- let m;
1706
+ let p;
1642
1707
  try {
1643
- if (u && supportsRequestStream && t !== "get" && t !== "head" && (m = await resolveBodyLength(f, s)) !== 0) {
1708
+ if (u && supportsRequestStream && t !== "get" && t !== "head" && (p = await resolveBodyLength(f, s)) !== 0) {
1644
1709
  let x = new Request(e, {
1645
1710
  method: "POST",
1646
1711
  body: s,
1647
1712
  duplex: "half"
1648
1713
  }), O;
1649
1714
  if (utils$1.isFormData(s) && (O = x.headers.get("content-type")) && f.setContentType(O), x.body) {
1650
- const [$, k] = progressEventDecorator(
1651
- m,
1715
+ const [C, N] = progressEventDecorator(
1716
+ p,
1652
1717
  progressEventReducer(asyncDecorator(u))
1653
1718
  );
1654
- s = trackStream(x.body, DEFAULT_CHUNK_SIZE, $, k);
1719
+ s = trackStream(x.body, DEFAULT_CHUNK_SIZE, C, N);
1655
1720
  }
1656
1721
  }
1657
1722
  utils$1.isString(h) || (h = h ? "include" : "omit");
1658
1723
  const D = "credentials" in Request.prototype;
1659
1724
  d = new Request(e, {
1660
- ...y,
1725
+ ...b,
1661
1726
  signal: w,
1662
1727
  method: t.toUpperCase(),
1663
1728
  headers: f.normalize().toJSON(),
@@ -1666,26 +1731,26 @@ const getBodyLength = async (r) => {
1666
1731
  credentials: D ? h : void 0
1667
1732
  });
1668
1733
  let A = await fetch(d);
1669
- const E = supportsResponseStream && (l === "stream" || l === "response");
1670
- if (supportsResponseStream && (a || E && g)) {
1734
+ const S = supportsResponseStream && (l === "stream" || l === "response");
1735
+ if (supportsResponseStream && (a || S && g)) {
1671
1736
  const x = {};
1672
- ["status", "statusText", "headers"].forEach((N) => {
1673
- x[N] = A[N];
1737
+ ["status", "statusText", "headers"].forEach((k) => {
1738
+ x[k] = A[k];
1674
1739
  });
1675
- const O = utils$1.toFiniteNumber(A.headers.get("content-length")), [$, k] = a && progressEventDecorator(
1740
+ const O = utils$1.toFiniteNumber(A.headers.get("content-length")), [C, N] = a && progressEventDecorator(
1676
1741
  O,
1677
1742
  progressEventReducer(asyncDecorator(a), !0)
1678
1743
  ) || [];
1679
1744
  A = new Response(
1680
- trackStream(A.body, DEFAULT_CHUNK_SIZE, $, () => {
1681
- k && k(), g && g();
1745
+ trackStream(A.body, DEFAULT_CHUNK_SIZE, C, () => {
1746
+ N && N(), g && g();
1682
1747
  }),
1683
1748
  x
1684
1749
  );
1685
1750
  }
1686
1751
  l = l || "text";
1687
1752
  let T = await resolvers[utils$1.findKey(resolvers, l) || "text"](A, r);
1688
- return !E && g && g(), await new Promise((x, O) => {
1753
+ return !S && g && g(), await new Promise((x, O) => {
1689
1754
  settle(x, O, {
1690
1755
  data: T,
1691
1756
  headers: AxiosHeaders$1.from(A.headers),
@@ -1880,21 +1945,21 @@ class Axios {
1880
1945
  this.interceptors.response.forEach(function(g) {
1881
1946
  l.push(g.fulfilled, g.rejected);
1882
1947
  });
1883
- let f, h = 0, y;
1948
+ let f, h = 0, b;
1884
1949
  if (!u) {
1885
1950
  const d = [dispatchRequest.bind(this), void 0];
1886
- for (d.unshift.apply(d, a), d.push.apply(d, l), y = d.length, f = Promise.resolve(t); h < y; )
1951
+ for (d.unshift.apply(d, a), d.push.apply(d, l), b = d.length, f = Promise.resolve(t); h < b; )
1887
1952
  f = f.then(d[h++], d[h++]);
1888
1953
  return f;
1889
1954
  }
1890
- y = a.length;
1955
+ b = a.length;
1891
1956
  let w = t;
1892
- for (h = 0; h < y; ) {
1957
+ for (h = 0; h < b; ) {
1893
1958
  const d = a[h++], g = a[h++];
1894
1959
  try {
1895
1960
  w = d(w);
1896
- } catch (m) {
1897
- g.call(this, m);
1961
+ } catch (p) {
1962
+ g.call(this, p);
1898
1963
  break;
1899
1964
  }
1900
1965
  }
@@ -1903,7 +1968,7 @@ class Axios {
1903
1968
  } catch (d) {
1904
1969
  return Promise.reject(d);
1905
1970
  }
1906
- for (h = 0, y = l.length; h < y; )
1971
+ for (h = 0, b = l.length; h < b; )
1907
1972
  f = f.then(l[h++], l[h++]);
1908
1973
  return f;
1909
1974
  }
@@ -2285,7 +2350,7 @@ c(R, "events", (e, t, s, n = "") => new Promise((o, i) => {
2285
2350
  return [...n, ...o];
2286
2351
  });
2287
2352
  let Utils = R;
2288
- const S = class S {
2353
+ const E = class E {
2289
2354
  constructor() {
2290
2355
  c(this, "getDecodingError", () => ({
2291
2356
  ERR_BAD_OPTION_VALUE: "Неправильное значение опции",
@@ -2298,18 +2363,18 @@ const S = class S {
2298
2363
  }));
2299
2364
  }
2300
2365
  static setErrorsHandler(e) {
2301
- S.errorsHandler = e;
2366
+ E.errorsHandler = e;
2302
2367
  }
2303
2368
  };
2304
- c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerRequest", new SaveRequest()), c(S, "registerFailedRequests", new SaveRequest()), c(S, "requestUploadToken", null), c(S, "errorsHandler", new ErrorsHandler()), c(S, "setMethodUploadToken", (e) => {
2305
- S.requestUploadToken = e;
2306
- }), c(S, "requestInServer", (e, t = {}) => new Promise((s, n) => {
2307
- var y;
2369
+ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerRequest", new SaveRequest()), c(E, "registerFailedRequests", new SaveRequest()), c(E, "requestUploadToken", null), c(E, "errorsHandler", new ErrorsHandler()), c(E, "setMethodUploadToken", (e) => {
2370
+ E.requestUploadToken = e;
2371
+ }), c(E, "requestInServer", (e, t = {}) => new Promise((s, n) => {
2372
+ var b;
2308
2373
  let o = { url: e, statusCode: 0, data: {}, res: {} };
2309
2374
  const i = {
2310
2375
  method: "get",
2311
2376
  headers: {
2312
- cookie: S.getAuthCookies()
2377
+ cookie: E.getAuthCookies()
2313
2378
  },
2314
2379
  timeout: 6e4
2315
2380
  }, a = Utils.deepMerge(i, t), u = 520, l = "", f = {
@@ -2320,60 +2385,60 @@ c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerReques
2320
2385
  request: a,
2321
2386
  errExt: { message: l, status: u }
2322
2387
  }, { cordova: h } = window;
2323
- if (h != null && h.cordova && ((y = h == null ? void 0 : h.plugin) != null && y.http)) {
2388
+ if (h != null && h.cordova && ((b = h == null ? void 0 : h.plugin) != null && b.http)) {
2324
2389
  const { http: w } = h == null ? void 0 : h.plugin;
2325
- "Content-Type" in (a == null ? void 0 : a.headers) && ((a == null ? void 0 : a.headers["Content-Type"]) === "multipart/form-data" && w.setDataSerializer("urlencoded"), (a == null ? void 0 : a.headers["Content-Type"]) === "application/json" && w.setDataSerializer("json")), w.setRequestTimeout(Number(a.timeout) / 1e3), S.registerRequest.setList({ url: e, options: a }), w.sendRequest(
2390
+ "Content-Type" in (a == null ? void 0 : a.headers) && ((a == null ? void 0 : a.headers["Content-Type"]) === "multipart/form-data" && w.setDataSerializer("urlencoded"), (a == null ? void 0 : a.headers["Content-Type"]) === "application/json" && w.setDataSerializer("json")), w.setRequestTimeout(Number(a.timeout) / 1e3), E.registerRequest.setList({ url: e, options: a }), w.sendRequest(
2326
2391
  e,
2327
2392
  a,
2328
2393
  (d) => {
2329
- S.registerFailedRequests.removeItem(e), S.registerRequest.removeItem(e);
2330
- const g = (d == null ? void 0 : d.headers) && d.headers["set-cookie"], m = d.status, D = Utils.isJSON(d == null ? void 0 : d.data) ? JSON.parse(d == null ? void 0 : d.data) : d == null ? void 0 : d.data;
2331
- o = { ...o, statusCode: m, data: D, res: d }, m === 200 && g && (S.saveToken(g), o.data = { ...o.data, token: g }), s(o);
2394
+ E.registerFailedRequests.removeItem(e), E.registerRequest.removeItem(e);
2395
+ const g = (d == null ? void 0 : d.headers) && d.headers["set-cookie"], p = d.status, D = Utils.isJSON(d == null ? void 0 : d.data) ? JSON.parse(d == null ? void 0 : d.data) : d == null ? void 0 : d.data;
2396
+ o = { ...o, statusCode: p, data: D, res: d }, p === 200 && g && (E.saveToken(g), o.data = { ...o.data, token: g }), s(o);
2332
2397
  },
2333
2398
  (d) => {
2334
- const g = S.errorsHandler.handleError(d), { url: m, status: D, headers: A, error: E, ...T } = d, x = typeof E == "string" ? Utils.isJSON(E.trim()) : !1, O = {
2399
+ const g = E.errorsHandler.handleError(d), { url: p, status: D, headers: A, error: S, ...T } = d, x = typeof S == "string" ? Utils.isJSON(S.trim()) : !1, O = {
2335
2400
  headers: A,
2336
2401
  status: D,
2337
2402
  message: ""
2338
2403
  };
2339
2404
  if (x) {
2340
- const $ = JSON.parse(E.trim()), k = S.errorsHandler.getErrorMessageFromData(D, $);
2341
- O.message = k, O.data = $, g.msg = S.errorsHandler.gerErrorByStatusCordovaHttp(D, m);
2405
+ const C = JSON.parse(S.trim()), N = E.errorsHandler.getErrorMessageFromData(D, C);
2406
+ O.message = N, O.data = C, g.msg = E.errorsHandler.gerErrorByStatusCordovaHttp(D, p);
2342
2407
  } else
2343
- typeof E == "string" && (O.message = E);
2408
+ typeof S == "string" && (O.message = S);
2344
2409
  n({ ...f, ...g, errExt: O });
2345
2410
  }
2346
2411
  );
2347
2412
  } else
2348
- S.registerRequest.setList({ url: e, options: a }), axios({ url: e, ...a }).then((w) => {
2349
- S.registerRequest.removeItem(e);
2413
+ E.registerRequest.setList({ url: e, options: a }), axios({ url: e, ...a }).then((w) => {
2414
+ E.registerRequest.removeItem(e);
2350
2415
  const d = w.status, g = w == null ? void 0 : w.data;
2351
2416
  o = { ...o, statusCode: d, data: g, res: w }, s(o);
2352
2417
  }).catch((w) => {
2353
- const d = S.errorsHandler.handleError(w), { code: g, config: m, status: D, message: A, response: E, stack: T } = w, x = {
2418
+ const d = E.errorsHandler.handleError(w), { code: g, config: p, status: D, message: A, response: S, stack: T } = w, x = {
2354
2419
  code: g,
2355
- config: m,
2420
+ config: p,
2356
2421
  status: D || u,
2357
2422
  message: A,
2358
- headers: E == null ? void 0 : E.headers,
2359
- statusText: E == null ? void 0 : E.statusText,
2360
- data: E == null ? void 0 : E.data,
2423
+ headers: S == null ? void 0 : S.headers,
2424
+ statusText: S == null ? void 0 : S.statusText,
2425
+ data: S == null ? void 0 : S.data,
2361
2426
  stack: T
2362
2427
  };
2363
2428
  n({ ...f, ...d, errExt: x });
2364
2429
  });
2365
- })), c(S, "getAuthCookies", () => {
2430
+ })), c(E, "getAuthCookies", () => {
2366
2431
  var s;
2367
- const { keyCookie: e } = S, { cordova: t } = window;
2432
+ const { keyCookie: e } = E, { cordova: t } = window;
2368
2433
  if ((s = t == null ? void 0 : t.plugin) != null && s.http) {
2369
2434
  const { http: n } = t == null ? void 0 : t.plugin;
2370
2435
  return n.getCookieString(e);
2371
2436
  }
2372
2437
  return api.get(e);
2373
- }), c(S, "saveToken", (e) => {
2438
+ }), c(E, "saveToken", (e) => {
2374
2439
  var t;
2375
2440
  if (e) {
2376
- const { keyCookie: s, cookieOptions: n } = S, { cordova: o } = window;
2441
+ const { keyCookie: s, cookieOptions: n } = E, { cordova: o } = window;
2377
2442
  if ((t = o == null ? void 0 : o.plugin) != null && t.http) {
2378
2443
  const { http: i } = o == null ? void 0 : o.plugin;
2379
2444
  i.setCookie(s, e, n);
@@ -2381,19 +2446,19 @@ c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerReques
2381
2446
  }
2382
2447
  api.set(s, e, n);
2383
2448
  }
2384
- }), c(S, "removeAuthCookie", () => {
2449
+ }), c(E, "removeAuthCookie", () => {
2385
2450
  var s;
2386
- const { keyCookie: e } = S, { cordova: t } = window;
2451
+ const { keyCookie: e } = E, { cordova: t } = window;
2387
2452
  if ((s = t == null ? void 0 : t.plugin) != null && s.http) {
2388
2453
  const { http: n } = t == null ? void 0 : t.plugin;
2389
2454
  n.clearCookies();
2390
2455
  return;
2391
2456
  }
2392
2457
  api.remove(e);
2393
- }), c(S, "setCookieOptions", (e) => {
2394
- S.cookieOptions = e;
2458
+ }), c(E, "setCookieOptions", (e) => {
2459
+ E.cookieOptions = e;
2395
2460
  });
2396
- let apiRequest = S;
2461
+ let apiRequest = E;
2397
2462
  class NetworkInformationAbstract {
2398
2463
  }
2399
2464
  class NetworkInformationCordova extends NetworkInformationAbstract {
@@ -2500,21 +2565,21 @@ class EventSubscribers {
2500
2565
  });
2501
2566
  }
2502
2567
  }
2503
- const b = class b {
2568
+ const y = class y {
2504
2569
  static setState(e) {
2505
- b.state = { ...b.state, ...e };
2570
+ y.state = { ...y.state, ...e };
2506
2571
  }
2507
2572
  static getState() {
2508
- return b.state;
2573
+ return y.state;
2509
2574
  }
2510
2575
  static getIsNetwork() {
2511
- return b.state.isNetworkStatus;
2576
+ return y.state.isNetworkStatus;
2512
2577
  }
2513
2578
  static request({ keyAction: e, request: t }) {
2514
2579
  const { url: s, ...n } = t;
2515
2580
  return new Promise((o, i) => {
2516
- b.getIsInit() || b.init();
2517
- const u = b.getIsNetwork(), l = {
2581
+ y.getIsInit() || y.init();
2582
+ const u = y.getIsNetwork(), l = {
2518
2583
  url: s,
2519
2584
  keyAction: e,
2520
2585
  isErr: !u,
@@ -2523,7 +2588,7 @@ const b = class b {
2523
2588
  statusCode: u ? 0 : 520,
2524
2589
  isReload: !1
2525
2590
  };
2526
- if (b.events.publish("fetch", l), u) {
2591
+ if (y.events.publish("fetch", l), u) {
2527
2592
  apiRequest.requestInServer(s, n).then((f) => {
2528
2593
  const h = {
2529
2594
  isReq: !1,
@@ -2533,7 +2598,7 @@ const b = class b {
2533
2598
  msg: "",
2534
2599
  ...f
2535
2600
  };
2536
- b.events.publish("fetch", h), o(h);
2601
+ y.events.publish("fetch", h), o(h);
2537
2602
  }).catch((f) => {
2538
2603
  const h = {
2539
2604
  //TODO: Проверить. dataErr не верно возвращает
@@ -2542,32 +2607,32 @@ const b = class b {
2542
2607
  keyAction: e,
2543
2608
  ...f
2544
2609
  };
2545
- b.events.publish("fetch", h), i(h);
2610
+ y.events.publish("fetch", h), i(h);
2546
2611
  });
2547
2612
  return;
2548
2613
  }
2549
- b.events.publish("fetch", l), i(l);
2614
+ y.events.publish("fetch", l), i(l);
2550
2615
  });
2551
2616
  }
2552
2617
  };
2553
- c(b, "state", {
2618
+ c(y, "state", {
2554
2619
  isInit: !1,
2555
2620
  isNetworkStatus: navigator.onLine
2556
- }), c(b, "internet", new NetworkInformation([new NetworkInformationPC(), new NetworkInformationCordova()])), c(b, "events", new EventSubscribers(["fetch"])), c(b, "online", () => {
2557
- b.setState({ isNetworkStatus: !0 });
2558
- }), c(b, "offline", () => {
2559
- b.setState({ isNetworkStatus: !1 });
2560
- }), c(b, "errorInit", () => {
2621
+ }), c(y, "internet", new NetworkInformation([new NetworkInformationPC(), new NetworkInformationCordova()])), c(y, "events", new EventSubscribers(["fetch"])), c(y, "online", () => {
2622
+ y.setState({ isNetworkStatus: !0 });
2623
+ }), c(y, "offline", () => {
2624
+ y.setState({ isNetworkStatus: !1 });
2625
+ }), c(y, "errorInit", () => {
2561
2626
  console.error("Не вызван HTTPSApi.init()");
2562
- }), c(b, "getIsInit", () => {
2563
- const { isInit: e } = b.getState();
2564
- return e || b.errorInit(), e;
2565
- }), c(b, "init", () => {
2566
- b.internet.run((e) => {
2567
- e ? b.online() : b.offline();
2568
- }), b.setState({ isInit: !0 });
2569
- }), c(b, "on", b.events.subscribe), c(b, "off", b.events.unsubscribe), c(b, "removeAuthCookie", apiRequest.removeAuthCookie), c(b, "getAuthCookies", apiRequest.getAuthCookies);
2570
- let HTTPSApi = b;
2627
+ }), c(y, "getIsInit", () => {
2628
+ const { isInit: e } = y.getState();
2629
+ return e || y.errorInit(), e;
2630
+ }), c(y, "init", () => {
2631
+ y.internet.run((e) => {
2632
+ e ? y.online() : y.offline();
2633
+ }), y.setState({ isInit: !0 });
2634
+ }), c(y, "on", y.events.subscribe), c(y, "off", y.events.unsubscribe), c(y, "removeAuthCookie", apiRequest.removeAuthCookie), c(y, "getAuthCookies", apiRequest.getAuthCookies);
2635
+ let HTTPSApi = y;
2571
2636
  class Numbers {
2572
2637
  }
2573
2638
  c(Numbers, "getOnlyTheStringNumbers", (e) => e.split("").filter((t) => !Number.isNaN(Number.parseInt(t))).join("")), c(Numbers, "isNumber", (e) => {
@@ -2663,7 +2728,7 @@ class NetworkStatusTracker {
2663
2728
  }, { signal: (a = s.online) == null ? void 0 : a.signal }), window.addEventListener("offline", () => {
2664
2729
  this.updateState(!1, e);
2665
2730
  }, { signal: (u = s.offline) == null ? void 0 : u.signal }), (l = this.getConnection()) != null && l.addEventListener && this.getConnection().addEventListener("change", () => {
2666
- const h = this.getConnection(), y = this.getTypeNetwork(h, null), w = this.getIsNetwork(y);
2731
+ const h = this.getConnection(), b = this.getTypeNetwork(h, null), w = this.getIsNetwork(b);
2667
2732
  this.updateState(w, e);
2668
2733
  }, { signal: (f = s.change) == null ? void 0 : f.signal });
2669
2734
  }
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.22",
14
+ "version": "1.4.30",
15
15
  "type": "module",
16
16
  "module": "./dist/index.js",
17
17
  "main": "./dist/index.js",