@dxtmisha/functional 1.0.9
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/LICENSE +21 -0
- package/README.md +767 -0
- package/dist/Icons-C2lZhD4l.js +1284 -0
- package/dist/classes/Api.d.ts +305 -0
- package/dist/classes/Cache.d.ts +34 -0
- package/dist/classes/CacheItem.d.ts +55 -0
- package/dist/classes/CacheStatic.d.ts +17 -0
- package/dist/classes/Cookie.d.ts +52 -0
- package/dist/classes/CookieBlock.d.ts +22 -0
- package/dist/classes/DataStorage.d.ts +70 -0
- package/dist/classes/Datetime.d.ts +482 -0
- package/dist/classes/EventItem.d.ts +160 -0
- package/dist/classes/Geo.d.ts +168 -0
- package/dist/classes/GeoFlag.d.ts +79 -0
- package/dist/classes/GeoIntl.d.ts +262 -0
- package/dist/classes/GeoPhone.d.ts +107 -0
- package/dist/classes/Global.d.ts +21 -0
- package/dist/classes/Hash.d.ts +59 -0
- package/dist/classes/Icons.d.ts +90 -0
- package/dist/classes/Loading.d.ts +49 -0
- package/dist/classes/ScrollbarWidth.d.ts +33 -0
- package/dist/classes/Translate.d.ts +116 -0
- package/dist/classes/design/DesignAbstract.d.ts +61 -0
- package/dist/classes/design/DesignAsyncAbstract.d.ts +28 -0
- package/dist/classes/design/DesignChanged.d.ts +42 -0
- package/dist/classes/design/DesignComp.d.ts +4 -0
- package/dist/classes/design/DesignComponents.d.ts +81 -0
- package/dist/classes/design/DesignConstructorAbstract.d.ts +150 -0
- package/dist/classes/ref/DatetimeRef.d.ts +119 -0
- package/dist/classes/ref/EventRef.d.ts +23 -0
- package/dist/classes/ref/GeoFlagRef.d.ts +52 -0
- package/dist/classes/ref/GeoIntlRef.d.ts +173 -0
- package/dist/classes/ref/GeoRef.d.ts +52 -0
- package/dist/classes/ref/ListDataRef.d.ts +228 -0
- package/dist/classes/ref/RouterItemRef.d.ts +36 -0
- package/dist/classes/ref/ScrollbarWidthRef.d.ts +24 -0
- package/dist/composables/ref/useApiRef.d.ts +25 -0
- package/dist/composables/ref/useCookieRef.d.ts +11 -0
- package/dist/composables/ref/useGeoIntlRef.d.ts +7 -0
- package/dist/composables/ref/useHashRef.d.ts +9 -0
- package/dist/composables/ref/useLazyRef.d.ts +33 -0
- package/dist/composables/ref/useLoadingRef.d.ts +7 -0
- package/dist/composables/ref/useSessionRef.d.ts +9 -0
- package/dist/composables/ref/useStorageRef.d.ts +10 -0
- package/dist/composables/ref/useTranslateRef.d.ts +16 -0
- package/dist/flags.d.ts +1 -0
- package/dist/flags.js +8 -0
- package/dist/functions/anyToString.d.ts +7 -0
- package/dist/functions/applyTemplate.d.ts +10 -0
- package/dist/functions/arrFill.d.ts +8 -0
- package/dist/functions/copyObject.d.ts +8 -0
- package/dist/functions/createElement.d.ts +13 -0
- package/dist/functions/domQuerySelector.d.ts +7 -0
- package/dist/functions/domQuerySelectorAll.d.ts +7 -0
- package/dist/functions/eventStopPropagation.d.ts +7 -0
- package/dist/functions/executeFunction.d.ts +8 -0
- package/dist/functions/executePromise.d.ts +7 -0
- package/dist/functions/executeUse.d.ts +11 -0
- package/dist/functions/forEach.d.ts +11 -0
- package/dist/functions/frame.d.ts +16 -0
- package/dist/functions/getAttributes.d.ts +8 -0
- package/dist/functions/getClipboardData.d.ts +11 -0
- package/dist/functions/getColumn.d.ts +10 -0
- package/dist/functions/getElement.d.ts +8 -0
- package/dist/functions/getElementId.d.ts +9 -0
- package/dist/functions/getElementItem.d.ts +11 -0
- package/dist/functions/getElementOrWindow.d.ts +8 -0
- package/dist/functions/getExp.d.ts +13 -0
- package/dist/functions/getItemByPath.d.ts +8 -0
- package/dist/functions/getKey.d.ts +7 -0
- package/dist/functions/getLengthOfAllArray.d.ts +8 -0
- package/dist/functions/getMaxLengthAllArray.d.ts +8 -0
- package/dist/functions/getMinLengthAllArray.d.ts +8 -0
- package/dist/functions/getMouseClient.d.ts +8 -0
- package/dist/functions/getMouseClientX.d.ts +7 -0
- package/dist/functions/getMouseClientY.d.ts +7 -0
- package/dist/functions/getObjectByKeys.d.ts +8 -0
- package/dist/functions/getObjectNoUndefined.d.ts +8 -0
- package/dist/functions/getObjectOrNone.d.ts +7 -0
- package/dist/functions/getRandomText.d.ts +11 -0
- package/dist/functions/getRequestString.d.ts +9 -0
- package/dist/functions/getStepPercent.d.ts +8 -0
- package/dist/functions/getStepValue.d.ts +8 -0
- package/dist/functions/goScroll.d.ts +10 -0
- package/dist/functions/inArray.d.ts +8 -0
- package/dist/functions/initScrollbarOffset.d.ts +6 -0
- package/dist/functions/intersectKey.d.ts +8 -0
- package/dist/functions/isArray.d.ts +7 -0
- package/dist/functions/isDifferent.d.ts +9 -0
- package/dist/functions/isDomRuntime.d.ts +10 -0
- package/dist/functions/isFilled.d.ts +9 -0
- package/dist/functions/isFloat.d.ts +7 -0
- package/dist/functions/isFunction.d.ts +8 -0
- package/dist/functions/isInDom.d.ts +8 -0
- package/dist/functions/isIntegerBetween.d.ts +8 -0
- package/dist/functions/isNull.d.ts +8 -0
- package/dist/functions/isNumber.d.ts +7 -0
- package/dist/functions/isObject.d.ts +7 -0
- package/dist/functions/isObjectNotArray.d.ts +7 -0
- package/dist/functions/isSelected.d.ts +8 -0
- package/dist/functions/isSelectedByList.d.ts +8 -0
- package/dist/functions/isString.d.ts +7 -0
- package/dist/functions/isWindow.d.ts +7 -0
- package/dist/functions/random.d.ts +8 -0
- package/dist/functions/ref/getBindRef.d.ts +13 -0
- package/dist/functions/ref/getComputedAsync.d.ts +9 -0
- package/dist/functions/ref/getRef.d.ts +8 -0
- package/dist/functions/ref/render.d.ts +13 -0
- package/dist/functions/ref/setRef.d.ts +9 -0
- package/dist/functions/ref/toComputed.d.ts +8 -0
- package/dist/functions/ref/toRefItem.d.ts +9 -0
- package/dist/functions/render/getBind.d.ts +14 -0
- package/dist/functions/render/getClassName.d.ts +8 -0
- package/dist/functions/render/getIndexForRender.d.ts +10 -0
- package/dist/functions/replaceRecursive.d.ts +10 -0
- package/dist/functions/replaceTemplate.d.ts +9 -0
- package/dist/functions/secondToTime.d.ts +7 -0
- package/dist/functions/setElementItem.d.ts +10 -0
- package/dist/functions/setValues.d.ts +17 -0
- package/dist/functions/splice.d.ts +12 -0
- package/dist/functions/strFill.d.ts +8 -0
- package/dist/functions/toArray.d.ts +17 -0
- package/dist/functions/toBind.d.ts +10 -0
- package/dist/functions/toBinds.d.ts +9 -0
- package/dist/functions/toCamelCase.d.ts +7 -0
- package/dist/functions/toCamelCaseFirst.d.ts +7 -0
- package/dist/functions/toDate.d.ts +7 -0
- package/dist/functions/toKebabCase.d.ts +15 -0
- package/dist/functions/toNumber.d.ts +8 -0
- package/dist/functions/toNumberByMax.d.ts +9 -0
- package/dist/functions/toPercent.d.ts +8 -0
- package/dist/functions/toPercentBy100.d.ts +8 -0
- package/dist/functions/transformation.d.ts +21 -0
- package/dist/functions/uniqueArray.d.ts +7 -0
- package/dist/functions/writeClipboardData.d.ts +7 -0
- package/dist/library.d.ts +135 -0
- package/dist/library.js +4254 -0
- package/dist/types/basicTypes.d.ts +126 -0
- package/dist/types/constructorTypes.d.ts +114 -0
- package/dist/types/geoTypes.d.ts +86 -0
- package/dist/types/listTypes.d.ts +61 -0
- package/dist/types/refTypes.d.ts +36 -0
- package/package.json +77 -0
package/dist/library.js
ADDED
|
@@ -0,0 +1,4254 @@
|
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var It = (i, t, e) => t in i ? At(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var k = (i, t, e) => It(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { i as d, D as Y, e as I, a as O, b as Nt, G as y, f, t as b, c as nt, d as B, g as Tt, h as K, j as m, k as C, A as j, l as g, E as Bt, m as F, r as G, L as ht, n as x } from "./Icons-C2lZhD4l.js";
|
|
5
|
+
import { o as Ls, I as Ds, p as ks, q as Ms, s as As, u as Is, v as Ns, w as Ts } from "./Icons-C2lZhD4l.js";
|
|
6
|
+
import { h as Ft, computed as c, toRefs as xt, useAttrs as Et, useSlots as Rt, ref as $, isRef as at, watch as p, triggerRef as Ot, shallowRef as W, onUnmounted as st, inject as Wt, provide as Pt, watchEffect as jt } from "vue";
|
|
7
|
+
class Ht {
|
|
8
|
+
/**
|
|
9
|
+
* Constructor
|
|
10
|
+
* @param callback function for the cache/ функция для кэша
|
|
11
|
+
*/
|
|
12
|
+
constructor(t) {
|
|
13
|
+
this.callback = t;
|
|
14
|
+
}
|
|
15
|
+
cache;
|
|
16
|
+
cacheOld;
|
|
17
|
+
comparisons = [];
|
|
18
|
+
/**
|
|
19
|
+
* Getting data for the cache, and if there is no cache, it performs a function to save the cache.
|
|
20
|
+
*
|
|
21
|
+
* Получение данных для кэша, и если нет кэша, выполняет функцию для сохранения кэша.
|
|
22
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
23
|
+
*/
|
|
24
|
+
getCache(t) {
|
|
25
|
+
return this.isUpdate(t) && (this.cacheOld = this.cache, this.setCache()), this.cache;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Getting the previous value of the cache.
|
|
29
|
+
*
|
|
30
|
+
* Получение предыдущего значения кэша.
|
|
31
|
+
*/
|
|
32
|
+
getCacheOld() {
|
|
33
|
+
return this.cacheOld;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Getting data for the cache, and if there is no cache, it performs a function to save the cache (Async).
|
|
37
|
+
*
|
|
38
|
+
* Получение данных для кэша, и если нет кэша, выполняет функцию для сохранения кэша (Async).
|
|
39
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
40
|
+
*/
|
|
41
|
+
async getCacheAsync(t) {
|
|
42
|
+
return this.isUpdate(t) && (this.cacheOld = this.cache, await this.setCacheAsync()), this.cache;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Overwrites or adds new values for the cache.
|
|
46
|
+
*
|
|
47
|
+
* Перезаписывает или добавляет новые значения для кэша.
|
|
48
|
+
*/
|
|
49
|
+
setCache() {
|
|
50
|
+
this.cache = this.callback();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Overwrites or adds new values for the cache (Async).
|
|
54
|
+
*
|
|
55
|
+
* Перезаписывает или добавляет новые значения для кэша (Async).
|
|
56
|
+
*/
|
|
57
|
+
async setCacheAsync() {
|
|
58
|
+
this.cache = await this.callback();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checking additional data.
|
|
62
|
+
*
|
|
63
|
+
* Проверка дополнительных данных.
|
|
64
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
65
|
+
*/
|
|
66
|
+
isUpdate(t) {
|
|
67
|
+
return this.cache === void 0 || this.comparisons.length !== t.length || this.comparisons.findIndex((e, s) => e !== t[s]) >= 0 ? (this.comparisons = [...t], !0) : !1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class Gt {
|
|
71
|
+
cache = {};
|
|
72
|
+
/**
|
|
73
|
+
* Getting data for the cache, and if there is no cache, it performs a function to save the cache.
|
|
74
|
+
*
|
|
75
|
+
* Получение данных для кэша, и если нет кэша, выполняет функцию для сохранения кэша.
|
|
76
|
+
* @param name cache name/ название кэша
|
|
77
|
+
* @param callback function for the cache/ функция для кэша
|
|
78
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
79
|
+
*/
|
|
80
|
+
get(t, e, s) {
|
|
81
|
+
return this.getCacheItem(t, e).getCache(s ?? []);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Getting data for the cache, and if there is no cache, it performs a function to save the cache (Async).
|
|
85
|
+
*
|
|
86
|
+
* Получение данных для кэша, и если нет кэша, выполняет функцию для сохранения кэша (Async).
|
|
87
|
+
* @param name cache name/ название кэша
|
|
88
|
+
* @param callback function for the cache/ функция для кэша
|
|
89
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
90
|
+
*/
|
|
91
|
+
async getAsync(t, e, s) {
|
|
92
|
+
return await this.getCacheItem(t, e).getCacheAsync(s ?? []);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns an instance of the object for working with the cache element.
|
|
96
|
+
*
|
|
97
|
+
* Возвращает экземпляр объекта для работы с элементом кэша.
|
|
98
|
+
* @param name cache name/ название кэша
|
|
99
|
+
* @param callback function for the cache/ функция для кэша
|
|
100
|
+
*/
|
|
101
|
+
getCacheItem(t, e) {
|
|
102
|
+
return t in this.cache || (this.cache[t] = new Ht(e)), this.cache[t];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const Z = class Z {
|
|
106
|
+
/**
|
|
107
|
+
* Getting data for the cache, and if there is no cache, it performs a function to save the cache.
|
|
108
|
+
*
|
|
109
|
+
* Получение данных для кэша, и если нет кэша, выполняет функцию для сохранения кэша.
|
|
110
|
+
* @param name cache name/ название кэша
|
|
111
|
+
* @param callback function for the cache/ функция для кэша
|
|
112
|
+
* @param comparison additional data for comparison/ дополнительные данные для сравнения
|
|
113
|
+
*/
|
|
114
|
+
static get(t, e, s) {
|
|
115
|
+
return this.cache.get(t, e, s);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
k(Z, "cache"), Z.cache = new Gt();
|
|
119
|
+
let lt = Z;
|
|
120
|
+
function $t(i, t = !1) {
|
|
121
|
+
if (typeof i == "string") {
|
|
122
|
+
const e = i.trim();
|
|
123
|
+
switch (e) {
|
|
124
|
+
case "undefined":
|
|
125
|
+
return;
|
|
126
|
+
case "null":
|
|
127
|
+
return null;
|
|
128
|
+
case "true":
|
|
129
|
+
return !0;
|
|
130
|
+
case "false":
|
|
131
|
+
return !1;
|
|
132
|
+
default:
|
|
133
|
+
if (/^[{[]/.exec(e))
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(e);
|
|
136
|
+
} catch (s) {
|
|
137
|
+
console.error("transformation: JSON error", s);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
if (/^[0-9]+\.[0-9.]+$/.exec(e))
|
|
141
|
+
return parseFloat(e);
|
|
142
|
+
if (/^[0-9]+$/.exec(e))
|
|
143
|
+
return parseInt(e, 10);
|
|
144
|
+
if (t && d() && typeof window?.[e] == "function")
|
|
145
|
+
return window[e];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return i;
|
|
150
|
+
}
|
|
151
|
+
const zt = "cookie-block";
|
|
152
|
+
class Ut {
|
|
153
|
+
static storage = new Y(zt);
|
|
154
|
+
/**
|
|
155
|
+
* Obtaining status.
|
|
156
|
+
*
|
|
157
|
+
* Получение статуса.
|
|
158
|
+
*/
|
|
159
|
+
static get() {
|
|
160
|
+
return this.storage.get() ?? !1;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Changing status.
|
|
164
|
+
*
|
|
165
|
+
* Изменение статуса.
|
|
166
|
+
* @param value value to be changed/ значение, на которое будет изменен
|
|
167
|
+
*/
|
|
168
|
+
static set(t) {
|
|
169
|
+
this.storage.set(t);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const gt = {};
|
|
173
|
+
class Zt {
|
|
174
|
+
constructor(t) {
|
|
175
|
+
if (this.name = t, t in J)
|
|
176
|
+
return J[t];
|
|
177
|
+
this.value = gt?.[t], J[t] = this;
|
|
178
|
+
}
|
|
179
|
+
value;
|
|
180
|
+
options = {};
|
|
181
|
+
/**
|
|
182
|
+
* Get data or update if none.
|
|
183
|
+
*
|
|
184
|
+
* Получает данные или обновляет, если их нет.
|
|
185
|
+
* @param defaultValue value or function to change data/ значение или функция для изменения данных
|
|
186
|
+
* @param options additional parameters/ дополнительные параметры
|
|
187
|
+
*/
|
|
188
|
+
get(t, e) {
|
|
189
|
+
return this.value === void 0 && t && this.set(t, e), this.value;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Updates cookie data.
|
|
193
|
+
*
|
|
194
|
+
* Обновляет данные cookie.
|
|
195
|
+
* @param value value or function to change data/ значение или функция для изменения данных
|
|
196
|
+
* @param options additional parameters/ дополнительные параметры
|
|
197
|
+
*/
|
|
198
|
+
set(t, e) {
|
|
199
|
+
this.value = I(t), Object.assign(this.options, e), this.update();
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Delete cookie data.
|
|
203
|
+
*
|
|
204
|
+
* Удаление данных из cookie.
|
|
205
|
+
*/
|
|
206
|
+
remove() {
|
|
207
|
+
this.set("");
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Returns cache time.
|
|
211
|
+
*
|
|
212
|
+
* Возвращает время кэширования.
|
|
213
|
+
*/
|
|
214
|
+
getAge() {
|
|
215
|
+
return this.options?.age ?? 10080 * 60;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Update cookie data.
|
|
219
|
+
*
|
|
220
|
+
* Обновление данных cookie.
|
|
221
|
+
*/
|
|
222
|
+
update() {
|
|
223
|
+
if (d() && !Ut.get()) {
|
|
224
|
+
const t = String(this.value ?? "");
|
|
225
|
+
document.cookie = [
|
|
226
|
+
`${encodeURIComponent(this.name)}=${encodeURIComponent(t)}`,
|
|
227
|
+
`max-age=${t === "" ? "-1" : this.getAge()}`,
|
|
228
|
+
`SameSite=${this.options?.sameSite ?? "strict"}`,
|
|
229
|
+
...this.options?.arguments ?? []
|
|
230
|
+
].join("; ");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
(() => {
|
|
235
|
+
if (d())
|
|
236
|
+
for (const t of document.cookie.split(";")) {
|
|
237
|
+
const [e, s] = t.trim().split("=");
|
|
238
|
+
e && O(s) && (gt[e] = $t(s));
|
|
239
|
+
}
|
|
240
|
+
})();
|
|
241
|
+
const J = {};
|
|
242
|
+
function S(i) {
|
|
243
|
+
if (i instanceof Date)
|
|
244
|
+
return i;
|
|
245
|
+
if (Nt(i))
|
|
246
|
+
return /* @__PURE__ */ new Date();
|
|
247
|
+
if (typeof i == "number")
|
|
248
|
+
return new Date(i);
|
|
249
|
+
let t = i, e = y.getTimezoneFormat();
|
|
250
|
+
i.replace(/^([\s\S]+)([-+]\d{2}:?\d{2})$/, (n, a, o) => (t = a, e = o, n));
|
|
251
|
+
const s = (/^\d{4}\d{2}\d{2}$/.exec(t) && `${t.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")}T00:00:00`) ?? (/^\d{4}\d{2}$/.exec(t) && `${t.replace(/^(\d{4})(\d{2})$/, "$1-$2")}-01T00:00:00`) ?? (/^\d{4}\d{2}\d{2} \d{2}:\d{2}:\d{2}$/.exec(t) && t.replace(/^(\d{4})(\d{2})(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, "$1-$2-$3T$4:$5:$6")) ?? (/^\d{4}-\d{2}-\d{2}$/.exec(t) && `${t}T00:00:00`) ?? (/^\d{4}-\d{2}$/.exec(t) && `${t}-01T00:00:00`) ?? (/^\d{4}$/.exec(t) && `${t}-01-01T00:00:00`) ?? (/^\d{2}:\d{2}$/.exec(t) && `2000-01-01T${t}:00`) ?? (/^\d{2}:\d{2}:\d{2}$/.exec(t) && `2000-01-01T${t}`) ?? t.replace(" ", "T");
|
|
252
|
+
return /* @__PURE__ */ new Date(`${s}${e}`);
|
|
253
|
+
}
|
|
254
|
+
function it(i, t) {
|
|
255
|
+
return f(i, (e) => e?.[t]);
|
|
256
|
+
}
|
|
257
|
+
class N {
|
|
258
|
+
/**
|
|
259
|
+
* Returns an instance of the class according to the specified country code.
|
|
260
|
+
*
|
|
261
|
+
* Возвращает экземпляр класса по указанному коду страны.
|
|
262
|
+
* @param code country code, full form language-country or one of them/
|
|
263
|
+
* код страны, полный вид язык-страна или один из них
|
|
264
|
+
*/
|
|
265
|
+
static getInstance(t = y.getLocation()) {
|
|
266
|
+
return new N(t);
|
|
267
|
+
}
|
|
268
|
+
geo;
|
|
269
|
+
/**
|
|
270
|
+
* Constructor
|
|
271
|
+
* @param code country code, full form language-country or one of them/
|
|
272
|
+
* код страны, полный вид язык-страна или один из них
|
|
273
|
+
*/
|
|
274
|
+
constructor(t = y.getLocation()) {
|
|
275
|
+
this.geo = y.find(t);
|
|
276
|
+
const e = this.getLocation();
|
|
277
|
+
if (e in _)
|
|
278
|
+
return _[e];
|
|
279
|
+
_[e] = this;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Returns country code and language.
|
|
283
|
+
*
|
|
284
|
+
* Возвращает код страны и языка.
|
|
285
|
+
*/
|
|
286
|
+
getLocation() {
|
|
287
|
+
return this.geo.standard;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Returns the first day of the week.
|
|
291
|
+
*
|
|
292
|
+
* Возвращает первый день недели.
|
|
293
|
+
*/
|
|
294
|
+
getFirstDay() {
|
|
295
|
+
return this.geo.firstDay;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The consistent translation of language, region and script display names.
|
|
299
|
+
*
|
|
300
|
+
* Последовательный перевод отображаемых названий языка, региона и скрипта.
|
|
301
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
302
|
+
* @param typeOptions an object with some or all of the following properties/
|
|
303
|
+
* объект с некоторыми или всеми из следующих свойств
|
|
304
|
+
*/
|
|
305
|
+
display(t, e) {
|
|
306
|
+
let s = { type: "language" }, n;
|
|
307
|
+
e && (typeof e == "string" ? s.type = e : s = {
|
|
308
|
+
...s,
|
|
309
|
+
...e
|
|
310
|
+
});
|
|
311
|
+
try {
|
|
312
|
+
d() && (t ? n = new Intl.DisplayNames(this.getLocation(), s).of(t) : s.type === "language" ? n = new Intl.DisplayNames(this.getLocation(), s).of(this.geo.language) : s.type === "region" && (n = new Intl.DisplayNames(this.getLocation(), s).of(this.geo.country)));
|
|
313
|
+
} catch (a) {
|
|
314
|
+
console.error("display: ", a);
|
|
315
|
+
}
|
|
316
|
+
return n ?? t ?? "";
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Get display names of language.
|
|
320
|
+
*
|
|
321
|
+
* Получить отображаемые имена языка.
|
|
322
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
323
|
+
* @param style the formatting style to use/ используемый стиль форматирования
|
|
324
|
+
*/
|
|
325
|
+
languageName(t, e) {
|
|
326
|
+
const s = {
|
|
327
|
+
type: "language",
|
|
328
|
+
style: e
|
|
329
|
+
};
|
|
330
|
+
return this.display(y.getByCode(t).language, s);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Get display names of region.
|
|
334
|
+
*
|
|
335
|
+
* Получить отображаемые имена региона.
|
|
336
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
337
|
+
* @param style the formatting style to use/ используемый стиль форматирования
|
|
338
|
+
*/
|
|
339
|
+
countryName(t, e) {
|
|
340
|
+
const s = {
|
|
341
|
+
type: "region",
|
|
342
|
+
style: e
|
|
343
|
+
};
|
|
344
|
+
return this.display(t, s);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The method returns a string containing the full name in a specific format.
|
|
348
|
+
*
|
|
349
|
+
* Метод возвращает строку, содержащую полное имя в определённом формате.
|
|
350
|
+
* @param last last name/ фамилию
|
|
351
|
+
* @param first first name/ имя
|
|
352
|
+
* @param surname surname middle name (optional)/ отчество
|
|
353
|
+
* @param short shorten the names/ сократить названия
|
|
354
|
+
*/
|
|
355
|
+
fullName(t, e, s, n) {
|
|
356
|
+
const a = this.geo?.nameFormat ?? "fl";
|
|
357
|
+
let o;
|
|
358
|
+
switch (a) {
|
|
359
|
+
case "fsl":
|
|
360
|
+
o = `${e}${s ? ` ${s}` : ""} ${t}`;
|
|
361
|
+
break;
|
|
362
|
+
case "lf":
|
|
363
|
+
o = `${t} ${e}`;
|
|
364
|
+
break;
|
|
365
|
+
case "lsf":
|
|
366
|
+
o = `${t}${s ? ` ${s}` : ""} ${e}`;
|
|
367
|
+
break;
|
|
368
|
+
default:
|
|
369
|
+
o = `${e} ${t}`;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
return n ? o.replace(/ (.)[^ ]+/ig, " $1.") : o;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* In basic use without specifying a locale, a formatted string.
|
|
376
|
+
*
|
|
377
|
+
* При обычном использовании без указания локали форматированная строка.
|
|
378
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
379
|
+
* @param options an object with some or all properties/ объект с некоторыми
|
|
380
|
+
* или всеми свойствами
|
|
381
|
+
*/
|
|
382
|
+
number(t, e) {
|
|
383
|
+
return this.numberObject(e)?.format?.(b(t)) || t.toString();
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Decimal point symbol.
|
|
387
|
+
*
|
|
388
|
+
* Символ десятичной точки.
|
|
389
|
+
*/
|
|
390
|
+
decimal() {
|
|
391
|
+
return this.numberObject()?.formatToParts?.(1.2)?.find?.((t) => t.type === "decimal")?.value || ".";
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Currency formatting.
|
|
395
|
+
*
|
|
396
|
+
* Форматирование валюты.
|
|
397
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
398
|
+
* @param currencyOptions the currency to use in currency formatting/
|
|
399
|
+
* валюта для использования в форматировании валюты
|
|
400
|
+
* @param numberOnly do not display the currency symbol/ не выводить значок валюты
|
|
401
|
+
*/
|
|
402
|
+
currency(t, e, s = !1) {
|
|
403
|
+
const n = {
|
|
404
|
+
style: "currency",
|
|
405
|
+
currencyDisplay: "symbol",
|
|
406
|
+
...typeof e == "string" ? { currency: e } : e || {}
|
|
407
|
+
}, a = t.toString().replace(/^([\S\s]+[\d ])([a-zA-Z]{3})$/i, (...o) => (n.currency = String(o[2]).toUpperCase(), String(o[1])));
|
|
408
|
+
if (s) {
|
|
409
|
+
const o = this.numberObject(n);
|
|
410
|
+
return o ? it(
|
|
411
|
+
o.formatToParts(b(t)).filter((u) => ["literal", "currency"].indexOf(u.type) === -1),
|
|
412
|
+
"value"
|
|
413
|
+
).join("") : t.toString();
|
|
414
|
+
} else return "currency" in n ? this.number(
|
|
415
|
+
typeof t == "number" ? t : a,
|
|
416
|
+
n
|
|
417
|
+
) : this.number(
|
|
418
|
+
typeof t == "number" ? t : a,
|
|
419
|
+
{
|
|
420
|
+
...n,
|
|
421
|
+
style: "decimal"
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Returns the currency symbol if it exists, otherwise the currency code.
|
|
427
|
+
*
|
|
428
|
+
* Возвращает символ для валюты, если он есть, или сам код валюты.
|
|
429
|
+
* @param currency the currency to use in currency formatting/
|
|
430
|
+
* валюта для использования в форматировании валюты
|
|
431
|
+
* @param currencyDisplay how to display the currency in currency formatting/
|
|
432
|
+
* как отобразить валюту в формате валюты
|
|
433
|
+
*/
|
|
434
|
+
currencySymbol(t, e = "symbol") {
|
|
435
|
+
return this.numberObject({
|
|
436
|
+
style: "currency",
|
|
437
|
+
currencyDisplay: e,
|
|
438
|
+
currency: t
|
|
439
|
+
})?.formatToParts?.(100)?.find?.((s) => s.type === "currency")?.value || t;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Unit formatting.
|
|
443
|
+
* If the style is 'unit', a unit property must be provided.
|
|
444
|
+
*
|
|
445
|
+
* Форматирование юнитов.
|
|
446
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
447
|
+
* @param unitOptions the unit to use in unit formatting/ блок для использования
|
|
448
|
+
* в форматировании блока
|
|
449
|
+
*/
|
|
450
|
+
unit(t, e) {
|
|
451
|
+
const s = {
|
|
452
|
+
style: "unit",
|
|
453
|
+
...typeof e == "string" ? { unit: e } : e || {}
|
|
454
|
+
}, n = t.toString().replace(/^([\S\s]+[\d ])([a-zA-Z]+)$/i, (...a) => (s.unit = String(a[2]).toLowerCase(), String(a[1])));
|
|
455
|
+
return this.number(n, s);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Возвращает отформатированный размер файла
|
|
459
|
+
* @param value a number, bigint, or string, to format /<br>число для форматирования
|
|
460
|
+
* @param unitOptions the unit to use in unit formatting /<br>блок для использования
|
|
461
|
+
* в форматировании блока
|
|
462
|
+
*/
|
|
463
|
+
sizeFile(t, e = "byte") {
|
|
464
|
+
const s = b(t);
|
|
465
|
+
if (s > 1024 && nt(e))
|
|
466
|
+
switch (e) {
|
|
467
|
+
case "byte":
|
|
468
|
+
return this.sizeFile(s / 1024, "kilobyte");
|
|
469
|
+
case "kilobyte":
|
|
470
|
+
return this.sizeFile(s / 1024, "megabyte");
|
|
471
|
+
case "megabyte":
|
|
472
|
+
return this.sizeFile(s / 1024, "gigabyte");
|
|
473
|
+
case "gigabyte":
|
|
474
|
+
return this.sizeFile(s / 1024, "terabyte");
|
|
475
|
+
case "terabyte":
|
|
476
|
+
return this.sizeFile(s / 1024, "petabyte");
|
|
477
|
+
}
|
|
478
|
+
return this.unit(t, e);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Number as a percentage.
|
|
482
|
+
*
|
|
483
|
+
* Число в виде процента.
|
|
484
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
485
|
+
* @param options an object with some or all properties/ объект с некоторыми или всеми свойствами
|
|
486
|
+
*/
|
|
487
|
+
percent(t, e) {
|
|
488
|
+
return this.number(t, {
|
|
489
|
+
style: "percent",
|
|
490
|
+
...e || {}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Number as a percentage (unit).
|
|
495
|
+
*
|
|
496
|
+
* Число в виде процента (единица).
|
|
497
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
498
|
+
* @param options an object with some or all properties/
|
|
499
|
+
* объект с некоторыми или всеми свойствами
|
|
500
|
+
*/
|
|
501
|
+
percentBy100(t, e) {
|
|
502
|
+
return this.percent(b(t) / 100, e);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Применять форматирование, учитывающее множественное число, и языковые правила, связанные с множественным числом
|
|
506
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
507
|
+
* @param words list of words for formatting (in the format one|two|few|many|other|zero)/
|
|
508
|
+
* список слов для форматирования (в формате `one|two|few|many|other|zero`)
|
|
509
|
+
* @param options Property for PluralRules/ свойство для PluralRules
|
|
510
|
+
* @param optionsNumber an object with some or all properties/ объект с некоторыми или всеми свойствами
|
|
511
|
+
*/
|
|
512
|
+
plural(t, e, s, n) {
|
|
513
|
+
const a = b(t), o = e.split("|");
|
|
514
|
+
if (o.length > 1)
|
|
515
|
+
try {
|
|
516
|
+
if (d()) {
|
|
517
|
+
const h = new Intl.PluralRules(this.getLocation(), s).select(a);
|
|
518
|
+
let l;
|
|
519
|
+
switch (h) {
|
|
520
|
+
case "zero":
|
|
521
|
+
l = o[o.length - 1];
|
|
522
|
+
break;
|
|
523
|
+
case "one":
|
|
524
|
+
l = o?.[0];
|
|
525
|
+
break;
|
|
526
|
+
case "two":
|
|
527
|
+
l = o?.[1];
|
|
528
|
+
break;
|
|
529
|
+
case "few":
|
|
530
|
+
l = o?.[3] ? o?.[2] : o?.[1];
|
|
531
|
+
break;
|
|
532
|
+
case "many":
|
|
533
|
+
l = o?.[3] || o?.[2] || o?.[1];
|
|
534
|
+
break;
|
|
535
|
+
case "other":
|
|
536
|
+
o.length === 6 ? l = o[o.length - 2] : l = o[o.length - 1];
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
return `${this.number(a, n)} ${l ?? ""}`.trim();
|
|
540
|
+
}
|
|
541
|
+
} catch (u) {
|
|
542
|
+
console.error("plural: ", u);
|
|
543
|
+
}
|
|
544
|
+
return `${this.number(a, n)} ${o?.[0] ?? ""}`.trim();
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Enables language-sensitive date and time formatting.
|
|
548
|
+
*
|
|
549
|
+
* Конструктором объектов, включающих языка-зависимое форматирование даты и времени.
|
|
550
|
+
* @param value the date to format/ дата для форматирования
|
|
551
|
+
* @param type type of data format/ тип формата data
|
|
552
|
+
* @param styleOptions the representation of the month/ представление месяца
|
|
553
|
+
* @param hour24 whether to use 12-hour time/ использовать ли 12-часовое время
|
|
554
|
+
*/
|
|
555
|
+
date(t, e, s, n) {
|
|
556
|
+
const a = S(t), o = typeof s == "string", u = this.dateOptions(e, o ? s : "short");
|
|
557
|
+
return n && (u.hour12 = !1), o || Object.assign(u, s), a.toLocaleString(this.getLocation(), u);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Enables language-sensitive relative time formatting.
|
|
561
|
+
*
|
|
562
|
+
* Включает форматирование относительного времени с учетом языка.
|
|
563
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
564
|
+
* @param styleOptions the length of the internationalized message/
|
|
565
|
+
* длина интернационализированного сообщения
|
|
566
|
+
* @param todayValue current day/ текущий день
|
|
567
|
+
*/
|
|
568
|
+
relative(t, e, s) {
|
|
569
|
+
const n = S(t), a = s || /* @__PURE__ */ new Date(), o = {
|
|
570
|
+
numeric: "auto",
|
|
571
|
+
...typeof e == "string" ? { style: e } : e || {}
|
|
572
|
+
};
|
|
573
|
+
let u = "second", h = (n.getTime() - a.getTime()) / 1e3;
|
|
574
|
+
return Math.abs(h) >= 60 && (u = "minute", h /= 60, Math.abs(h) >= 60 && (u = "hour", h /= 60, Math.abs(h) >= 24 && (u = "day", h /= 24, Math.abs(h) >= 30 && (u = "month", h /= 30, Math.abs(h) >= 12 && (u = "year", h /= 12))))), this.relativeByValue(h, u, o);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Enables language-sensitive relative time formatting
|
|
578
|
+
* Including the ability to add a limit to output the standard time format if the value
|
|
579
|
+
* exceeds the allowable limit.
|
|
580
|
+
*
|
|
581
|
+
* Включает форматирование относительного времени с учетом языка.
|
|
582
|
+
* Включая возможность добавления лимита, чтобы выводить уже стандартный формат времени,
|
|
583
|
+
* если значение вышло за пределы допустимого.
|
|
584
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
585
|
+
* @param limit values that determine the output limit (values per day)/
|
|
586
|
+
* значения, по которым определяем предел вывода (значения в день)
|
|
587
|
+
* @param todayValue current day/ текущий день
|
|
588
|
+
* @param relativeOptions the length of the internationalized message/
|
|
589
|
+
* длина интернационализированного сообщения
|
|
590
|
+
* @param dateOptions the representation of the month/ представление месяца
|
|
591
|
+
* @param type type of data format/ тип формата data
|
|
592
|
+
* @param hour24 whether to use 12-hour time/ использовать ли 12-часовое время
|
|
593
|
+
*/
|
|
594
|
+
relativeLimit(t, e, s, n, a, o, u) {
|
|
595
|
+
const h = S(t), l = s || /* @__PURE__ */ new Date(), L = new Date(l), D = new Date(l);
|
|
596
|
+
return L.setDate(l.getDate() - e), D.setDate(l.getDate() + e), h >= L && h <= D ? this.relative(
|
|
597
|
+
h,
|
|
598
|
+
n,
|
|
599
|
+
l
|
|
600
|
+
) : this.date(
|
|
601
|
+
h,
|
|
602
|
+
o,
|
|
603
|
+
a,
|
|
604
|
+
u
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Возвращает отформатированное значение времени, прошедшего с момента события
|
|
609
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
610
|
+
* @param unit time unit/ единица времени
|
|
611
|
+
* @param styleOptions additional option or formatting style/ дополнительная опция или стиль форматирования
|
|
612
|
+
*/
|
|
613
|
+
relativeByValue(t, e, s) {
|
|
614
|
+
const n = {
|
|
615
|
+
numeric: "auto",
|
|
616
|
+
...typeof s == "string" ? { style: s } : s || {}
|
|
617
|
+
};
|
|
618
|
+
try {
|
|
619
|
+
if (d())
|
|
620
|
+
return new Intl.RelativeTimeFormat(this.getLocation(), n).format(Math.round(b(t)), e);
|
|
621
|
+
} catch (a) {
|
|
622
|
+
console.error("relative: ", a);
|
|
623
|
+
}
|
|
624
|
+
return "";
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Names of months.<br>
|
|
628
|
+
* Названия месяцев.
|
|
629
|
+
* @param value the date to format/ дата для форматирования
|
|
630
|
+
* @param style the representation of the month/ представление месяца
|
|
631
|
+
*/
|
|
632
|
+
month(t, e) {
|
|
633
|
+
try {
|
|
634
|
+
if (d())
|
|
635
|
+
return Intl.DateTimeFormat(this.getLocation(), { month: e || "long" }).format(S(t));
|
|
636
|
+
} catch (s) {
|
|
637
|
+
console.error("month: ", s);
|
|
638
|
+
}
|
|
639
|
+
return "";
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Array to list of months.
|
|
643
|
+
*
|
|
644
|
+
* Массив в список месяцев.
|
|
645
|
+
* @param style the representation of the month/ представление месяца
|
|
646
|
+
*/
|
|
647
|
+
months(t) {
|
|
648
|
+
const e = [{
|
|
649
|
+
label: "",
|
|
650
|
+
value: void 0
|
|
651
|
+
}];
|
|
652
|
+
try {
|
|
653
|
+
if (d()) {
|
|
654
|
+
const s = /* @__PURE__ */ new Date(), n = Intl.DateTimeFormat(this.getLocation(), { month: t || "long" });
|
|
655
|
+
for (let a = 0; a < 12; a++)
|
|
656
|
+
s.setMonth(a), e.push({
|
|
657
|
+
label: n.format(s).replace(/^./, (o) => o.toUpperCase()),
|
|
658
|
+
value: a + 1
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
} catch (s) {
|
|
662
|
+
console.error("months: ", s);
|
|
663
|
+
}
|
|
664
|
+
return e;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Returns names of days of the week.
|
|
668
|
+
*
|
|
669
|
+
* Возвращает названия дней недели.
|
|
670
|
+
* @param value the date to format/ дата для форматирования
|
|
671
|
+
* @param style the representation of the weekday/ представление о дне недели
|
|
672
|
+
*/
|
|
673
|
+
weekday(t, e) {
|
|
674
|
+
try {
|
|
675
|
+
if (d())
|
|
676
|
+
return Intl.DateTimeFormat(this.getLocation(), { weekday: e || "long" }).format(S(t));
|
|
677
|
+
} catch (s) {
|
|
678
|
+
console.error("weekday: ", s);
|
|
679
|
+
}
|
|
680
|
+
return "";
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* An array of the list of names of the days of the week.
|
|
684
|
+
*
|
|
685
|
+
* Массив из списка названий дней недели.
|
|
686
|
+
* @param style the representation of the weekday/ представление о дне недели
|
|
687
|
+
*/
|
|
688
|
+
weekdays(t) {
|
|
689
|
+
const e = [{
|
|
690
|
+
label: "",
|
|
691
|
+
value: void 0
|
|
692
|
+
}];
|
|
693
|
+
try {
|
|
694
|
+
if (d()) {
|
|
695
|
+
const s = /* @__PURE__ */ new Date(), n = Intl.DateTimeFormat(this.getLocation(), { weekday: t || "long" }), a = s.getDay() + (this.geo.firstDay === "Mo" ? -1 : 1);
|
|
696
|
+
s.setDate(s.getDate() - a);
|
|
697
|
+
for (let o = 0; o < 7; o++)
|
|
698
|
+
e.push({
|
|
699
|
+
label: n.format(s).replace(/^./, (u) => u.toUpperCase()),
|
|
700
|
+
value: s.getDay()
|
|
701
|
+
}), s.setDate(s.getDate() + 1);
|
|
702
|
+
}
|
|
703
|
+
} catch (s) {
|
|
704
|
+
console.error("weekdays: ", s);
|
|
705
|
+
}
|
|
706
|
+
return e;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Time.
|
|
710
|
+
*
|
|
711
|
+
* Время.
|
|
712
|
+
* @param value the date to format/ дата для форматирования
|
|
713
|
+
*/
|
|
714
|
+
time(t) {
|
|
715
|
+
return this.date(t, "time");
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Sorts strings taking into account the characteristics of countries.
|
|
719
|
+
*
|
|
720
|
+
* Сортирует строки с учетом особенностей стран.
|
|
721
|
+
* @param data an array with data/ массив с данными
|
|
722
|
+
* @param compareFn a function for sorting/ функция для сортировки
|
|
723
|
+
*/
|
|
724
|
+
sort(t, e = (s, n) => [s, n]) {
|
|
725
|
+
if (d()) {
|
|
726
|
+
const s = new Intl.Collator(this.getLocation());
|
|
727
|
+
return t.sort((n, a) => s.compare(...e(n, a)));
|
|
728
|
+
}
|
|
729
|
+
return t;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* The object enables language-sensitive number formatting.
|
|
733
|
+
*
|
|
734
|
+
* Объект включает форматирование чисел с учетом языка.
|
|
735
|
+
* @param options an object with some or all properties/
|
|
736
|
+
* объект с некоторыми или всеми свойствами
|
|
737
|
+
*/
|
|
738
|
+
numberObject(t) {
|
|
739
|
+
try {
|
|
740
|
+
if (d())
|
|
741
|
+
return new Intl.NumberFormat(this.getLocation(), t);
|
|
742
|
+
} catch (e) {
|
|
743
|
+
console.error("numberObject: ", e);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Returns options for data according to its type.
|
|
748
|
+
*
|
|
749
|
+
* Возвращает options для data по его типу.
|
|
750
|
+
* @param type type of data format/ тип формата data
|
|
751
|
+
* @param display the representation of the month/ представление месяца
|
|
752
|
+
*/
|
|
753
|
+
dateOptions(t, e = "short") {
|
|
754
|
+
const s = {};
|
|
755
|
+
return ["full", "datetime", "date", void 0, "year-month", "year"].indexOf(t) !== -1 && (s.year = "numeric"), ["full", "datetime", "date", void 0, "year-month", "month", "day-month"].indexOf(t) !== -1 && (s.month = e), ["full", "datetime", "date", void 0, "day", "day-month"].indexOf(t) !== -1 && (s.day = "2-digit"), t !== void 0 && (["full", "datetime", "time", "hour-minute", "hour"].indexOf(t) !== -1 && (s.hour = "2-digit"), ["full", "datetime", "time", "hour-minute", "minute"].indexOf(t) !== -1 && (s.minute = "2-digit"), ["full", "time", "second"].indexOf(t) !== -1 && (s.second = "2-digit")), s;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
const _ = {};
|
|
759
|
+
class ot {
|
|
760
|
+
/**
|
|
761
|
+
* Constructor
|
|
762
|
+
* @param date date for processing/ дата для обработки
|
|
763
|
+
* @param type type of date format for output/ тип формата даты вывода
|
|
764
|
+
* @param code country and language code/ код страны и языка
|
|
765
|
+
*/
|
|
766
|
+
constructor(t, e = "date", s = y.getLocation()) {
|
|
767
|
+
this.type = e, this.code = s, this.date = S(t);
|
|
768
|
+
}
|
|
769
|
+
date;
|
|
770
|
+
hour24 = !1;
|
|
771
|
+
watch;
|
|
772
|
+
/**
|
|
773
|
+
* Returns an object for working with formatting.
|
|
774
|
+
*
|
|
775
|
+
* Возвращает объект для работы с форматированием.
|
|
776
|
+
*/
|
|
777
|
+
getIntl() {
|
|
778
|
+
return new N(this.code);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Returns a Date object.
|
|
782
|
+
*
|
|
783
|
+
* Возвращает объект Date.
|
|
784
|
+
*/
|
|
785
|
+
getDate() {
|
|
786
|
+
return this.date;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Returns the type of data output.
|
|
790
|
+
*
|
|
791
|
+
* Возвращает тип вывода данных.
|
|
792
|
+
*/
|
|
793
|
+
getType() {
|
|
794
|
+
return this.type;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Returns the format of hours.
|
|
798
|
+
*
|
|
799
|
+
* Возвращает формат часов.
|
|
800
|
+
*/
|
|
801
|
+
getHoursType() {
|
|
802
|
+
const t = this.clone();
|
|
803
|
+
return t.setHours(23), t.toLocaleTimeString(this.getIntl().getLocation(), { hour: "2-digit" }).match(/23/ig) ? "24" : "12";
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Whether to use 12-hour time.
|
|
807
|
+
*
|
|
808
|
+
* Использовать ли 12-часовой формат времени.
|
|
809
|
+
*/
|
|
810
|
+
getHour24() {
|
|
811
|
+
return this.hour24;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* The method returns the difference, in minutes, between
|
|
815
|
+
* a date as evaluated in the UTC time zone, and the same date as evaluated
|
|
816
|
+
* in the local time zone.
|
|
817
|
+
*
|
|
818
|
+
* Метод возвращает смещение часового пояса относительно часового пояса UTC
|
|
819
|
+
* в минутах для текущей локали.
|
|
820
|
+
*/
|
|
821
|
+
getTimeZoneOffset() {
|
|
822
|
+
return this.date.getTimezoneOffset();
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Returns the time zone as a string.
|
|
826
|
+
*
|
|
827
|
+
* Возвращает временную зону в виде строки.
|
|
828
|
+
* @param style the style of the returned data/ стиль возвращаемых данных
|
|
829
|
+
*/
|
|
830
|
+
getTimeZone(t) {
|
|
831
|
+
const e = this.getTimeZoneOffset();
|
|
832
|
+
if (t === "minute")
|
|
833
|
+
return e.toString();
|
|
834
|
+
const s = e / 60 * -1;
|
|
835
|
+
if (t === "hour")
|
|
836
|
+
return this.getIntl().number(Math.trunc(s), { signDisplay: "always" });
|
|
837
|
+
const n = this.getIntl().number(Math.trunc(s), {
|
|
838
|
+
signDisplay: "always",
|
|
839
|
+
minimumIntegerDigits: 2
|
|
840
|
+
}), a = s.toString().match(/.\d+/) ? "30" : "00";
|
|
841
|
+
return t === "RFC" ? `${n}${a}` : `${n}:${a}`;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Returns the code of the first day of the week.
|
|
845
|
+
*
|
|
846
|
+
* Возвращает код первого дня недели.
|
|
847
|
+
*/
|
|
848
|
+
getFirstDayCode() {
|
|
849
|
+
const t = this.getIntl().getFirstDay();
|
|
850
|
+
return t === "Sa" ? 6 : t === "Su" ? 0 : 1;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* The method returns the year of the specified date according to local time.
|
|
854
|
+
*
|
|
855
|
+
* Метод возвращает год указанной даты по местному времени.
|
|
856
|
+
*/
|
|
857
|
+
getYear() {
|
|
858
|
+
return this.date.getFullYear();
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* The method returns the month in the specified date according to local time,
|
|
862
|
+
* as a zero-based value.
|
|
863
|
+
*
|
|
864
|
+
* Метод возвращает месяц указанной даты по местному времени, нумерация
|
|
865
|
+
* месяцев начинается с нуля для первого месяца в году.
|
|
866
|
+
*/
|
|
867
|
+
getMonth() {
|
|
868
|
+
return this.date.getMonth() + 1;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* The method returns the day of the month for the specified date according to local time.
|
|
872
|
+
*
|
|
873
|
+
* Метод возвращает день месяца указанной даты по местному времени
|
|
874
|
+
*/
|
|
875
|
+
getDay() {
|
|
876
|
+
return this.date.getDate();
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* The method returns the hour for the specified date, according to local time.
|
|
880
|
+
*
|
|
881
|
+
* Метод возвращает часы указанной даты по местному времени.
|
|
882
|
+
*/
|
|
883
|
+
getHour() {
|
|
884
|
+
return this.date.getHours();
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* The method returns the minutes in the specified date according to local time.
|
|
888
|
+
*
|
|
889
|
+
* Метод возвращает минуты указанной даты по местному времени.
|
|
890
|
+
*/
|
|
891
|
+
getMinute() {
|
|
892
|
+
return this.date.getMinutes();
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* The method returns the seconds in the specified date according to local time.
|
|
896
|
+
*
|
|
897
|
+
* Метод возвращает секунды указанной даты по местному времени.
|
|
898
|
+
*/
|
|
899
|
+
getSecond() {
|
|
900
|
+
return this.date.getSeconds();
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Returns the last day of the week.
|
|
904
|
+
*
|
|
905
|
+
* Возвращает последний день недели.
|
|
906
|
+
*/
|
|
907
|
+
getMaxDay() {
|
|
908
|
+
return this.getMonth() > 0 ? this.cloneDayLast().getDay() : 0;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Enables language-sensitive date and time formatting.
|
|
912
|
+
*
|
|
913
|
+
* Конструктором объектов, включающих языка-зависимое форматирование даты и времени.
|
|
914
|
+
* @param type type of date format for output/ тип формата даты вывода
|
|
915
|
+
* @param styleOptions the representation of the month/ представление месяца
|
|
916
|
+
*/
|
|
917
|
+
locale(t = this.type, e) {
|
|
918
|
+
return this.getIntl().date(
|
|
919
|
+
this.date,
|
|
920
|
+
t,
|
|
921
|
+
e,
|
|
922
|
+
this.hour24
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Returns the formatted year.
|
|
927
|
+
*
|
|
928
|
+
* Возвращает отформатированный год.
|
|
929
|
+
* @param style the representation of the month/ представление месяца
|
|
930
|
+
*/
|
|
931
|
+
localeYear(t = "numeric") {
|
|
932
|
+
return this.locale("year", { year: t });
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Returns the formatted month.
|
|
936
|
+
*
|
|
937
|
+
* Возвращает отформатированный месяц.
|
|
938
|
+
* @param style the representation of the month/ представление месяца
|
|
939
|
+
*/
|
|
940
|
+
localeMonth(t = "long") {
|
|
941
|
+
return this.locale("month", { month: t });
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Returns the formatted day.
|
|
945
|
+
*
|
|
946
|
+
* Возвращает отформатированный день.
|
|
947
|
+
* @param style the representation of the month/ представление месяца
|
|
948
|
+
*/
|
|
949
|
+
localeDay(t = "numeric") {
|
|
950
|
+
return this.locale("day", { day: t });
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Returns the formatted hour.
|
|
954
|
+
*
|
|
955
|
+
* Возвращает отформатированный час.
|
|
956
|
+
* @param style the representation of the month/ представление месяца
|
|
957
|
+
*/
|
|
958
|
+
localeHour(t = "numeric") {
|
|
959
|
+
return this.locale("hour", { hour: t });
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Returns the formatted minute.
|
|
963
|
+
*
|
|
964
|
+
* Возвращает отформатированную минуту.
|
|
965
|
+
* @param style the representation of the month/ представление месяца
|
|
966
|
+
*/
|
|
967
|
+
localeMinute(t = "numeric") {
|
|
968
|
+
return this.locale("minute", { minute: t });
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Returns the formatted second.
|
|
972
|
+
*
|
|
973
|
+
* Возвращает отформатированную секунду.
|
|
974
|
+
* @param style the representation of the month/ представление месяца
|
|
975
|
+
*/
|
|
976
|
+
localeSecond(t = "numeric") {
|
|
977
|
+
return this.locale("second", { second: t });
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Output of standard data.
|
|
981
|
+
*
|
|
982
|
+
* Вывод стандартных данных.
|
|
983
|
+
* @param timeZone add time zone/ добавить временную зону
|
|
984
|
+
*/
|
|
985
|
+
standard(t = !0) {
|
|
986
|
+
const e = new ot(this.date, this.type, "en-GB"), s = [];
|
|
987
|
+
let n;
|
|
988
|
+
return e.setHour24(!0), this.type === "hour-minute" ? n = e.locale(this.type, {
|
|
989
|
+
year: "numeric",
|
|
990
|
+
month: "2-digit",
|
|
991
|
+
hour12: !1
|
|
992
|
+
}) : (["full", "datetime", "date", "year-month", "year", "month", "day"].indexOf(this.type) !== -1 && (s.push(e.localeYear()), s.push(e.localeMonth("2-digit"))), ["full", "datetime", "date", "year", "month", "day"].indexOf(this.type) !== -1 && s.push(e.localeDay("2-digit")), ["full", "datetime", "time", "hour", "minute", "second"].indexOf(this.type) !== -1 && (n = e.locale("time"))), `${s.join("-")}${n ? `T${n}${t ? e.getTimeZone() : ""}` : ""}`;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Change the date completely.
|
|
996
|
+
*
|
|
997
|
+
* Изменять полностью дату.
|
|
998
|
+
* @param value an integer value representing the number/
|
|
999
|
+
* целочисленное значение, представляющее число
|
|
1000
|
+
*/
|
|
1001
|
+
setDate(t) {
|
|
1002
|
+
return this.date = S(t), this.update(), this;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Change the type of data output.
|
|
1006
|
+
*
|
|
1007
|
+
* Изменить тип вывода данных.
|
|
1008
|
+
* @param value type of output/ тип вывод
|
|
1009
|
+
*/
|
|
1010
|
+
setType(t) {
|
|
1011
|
+
return this.type = t, this.update(), this;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Whether to use 12-hour time.
|
|
1015
|
+
*
|
|
1016
|
+
* Использовать ли 12-часовой формат времени.
|
|
1017
|
+
* @param value If true, output the 12-hour time format/
|
|
1018
|
+
* если true, выводить 12-часовой формат времени
|
|
1019
|
+
*/
|
|
1020
|
+
setHour24(t) {
|
|
1021
|
+
return this.hour24 = t, this.update(), this;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* To change the location.
|
|
1025
|
+
*
|
|
1026
|
+
* Изменить местоположение.
|
|
1027
|
+
* @param code country and language code/ код страны и языка
|
|
1028
|
+
*/
|
|
1029
|
+
setCode(t) {
|
|
1030
|
+
return this.code = t, this;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* The function is called when the data is updated.
|
|
1034
|
+
*
|
|
1035
|
+
* Функция вызывается при обновлении данных.
|
|
1036
|
+
* @param watch the function calls/ функция вызывает
|
|
1037
|
+
*/
|
|
1038
|
+
setWatch(t) {
|
|
1039
|
+
return this.watch = t, this;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* The method sets the full year for a specified date according to local time.
|
|
1043
|
+
*
|
|
1044
|
+
* Метод устанавливает полный год указанной даты по местному времени.
|
|
1045
|
+
* @param value value/ значения
|
|
1046
|
+
*/
|
|
1047
|
+
setYear(t) {
|
|
1048
|
+
return this.date.setFullYear(t), this.update(), this;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* The method sets the month for a specified date according to the currently set year.
|
|
1052
|
+
*
|
|
1053
|
+
* Метод устанавливает месяц указанной даты по местному времени.
|
|
1054
|
+
* @param value value/ значения
|
|
1055
|
+
*/
|
|
1056
|
+
setMonth(t) {
|
|
1057
|
+
return this.date.setMonth(t - 1), this.update(), this;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* The method changes the day of the month of a given Date instance, based on local time.
|
|
1061
|
+
*
|
|
1062
|
+
* Метод устанавливает день месяца указанной даты по местному времени.
|
|
1063
|
+
* @param value value/ значения
|
|
1064
|
+
*/
|
|
1065
|
+
setDay(t) {
|
|
1066
|
+
return this.date.setDate(t), this.update(), this;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* The method sets the hours for a specified date according to local time.
|
|
1070
|
+
*
|
|
1071
|
+
* Метод устанавливает часы указанной даты по местному времени.
|
|
1072
|
+
* @param value value/ значения
|
|
1073
|
+
*/
|
|
1074
|
+
setHour(t) {
|
|
1075
|
+
return this.date.setHours(t), this.update(), this;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* The method sets the minutes for a specified date according to local time
|
|
1079
|
+
*
|
|
1080
|
+
* Метод устанавливает минуты указанной даты по местному времени
|
|
1081
|
+
* @param value value / значения
|
|
1082
|
+
*/
|
|
1083
|
+
setMinute(t) {
|
|
1084
|
+
return this.date.setMinutes(t), this.update(), this;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* The method sets the seconds for a specified date according to local time.
|
|
1088
|
+
*
|
|
1089
|
+
* Метод устанавливает секунды указанной даты по местному времени.
|
|
1090
|
+
* @param value value/ значения
|
|
1091
|
+
*/
|
|
1092
|
+
setSecond(t) {
|
|
1093
|
+
return this.date.setSeconds(t), this.update(), this;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Shift the date by a given value in years.
|
|
1097
|
+
*
|
|
1098
|
+
* Сдвинуть дату на заданное значение в годах.
|
|
1099
|
+
* @param value values for moving/ значения для перемещения
|
|
1100
|
+
*/
|
|
1101
|
+
moveByYear(t) {
|
|
1102
|
+
return this.setYear(this.date.getFullYear() + t), this;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Shift the date by a given value in months.
|
|
1106
|
+
*
|
|
1107
|
+
* Сдвинуть дату на заданное значение в месяцах.
|
|
1108
|
+
* @param value values for moving/ значения для перемещения
|
|
1109
|
+
*/
|
|
1110
|
+
moveByMonth(t) {
|
|
1111
|
+
return this.setMonth(this.date.getMonth() + 1 + t), this;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Shift the date by a given value in days.
|
|
1115
|
+
*
|
|
1116
|
+
* Сдвинуть дату на заданное значение в днях.
|
|
1117
|
+
* @param value values for moving/ значения для перемещения
|
|
1118
|
+
*/
|
|
1119
|
+
moveByDay(t) {
|
|
1120
|
+
return this.setDay(this.date.getDate() + t), this;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Shift the date by a given value in hours.
|
|
1124
|
+
*
|
|
1125
|
+
* Сдвинуть дату на заданное значение в часах.
|
|
1126
|
+
* @param value values for moving/ значения для перемещения
|
|
1127
|
+
*/
|
|
1128
|
+
moveByHour(t) {
|
|
1129
|
+
return this.setHour(this.date.getHours() + t), this;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Shift the date by a given value in minutes.
|
|
1133
|
+
*
|
|
1134
|
+
* Сдвинуть дату на заданное значение в минутах.
|
|
1135
|
+
* @param value values for moving/ значения для перемещения
|
|
1136
|
+
*/
|
|
1137
|
+
moveByMinute(t) {
|
|
1138
|
+
return this.setMinute(this.date.getMinutes() + t), this;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Shift the date by a given value in seconds.
|
|
1142
|
+
*
|
|
1143
|
+
* Сдвинуть дату на заданное значение в секундах.
|
|
1144
|
+
* @param value values for moving/ значения для перемещения
|
|
1145
|
+
*/
|
|
1146
|
+
moveBySecond(t) {
|
|
1147
|
+
return this.setSecond(this.date.getSeconds() + t), this;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Translate to the first month.
|
|
1151
|
+
*
|
|
1152
|
+
* Переводить на первый месяц.
|
|
1153
|
+
*/
|
|
1154
|
+
moveMonthFirst() {
|
|
1155
|
+
return this.setMonth(1), this;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Translate to the first month.
|
|
1159
|
+
*
|
|
1160
|
+
* Переводить на первый месяц.
|
|
1161
|
+
*/
|
|
1162
|
+
moveMonthLast() {
|
|
1163
|
+
return this.setMonth(12), this;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Translate to the first day of the next month.
|
|
1167
|
+
*
|
|
1168
|
+
* Переводить на первый день следующего месяца.
|
|
1169
|
+
*/
|
|
1170
|
+
moveMonthNext() {
|
|
1171
|
+
return this.setDay(1).moveByMonth(1), this;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Translate to the first day of the previous month.
|
|
1175
|
+
*
|
|
1176
|
+
* Переводить на первый день предыдущего месяца.
|
|
1177
|
+
*/
|
|
1178
|
+
moveMonthPrevious() {
|
|
1179
|
+
return this.setDay(1).moveByMonth(-1), this;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Translate to the first day of the week.
|
|
1183
|
+
*
|
|
1184
|
+
* Переводить на первый день недели.
|
|
1185
|
+
*/
|
|
1186
|
+
moveWeekdayFirst() {
|
|
1187
|
+
const t = this.date.getDay(), e = this.getFirstDayCode();
|
|
1188
|
+
return this.moveByDay(
|
|
1189
|
+
(e === 6 ? -1 : e) - t
|
|
1190
|
+
), this;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Translate to the last day of the week.
|
|
1194
|
+
*
|
|
1195
|
+
* Переводить на последний день недели.
|
|
1196
|
+
*/
|
|
1197
|
+
moveWeekdayLast() {
|
|
1198
|
+
return this.moveWeekdayFirst().moveByDay(6), this;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Translate to the first day of the first week of the month.
|
|
1202
|
+
*
|
|
1203
|
+
* Переводить на первый день первой недели месяца.
|
|
1204
|
+
*/
|
|
1205
|
+
moveWeekdayFirstByMonth() {
|
|
1206
|
+
return this.moveDayFirst().moveWeekdayFirst(), this;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Translate to the first day of the first full week of the following month.
|
|
1210
|
+
*
|
|
1211
|
+
* Переводить на первый день первой полной недели следующего месяца.
|
|
1212
|
+
*/
|
|
1213
|
+
moveWeekdayLastByMonth() {
|
|
1214
|
+
return this.moveDayLast().moveWeekdayLast(), this;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Translate to the next week.
|
|
1218
|
+
*
|
|
1219
|
+
* Переводить на следующую неделю.
|
|
1220
|
+
*/
|
|
1221
|
+
moveWeekdayNext() {
|
|
1222
|
+
return this.moveWeekdayFirst().moveByDay(7), this;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Translate to the previous week.
|
|
1226
|
+
*
|
|
1227
|
+
* Переводить на предыдущую неделю.
|
|
1228
|
+
*/
|
|
1229
|
+
moveWeekdayPrevious() {
|
|
1230
|
+
return this.moveWeekdayFirst().moveByDay(-7), this;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Translate to the first day of the month.
|
|
1234
|
+
*
|
|
1235
|
+
* Переводить на первый день месяца.
|
|
1236
|
+
*/
|
|
1237
|
+
moveDayFirst() {
|
|
1238
|
+
return this.setDay(1), this;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Translate to the last day of the month.
|
|
1242
|
+
*
|
|
1243
|
+
* Переводить на последний день месяца.
|
|
1244
|
+
*/
|
|
1245
|
+
moveDayLast() {
|
|
1246
|
+
return this.setDay(1).moveByMonth(1).moveByDay(-1), this;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Translate to the next day.
|
|
1250
|
+
*
|
|
1251
|
+
* Переводить на следующий день.
|
|
1252
|
+
*/
|
|
1253
|
+
moveDayNext() {
|
|
1254
|
+
return this.moveByDay(1), this;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Translate to the previous day.
|
|
1258
|
+
*
|
|
1259
|
+
* Переводить на предыдущий день.
|
|
1260
|
+
*/
|
|
1261
|
+
moveDayPrevious() {
|
|
1262
|
+
return this.moveByDay(-1), this;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Clone the Date object.
|
|
1266
|
+
*
|
|
1267
|
+
* Клонировать объект Date.
|
|
1268
|
+
*/
|
|
1269
|
+
clone() {
|
|
1270
|
+
return new Date(this.date);
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Clone the GeoDate object.
|
|
1274
|
+
*
|
|
1275
|
+
* Клонировать объект GeoDate.
|
|
1276
|
+
*/
|
|
1277
|
+
cloneClass() {
|
|
1278
|
+
return new this.constructor(
|
|
1279
|
+
this.clone(),
|
|
1280
|
+
this.type,
|
|
1281
|
+
this.code
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Clone the GeoDate object and set the month to January.
|
|
1286
|
+
*
|
|
1287
|
+
* Клонировать объект GeoDate и установить месяц на январь.
|
|
1288
|
+
*/
|
|
1289
|
+
cloneMonthFirst() {
|
|
1290
|
+
return this.cloneClass().moveMonthFirst();
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Clone the GeoDate object and move the month to the end of the year.
|
|
1294
|
+
*
|
|
1295
|
+
* Клонировать объект GeoDate и перевести месяц на конец года.
|
|
1296
|
+
*/
|
|
1297
|
+
cloneMonthLast() {
|
|
1298
|
+
return this.cloneClass().moveMonthLast();
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Clone the GeoDate object and transfer it one month ahead.
|
|
1302
|
+
*
|
|
1303
|
+
* Клонировать объект GeoDate и перевести на 1 месяц вперед.
|
|
1304
|
+
*/
|
|
1305
|
+
cloneMonthNext() {
|
|
1306
|
+
return this.cloneClass().moveMonthNext();
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Clone the GeoDate object and transfer it one month back.
|
|
1310
|
+
*
|
|
1311
|
+
* Клонировать объект GeoDate и перевести на 1 месяц назад.
|
|
1312
|
+
*/
|
|
1313
|
+
cloneMonthPrevious() {
|
|
1314
|
+
return this.cloneClass().moveMonthPrevious();
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Returns the first day of the week according to the current date.
|
|
1318
|
+
*
|
|
1319
|
+
* Возвращает первый день недели по текущей дате.
|
|
1320
|
+
*/
|
|
1321
|
+
cloneWeekdayFirst() {
|
|
1322
|
+
return this.cloneClass().moveWeekdayFirst();
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Returns the last day of the week according to the current date.
|
|
1326
|
+
*
|
|
1327
|
+
* Возвращает последний день недели по текущей дате.
|
|
1328
|
+
*/
|
|
1329
|
+
cloneWeekdayLast() {
|
|
1330
|
+
return this.cloneClass().moveWeekdayLast();
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Returns the first day of the week according to the current month.
|
|
1334
|
+
*
|
|
1335
|
+
* Возвращает первый день недели по текущему месяцу.
|
|
1336
|
+
*/
|
|
1337
|
+
cloneWeekdayFirstByMonth() {
|
|
1338
|
+
return this.cloneClass().moveWeekdayFirstByMonth();
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Returns the last day of the week according to the current month.
|
|
1342
|
+
*
|
|
1343
|
+
* Возвращает последний день недели по текущему месяцу.
|
|
1344
|
+
*/
|
|
1345
|
+
cloneWeekdayLastByMonth() {
|
|
1346
|
+
return this.cloneClass().moveWeekdayLastByMonth();
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Returns the next week according to the current date.
|
|
1350
|
+
*
|
|
1351
|
+
* Возвращает следующую неделю по текущей дате.
|
|
1352
|
+
*/
|
|
1353
|
+
cloneWeekdayNext() {
|
|
1354
|
+
return this.cloneClass().moveWeekdayNext();
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Returns the previous week according to the current date.
|
|
1358
|
+
*
|
|
1359
|
+
* Возвращает предыдущую неделю по текущей дате.
|
|
1360
|
+
*/
|
|
1361
|
+
cloneWeekdayPrevious() {
|
|
1362
|
+
return this.cloneClass().moveWeekdayPrevious();
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Clone the GeoDate object and move the day to the beginning of the month.
|
|
1366
|
+
*
|
|
1367
|
+
* Клонировать объект GeoDate и перевести день на начало месяца.
|
|
1368
|
+
*/
|
|
1369
|
+
cloneDayFirst() {
|
|
1370
|
+
return this.cloneClass().moveDayFirst();
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Clone the GeoDate object and move the day to the end of the month.
|
|
1374
|
+
*
|
|
1375
|
+
* Клонировать объект GeoDate и перевести день на конец месяца.
|
|
1376
|
+
*/
|
|
1377
|
+
cloneDayLast() {
|
|
1378
|
+
return this.cloneClass().moveDayLast();
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Clone the GeoDate object and move by 1 day.
|
|
1382
|
+
*
|
|
1383
|
+
* Клонировать объект GeoDate и перевести на 1 день.
|
|
1384
|
+
*/
|
|
1385
|
+
cloneDayNext() {
|
|
1386
|
+
return this.cloneClass().moveDayNext();
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Clone the GeoDate object and go back by 1 day.
|
|
1390
|
+
*
|
|
1391
|
+
* Клонировать объект GeoDate и вернуться на 1 день.
|
|
1392
|
+
*/
|
|
1393
|
+
cloneDayPrevious() {
|
|
1394
|
+
return this.cloneClass().moveDayPrevious();
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Updating all values.
|
|
1398
|
+
*
|
|
1399
|
+
* Обновление всех значений.
|
|
1400
|
+
*/
|
|
1401
|
+
update() {
|
|
1402
|
+
return this.watch?.(
|
|
1403
|
+
this.date,
|
|
1404
|
+
this.type,
|
|
1405
|
+
this.hour24
|
|
1406
|
+
), this;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
const r = "@flag";
|
|
1410
|
+
class E {
|
|
1411
|
+
/**
|
|
1412
|
+
* Constructor
|
|
1413
|
+
* @param code country and language code/ код страны и языка
|
|
1414
|
+
*/
|
|
1415
|
+
constructor(t = y.getLocation()) {
|
|
1416
|
+
this.code = t;
|
|
1417
|
+
}
|
|
1418
|
+
static flags = {
|
|
1419
|
+
AD: `${r}-ad`,
|
|
1420
|
+
AE: `${r}-ae`,
|
|
1421
|
+
AF: `${r}-af`,
|
|
1422
|
+
AG: `${r}-ag`,
|
|
1423
|
+
AI: `${r}-ai`,
|
|
1424
|
+
AL: `${r}-al`,
|
|
1425
|
+
AM: `${r}-am`,
|
|
1426
|
+
AN: `${r}-an`,
|
|
1427
|
+
AO: `${r}-ao`,
|
|
1428
|
+
AQ: `${r}-aq`,
|
|
1429
|
+
AR: `${r}-ar`,
|
|
1430
|
+
AS: `${r}-as`,
|
|
1431
|
+
AT: `${r}-at`,
|
|
1432
|
+
AU: `${r}-au`,
|
|
1433
|
+
AW: `${r}-aw`,
|
|
1434
|
+
AZ: `${r}-az`,
|
|
1435
|
+
BA: `${r}-ba`,
|
|
1436
|
+
BB: `${r}-bb`,
|
|
1437
|
+
BD: `${r}-bd`,
|
|
1438
|
+
BE: `${r}-be`,
|
|
1439
|
+
BF: `${r}-bf`,
|
|
1440
|
+
BG: `${r}-bg`,
|
|
1441
|
+
BH: `${r}-bh`,
|
|
1442
|
+
BI: `${r}-bi`,
|
|
1443
|
+
BJ: `${r}-bj`,
|
|
1444
|
+
BL: `${r}-bl`,
|
|
1445
|
+
BM: `${r}-bm`,
|
|
1446
|
+
BN: `${r}-bn`,
|
|
1447
|
+
BO: `${r}-bo`,
|
|
1448
|
+
BR: `${r}-br`,
|
|
1449
|
+
BS: `${r}-bs`,
|
|
1450
|
+
BT: `${r}-bt`,
|
|
1451
|
+
BW: `${r}-bw`,
|
|
1452
|
+
BY: `${r}-by`,
|
|
1453
|
+
BZ: `${r}-bz`,
|
|
1454
|
+
CA: `${r}-ca`,
|
|
1455
|
+
CC: `${r}-cc`,
|
|
1456
|
+
CD: `${r}-cd`,
|
|
1457
|
+
CF: `${r}-cf`,
|
|
1458
|
+
CG: `${r}-cg`,
|
|
1459
|
+
CH: `${r}-ch`,
|
|
1460
|
+
CI: `${r}-ci`,
|
|
1461
|
+
CK: `${r}-ck`,
|
|
1462
|
+
CL: `${r}-cl`,
|
|
1463
|
+
CM: `${r}-cm`,
|
|
1464
|
+
CN: `${r}-cn`,
|
|
1465
|
+
CO: `${r}-co`,
|
|
1466
|
+
CR: `${r}-cr`,
|
|
1467
|
+
CU: `${r}-cu`,
|
|
1468
|
+
CV: `${r}-cv`,
|
|
1469
|
+
CW: `${r}-cw`,
|
|
1470
|
+
CX: `${r}-cx`,
|
|
1471
|
+
CY: `${r}-cy`,
|
|
1472
|
+
CZ: `${r}-cz`,
|
|
1473
|
+
DE: `${r}-de`,
|
|
1474
|
+
DJ: `${r}-dj`,
|
|
1475
|
+
DK: `${r}-dk`,
|
|
1476
|
+
DM: `${r}-dm`,
|
|
1477
|
+
DZ: `${r}-dz`,
|
|
1478
|
+
EC: `${r}-ec`,
|
|
1479
|
+
EE: `${r}-ee`,
|
|
1480
|
+
EG: `${r}-eg`,
|
|
1481
|
+
EH: `${r}-eh`,
|
|
1482
|
+
ER: `${r}-er`,
|
|
1483
|
+
ES: `${r}-es`,
|
|
1484
|
+
ET: `${r}-et`,
|
|
1485
|
+
FI: `${r}-fi`,
|
|
1486
|
+
FJ: `${r}-fj`,
|
|
1487
|
+
FK: `${r}-fk`,
|
|
1488
|
+
FM: `${r}-fm`,
|
|
1489
|
+
FO: `${r}-fo`,
|
|
1490
|
+
FR: `${r}-fr`,
|
|
1491
|
+
GA: `${r}-ga`,
|
|
1492
|
+
GB: `${r}-gb`,
|
|
1493
|
+
GD: `${r}-gd`,
|
|
1494
|
+
GE: `${r}-ge`,
|
|
1495
|
+
GF: `${r}-gf`,
|
|
1496
|
+
GG: `${r}-gg`,
|
|
1497
|
+
GH: `${r}-gh`,
|
|
1498
|
+
GI: `${r}-gi`,
|
|
1499
|
+
GL: `${r}-gl`,
|
|
1500
|
+
GM: `${r}-gm`,
|
|
1501
|
+
GN: `${r}-gn`,
|
|
1502
|
+
GQ: `${r}-gq`,
|
|
1503
|
+
GR: `${r}-gr`,
|
|
1504
|
+
GT: `${r}-gt`,
|
|
1505
|
+
GU: `${r}-gu`,
|
|
1506
|
+
GW: `${r}-gw`,
|
|
1507
|
+
GY: `${r}-gy`,
|
|
1508
|
+
HK: `${r}-hk`,
|
|
1509
|
+
HN: `${r}-hn`,
|
|
1510
|
+
HR: `${r}-hr`,
|
|
1511
|
+
HT: `${r}-ht`,
|
|
1512
|
+
HU: `${r}-hu`,
|
|
1513
|
+
ID: `${r}-id`,
|
|
1514
|
+
IE: `${r}-ie`,
|
|
1515
|
+
IL: `${r}-il`,
|
|
1516
|
+
IM: `${r}-im`,
|
|
1517
|
+
IN: `${r}-in`,
|
|
1518
|
+
IO: `${r}-io`,
|
|
1519
|
+
IQ: `${r}-iq`,
|
|
1520
|
+
IR: `${r}-ir`,
|
|
1521
|
+
IS: `${r}-is`,
|
|
1522
|
+
IT: `${r}-it`,
|
|
1523
|
+
JE: `${r}-je`,
|
|
1524
|
+
JM: `${r}-jm`,
|
|
1525
|
+
JO: `${r}-jo`,
|
|
1526
|
+
JP: `${r}-jp`,
|
|
1527
|
+
KE: `${r}-ke`,
|
|
1528
|
+
KG: `${r}-kg`,
|
|
1529
|
+
KH: `${r}-kh`,
|
|
1530
|
+
KI: `${r}-ki`,
|
|
1531
|
+
KM: `${r}-km`,
|
|
1532
|
+
KN: `${r}-kn`,
|
|
1533
|
+
KP: `${r}-kp`,
|
|
1534
|
+
KR: `${r}-kr`,
|
|
1535
|
+
KW: `${r}-kw`,
|
|
1536
|
+
KY: `${r}-ky`,
|
|
1537
|
+
KZ: `${r}-kz`,
|
|
1538
|
+
LA: `${r}-la`,
|
|
1539
|
+
LB: `${r}-lb`,
|
|
1540
|
+
LC: `${r}-lc`,
|
|
1541
|
+
LI: `${r}-li`,
|
|
1542
|
+
LK: `${r}-lk`,
|
|
1543
|
+
LR: `${r}-lr`,
|
|
1544
|
+
LS: `${r}-ls`,
|
|
1545
|
+
LT: `${r}-lt`,
|
|
1546
|
+
LU: `${r}-lu`,
|
|
1547
|
+
LV: `${r}-lv`,
|
|
1548
|
+
LY: `${r}-ly`,
|
|
1549
|
+
MA: `${r}-ma`,
|
|
1550
|
+
MC: `${r}-mc`,
|
|
1551
|
+
MD: `${r}-md`,
|
|
1552
|
+
ME: `${r}-me`,
|
|
1553
|
+
MF: `${r}-mf`,
|
|
1554
|
+
MG: `${r}-mg`,
|
|
1555
|
+
MH: `${r}-mh`,
|
|
1556
|
+
MK: `${r}-mk`,
|
|
1557
|
+
ML: `${r}-ml`,
|
|
1558
|
+
MM: `${r}-mm`,
|
|
1559
|
+
MN: `${r}-mn`,
|
|
1560
|
+
MO: `${r}-mo`,
|
|
1561
|
+
MP: `${r}-mp`,
|
|
1562
|
+
MQ: `${r}-mq`,
|
|
1563
|
+
MR: `${r}-mr`,
|
|
1564
|
+
MS: `${r}-ms`,
|
|
1565
|
+
MT: `${r}-mt`,
|
|
1566
|
+
MU: `${r}-mu`,
|
|
1567
|
+
MV: `${r}-mv`,
|
|
1568
|
+
MW: `${r}-mw`,
|
|
1569
|
+
MX: `${r}-mx`,
|
|
1570
|
+
MY: `${r}-my`,
|
|
1571
|
+
MZ: `${r}-mz`,
|
|
1572
|
+
NA: `${r}-na`,
|
|
1573
|
+
NC: `${r}-nc`,
|
|
1574
|
+
NE: `${r}-ne`,
|
|
1575
|
+
NF: `${r}-nf`,
|
|
1576
|
+
NG: `${r}-ng`,
|
|
1577
|
+
NI: `${r}-ni`,
|
|
1578
|
+
NL: `${r}-nl`,
|
|
1579
|
+
NO: `${r}-no`,
|
|
1580
|
+
NP: `${r}-np`,
|
|
1581
|
+
NR: `${r}-nr`,
|
|
1582
|
+
NU: `${r}-nu`,
|
|
1583
|
+
NZ: `${r}-nz`,
|
|
1584
|
+
OM: `${r}-om`,
|
|
1585
|
+
PA: `${r}-pa`,
|
|
1586
|
+
PE: `${r}-pe`,
|
|
1587
|
+
PF: `${r}-pf`,
|
|
1588
|
+
PG: `${r}-pg`,
|
|
1589
|
+
PH: `${r}-ph`,
|
|
1590
|
+
PK: `${r}-pk`,
|
|
1591
|
+
PL: `${r}-pl`,
|
|
1592
|
+
PM: `${r}-pm`,
|
|
1593
|
+
PN: `${r}-pn`,
|
|
1594
|
+
PR: `${r}-pr`,
|
|
1595
|
+
PS: `${r}-ps`,
|
|
1596
|
+
PT: `${r}-pt`,
|
|
1597
|
+
PW: `${r}-pw`,
|
|
1598
|
+
PY: `${r}-py`,
|
|
1599
|
+
QA: `${r}-qa`,
|
|
1600
|
+
RE: `${r}-re`,
|
|
1601
|
+
RO: `${r}-ro`,
|
|
1602
|
+
RS: `${r}-rs`,
|
|
1603
|
+
RU: `${r}-ru`,
|
|
1604
|
+
RW: `${r}-rw`,
|
|
1605
|
+
SA: `${r}-sa`,
|
|
1606
|
+
SB: `${r}-sb`,
|
|
1607
|
+
SC: `${r}-sc`,
|
|
1608
|
+
SD: `${r}-sd`,
|
|
1609
|
+
SE: `${r}-se`,
|
|
1610
|
+
SG: `${r}-sg`,
|
|
1611
|
+
SH: `${r}-sh`,
|
|
1612
|
+
SI: `${r}-si`,
|
|
1613
|
+
SJ: `${r}-sj`,
|
|
1614
|
+
SK: `${r}-sk`,
|
|
1615
|
+
SL: `${r}-sl`,
|
|
1616
|
+
SM: `${r}-sm`,
|
|
1617
|
+
SN: `${r}-sn`,
|
|
1618
|
+
SO: `${r}-so`,
|
|
1619
|
+
SR: `${r}-sr`,
|
|
1620
|
+
SS: `${r}-ss`,
|
|
1621
|
+
ST: `${r}-st`,
|
|
1622
|
+
SV: `${r}-sv`,
|
|
1623
|
+
SX: `${r}-sx`,
|
|
1624
|
+
SY: `${r}-sy`,
|
|
1625
|
+
SZ: `${r}-sz`,
|
|
1626
|
+
TC: `${r}-tc`,
|
|
1627
|
+
TD: `${r}-td`,
|
|
1628
|
+
TG: `${r}-tg`,
|
|
1629
|
+
TH: `${r}-th`,
|
|
1630
|
+
TJ: `${r}-tj`,
|
|
1631
|
+
TK: `${r}-tk`,
|
|
1632
|
+
TL: `${r}-tl`,
|
|
1633
|
+
TM: `${r}-tm`,
|
|
1634
|
+
TN: `${r}-tn`,
|
|
1635
|
+
TO: `${r}-to`,
|
|
1636
|
+
TR: `${r}-tr`,
|
|
1637
|
+
TT: `${r}-tt`,
|
|
1638
|
+
TV: `${r}-tv`,
|
|
1639
|
+
TW: `${r}-tw`,
|
|
1640
|
+
TZ: `${r}-tz`,
|
|
1641
|
+
UA: `${r}-ua`,
|
|
1642
|
+
UG: `${r}-ug`,
|
|
1643
|
+
US: `${r}-us`,
|
|
1644
|
+
UY: `${r}-uy`,
|
|
1645
|
+
UZ: `${r}-uz`,
|
|
1646
|
+
VA: `${r}-va`,
|
|
1647
|
+
VC: `${r}-vc`,
|
|
1648
|
+
VE: `${r}-ve`,
|
|
1649
|
+
VG: `${r}-vg`,
|
|
1650
|
+
VI: `${r}-vi`,
|
|
1651
|
+
VN: `${r}-vn`,
|
|
1652
|
+
VU: `${r}-vu`,
|
|
1653
|
+
WF: `${r}-wf`,
|
|
1654
|
+
WS: `${r}-ws`,
|
|
1655
|
+
YE: `${r}-ye`,
|
|
1656
|
+
YT: `${r}-yt`,
|
|
1657
|
+
ZA: `${r}-za`,
|
|
1658
|
+
ZM: `${r}-zm`,
|
|
1659
|
+
ZW: `${r}-zw`
|
|
1660
|
+
};
|
|
1661
|
+
/**
|
|
1662
|
+
* Returns information about the country and its flag.
|
|
1663
|
+
*
|
|
1664
|
+
* Возвращает информацию о стране и её флаге.
|
|
1665
|
+
* @param code country code/ код страны
|
|
1666
|
+
*/
|
|
1667
|
+
get(t = this.code) {
|
|
1668
|
+
const e = y.find(t);
|
|
1669
|
+
if (e) {
|
|
1670
|
+
const s = this.getCountry(e);
|
|
1671
|
+
return {
|
|
1672
|
+
language: this.getLanguage(e),
|
|
1673
|
+
country: s,
|
|
1674
|
+
standard: e.standard,
|
|
1675
|
+
icon: E.flags?.[e.country],
|
|
1676
|
+
label: s,
|
|
1677
|
+
value: e.country
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Getting a link to the flag.
|
|
1683
|
+
*
|
|
1684
|
+
* Получение ссылки на флаг.
|
|
1685
|
+
* @param code country code/ код страны
|
|
1686
|
+
*/
|
|
1687
|
+
getFlag(t = this.code) {
|
|
1688
|
+
return this.get(t)?.icon;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Getting a list of countries by an array of codes.
|
|
1692
|
+
*
|
|
1693
|
+
* Получение списка стран по массиву с кодами.
|
|
1694
|
+
* @param codes country code/ код страны
|
|
1695
|
+
*/
|
|
1696
|
+
getList(t) {
|
|
1697
|
+
return f(this.getCodes(t), (e) => this.get(e));
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Getting a list of countries by an array of codes in national language.
|
|
1701
|
+
*
|
|
1702
|
+
* Получение списка стран по массиву с кодами на национальный язык.
|
|
1703
|
+
* @param codes country code/ код страны.
|
|
1704
|
+
*/
|
|
1705
|
+
getNational(t) {
|
|
1706
|
+
return f(this.getList(t), (e) => {
|
|
1707
|
+
const s = new E(e.standard).get(e.standard);
|
|
1708
|
+
return {
|
|
1709
|
+
...e,
|
|
1710
|
+
description: s?.country,
|
|
1711
|
+
nationalLanguage: s?.language,
|
|
1712
|
+
nationalCountry: s?.country
|
|
1713
|
+
};
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* To change the location.
|
|
1718
|
+
*
|
|
1719
|
+
* Изменить местоположение.
|
|
1720
|
+
* @param code country and language code/ код страны и языка
|
|
1721
|
+
*/
|
|
1722
|
+
setCode(t) {
|
|
1723
|
+
return this.code = t, this;
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Returns a special object for formatting.
|
|
1727
|
+
*
|
|
1728
|
+
* Возвращает специальный объект для работы с форматированием.
|
|
1729
|
+
*/
|
|
1730
|
+
getLocation() {
|
|
1731
|
+
return new N(this.code);
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Returns a list of countries to retrieve data from.
|
|
1735
|
+
*
|
|
1736
|
+
* Возвращает список стран для получения данных.
|
|
1737
|
+
* @param codes country code/ код страны
|
|
1738
|
+
*/
|
|
1739
|
+
getCodes(t) {
|
|
1740
|
+
return t ?? Object.keys(E.flags);
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Getting the name of the language.
|
|
1744
|
+
*
|
|
1745
|
+
* Получение названия языка.
|
|
1746
|
+
* @param data object with information of data/ объект с информацией данных
|
|
1747
|
+
*/
|
|
1748
|
+
getLanguage(t) {
|
|
1749
|
+
return this.getLocation().languageName(t.language);
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Getting the name of the country.
|
|
1753
|
+
*
|
|
1754
|
+
* Получение названия страны.
|
|
1755
|
+
* @param data object with information of data/ объект с информацией данных
|
|
1756
|
+
*/
|
|
1757
|
+
getCountry(t) {
|
|
1758
|
+
return this.getLocation().countryName(t.country);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
const A = class A {
|
|
1762
|
+
/**
|
|
1763
|
+
* Getting an object with information about the phone code and country.
|
|
1764
|
+
*
|
|
1765
|
+
* Получение объекта с информацией о телефонном коде и стране.
|
|
1766
|
+
* @param code country and language code/ код страны и языка
|
|
1767
|
+
*/
|
|
1768
|
+
static get(t) {
|
|
1769
|
+
return this.list.find((e) => t === e.value);
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Getting information by phone.
|
|
1773
|
+
*
|
|
1774
|
+
* Получение информации по телефону.
|
|
1775
|
+
* @param phone phone number/ номер телефон
|
|
1776
|
+
*/
|
|
1777
|
+
static getByPhone(t) {
|
|
1778
|
+
let e = this.map, s, n = "";
|
|
1779
|
+
return this.toNumber(t).forEach((a) => {
|
|
1780
|
+
n === "" && a in e ? (s = e[a], e = s?.next ?? {}) : n += a;
|
|
1781
|
+
}), {
|
|
1782
|
+
item: s,
|
|
1783
|
+
phone: n
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Retrieves complete mask data by country code.
|
|
1788
|
+
*
|
|
1789
|
+
* Получает полные данные о маске по коду страны.
|
|
1790
|
+
* @param code country and language code/ код страны и языка
|
|
1791
|
+
*/
|
|
1792
|
+
static getByCode(t) {
|
|
1793
|
+
const e = this.get(t);
|
|
1794
|
+
if (e)
|
|
1795
|
+
return this.getByPhone(e.phone.toString())?.item;
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* We get an array from a list of all phone numbers.
|
|
1799
|
+
*
|
|
1800
|
+
* Получаем массив из списка всех телефонных кодов.
|
|
1801
|
+
*/
|
|
1802
|
+
static getList() {
|
|
1803
|
+
return this.list;
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* We get a map of a tree, sorted by its code.
|
|
1807
|
+
*
|
|
1808
|
+
* Получаем карту дерева, отсортированную по его коду.
|
|
1809
|
+
*/
|
|
1810
|
+
static getMap() {
|
|
1811
|
+
return this.map;
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Convert to phone mask.
|
|
1815
|
+
*
|
|
1816
|
+
* Преобразовать в маску телефона.
|
|
1817
|
+
* @param phone phone number/ номер телефон
|
|
1818
|
+
* @param masks a mask to transform a phone number/ маска для преобразования номер телефон
|
|
1819
|
+
*/
|
|
1820
|
+
static toMask(t, e) {
|
|
1821
|
+
if (O(t) && Array.isArray(e) && e.length > 0) {
|
|
1822
|
+
const s = this.removeZero(t), n = s.length;
|
|
1823
|
+
for (const a of e)
|
|
1824
|
+
if (this.getUnnecessaryLength(a) === n)
|
|
1825
|
+
return this.toStandard(s, a);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Deletes the country code from the input number.
|
|
1830
|
+
*
|
|
1831
|
+
* Удаляет код страны по входному номеру.
|
|
1832
|
+
* @param phone phone number/ номер телефон
|
|
1833
|
+
*/
|
|
1834
|
+
static removeZero(t) {
|
|
1835
|
+
return t.match(/^0/) ? t.replace(/^0/, "") : t.match(/^89/) ? t.replace(/^8/, "") : t;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Returns the symbol by the internal country code.
|
|
1839
|
+
*
|
|
1840
|
+
* Возвращает символ по коду внутри страны.
|
|
1841
|
+
* @param within internal country code/ код внутри страны
|
|
1842
|
+
*/
|
|
1843
|
+
static getWithinSymbol(t) {
|
|
1844
|
+
switch (t) {
|
|
1845
|
+
case 4:
|
|
1846
|
+
case "4":
|
|
1847
|
+
return "$";
|
|
1848
|
+
case 8:
|
|
1849
|
+
case "8":
|
|
1850
|
+
return "~";
|
|
1851
|
+
}
|
|
1852
|
+
return "=";
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Deletes all characters that do not belong to the mask.
|
|
1856
|
+
*
|
|
1857
|
+
* Удаляет все символы, не относящиеся к маске.
|
|
1858
|
+
* @param mask A mask to transform a phone number/ маска для преобразования номер телефон
|
|
1859
|
+
*/
|
|
1860
|
+
static getUnnecessaryLength(t) {
|
|
1861
|
+
return t.replace(/[^*]+/ig, "").length;
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Creating a list for the map.
|
|
1865
|
+
*
|
|
1866
|
+
* Формирование списка для карты.
|
|
1867
|
+
*/
|
|
1868
|
+
static makeList() {
|
|
1869
|
+
const t = f(y.getList(), (e) => {
|
|
1870
|
+
if (e?.phoneMask)
|
|
1871
|
+
return {
|
|
1872
|
+
phone: e?.phoneCode && Number(e.phoneCode.replace(/[^0-9]+/, "")) || void 0,
|
|
1873
|
+
within: e?.phoneWithin || 0,
|
|
1874
|
+
mask: B(e.phoneMask),
|
|
1875
|
+
value: e.country
|
|
1876
|
+
};
|
|
1877
|
+
});
|
|
1878
|
+
this.list = t.sort((e, s) => e.phone - s.phone);
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Creating a map for search.
|
|
1882
|
+
*
|
|
1883
|
+
* Создание карты для поиска.
|
|
1884
|
+
*/
|
|
1885
|
+
static makeMap() {
|
|
1886
|
+
this.list.forEach((t) => {
|
|
1887
|
+
t.mask.forEach((e) => {
|
|
1888
|
+
let s = this.map, n;
|
|
1889
|
+
if (this.toNumber(e).forEach((a) => {
|
|
1890
|
+
a in s || (s[a] = {
|
|
1891
|
+
items: [],
|
|
1892
|
+
info: void 0,
|
|
1893
|
+
value: void 0,
|
|
1894
|
+
mask: [],
|
|
1895
|
+
maskFull: [],
|
|
1896
|
+
next: {}
|
|
1897
|
+
}), n = s[a], s = n?.next ?? {};
|
|
1898
|
+
}), n) {
|
|
1899
|
+
n.value === void 0 && (n.info = t, n.value = t.value);
|
|
1900
|
+
const a = this.toWithin(e, t.within);
|
|
1901
|
+
n.mask.push(a), n.maskFull.push(a.replace(/\d/ig, "*")), n.items.push(t);
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* The method parses a string argument and returns a floating point number.
|
|
1908
|
+
*
|
|
1909
|
+
* Метод принимает строку в качестве аргумента и возвращает десятичное число.
|
|
1910
|
+
* @param value the value to parse/ текстовая строка
|
|
1911
|
+
*/
|
|
1912
|
+
static toNumber(t) {
|
|
1913
|
+
return t.replace(/\D+/ig, "").split("");
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Converts the phone to a standard.
|
|
1917
|
+
*
|
|
1918
|
+
* Преобразовывает телефон в стандарт.
|
|
1919
|
+
* @param phone phone number/ номер телефон
|
|
1920
|
+
* @param mask a mask to transform a phone number/ маска для преобразования номер телефон
|
|
1921
|
+
*/
|
|
1922
|
+
static toStandard(t, e) {
|
|
1923
|
+
let s = 0;
|
|
1924
|
+
return e.replace(/\*/ig, () => String(t[s++]));
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Replaces the first character with the internal country code
|
|
1928
|
+
*
|
|
1929
|
+
* Заменяет первый символ на код внутри страны.
|
|
1930
|
+
* @param mask a mask to transform a phone number/ маска для преобразования номер телефон
|
|
1931
|
+
* @param within internal country code/ код внутри страны
|
|
1932
|
+
*/
|
|
1933
|
+
static toWithin(t, e) {
|
|
1934
|
+
return t.replace(/\*/, this.getWithinSymbol(e));
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
k(A, "list", []), k(A, "map", {}), A.makeList(), A.makeMap();
|
|
1938
|
+
let ft = A, P;
|
|
1939
|
+
class $e {
|
|
1940
|
+
/**
|
|
1941
|
+
* Returns the value by its name.
|
|
1942
|
+
*
|
|
1943
|
+
* Возвращает значение по его имени.
|
|
1944
|
+
* @param name property name/ название свойства
|
|
1945
|
+
*/
|
|
1946
|
+
static get(t) {
|
|
1947
|
+
return P && P?.[t];
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Adds data, this method works only once.
|
|
1951
|
+
*
|
|
1952
|
+
* Добавляет данные, этот метод работает только 1 раз.
|
|
1953
|
+
* @param data global data/ глобальные данные
|
|
1954
|
+
*/
|
|
1955
|
+
static add(t) {
|
|
1956
|
+
P === void 0 && (P = { ...t });
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
const M = class M {
|
|
1960
|
+
/**
|
|
1961
|
+
* Get data from hash.
|
|
1962
|
+
*
|
|
1963
|
+
* Получение данных из хэша.
|
|
1964
|
+
* @param name variable names/ названия переменных
|
|
1965
|
+
* @param defaultValue value or function to change data/ значение или функция для изменения данных
|
|
1966
|
+
*/
|
|
1967
|
+
static get(t, e) {
|
|
1968
|
+
return !(t in this.hash) && e && this.set(t, e), this.hash[t];
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Change data in hash.
|
|
1972
|
+
*
|
|
1973
|
+
* Изменение данных в хэше.
|
|
1974
|
+
* @param name variable names/ названия переменных
|
|
1975
|
+
* @param callback value or function to change data/ значение или функция для изменения данных
|
|
1976
|
+
*/
|
|
1977
|
+
static set(t, e) {
|
|
1978
|
+
const s = I(e);
|
|
1979
|
+
s !== this.hash?.[t] && (this.hash[t] = s, this.update());
|
|
1980
|
+
}
|
|
1981
|
+
/**
|
|
1982
|
+
* Adding an event when data is changed.
|
|
1983
|
+
*
|
|
1984
|
+
* Добавление события при изменении данных.
|
|
1985
|
+
* @param name variable names/ названия переменных
|
|
1986
|
+
* @param callback the function is called when the data is changed/ функция вызывается при изменении данных
|
|
1987
|
+
*/
|
|
1988
|
+
static addWatch(t, e) {
|
|
1989
|
+
t in this.watch ? this.watch[t]?.push(e) : this.watch[t] = [e];
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Update hash variable from URL string.
|
|
1993
|
+
*
|
|
1994
|
+
* Обновление переменной хэша из строки URL.
|
|
1995
|
+
*/
|
|
1996
|
+
static reload() {
|
|
1997
|
+
if (!this.block) {
|
|
1998
|
+
const t = this.getLocation();
|
|
1999
|
+
this.makeWatch(t), this.hash = t;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Obtaining data from the URL string.
|
|
2004
|
+
*
|
|
2005
|
+
* Получение данных из строки URL.
|
|
2006
|
+
*/
|
|
2007
|
+
static getLocation() {
|
|
2008
|
+
const t = {};
|
|
2009
|
+
return location.hash.replace(
|
|
2010
|
+
/([\w-]+)[:=]([^;]+)/ig,
|
|
2011
|
+
(...e) => (t[String(e[1])] = $t(e[2]), "")
|
|
2012
|
+
), t;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Update hash string in URL.
|
|
2016
|
+
*
|
|
2017
|
+
* Обновление строки хэша в URL.
|
|
2018
|
+
*/
|
|
2019
|
+
static update() {
|
|
2020
|
+
this.block = !0, history.replaceState(null, "", `#${Tt(this.hash, "=", ";")}`), requestAnimationFrame(() => {
|
|
2021
|
+
this.block = !1;
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Calling all functions whose data has changed.
|
|
2026
|
+
*
|
|
2027
|
+
* Вызов всех функций, у которых были изменены данные.
|
|
2028
|
+
* @param location fresh data/ свежий данные
|
|
2029
|
+
*/
|
|
2030
|
+
static makeWatch(t) {
|
|
2031
|
+
f(this.watch, (e, s) => {
|
|
2032
|
+
this.hash?.[s] !== t?.[s] && e.forEach((n) => n(t[s]));
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
k(M, "hash", {}), k(M, "watch", {}), k(M, "block", !1), d() && (M.reload(), addEventListener("hashchange", () => M.reload()));
|
|
2037
|
+
let R = M;
|
|
2038
|
+
function Yt(i, t, e) {
|
|
2039
|
+
return K(i)?.[t] ?? e;
|
|
2040
|
+
}
|
|
2041
|
+
function Kt(i, t, e) {
|
|
2042
|
+
const s = K(i);
|
|
2043
|
+
if (s) {
|
|
2044
|
+
const n = Yt(s, t);
|
|
2045
|
+
if (m(n) && m(e))
|
|
2046
|
+
f(e, (a, o) => {
|
|
2047
|
+
n[o] = I(a);
|
|
2048
|
+
});
|
|
2049
|
+
else {
|
|
2050
|
+
const a = I(e);
|
|
2051
|
+
!(t in s) && typeof a == "string" ? s.setAttribute(t.toString(), a) : s[t] = I(e);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
return s;
|
|
2055
|
+
}
|
|
2056
|
+
function dt(i, t = "div", e, s) {
|
|
2057
|
+
if (!d())
|
|
2058
|
+
return;
|
|
2059
|
+
const n = document.createElement(t);
|
|
2060
|
+
return typeof e == "function" ? e(n) : C(e) && f(e, (a, o) => {
|
|
2061
|
+
Kt(n, o, a);
|
|
2062
|
+
}), i?.insertBefore(n, s ?? null), n;
|
|
2063
|
+
}
|
|
2064
|
+
class vt {
|
|
2065
|
+
static storage = new Y("scrollbar", !0);
|
|
2066
|
+
static calculate = !1;
|
|
2067
|
+
/**
|
|
2068
|
+
* Checks whether to enable scroll hiding.
|
|
2069
|
+
*
|
|
2070
|
+
* Проверяет, надо ли включить скрытие скролла.
|
|
2071
|
+
*/
|
|
2072
|
+
static async is() {
|
|
2073
|
+
const t = await this.get();
|
|
2074
|
+
return t !== -1 && t <= 8;
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Returns the width of the scroll.
|
|
2078
|
+
*
|
|
2079
|
+
* Возвращает ширину скролла.
|
|
2080
|
+
*/
|
|
2081
|
+
static async get() {
|
|
2082
|
+
const t = this.storage.get() ?? -1;
|
|
2083
|
+
if (!this.calculate && t === -1) {
|
|
2084
|
+
const e = await this.init();
|
|
2085
|
+
return this.storage.set(e), e;
|
|
2086
|
+
}
|
|
2087
|
+
return t;
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Creates elements to check the width of the scroll.
|
|
2091
|
+
*
|
|
2092
|
+
* Создает элементы для проверки ширины скролла.
|
|
2093
|
+
*/
|
|
2094
|
+
static createElement() {
|
|
2095
|
+
return dt(document.body, "div", (t) => {
|
|
2096
|
+
t.style.height = "24px", t.style.overflowY = "scroll", t.style.position = "fixed", t.style.width = "100%", dt(t, "div", (e) => {
|
|
2097
|
+
e.style.height = "100px";
|
|
2098
|
+
});
|
|
2099
|
+
});
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Initialization of data to check the width of the scroll.
|
|
2103
|
+
*
|
|
2104
|
+
* Инициализация данных для проверки ширины скролла.
|
|
2105
|
+
*/
|
|
2106
|
+
static init() {
|
|
2107
|
+
return new Promise((t) => {
|
|
2108
|
+
this.calculate = !0;
|
|
2109
|
+
const e = this.createElement();
|
|
2110
|
+
e ? requestAnimationFrame(() => {
|
|
2111
|
+
t(e.offsetWidth - e.clientWidth), e.remove(), this.calculate = !1;
|
|
2112
|
+
}) : t(0);
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
const Vt = [
|
|
2117
|
+
"d",
|
|
2118
|
+
"e",
|
|
2119
|
+
"f",
|
|
2120
|
+
"g",
|
|
2121
|
+
"h",
|
|
2122
|
+
"i",
|
|
2123
|
+
"j",
|
|
2124
|
+
"k",
|
|
2125
|
+
"l",
|
|
2126
|
+
"m",
|
|
2127
|
+
"n",
|
|
2128
|
+
"o",
|
|
2129
|
+
"p",
|
|
2130
|
+
"q",
|
|
2131
|
+
"r",
|
|
2132
|
+
"s",
|
|
2133
|
+
"t",
|
|
2134
|
+
"u",
|
|
2135
|
+
"v"
|
|
2136
|
+
], qt = (i, t = {}) => {
|
|
2137
|
+
let e = String(i);
|
|
2138
|
+
if (i.match(/%[a-z]/)) {
|
|
2139
|
+
let s = 0;
|
|
2140
|
+
f(t, (n) => {
|
|
2141
|
+
e = e.replace(new RegExp(`%${Vt[s++]}`, "g"), String(n));
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
return C(t) && f(t, (s, n) => {
|
|
2145
|
+
e = e.replace(
|
|
2146
|
+
new RegExp(`\\[${n}\\](.*?)\\[/${n}\\]`, "g"),
|
|
2147
|
+
(a, o) => String(s).replace(/\[content]/g, o)
|
|
2148
|
+
).replace(new RegExp(`\\[${n}\\]`, "g"), String(s));
|
|
2149
|
+
}), e;
|
|
2150
|
+
};
|
|
2151
|
+
class z {
|
|
2152
|
+
static url = "/api/translate";
|
|
2153
|
+
static propsName = "list";
|
|
2154
|
+
static data = {};
|
|
2155
|
+
static cache = [];
|
|
2156
|
+
static resolveList = [];
|
|
2157
|
+
static timeout;
|
|
2158
|
+
/**
|
|
2159
|
+
* Getting the translation text by its code.
|
|
2160
|
+
*
|
|
2161
|
+
* Получение текста перевода по его коду.
|
|
2162
|
+
* @param name code name/ название кода
|
|
2163
|
+
* @param replacement If set, replaces the text with the specified values/ если установлено, заменяет текст на указанные значения
|
|
2164
|
+
*/
|
|
2165
|
+
static async get(t, e) {
|
|
2166
|
+
const s = this.getName(t);
|
|
2167
|
+
return s in this.data ? this.replacement(this.data[s], e) : (j.isLocalhost() || await this.add(t), this.replacement(this.data?.[s] ?? t));
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Getting the translation text by its code (Sync).
|
|
2171
|
+
*
|
|
2172
|
+
* Получение текста перевода по его коду (Sync).
|
|
2173
|
+
* @param name code name/ название кода
|
|
2174
|
+
* @param first If set to false, returns an empty string if there is no text/
|
|
2175
|
+
* если установлено false, возвращает пустую строку, если нет текста
|
|
2176
|
+
* @param replacement If set, replaces the text with the specified values/
|
|
2177
|
+
* если установлено, заменяет текст на указанные значения
|
|
2178
|
+
*/
|
|
2179
|
+
static getSync(t, e = !1, s) {
|
|
2180
|
+
const n = this.getName(t);
|
|
2181
|
+
return n in this.data ? this.replacement(String(this.data[n]), s) : e ? " " : t;
|
|
2182
|
+
}
|
|
2183
|
+
/**
|
|
2184
|
+
* Getting a list of translations by an array of text codes.
|
|
2185
|
+
*
|
|
2186
|
+
* Получение списка переводов по массиву кодов текста.
|
|
2187
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
2188
|
+
*/
|
|
2189
|
+
static getList(t) {
|
|
2190
|
+
return new Promise((e) => {
|
|
2191
|
+
const s = {};
|
|
2192
|
+
let n = 0;
|
|
2193
|
+
for (const a of t) {
|
|
2194
|
+
const o = Array.isArray(a) ? a[0] : a, u = Array.isArray(a) ? a.slice(1) : void 0;
|
|
2195
|
+
this.get(o, u).then((h) => {
|
|
2196
|
+
s[o] = h, ++n >= t.length && e(s);
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Getting a list of translations by an array of text codes.
|
|
2203
|
+
*
|
|
2204
|
+
* Получение списка переводов по массиву кодов текста.
|
|
2205
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
2206
|
+
* @param first If set to false, returns an empty string if there is no text/
|
|
2207
|
+
* если установлено false, возвращает пустую строку, если нет текста
|
|
2208
|
+
*/
|
|
2209
|
+
static getListSync(t, e = !1) {
|
|
2210
|
+
const s = {};
|
|
2211
|
+
for (const n of t) {
|
|
2212
|
+
const a = Array.isArray(n) ? n[0] : n, o = Array.isArray(n) ? n.slice(1) : void 0;
|
|
2213
|
+
s[a] = this.getSync(a, e, o);
|
|
2214
|
+
}
|
|
2215
|
+
return s;
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Added a list of translated texts.
|
|
2219
|
+
*
|
|
2220
|
+
* Добавлен список переведенных текстов.
|
|
2221
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
2222
|
+
*/
|
|
2223
|
+
static add(t) {
|
|
2224
|
+
return new Promise((e) => {
|
|
2225
|
+
this.getNamesNone(t).length > 0 ? (this.cache.push(...this.getNamesNone(t)), this.resolveList.push(e), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(() => {
|
|
2226
|
+
this.timeout = void 0, this.make().then(() => {
|
|
2227
|
+
this.resolveList.forEach((n) => n()), this.resolveList = [];
|
|
2228
|
+
});
|
|
2229
|
+
}, 160)) : e();
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
/**
|
|
2233
|
+
* Adds texts in sync mode.
|
|
2234
|
+
*
|
|
2235
|
+
* Добавляет тексты в режиме синхронизации.
|
|
2236
|
+
* @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
|
|
2237
|
+
*/
|
|
2238
|
+
static addSync(t) {
|
|
2239
|
+
f(t, (e, s) => {
|
|
2240
|
+
nt(e) && O(e) && (this.data[this.getName(s)] = e);
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
/**
|
|
2244
|
+
* Adding data in the form of a query or directly, depending on the execution environment.
|
|
2245
|
+
*
|
|
2246
|
+
* Добавление данных в виде запроса или напрямую, в зависимости от среды выполнения.
|
|
2247
|
+
* @param data list of texts in the form of key-value/ список текстов в виде ключ-значение
|
|
2248
|
+
*/
|
|
2249
|
+
static async addNormalOrSync(t) {
|
|
2250
|
+
if (O(t))
|
|
2251
|
+
if (j.isLocalhost())
|
|
2252
|
+
this.addSync(t);
|
|
2253
|
+
else {
|
|
2254
|
+
const e = Object.keys(t);
|
|
2255
|
+
e.length > 0 && await this.add(e);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Change the path to the script for obtaining the translation.
|
|
2260
|
+
*
|
|
2261
|
+
* Изменить путь к скрипту для получения перевода.
|
|
2262
|
+
* @param url path to the script/ путь к скрипту
|
|
2263
|
+
*/
|
|
2264
|
+
static setUrl(t) {
|
|
2265
|
+
return this.url = t, z;
|
|
2266
|
+
}
|
|
2267
|
+
static setPropsName(t) {
|
|
2268
|
+
return this.propsName = t, this;
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Getting the full title for translation.
|
|
2272
|
+
*
|
|
2273
|
+
* Получение полного названия для перевода.
|
|
2274
|
+
* @param name code name/ название кода
|
|
2275
|
+
*/
|
|
2276
|
+
static getName(t) {
|
|
2277
|
+
return `${y.getLocation()}-${t}`;
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Returns a list of names that are not yet in the list.
|
|
2281
|
+
*
|
|
2282
|
+
* Возвращает список имен, которых еще нет в списке.
|
|
2283
|
+
* @param names list of codes to get translations/ список кодов для получения переводов
|
|
2284
|
+
*/
|
|
2285
|
+
static getNamesNone(t) {
|
|
2286
|
+
const e = [];
|
|
2287
|
+
return B(t).forEach((s) => {
|
|
2288
|
+
s !== "__TRANSLATE_START__" && s !== "__TRANSLATE_END__" && !(this.getName(s) in this.data) && e.push(s);
|
|
2289
|
+
}), e;
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Getting the list of translations from the server.
|
|
2293
|
+
*
|
|
2294
|
+
* Получение списка переводов с сервера.
|
|
2295
|
+
*/
|
|
2296
|
+
static async getResponse() {
|
|
2297
|
+
return await j.get({
|
|
2298
|
+
api: !1,
|
|
2299
|
+
path: this.url,
|
|
2300
|
+
request: {
|
|
2301
|
+
[this.propsName]: this.cache
|
|
2302
|
+
},
|
|
2303
|
+
toData: !0,
|
|
2304
|
+
global: !0
|
|
2305
|
+
}) ?? {};
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Replaces the text with the specified values.
|
|
2309
|
+
*
|
|
2310
|
+
* Заменяет текст на указанные значения.
|
|
2311
|
+
* @param text text to replace/ текст для замены
|
|
2312
|
+
* @param replacement values for replacement/ значения для замены
|
|
2313
|
+
*/
|
|
2314
|
+
static replacement(t, e) {
|
|
2315
|
+
return e ? qt(t, e) : t;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* Adding translation data from the server.
|
|
2319
|
+
*
|
|
2320
|
+
* Добавление данных по переводу с сервера.
|
|
2321
|
+
*/
|
|
2322
|
+
static async make() {
|
|
2323
|
+
const t = await this.getResponse();
|
|
2324
|
+
this.cache.forEach((e) => {
|
|
2325
|
+
this.data[this.getName(e)] = t?.[e] ?? "";
|
|
2326
|
+
}), this.cache = [];
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
function ct(i) {
|
|
2330
|
+
return Array.isArray(i);
|
|
2331
|
+
}
|
|
2332
|
+
class Jt {
|
|
2333
|
+
/**
|
|
2334
|
+
* Constructor
|
|
2335
|
+
* @param props base data/ базовые данные
|
|
2336
|
+
* @param watch data for tracking/ данные для слежения
|
|
2337
|
+
*/
|
|
2338
|
+
constructor(t, e = Object.keys(t)) {
|
|
2339
|
+
this.props = t, this.watch = e;
|
|
2340
|
+
}
|
|
2341
|
+
cache = {};
|
|
2342
|
+
/**
|
|
2343
|
+
* Checks if the value has been updated.
|
|
2344
|
+
*
|
|
2345
|
+
* Проверяет, обновлено ли значение.
|
|
2346
|
+
* @param name property name/ название свойства
|
|
2347
|
+
*/
|
|
2348
|
+
is(t) {
|
|
2349
|
+
return ct(t) ? !!t.find((e) => this.isDifferent(e)) : this.isDifferent(t);
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Checks if there are changes in the data.
|
|
2353
|
+
*
|
|
2354
|
+
* Проверяет, есть ли изменения в данных.
|
|
2355
|
+
*/
|
|
2356
|
+
isChanged() {
|
|
2357
|
+
const t = this.props;
|
|
2358
|
+
return !!this.watch.find((e) => e in t && this.isDifferent(e));
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Updates all values.
|
|
2362
|
+
*
|
|
2363
|
+
* Обновляет все значения.
|
|
2364
|
+
*/
|
|
2365
|
+
update() {
|
|
2366
|
+
const t = this.props;
|
|
2367
|
+
this.watch.forEach((e) => {
|
|
2368
|
+
e in t && this.isDifferent(e) && (this.cache[e] = t[e]);
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Checking additional data.
|
|
2373
|
+
*
|
|
2374
|
+
* Проверка дополнительных данных.
|
|
2375
|
+
* @param name property name/ название свойства
|
|
2376
|
+
*/
|
|
2377
|
+
isDifferent(t) {
|
|
2378
|
+
return this.cache?.[t] !== this.props?.[t];
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
class _t {
|
|
2382
|
+
/**
|
|
2383
|
+
* Constructor
|
|
2384
|
+
* @param props base data/ базовые данные
|
|
2385
|
+
* @param callback callback function when the value changes/
|
|
2386
|
+
* функция обратного вызова при изменении значения
|
|
2387
|
+
* @param changed base data/ данный для слежения
|
|
2388
|
+
*/
|
|
2389
|
+
constructor(t, e, s) {
|
|
2390
|
+
this.props = t, this.callback = e, this.changed = new Jt(t, s);
|
|
2391
|
+
}
|
|
2392
|
+
event = {};
|
|
2393
|
+
changed;
|
|
2394
|
+
/**
|
|
2395
|
+
* Calls the callback function.
|
|
2396
|
+
*
|
|
2397
|
+
* Вызывает функцию обратного вызова.
|
|
2398
|
+
* @param compelled forces data to update/ вынуждает обновлять данные
|
|
2399
|
+
*/
|
|
2400
|
+
make(t) {
|
|
2401
|
+
return this.makeCallback(t), this;
|
|
2402
|
+
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Checks if there are values in the property.
|
|
2405
|
+
*
|
|
2406
|
+
* Проверяет, есть ли значения в свойстве.
|
|
2407
|
+
* @param name property names/ названия свойств
|
|
2408
|
+
*/
|
|
2409
|
+
is(t) {
|
|
2410
|
+
return t in this.props;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Checks if the value has been changed by the property name.
|
|
2414
|
+
*
|
|
2415
|
+
* Проверяет, было ли изменено значение по названию свойства.
|
|
2416
|
+
* @param name property names/ названия свойств
|
|
2417
|
+
* @param nameProp names of properties of the input variable/ названия свойств входной переменной
|
|
2418
|
+
*/
|
|
2419
|
+
isChanged(t, e) {
|
|
2420
|
+
return !(t in this.event) || this.changed.is(e || t);
|
|
2421
|
+
}
|
|
2422
|
+
/**
|
|
2423
|
+
* Calls the callback function.
|
|
2424
|
+
*
|
|
2425
|
+
* Вызывает функцию обратного вызова.
|
|
2426
|
+
* @param compelled forces data to update/ вынуждает обновлять данные
|
|
2427
|
+
*/
|
|
2428
|
+
makeCallback(t = !1) {
|
|
2429
|
+
(t || this.changed.isChanged()) && (this.initEvent(), this.makeCallbackItem(), this.changed.update());
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* The function calls an image call.
|
|
2433
|
+
*
|
|
2434
|
+
* Функция вызывает образный вызов.
|
|
2435
|
+
*/
|
|
2436
|
+
makeCallbackItem() {
|
|
2437
|
+
this.callback && this.callback(this.event);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
class ve extends _t {
|
|
2441
|
+
/**
|
|
2442
|
+
* Calls the callback function.
|
|
2443
|
+
*
|
|
2444
|
+
* Вызывает функцию обратного вызова.
|
|
2445
|
+
* @param compelled forces data to update/ вынуждает обновлять данные
|
|
2446
|
+
*/
|
|
2447
|
+
make(t) {
|
|
2448
|
+
return this.makeCallback(t).then(), this;
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Calls the callback function.
|
|
2452
|
+
*
|
|
2453
|
+
* Вызывает функцию обратного вызова.
|
|
2454
|
+
* @param compelled forces data to update/ вынуждает обновлять данные
|
|
2455
|
+
*/
|
|
2456
|
+
async makeCallback(t) {
|
|
2457
|
+
(t || this.changed.isChanged()) && (await this.initEvent(), this.makeCallbackItem(), this.changed.update());
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
function Qt(i) {
|
|
2461
|
+
return i && "class" in i && typeof i.class == "string" ? i.class : void 0;
|
|
2462
|
+
}
|
|
2463
|
+
function Xt(i, t, e) {
|
|
2464
|
+
const s = Qt(t);
|
|
2465
|
+
return e && s ? `${e}.${s}` : e || s || i;
|
|
2466
|
+
}
|
|
2467
|
+
function te(i, t, e, s) {
|
|
2468
|
+
const n = Xt(i, t, s);
|
|
2469
|
+
return Ft(i, { key: n, ...t }, e);
|
|
2470
|
+
}
|
|
2471
|
+
function rt(i, t) {
|
|
2472
|
+
const e = i?.class, s = t?.class, n = i?.style, a = t?.style, o = {
|
|
2473
|
+
...i,
|
|
2474
|
+
...t
|
|
2475
|
+
};
|
|
2476
|
+
return e && s && (o.class = [], e && o.class.push(e), s && o.class.push(s)), n && a && (o.style = [], n && o.style.push(n), a && o.style.push(a)), o;
|
|
2477
|
+
}
|
|
2478
|
+
function ee(...i) {
|
|
2479
|
+
let t = {};
|
|
2480
|
+
return i.forEach((e) => {
|
|
2481
|
+
e && (t = rt(t, e));
|
|
2482
|
+
}), t;
|
|
2483
|
+
}
|
|
2484
|
+
class bt {
|
|
2485
|
+
/**
|
|
2486
|
+
* Constructor
|
|
2487
|
+
* @param components list of connected components/ список подключенных компонентов
|
|
2488
|
+
* @param modification data for modification/ данные для модификации
|
|
2489
|
+
*/
|
|
2490
|
+
constructor(t = {}, e) {
|
|
2491
|
+
this.components = t, this.modification = e;
|
|
2492
|
+
}
|
|
2493
|
+
/** Cache for computed properties/ Кэш для вычисляемых свойств */
|
|
2494
|
+
caching = {};
|
|
2495
|
+
/**
|
|
2496
|
+
* Check the presence of the component.
|
|
2497
|
+
*
|
|
2498
|
+
* Проверить наличие компонента.
|
|
2499
|
+
* @param name name of the component/ названия компонента
|
|
2500
|
+
*/
|
|
2501
|
+
is(t) {
|
|
2502
|
+
return t in this.components;
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* Getting the object of the component.
|
|
2506
|
+
*
|
|
2507
|
+
* Получение объекта компонента.
|
|
2508
|
+
* @param name name of the component/ названия компонента
|
|
2509
|
+
*/
|
|
2510
|
+
get(t) {
|
|
2511
|
+
return this.components?.[t];
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
* Returns the modified input data of the connected components.
|
|
2515
|
+
*
|
|
2516
|
+
* Возвращает модифицированные входные данные у подключенных компонентов.
|
|
2517
|
+
* @param index the name of this/ название данного
|
|
2518
|
+
* @param props basic data/ базовые данные
|
|
2519
|
+
*/
|
|
2520
|
+
getModification(t, e) {
|
|
2521
|
+
if (t) {
|
|
2522
|
+
t in this.caching || (this.caching[t] = c(() => this.computeModification(t)));
|
|
2523
|
+
const s = this.caching[t];
|
|
2524
|
+
if (s)
|
|
2525
|
+
return e ? ee(s.value, e) : s.value;
|
|
2526
|
+
}
|
|
2527
|
+
return e;
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* Rendering a component by its name and returning an array with one component.
|
|
2531
|
+
*
|
|
2532
|
+
* Рендеринг компонента по его имени и возвращение массива с одним компонентом.
|
|
2533
|
+
* @param name name of the component/ названия компонента
|
|
2534
|
+
* @param props property of the component/ свойство компонента
|
|
2535
|
+
* @param children sub-elements of the component/ под элементы компонента
|
|
2536
|
+
* @param index the name of the key/ названия ключа
|
|
2537
|
+
*/
|
|
2538
|
+
render(t, e, s, n) {
|
|
2539
|
+
const a = this.renderOne(
|
|
2540
|
+
t,
|
|
2541
|
+
e,
|
|
2542
|
+
s,
|
|
2543
|
+
n
|
|
2544
|
+
);
|
|
2545
|
+
return a ? [a] : [];
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Rendering a component by its name.
|
|
2549
|
+
*
|
|
2550
|
+
* Рендеринг компонента по его имени.
|
|
2551
|
+
* @param name name of the component/ названия компонента
|
|
2552
|
+
* @param props property of the component/ свойство компонента
|
|
2553
|
+
* @param children sub-elements of the component/ под элементы компонента
|
|
2554
|
+
* @param index the name of the key/ названия ключа
|
|
2555
|
+
*/
|
|
2556
|
+
renderOne(t, e, s, n) {
|
|
2557
|
+
if (this.is(t)) {
|
|
2558
|
+
const a = n ?? t;
|
|
2559
|
+
return te(
|
|
2560
|
+
this.get(t),
|
|
2561
|
+
this.getModification(a, e),
|
|
2562
|
+
s,
|
|
2563
|
+
a
|
|
2564
|
+
);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Rendering the component by its name.
|
|
2569
|
+
*
|
|
2570
|
+
* Рендеринг компонента по его имени.
|
|
2571
|
+
* @param item an array to which the rendered object will be added/
|
|
2572
|
+
* массив, по которому будет добавлять объект
|
|
2573
|
+
* @param name name of the component/ названия компонента
|
|
2574
|
+
* @param props property of the component/ свойство компонента
|
|
2575
|
+
* @param children sub-elements of the component/ под элементы компонента
|
|
2576
|
+
* @param index the name of the key/ названия ключа
|
|
2577
|
+
*/
|
|
2578
|
+
renderAdd(t, e, s, n, a) {
|
|
2579
|
+
return t.push(...this.render(e, s, n, a)), this;
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Calculates modified input data for connected components.
|
|
2583
|
+
*
|
|
2584
|
+
* Вычисляет модифицированные входные данные для подключенных компонентов.
|
|
2585
|
+
* @param index the name of this/ название данного
|
|
2586
|
+
*/
|
|
2587
|
+
computeModification(t) {
|
|
2588
|
+
const e = g(this.modification?.[t]);
|
|
2589
|
+
if (e && C(e)) {
|
|
2590
|
+
const s = {};
|
|
2591
|
+
return f(e, (n, a) => {
|
|
2592
|
+
s[a] = g(n);
|
|
2593
|
+
}), s;
|
|
2594
|
+
}
|
|
2595
|
+
return {};
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
class be extends bt {
|
|
2599
|
+
}
|
|
2600
|
+
function St(i) {
|
|
2601
|
+
return i.toString().trim().replace(/[^\w- ]+/g, "").replace(/ +/g, "-").replace(new RegExp("(?<=[A-Z])([A-Z])", "g"), (t) => `${t.toLowerCase()}`).replace(/-+([a-zA-Z0-9])/g, (...t) => `${String(t[1]).toUpperCase()}`).replace(/^([A-Z])/, (t) => `${t.toLowerCase()}`);
|
|
2602
|
+
}
|
|
2603
|
+
class Se {
|
|
2604
|
+
/**
|
|
2605
|
+
* Constructor
|
|
2606
|
+
* @param name class name/ название класса
|
|
2607
|
+
* @param props properties/ свойства
|
|
2608
|
+
* @param options list of additional parameters/ список дополнительных параметров
|
|
2609
|
+
*/
|
|
2610
|
+
constructor(t, e, s) {
|
|
2611
|
+
this.props = e, this.options = s, this.name = this.initName(t), this.refs = this.props ? xt(this.props) : {}, this.components = new bt(s?.components, s?.compMod), this.emits = s?.emits, this.classes = c(() => this.updateClasses()), this.styles = c(() => this.updateStyles()), this.attrs = Et(), this.slots = Rt();
|
|
2612
|
+
}
|
|
2613
|
+
name;
|
|
2614
|
+
element = $();
|
|
2615
|
+
refs;
|
|
2616
|
+
components;
|
|
2617
|
+
emits;
|
|
2618
|
+
classes;
|
|
2619
|
+
classesSub;
|
|
2620
|
+
styles;
|
|
2621
|
+
stylesSub;
|
|
2622
|
+
attrs;
|
|
2623
|
+
slots;
|
|
2624
|
+
dataExpose;
|
|
2625
|
+
init() {
|
|
2626
|
+
return this.classesSub = c(() => this.initClasses()), this.stylesSub = c(() => this.initStyles()), this.dataExpose = this.initExpose(), this;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Getting the class name.
|
|
2630
|
+
*
|
|
2631
|
+
* Получение названия класса.
|
|
2632
|
+
*/
|
|
2633
|
+
getName() {
|
|
2634
|
+
return this.name.join("-");
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Getting the class name.
|
|
2638
|
+
*
|
|
2639
|
+
* Получение названия дизайна.
|
|
2640
|
+
*/
|
|
2641
|
+
getDesign() {
|
|
2642
|
+
return String(this.name[0]);
|
|
2643
|
+
}
|
|
2644
|
+
/**
|
|
2645
|
+
* Getting the class name.
|
|
2646
|
+
*
|
|
2647
|
+
* Получение названия класса.
|
|
2648
|
+
* @param name list of class names by levels/ список названий классов по уровням
|
|
2649
|
+
*/
|
|
2650
|
+
getSubClass(t) {
|
|
2651
|
+
return `${this.getName()}__${B(t).join("__")}`;
|
|
2652
|
+
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Getting the class name for the status.
|
|
2655
|
+
*
|
|
2656
|
+
* Получение названия класса для статуса.
|
|
2657
|
+
* @param name list of class names by levels/ список названий классов по уровням
|
|
2658
|
+
*/
|
|
2659
|
+
getStatusClass(t) {
|
|
2660
|
+
return `${this.getName()}--${B(t).join("--")}`;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Getting the property name for the style.
|
|
2664
|
+
*
|
|
2665
|
+
* Получение названия свойства для стиля.
|
|
2666
|
+
* @param name list of class names by levels/ список названий классов по уровням
|
|
2667
|
+
*/
|
|
2668
|
+
getStyle(t) {
|
|
2669
|
+
return `--${this.getName()}-sys-${B(t).join("-")}`;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Getting additional parameters.
|
|
2673
|
+
*
|
|
2674
|
+
* Получение дополнительных параметров.
|
|
2675
|
+
*/
|
|
2676
|
+
getAttrs() {
|
|
2677
|
+
const t = { ...this.attrs ?? {} };
|
|
2678
|
+
return "class" in t && delete t.class, "style" in t && delete t.style, t;
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* List of available external variables.
|
|
2682
|
+
*
|
|
2683
|
+
* Список доступных переменных извне.
|
|
2684
|
+
*/
|
|
2685
|
+
expose() {
|
|
2686
|
+
return this.dataExpose ?? {};
|
|
2687
|
+
}
|
|
2688
|
+
/**
|
|
2689
|
+
* The rendering method for the setup method.
|
|
2690
|
+
*
|
|
2691
|
+
* Метод рендеринга для метода настройки.
|
|
2692
|
+
*/
|
|
2693
|
+
render() {
|
|
2694
|
+
return () => this.initRender();
|
|
2695
|
+
}
|
|
2696
|
+
/**
|
|
2697
|
+
* Initializes the slot.
|
|
2698
|
+
*
|
|
2699
|
+
* Инициализирует слот.
|
|
2700
|
+
* @param name slot name/ название слота
|
|
2701
|
+
* @param children if you pass this element, the slot will be added to it/
|
|
2702
|
+
* если передать этот элемент, то слот добавится в него
|
|
2703
|
+
* @param props property for the slot/ свойство для слота
|
|
2704
|
+
*/
|
|
2705
|
+
initSlot(t, e, s = {}) {
|
|
2706
|
+
if (this.slots && this.slots?.[t] && typeof this.slots[t] == "function") {
|
|
2707
|
+
const n = this.slots[t](s);
|
|
2708
|
+
return e && e.push(n), n;
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
/**
|
|
2712
|
+
* Transformation of the class value into an object.
|
|
2713
|
+
*
|
|
2714
|
+
* Преобразование значения класса в объект.
|
|
2715
|
+
* @param classes list of classes for transformation/ список классов для преобразования
|
|
2716
|
+
*/
|
|
2717
|
+
toClass(t) {
|
|
2718
|
+
return C(t) ? t : Array.isArray(t) ? { [t.filter((s) => typeof s == "string" && s.trim() !== "").join(" ")]: !0 } : typeof t == "string" ? { [t]: !0 } : {};
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Converts the class name to standard for the current component.
|
|
2722
|
+
*
|
|
2723
|
+
* Преобразовывает название класса в стандартное для текущего компонента.
|
|
2724
|
+
* @param classes list of classes/ список классов
|
|
2725
|
+
*/
|
|
2726
|
+
toClassName(t) {
|
|
2727
|
+
if (m(t)) {
|
|
2728
|
+
const e = {};
|
|
2729
|
+
return f(t, (s, n) => {
|
|
2730
|
+
n.match(/\?\?/) ? e[n.replace(/\?\?/, this.getName())] = s : n.match(/\?/) ? e[n.replace(/\?/, this.getDesign())] = s : e[n] = s;
|
|
2731
|
+
}), e;
|
|
2732
|
+
}
|
|
2733
|
+
return {};
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Getting component names as an array.
|
|
2737
|
+
*
|
|
2738
|
+
* Получение названий компонентов в виде массива.
|
|
2739
|
+
* @param name component name for transformation/ название компонента для преобразования
|
|
2740
|
+
*/
|
|
2741
|
+
initName(t) {
|
|
2742
|
+
return f(t.split(".", 2), (e) => St(e));
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* Updating data about the class.
|
|
2746
|
+
*
|
|
2747
|
+
* Обновление данных об классе.
|
|
2748
|
+
*/
|
|
2749
|
+
updateClasses() {
|
|
2750
|
+
const t = this.classesSub?.value, e = this.options?.classes?.value;
|
|
2751
|
+
return t && e ? {
|
|
2752
|
+
...t,
|
|
2753
|
+
...e,
|
|
2754
|
+
main: {
|
|
2755
|
+
...this.toClass(t?.main),
|
|
2756
|
+
...this.toClass(e?.main),
|
|
2757
|
+
...this.toClass(this.attrs?.class)
|
|
2758
|
+
}
|
|
2759
|
+
} : e ?? {
|
|
2760
|
+
main: {}
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Refinement of the received list of styles.
|
|
2765
|
+
*
|
|
2766
|
+
* Доработка полученного списка стилей.
|
|
2767
|
+
*/
|
|
2768
|
+
updateStyles() {
|
|
2769
|
+
const t = this.stylesSub?.value, e = this.options?.styles?.value;
|
|
2770
|
+
return t && e ? {
|
|
2771
|
+
...t,
|
|
2772
|
+
...e
|
|
2773
|
+
} : e ?? {};
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
function w(i) {
|
|
2777
|
+
return at(i) ? i : $(i);
|
|
2778
|
+
}
|
|
2779
|
+
class we {
|
|
2780
|
+
item;
|
|
2781
|
+
type;
|
|
2782
|
+
code;
|
|
2783
|
+
date;
|
|
2784
|
+
datetime;
|
|
2785
|
+
year = c(() => this.date.value && this.datetime.getYear());
|
|
2786
|
+
month = c(() => this.date.value && this.datetime.getMonth());
|
|
2787
|
+
day = c(() => this.date.value && this.datetime.getDay());
|
|
2788
|
+
hour = c(() => this.date.value && this.datetime.getHour());
|
|
2789
|
+
minute = c(() => this.date.value && this.datetime.getMinute());
|
|
2790
|
+
second = c(() => this.date.value && this.datetime.getSecond());
|
|
2791
|
+
/**
|
|
2792
|
+
* Constructor
|
|
2793
|
+
* @param date date for processing. дата для обработки
|
|
2794
|
+
* @param type type of date format for output. тип формата даты вывода
|
|
2795
|
+
* @param code country and language code. код страны и языка
|
|
2796
|
+
*/
|
|
2797
|
+
constructor(t, e = "date", s = y.getLocation()) {
|
|
2798
|
+
this.item = w(t), this.type = w(e), this.code = w(s), this.date = $(S(this.item.value)), this.datetime = new ot(
|
|
2799
|
+
this.date.value,
|
|
2800
|
+
this.type.value,
|
|
2801
|
+
this.code.value
|
|
2802
|
+
), p(this.item, (n) => {
|
|
2803
|
+
this.date.value = S(n);
|
|
2804
|
+
}), p(this.type, (n) => this.datetime.setType(n)), p(this.code, (n) => this.datetime.setCode(n)), p(this.date, (n) => this.datetime.setDate(n)), this.datetime.setWatch(() => Ot(this.date));
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Returns the basic data for the date.
|
|
2808
|
+
*
|
|
2809
|
+
* Возвращает основные данные для даты.
|
|
2810
|
+
*/
|
|
2811
|
+
getItem() {
|
|
2812
|
+
return this.item;
|
|
2813
|
+
}
|
|
2814
|
+
/**
|
|
2815
|
+
* Returns a Date object.
|
|
2816
|
+
*
|
|
2817
|
+
* Возвращает объект Date.
|
|
2818
|
+
*/
|
|
2819
|
+
getDate() {
|
|
2820
|
+
return this.date;
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* Obtaining an object of the basic Datetime class.
|
|
2824
|
+
*
|
|
2825
|
+
* Получение объекта основного класса Datetime.
|
|
2826
|
+
*/
|
|
2827
|
+
getDatetime() {
|
|
2828
|
+
return this.datetime;
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Returns the format of hours.
|
|
2832
|
+
*
|
|
2833
|
+
* Возвращает формат часов.
|
|
2834
|
+
*/
|
|
2835
|
+
getHoursType() {
|
|
2836
|
+
return c(() => this.date.value && this.datetime.getHoursType());
|
|
2837
|
+
}
|
|
2838
|
+
/**
|
|
2839
|
+
* Returns the code of the first day of the week.
|
|
2840
|
+
*
|
|
2841
|
+
* Возвращает код первого дня недели.
|
|
2842
|
+
*/
|
|
2843
|
+
getFirstDayCode() {
|
|
2844
|
+
return c(() => this.date.value && this.datetime.getFirstDayCode());
|
|
2845
|
+
}
|
|
2846
|
+
/**
|
|
2847
|
+
* The method returns the year of the specified date according to local time.
|
|
2848
|
+
*
|
|
2849
|
+
* Метод возвращает год указанной даты по местному времени.
|
|
2850
|
+
*/
|
|
2851
|
+
getYear() {
|
|
2852
|
+
return this.year;
|
|
2853
|
+
}
|
|
2854
|
+
/**
|
|
2855
|
+
* The method returns the month in the specified date according to local time,
|
|
2856
|
+
* as a zero-based value.
|
|
2857
|
+
*
|
|
2858
|
+
* Метод возвращает месяц указанной даты по местному времени, нумерация
|
|
2859
|
+
* месяцев начинается с нуля для первого месяца в году.
|
|
2860
|
+
*/
|
|
2861
|
+
getMonth() {
|
|
2862
|
+
return this.month;
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* The method returns the day of the month for the specified date according to local time.
|
|
2866
|
+
*
|
|
2867
|
+
* Метод возвращает день месяца указанной даты по местному времени.
|
|
2868
|
+
*/
|
|
2869
|
+
getDay() {
|
|
2870
|
+
return this.day;
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* The method returns the hour for the specified date, according to local time.
|
|
2874
|
+
*
|
|
2875
|
+
* Метод возвращает часы указанной даты по местному времени.
|
|
2876
|
+
*/
|
|
2877
|
+
getHour() {
|
|
2878
|
+
return this.hour;
|
|
2879
|
+
}
|
|
2880
|
+
/**
|
|
2881
|
+
* The method returns the minutes in the specified date according to local time.
|
|
2882
|
+
*
|
|
2883
|
+
* Метод возвращает минуты указанной даты по местному времени.
|
|
2884
|
+
*/
|
|
2885
|
+
getMinute() {
|
|
2886
|
+
return this.minute;
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* The method returns the seconds in the specified date according to local time.
|
|
2890
|
+
*
|
|
2891
|
+
* Метод возвращает секунды указанной даты по местному времени.
|
|
2892
|
+
*/
|
|
2893
|
+
getSecond() {
|
|
2894
|
+
return this.second;
|
|
2895
|
+
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Returns the last day of the week.
|
|
2898
|
+
*
|
|
2899
|
+
* Возвращает последний день недели.
|
|
2900
|
+
*/
|
|
2901
|
+
getMaxDay() {
|
|
2902
|
+
return c(() => this.date.value && this.datetime.getMaxDay());
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* Enables language-sensitive date and time formatting.
|
|
2906
|
+
*
|
|
2907
|
+
* Конструктором объектов, включающих языка-зависимое форматирование даты и времени.
|
|
2908
|
+
* @param type type of date format for output. тип формата даты вывода
|
|
2909
|
+
* @param styleOptions the representation of the month. представление месяца
|
|
2910
|
+
*/
|
|
2911
|
+
locale(t = this.type.value, e) {
|
|
2912
|
+
return c(() => this.date.value && this.datetime.locale(t, e));
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Output of standard data.
|
|
2916
|
+
*
|
|
2917
|
+
* Вывод стандартных данных.
|
|
2918
|
+
* @param timeZone add time zone. добавить временную зону
|
|
2919
|
+
*/
|
|
2920
|
+
standard(t = !0) {
|
|
2921
|
+
return c(() => this.date.value && this.datetime.standard(t));
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
class Ce extends Bt {
|
|
2925
|
+
/**
|
|
2926
|
+
* Classes Constructor
|
|
2927
|
+
* @param elementSelector element/ элемент
|
|
2928
|
+
* @param elementSelectorControl control element/ элемент управления
|
|
2929
|
+
* @param type type/ тип
|
|
2930
|
+
* @param listener the object that receives a notification (an object that implements the
|
|
2931
|
+
* Event interface) when an event of the specified type occurs/ объект, который принимает
|
|
2932
|
+
* уведомление, когда событие указанного типа произошло
|
|
2933
|
+
* @param options object that specifies characteristics/ объект options
|
|
2934
|
+
* @param detail an event-dependent value associated with the event/ зависимое от события
|
|
2935
|
+
* значение, связанное с событием
|
|
2936
|
+
*/
|
|
2937
|
+
constructor(t, e, s = ["click"], n, a, o) {
|
|
2938
|
+
const u = w(t), h = w(e);
|
|
2939
|
+
super(
|
|
2940
|
+
u.value,
|
|
2941
|
+
s,
|
|
2942
|
+
n,
|
|
2943
|
+
a,
|
|
2944
|
+
o
|
|
2945
|
+
), h.value && this.setElementControl(h.value), p(u, (l) => this.setElement(l)), p(h, (l) => this.setElementControl(l));
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
class Le {
|
|
2949
|
+
code;
|
|
2950
|
+
flag;
|
|
2951
|
+
/**
|
|
2952
|
+
* Constructor
|
|
2953
|
+
* @param code country and language code/ код страны и языка
|
|
2954
|
+
*/
|
|
2955
|
+
constructor(t = y.getLocation()) {
|
|
2956
|
+
this.code = w(t), this.flag = new E(this.code.value), p(this.code, (e) => this.flag.setCode(e));
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Obtaining a reactive object with the country code.
|
|
2960
|
+
*
|
|
2961
|
+
* Получение реактивного объекта с кодом страны.
|
|
2962
|
+
*/
|
|
2963
|
+
getCode() {
|
|
2964
|
+
return this.code;
|
|
2965
|
+
}
|
|
2966
|
+
/**
|
|
2967
|
+
* Returns information about the country and its flag.
|
|
2968
|
+
*
|
|
2969
|
+
* Возвращает информацию о стране и её флаге.
|
|
2970
|
+
* @param code country code/ код страны
|
|
2971
|
+
*/
|
|
2972
|
+
get(t = this.code.value) {
|
|
2973
|
+
return c(() => this.flag.get(t));
|
|
2974
|
+
}
|
|
2975
|
+
/**
|
|
2976
|
+
* Getting a link to the flag.
|
|
2977
|
+
*
|
|
2978
|
+
* Получение ссылки на флаг.
|
|
2979
|
+
* @param code country code/ код страны
|
|
2980
|
+
*/
|
|
2981
|
+
getFlag(t = this.code.value) {
|
|
2982
|
+
return c(() => this.flag.get(t)?.icon);
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Getting a list of countries by an array of codes.
|
|
2986
|
+
*
|
|
2987
|
+
* Получение списка стран по массиву с кодами.
|
|
2988
|
+
* @param codes country code/ код страны
|
|
2989
|
+
*/
|
|
2990
|
+
getList(t) {
|
|
2991
|
+
return c(() => this.flag.getList(t));
|
|
2992
|
+
}
|
|
2993
|
+
/**
|
|
2994
|
+
* Getting a list of countries by an array of codes in national language.
|
|
2995
|
+
*
|
|
2996
|
+
* Получение списка стран по массиву с кодами на национальный язык.
|
|
2997
|
+
* @param codes country code/ код страны.
|
|
2998
|
+
*/
|
|
2999
|
+
getNational(t) {
|
|
3000
|
+
return c(() => this.flag.getNational(t));
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
class wt {
|
|
3004
|
+
static item = W(y.get());
|
|
3005
|
+
static country = c(() => this.item.value.country);
|
|
3006
|
+
static language = c(() => this.item.value.language);
|
|
3007
|
+
static standard = c(() => this.item.value.standard);
|
|
3008
|
+
static firstDay = c(() => this.item.value.firstDay);
|
|
3009
|
+
/**
|
|
3010
|
+
* Information about the current country.
|
|
3011
|
+
*
|
|
3012
|
+
* Информация об текущей стране.
|
|
3013
|
+
*/
|
|
3014
|
+
static get() {
|
|
3015
|
+
return this.item;
|
|
3016
|
+
}
|
|
3017
|
+
/**
|
|
3018
|
+
* Current country.
|
|
3019
|
+
*
|
|
3020
|
+
* Текущая страна.
|
|
3021
|
+
*/
|
|
3022
|
+
static getCountry() {
|
|
3023
|
+
return this.country;
|
|
3024
|
+
}
|
|
3025
|
+
/**
|
|
3026
|
+
* Current language.
|
|
3027
|
+
*
|
|
3028
|
+
* Текущий язык.
|
|
3029
|
+
*/
|
|
3030
|
+
static getLanguage() {
|
|
3031
|
+
return this.language;
|
|
3032
|
+
}
|
|
3033
|
+
/**
|
|
3034
|
+
* Full format according to the standard.
|
|
3035
|
+
*
|
|
3036
|
+
* Полный формат согласно стандарту.
|
|
3037
|
+
*/
|
|
3038
|
+
static getStandard() {
|
|
3039
|
+
return this.standard;
|
|
3040
|
+
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Returns the first day of the week.
|
|
3043
|
+
*
|
|
3044
|
+
* Возвращает первый день недели.
|
|
3045
|
+
*/
|
|
3046
|
+
static getFirstDay() {
|
|
3047
|
+
return this.firstDay;
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Changes the data by the full code.
|
|
3051
|
+
*
|
|
3052
|
+
* Изменяет данные по полному коду.
|
|
3053
|
+
* @param code country code, full form language-country or one of them/
|
|
3054
|
+
* код страны, полный вид язык-страна или один из них
|
|
3055
|
+
*/
|
|
3056
|
+
static set(t) {
|
|
3057
|
+
y.set(t, !0), this.item.value = y.getItem();
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
class se {
|
|
3061
|
+
location;
|
|
3062
|
+
intl;
|
|
3063
|
+
/**
|
|
3064
|
+
* Constructor
|
|
3065
|
+
* @param code country code, full form language-country or one of them/
|
|
3066
|
+
* код страны, полный вид язык-страна или один из них
|
|
3067
|
+
*/
|
|
3068
|
+
constructor(t) {
|
|
3069
|
+
this.location = w(t), this.intl = c(() => new N(this.location.value ?? wt.getLanguage().value));
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* The consistent translation of language, region and script display names.
|
|
3073
|
+
*
|
|
3074
|
+
* Последовательный перевод отображаемых названий языка, региона и скрипта.
|
|
3075
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
3076
|
+
* @param typeOptions an object with some or all of the following properties/
|
|
3077
|
+
* объект с некоторыми или всеми из следующих свойств
|
|
3078
|
+
*/
|
|
3079
|
+
display(t, e) {
|
|
3080
|
+
return c(() => this.intl.value.display(g(t), e));
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Get display names of language.
|
|
3084
|
+
*
|
|
3085
|
+
* Получить отображаемые имена языка.
|
|
3086
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
3087
|
+
* @param style the formatting style to use/ используемый стиль форматирования
|
|
3088
|
+
*/
|
|
3089
|
+
languageName(t, e) {
|
|
3090
|
+
return c(() => this.intl.value.languageName(g(t), e));
|
|
3091
|
+
}
|
|
3092
|
+
/**
|
|
3093
|
+
* Get display names of region.
|
|
3094
|
+
*
|
|
3095
|
+
* Получить отображаемые имена региона.
|
|
3096
|
+
* @param value the code to provide depends on the type/ предоставляемый код зависит от типа
|
|
3097
|
+
* @param style the formatting style to use/ используемый стиль форматирования
|
|
3098
|
+
*/
|
|
3099
|
+
countryName(t, e) {
|
|
3100
|
+
return c(() => this.intl.value.countryName(g(t), e));
|
|
3101
|
+
}
|
|
3102
|
+
/**
|
|
3103
|
+
* In basic use without specifying a locale, a formatted string.
|
|
3104
|
+
*
|
|
3105
|
+
* При обычном использовании без указания локали форматированная строка
|
|
3106
|
+
*
|
|
3107
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3108
|
+
* @param options an object with some or all properties/ объект с некоторыми
|
|
3109
|
+
* или всеми свойствами
|
|
3110
|
+
*/
|
|
3111
|
+
number(t, e) {
|
|
3112
|
+
return c(() => this.intl.value.number(g(t), e));
|
|
3113
|
+
}
|
|
3114
|
+
/**
|
|
3115
|
+
* Decimal point symbol.
|
|
3116
|
+
*
|
|
3117
|
+
* Символ десятичной точки.
|
|
3118
|
+
*/
|
|
3119
|
+
decimal() {
|
|
3120
|
+
return c(() => this.intl.value.decimal());
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Currency formatting.
|
|
3124
|
+
*
|
|
3125
|
+
* Форматирование валюты.
|
|
3126
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3127
|
+
* @param currencyOptions the currency to use in currency formatting/
|
|
3128
|
+
* валюта для использования в форматировании валюты
|
|
3129
|
+
* @param numberOnly do not display the currency symbol/ не выводить значок валюты
|
|
3130
|
+
*/
|
|
3131
|
+
currency(t, e, s = !1) {
|
|
3132
|
+
return c(
|
|
3133
|
+
() => this.intl.value.currency(
|
|
3134
|
+
g(t),
|
|
3135
|
+
g(e),
|
|
3136
|
+
s
|
|
3137
|
+
)
|
|
3138
|
+
);
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* Unit formatting.
|
|
3142
|
+
* If the style is 'unit', a unit property must be provided.
|
|
3143
|
+
*
|
|
3144
|
+
* Форматирование юнитов.
|
|
3145
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3146
|
+
* @param unitOptions the unit to use in unit formatting/ блок для использования
|
|
3147
|
+
* в форматировании блока
|
|
3148
|
+
*/
|
|
3149
|
+
unit(t, e) {
|
|
3150
|
+
return c(() => this.intl.value.unit(g(t), e));
|
|
3151
|
+
}
|
|
3152
|
+
/**
|
|
3153
|
+
* Number as a percentage.
|
|
3154
|
+
*
|
|
3155
|
+
* Число в виде процента.
|
|
3156
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3157
|
+
* @param options an object with some or all properties/ объект с некоторыми или всеми свойствами
|
|
3158
|
+
*/
|
|
3159
|
+
percent(t, e) {
|
|
3160
|
+
return c(() => this.intl.value.percent(g(t), e));
|
|
3161
|
+
}
|
|
3162
|
+
/**
|
|
3163
|
+
* Number as a percentage (unit).
|
|
3164
|
+
*
|
|
3165
|
+
* Число в виде процента (единица).
|
|
3166
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3167
|
+
* @param options an object with some or all properties/
|
|
3168
|
+
* объект с некоторыми или всеми свойствами
|
|
3169
|
+
*/
|
|
3170
|
+
percentBy100(t, e) {
|
|
3171
|
+
return c(() => this.intl.value.percentBy100(g(t), e));
|
|
3172
|
+
}
|
|
3173
|
+
/**
|
|
3174
|
+
* Enables language-sensitive date and time formatting.
|
|
3175
|
+
*
|
|
3176
|
+
* Конструктором объектов, включающих языка-зависимое форматирование даты и времени.
|
|
3177
|
+
* @param value the date to format/ дата для форматирования
|
|
3178
|
+
* @param type type of data format/ тип формата data
|
|
3179
|
+
* @param styleOptions the representation of the month/ представление месяца
|
|
3180
|
+
* @param hour24 whether to use 12-hour time/ использовать ли 12-часовое время
|
|
3181
|
+
*/
|
|
3182
|
+
date(t, e, s, n) {
|
|
3183
|
+
return c(() => this.intl.value.date(g(t), e, s, n));
|
|
3184
|
+
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Enables language-sensitive relative time formatting.
|
|
3187
|
+
*
|
|
3188
|
+
* Включает форматирование относительного времени с учетом языка.
|
|
3189
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3190
|
+
* @param styleOptions the length of the internationalized message/
|
|
3191
|
+
* длина интернационализированного сообщения
|
|
3192
|
+
* @param todayValue current day/ текущий день
|
|
3193
|
+
*/
|
|
3194
|
+
relative(t, e, s) {
|
|
3195
|
+
return c(() => this.intl.value.relative(g(t), e, s));
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* Enables language-sensitive relative time formatting
|
|
3199
|
+
* Including the ability to add a limit to output the standard time format if the value
|
|
3200
|
+
* exceeds the allowable limit.
|
|
3201
|
+
*
|
|
3202
|
+
* Включает форматирование относительного времени с учетом языка.
|
|
3203
|
+
* Включая возможность добавления лимита, чтобы выводить уже стандартный формат времени,
|
|
3204
|
+
* если значение вышло за пределы допустимого.
|
|
3205
|
+
* @param value a number, bigint, or string, to format/ число для форматирования
|
|
3206
|
+
* @param limit values that determine the output limit (values per day)/
|
|
3207
|
+
* значения, по которым определяем предел вывода (значения в день)
|
|
3208
|
+
* @param todayValue current day/ текущий день
|
|
3209
|
+
* @param relativeOptions the length of the internationalized message/
|
|
3210
|
+
* длина интернационализированного сообщения
|
|
3211
|
+
* @param dateOptions the representation of the month/ представление месяца
|
|
3212
|
+
* @param type type of data format/ тип формата data
|
|
3213
|
+
* @param hour24 whether to use 12-hour time/ использовать ли 12-часовое время
|
|
3214
|
+
*/
|
|
3215
|
+
relativeLimit(t, e, s, n, a, o, u) {
|
|
3216
|
+
return c(() => this.intl.value.relativeLimit(
|
|
3217
|
+
g(t),
|
|
3218
|
+
e,
|
|
3219
|
+
s,
|
|
3220
|
+
n,
|
|
3221
|
+
a,
|
|
3222
|
+
o,
|
|
3223
|
+
u
|
|
3224
|
+
));
|
|
3225
|
+
}
|
|
3226
|
+
/**
|
|
3227
|
+
* Names of months.
|
|
3228
|
+
*
|
|
3229
|
+
* Названия месяцев.
|
|
3230
|
+
* @param value the date to format/ дата для форматирования
|
|
3231
|
+
* @param style the representation of the month/ представление месяца
|
|
3232
|
+
*/
|
|
3233
|
+
month(t, e) {
|
|
3234
|
+
return c(() => this.intl.value.month(g(t), e));
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* Array to list of months.
|
|
3238
|
+
*
|
|
3239
|
+
* Массив в список месяцев.
|
|
3240
|
+
* @param style the representation of the month/ представление месяца
|
|
3241
|
+
*/
|
|
3242
|
+
months(t) {
|
|
3243
|
+
return c(() => this.intl.value.months(t));
|
|
3244
|
+
}
|
|
3245
|
+
/**
|
|
3246
|
+
* Returns names of days of the week.
|
|
3247
|
+
*
|
|
3248
|
+
* Возвращает названия дней недели.
|
|
3249
|
+
* @param value the date to format/ дата для форматирования
|
|
3250
|
+
* @param style the representation of the weekday/ представление о дне недели
|
|
3251
|
+
*/
|
|
3252
|
+
weekday(t, e) {
|
|
3253
|
+
return c(() => this.intl.value.weekday(g(t), e));
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* An array of the list of names of the days of the week.
|
|
3257
|
+
*
|
|
3258
|
+
* Массив из списка названий дней недели.
|
|
3259
|
+
* @param style the representation of the weekday/ представление о дне недели
|
|
3260
|
+
*/
|
|
3261
|
+
weekdays(t) {
|
|
3262
|
+
return c(() => this.intl.value.weekdays(t));
|
|
3263
|
+
}
|
|
3264
|
+
/**
|
|
3265
|
+
* Time.
|
|
3266
|
+
*
|
|
3267
|
+
* Время.
|
|
3268
|
+
* @param value the date to format/ дата для форматирования
|
|
3269
|
+
*/
|
|
3270
|
+
time(t) {
|
|
3271
|
+
return c(() => this.intl.value.time(g(t)));
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
function Ct(i, t = "ig", e = ":value") {
|
|
3275
|
+
const s = i.replace(/([[\]\\^$.?*+()/])/g, "\\$1");
|
|
3276
|
+
return new RegExp(e.replace(/:value/g, s), t);
|
|
3277
|
+
}
|
|
3278
|
+
class Lt {
|
|
3279
|
+
/**
|
|
3280
|
+
* Creates an instance of ListData for managing list data.
|
|
3281
|
+
*
|
|
3282
|
+
* Создает экземпляр ListData для управления данными списка.
|
|
3283
|
+
* @param list List data / данные списка
|
|
3284
|
+
* @param focus Focused item / элемент в фокусе
|
|
3285
|
+
* @param highlight Search text for highlighting / текст поиска для выделения
|
|
3286
|
+
* @param highlightLengthStart Minimum length to start highlighting / минимальная длина для начала выделения
|
|
3287
|
+
* @param selected Selected items / выбранные элементы
|
|
3288
|
+
* @param keyValue Key for getting item value / ключ для получения значения элемента
|
|
3289
|
+
* @param keyLabel Key for getting item label / ключ для получения метки элемента
|
|
3290
|
+
* @param lite Threshold for lite mode / порог для облегченного режима
|
|
3291
|
+
* @param parent Parent identifier / идентификатор родителя
|
|
3292
|
+
*/
|
|
3293
|
+
constructor(t, e, s, n, a, o, u, h, l) {
|
|
3294
|
+
this.list = t, this.focus = e, this.highlight = s, this.highlightLengthStart = n, this.selected = a, this.keyValue = o, this.keyLabel = u, this.lite = h, this.parent = l, at(t) && p(t, () => {
|
|
3295
|
+
this.subList = {};
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
subList = {};
|
|
3299
|
+
/**
|
|
3300
|
+
* Returns a list for forming a list.
|
|
3301
|
+
*
|
|
3302
|
+
* Возвращает список для формирования списка.
|
|
3303
|
+
*/
|
|
3304
|
+
data = c(
|
|
3305
|
+
() => f(
|
|
3306
|
+
g(this.list) || [],
|
|
3307
|
+
(t, e) => this.initItem(e, t)
|
|
3308
|
+
)
|
|
3309
|
+
);
|
|
3310
|
+
/**
|
|
3311
|
+
* Returns a simplified list for quick loading.
|
|
3312
|
+
*
|
|
3313
|
+
* Возвращает упрощенный список для быстрой загрузки.
|
|
3314
|
+
*/
|
|
3315
|
+
liteData = c(() => {
|
|
3316
|
+
if (this.isLite()) {
|
|
3317
|
+
const t = [];
|
|
3318
|
+
for (const e of this.data.value) {
|
|
3319
|
+
const s = {
|
|
3320
|
+
parent: this.parent,
|
|
3321
|
+
index: e.index,
|
|
3322
|
+
type: e.type,
|
|
3323
|
+
label: e.label,
|
|
3324
|
+
description: e.description,
|
|
3325
|
+
value: e.value
|
|
3326
|
+
};
|
|
3327
|
+
"description" in e && (s.description = e.description), t.push(s);
|
|
3328
|
+
}
|
|
3329
|
+
return t;
|
|
3330
|
+
}
|
|
3331
|
+
return this.data.value;
|
|
3332
|
+
});
|
|
3333
|
+
/**
|
|
3334
|
+
* Returns a list of records with all additional data.
|
|
3335
|
+
*
|
|
3336
|
+
* Возвращает список записей со всеми дополнительными данными.
|
|
3337
|
+
*/
|
|
3338
|
+
fullData = c(() => {
|
|
3339
|
+
const t = this.getFocus(), e = this.getHighlight(), s = this.getSelected();
|
|
3340
|
+
return f(
|
|
3341
|
+
this.data.value,
|
|
3342
|
+
(n) => ({
|
|
3343
|
+
...n,
|
|
3344
|
+
focus: t === n.index,
|
|
3345
|
+
highlight: e,
|
|
3346
|
+
selected: F(n.index, s)
|
|
3347
|
+
})
|
|
3348
|
+
);
|
|
3349
|
+
});
|
|
3350
|
+
/**
|
|
3351
|
+
* Returns a map of all entries.
|
|
3352
|
+
*
|
|
3353
|
+
* Возвращает карту всех записей.
|
|
3354
|
+
*/
|
|
3355
|
+
map = c(() => {
|
|
3356
|
+
const t = [];
|
|
3357
|
+
return this.data.value.forEach((e) => {
|
|
3358
|
+
switch (e.type) {
|
|
3359
|
+
case "item":
|
|
3360
|
+
t.push(e);
|
|
3361
|
+
break;
|
|
3362
|
+
case "group":
|
|
3363
|
+
case "menu":
|
|
3364
|
+
t.push(
|
|
3365
|
+
e,
|
|
3366
|
+
...this.getSubList(e).map.value
|
|
3367
|
+
);
|
|
3368
|
+
break;
|
|
3369
|
+
}
|
|
3370
|
+
}), t;
|
|
3371
|
+
});
|
|
3372
|
+
/** Returns a list consisting only of items/ Возвращает список, состоящий только из элементов. */
|
|
3373
|
+
mapItems = c(() => this.map.value.filter((t) => t.type === "item"));
|
|
3374
|
+
/**
|
|
3375
|
+
* Returns a list consisting only of values for selection.
|
|
3376
|
+
*
|
|
3377
|
+
* Возвращает список, состоящий только из значений для выбора.
|
|
3378
|
+
*/
|
|
3379
|
+
items = c(() => this.map.value.filter(
|
|
3380
|
+
(t) => t.type === "item" || t.type === "group" || t.type === "menu"
|
|
3381
|
+
));
|
|
3382
|
+
/**
|
|
3383
|
+
* Finds the first element that meets the search conditions.
|
|
3384
|
+
*
|
|
3385
|
+
* Находит первый элемент, соответствующий условиям поиска.
|
|
3386
|
+
*/
|
|
3387
|
+
highlightFirstItem = c(() => {
|
|
3388
|
+
const t = this.getHighlight(), e = t && t.length >= this.getHighlightLengthStart() && Ct(t, "i");
|
|
3389
|
+
return e ? this.map.value.findIndex(
|
|
3390
|
+
(s) => s.label?.toString().match(e) || s.index?.toString().match(e) || s.search?.toString().match(e)
|
|
3391
|
+
) : -1;
|
|
3392
|
+
});
|
|
3393
|
+
/**
|
|
3394
|
+
* Is there a selected item.
|
|
3395
|
+
*
|
|
3396
|
+
* Есть ли выбранный элемент.
|
|
3397
|
+
*/
|
|
3398
|
+
isSelected = c(() => {
|
|
3399
|
+
const t = this.getSelected();
|
|
3400
|
+
return !!t && this.mapItems.value.findIndex((e) => F(e.index, t)) !== -1;
|
|
3401
|
+
});
|
|
3402
|
+
/**
|
|
3403
|
+
* Returns a list of selected items on the map.
|
|
3404
|
+
*
|
|
3405
|
+
* Возвращает список выделенных элементов на карте.
|
|
3406
|
+
*/
|
|
3407
|
+
selectedList = c(() => {
|
|
3408
|
+
const t = this.getSelected();
|
|
3409
|
+
return t && this.isSelected.value ? this.mapItems.value.filter((e) => F(e.index, t)) : [];
|
|
3410
|
+
});
|
|
3411
|
+
/**
|
|
3412
|
+
* Returns a list of selected items on the map.
|
|
3413
|
+
*
|
|
3414
|
+
* Возвращает список выделенных элементов на карте.
|
|
3415
|
+
*/
|
|
3416
|
+
selectedNames = c(() => it(this.selectedList.value, "label"));
|
|
3417
|
+
/**
|
|
3418
|
+
* Returns a list of selected item values on the map.
|
|
3419
|
+
*
|
|
3420
|
+
* Возвращает список значений выделенных элементов на карте.
|
|
3421
|
+
*/
|
|
3422
|
+
selectedValues = c(() => it(this.selectedList.value, "value"));
|
|
3423
|
+
/**
|
|
3424
|
+
* Checks whether it is necessary to first display a simplified version.
|
|
3425
|
+
*
|
|
3426
|
+
* Проверяет, надо ли сначала вывести упрощенную версию.
|
|
3427
|
+
*/
|
|
3428
|
+
isLite() {
|
|
3429
|
+
return !!(this.lite?.value && this.data.value.length > this.lite.value);
|
|
3430
|
+
}
|
|
3431
|
+
/**
|
|
3432
|
+
* Checks if an element is in focus.
|
|
3433
|
+
*
|
|
3434
|
+
* Проверяет, есть ли элемент в фокусе.
|
|
3435
|
+
*/
|
|
3436
|
+
isFocus() {
|
|
3437
|
+
const t = this.getFocus();
|
|
3438
|
+
return !!(t && this.map.value.findIndex((e) => e.index === t) !== -1);
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* Checks if there is a selected item.
|
|
3442
|
+
*
|
|
3443
|
+
* Проверяет, есть ли выделенный элемент.
|
|
3444
|
+
*/
|
|
3445
|
+
isHighlight() {
|
|
3446
|
+
return this.highlightFirstItem.value !== -1;
|
|
3447
|
+
}
|
|
3448
|
+
/**
|
|
3449
|
+
* Returns the number of records.
|
|
3450
|
+
*
|
|
3451
|
+
* Возвращает количество записей.
|
|
3452
|
+
*/
|
|
3453
|
+
getLength() {
|
|
3454
|
+
return this.data.value.length;
|
|
3455
|
+
}
|
|
3456
|
+
/**
|
|
3457
|
+
* Returns the number of all available records.
|
|
3458
|
+
*
|
|
3459
|
+
* Возвращает количество всех доступных записей.
|
|
3460
|
+
*/
|
|
3461
|
+
getLengthByMap() {
|
|
3462
|
+
return this.map.value.length;
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* Returns the number of all available records.
|
|
3466
|
+
*
|
|
3467
|
+
* Возвращает количество всех доступных записей.
|
|
3468
|
+
*/
|
|
3469
|
+
getLengthByItems() {
|
|
3470
|
+
return this.items.value.length;
|
|
3471
|
+
}
|
|
3472
|
+
/**
|
|
3473
|
+
* Returns the values in focus.
|
|
3474
|
+
*
|
|
3475
|
+
* Возвращает значения в фокусе.
|
|
3476
|
+
*/
|
|
3477
|
+
getFocus() {
|
|
3478
|
+
return this.focus?.value;
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* Returns the selected value.
|
|
3482
|
+
*
|
|
3483
|
+
* Возвращает выделенного значение.
|
|
3484
|
+
*/
|
|
3485
|
+
getHighlight() {
|
|
3486
|
+
return this.highlight?.value;
|
|
3487
|
+
}
|
|
3488
|
+
/**
|
|
3489
|
+
* Returns the minimum length for highlight to start.
|
|
3490
|
+
*
|
|
3491
|
+
* Возвращает минимальную длину для начала выделения.
|
|
3492
|
+
*/
|
|
3493
|
+
getHighlightLengthStart() {
|
|
3494
|
+
return this.highlightLengthStart?.value ?? 2;
|
|
3495
|
+
}
|
|
3496
|
+
/**
|
|
3497
|
+
* Returns the selected value.
|
|
3498
|
+
*
|
|
3499
|
+
* Возвращает выбранное значение.
|
|
3500
|
+
*/
|
|
3501
|
+
getSelected() {
|
|
3502
|
+
return this.selected?.value;
|
|
3503
|
+
}
|
|
3504
|
+
/**
|
|
3505
|
+
* Returns an item by its index.
|
|
3506
|
+
*
|
|
3507
|
+
* Возвращает элемент по его индексу.
|
|
3508
|
+
* @param index item index/ индекс элемента
|
|
3509
|
+
*/
|
|
3510
|
+
getItemByIndex(t) {
|
|
3511
|
+
const e = this.map.value.findIndex((s) => s.index === t);
|
|
3512
|
+
if (e !== -1)
|
|
3513
|
+
return {
|
|
3514
|
+
key: e,
|
|
3515
|
+
item: this.map.value[e]
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* Returns an item by its key.
|
|
3520
|
+
*
|
|
3521
|
+
* Возвращает элемент по его ключу.
|
|
3522
|
+
* @param key item key/ ключ элемента
|
|
3523
|
+
*/
|
|
3524
|
+
getItemByKey(t) {
|
|
3525
|
+
return this.map.value?.[t];
|
|
3526
|
+
}
|
|
3527
|
+
/**
|
|
3528
|
+
* Returns the first item with the specified parent.
|
|
3529
|
+
*
|
|
3530
|
+
* Возвращает первый элемент с указанным родителем.
|
|
3531
|
+
* @param parent parent identifier to search for / идентификатор родителя для поиска
|
|
3532
|
+
*/
|
|
3533
|
+
getFirstItemByParent(t) {
|
|
3534
|
+
return this.map.value.find((e) => this.isInParent(t, e));
|
|
3535
|
+
}
|
|
3536
|
+
/**
|
|
3537
|
+
* Returns the last item with the specified parent.
|
|
3538
|
+
*
|
|
3539
|
+
* Возвращает последний элемент с указанным родителем.
|
|
3540
|
+
* @param parent parent identifier to search for / идентификатор родителя для поиска
|
|
3541
|
+
*/
|
|
3542
|
+
getLastItemByParent(t) {
|
|
3543
|
+
return this.map.value.filter((e) => this.isInParent(t, e)).pop();
|
|
3544
|
+
}
|
|
3545
|
+
/**
|
|
3546
|
+
* Returns a sublist object for a group item.
|
|
3547
|
+
*
|
|
3548
|
+
* Возвращает объект подсписка для группового элемента.
|
|
3549
|
+
* @param item List item data/ данные элемента списка
|
|
3550
|
+
*/
|
|
3551
|
+
getSubList(t) {
|
|
3552
|
+
return t.index in this.subList || (this.subList[t.index] = new Lt(
|
|
3553
|
+
t.value,
|
|
3554
|
+
this.focus,
|
|
3555
|
+
this.highlight,
|
|
3556
|
+
this.highlightLengthStart,
|
|
3557
|
+
this.selected,
|
|
3558
|
+
this.keyValue,
|
|
3559
|
+
this.keyLabel,
|
|
3560
|
+
this.lite,
|
|
3561
|
+
t.index
|
|
3562
|
+
)), this.subList[t.index];
|
|
3563
|
+
}
|
|
3564
|
+
/**
|
|
3565
|
+
* Checks if the item is an item, group, or menu.
|
|
3566
|
+
*
|
|
3567
|
+
* Проверяет, является ли элемент элементом, группой или меню.
|
|
3568
|
+
* @param item List item data/ данные элемента списка
|
|
3569
|
+
*/
|
|
3570
|
+
isItem(t) {
|
|
3571
|
+
return t.type === "item" || t.type === "group" || t.type === "menu";
|
|
3572
|
+
}
|
|
3573
|
+
/**
|
|
3574
|
+
* Checks if the item is in the specified parent.
|
|
3575
|
+
*
|
|
3576
|
+
* Проверяет, находится ли элемент в указанном родителе.
|
|
3577
|
+
* @param parent parent identifier to search for / идентификатор родителя для поиска
|
|
3578
|
+
* @param item List item data/ данные элемента списка
|
|
3579
|
+
*/
|
|
3580
|
+
isInParent(t, e) {
|
|
3581
|
+
return e.parent === t && this.isItem(e);
|
|
3582
|
+
}
|
|
3583
|
+
/**
|
|
3584
|
+
* Returns the index for the list item.
|
|
3585
|
+
*
|
|
3586
|
+
* Возвращает индекс для элемента списка.
|
|
3587
|
+
* @param index current index / текущий индекс
|
|
3588
|
+
* @param value item value / значение элемента
|
|
3589
|
+
* @param key item key / ключ элемента
|
|
3590
|
+
* @param label item label / метка элемента
|
|
3591
|
+
*/
|
|
3592
|
+
getIndex(t, e, s, n) {
|
|
3593
|
+
return t && !m(t) ? t : e && !m(e) ? e : s && n;
|
|
3594
|
+
}
|
|
3595
|
+
/**
|
|
3596
|
+
* Creates an object of the record element.
|
|
3597
|
+
*
|
|
3598
|
+
* Создает объект элемента записи.
|
|
3599
|
+
* @param key the value of the key in the element/ значения ключа у элемента
|
|
3600
|
+
* @param item selected element/ выбранный элемент
|
|
3601
|
+
*/
|
|
3602
|
+
initItem(t, e) {
|
|
3603
|
+
if (C(e)) {
|
|
3604
|
+
const s = e?.[this.keyValue?.value ?? "value"], n = e?.[this.keyLabel?.value ?? "label"] ?? s, a = this.getIndex(
|
|
3605
|
+
e?.index,
|
|
3606
|
+
s,
|
|
3607
|
+
t,
|
|
3608
|
+
n
|
|
3609
|
+
);
|
|
3610
|
+
return {
|
|
3611
|
+
...e,
|
|
3612
|
+
parent: this.parent,
|
|
3613
|
+
index: a,
|
|
3614
|
+
type: e?.type ?? "item",
|
|
3615
|
+
label: n,
|
|
3616
|
+
value: s
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
return {
|
|
3620
|
+
parent: this.parent,
|
|
3621
|
+
index: t.toString(),
|
|
3622
|
+
type: "item",
|
|
3623
|
+
label: e,
|
|
3624
|
+
value: t
|
|
3625
|
+
};
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
class De {
|
|
3629
|
+
static router;
|
|
3630
|
+
/**
|
|
3631
|
+
* Get router instance.
|
|
3632
|
+
*
|
|
3633
|
+
* Получить экземпляр роутера.
|
|
3634
|
+
*/
|
|
3635
|
+
static get() {
|
|
3636
|
+
return this.router;
|
|
3637
|
+
}
|
|
3638
|
+
/**
|
|
3639
|
+
* Site path change.
|
|
3640
|
+
*
|
|
3641
|
+
* Изменение пути сайта.
|
|
3642
|
+
* @param to new path/ новый путь
|
|
3643
|
+
*/
|
|
3644
|
+
static push(t) {
|
|
3645
|
+
this.router && this.router.push(t).then();
|
|
3646
|
+
}
|
|
3647
|
+
/**
|
|
3648
|
+
* Set router instance.
|
|
3649
|
+
*
|
|
3650
|
+
* Установить экземпляр роутера.
|
|
3651
|
+
* @param router router instance/ экземпляр роутера
|
|
3652
|
+
*/
|
|
3653
|
+
static set(t) {
|
|
3654
|
+
this.router = t;
|
|
3655
|
+
}
|
|
3656
|
+
/**
|
|
3657
|
+
* Set router instance only once.
|
|
3658
|
+
*
|
|
3659
|
+
* Установить экземпляр роутера только один раз.
|
|
3660
|
+
* @param router router instance/ экземпляр роутера
|
|
3661
|
+
*/
|
|
3662
|
+
static setOneTime(t) {
|
|
3663
|
+
this.router || this.set(t);
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
class ke {
|
|
3667
|
+
/**
|
|
3668
|
+
* Reactive item.
|
|
3669
|
+
*
|
|
3670
|
+
* Реактивный элемент.
|
|
3671
|
+
*/
|
|
3672
|
+
item = $();
|
|
3673
|
+
/**
|
|
3674
|
+
* Constructor
|
|
3675
|
+
*/
|
|
3676
|
+
constructor() {
|
|
3677
|
+
vt.is().then((t) => {
|
|
3678
|
+
this.item.value = t;
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* Checks whether the scroll width is defined.
|
|
3683
|
+
*
|
|
3684
|
+
* Проверяет, определена ли ширина скролла.
|
|
3685
|
+
*/
|
|
3686
|
+
is = c(() => this.item.value !== void 0);
|
|
3687
|
+
}
|
|
3688
|
+
const ie = (i) => typeof i == "string" ? { method: i } : i || {};
|
|
3689
|
+
let U;
|
|
3690
|
+
function Me(i, t, e = !0, s, n, a) {
|
|
3691
|
+
const o = $(), u = w(ie(t)), h = $(!1), l = $(!1);
|
|
3692
|
+
let L = !0, D = 0;
|
|
3693
|
+
const V = async () => {
|
|
3694
|
+
if (L)
|
|
3695
|
+
return;
|
|
3696
|
+
const v = g(i);
|
|
3697
|
+
if ((!s || s.value) && v) {
|
|
3698
|
+
h.value = !0, l.value = !0;
|
|
3699
|
+
let q = {};
|
|
3700
|
+
const ut = await j.request({
|
|
3701
|
+
path: v,
|
|
3702
|
+
...u.value
|
|
3703
|
+
});
|
|
3704
|
+
ut && (q = ut), n ? o.value = n(q) : o.value = q, h.value = !1;
|
|
3705
|
+
} else o.value !== void 0 && (o.value = void 0);
|
|
3706
|
+
}, Mt = () => {
|
|
3707
|
+
const v = [];
|
|
3708
|
+
e && v.push(u), at(i) && v.push(i), s && v.push(s), U && v.push(U), v.length > 0 && p(v, async () => {
|
|
3709
|
+
h.value || await V();
|
|
3710
|
+
});
|
|
3711
|
+
};
|
|
3712
|
+
return {
|
|
3713
|
+
get data() {
|
|
3714
|
+
return L && (L = !1, V().then()), Mt(), a && (D++, st(() => {
|
|
3715
|
+
D--, D < 1 && (console.warn("useApiRef: unmounted"), o.value = void 0, L = !0, D = 0);
|
|
3716
|
+
})), o;
|
|
3717
|
+
},
|
|
3718
|
+
get isStarting() {
|
|
3719
|
+
return c(() => o.value === void 0);
|
|
3720
|
+
},
|
|
3721
|
+
loading: h,
|
|
3722
|
+
get reading() {
|
|
3723
|
+
return c(() => l.value);
|
|
3724
|
+
},
|
|
3725
|
+
reset: V
|
|
3726
|
+
};
|
|
3727
|
+
}
|
|
3728
|
+
const Ae = (i) => {
|
|
3729
|
+
U || (U = i);
|
|
3730
|
+
};
|
|
3731
|
+
function Ie(i, t, e) {
|
|
3732
|
+
if (i in Q)
|
|
3733
|
+
return Q[i];
|
|
3734
|
+
const s = new Zt(i), n = $(s.get(t, e));
|
|
3735
|
+
return p(n, (a) => {
|
|
3736
|
+
s.set(a, e);
|
|
3737
|
+
}), Q[i] = n, n;
|
|
3738
|
+
}
|
|
3739
|
+
const Q = {};
|
|
3740
|
+
function Ne() {
|
|
3741
|
+
return new se();
|
|
3742
|
+
}
|
|
3743
|
+
function Te(i, t) {
|
|
3744
|
+
if (i in X)
|
|
3745
|
+
return X[i];
|
|
3746
|
+
const e = W(R.get(i, t));
|
|
3747
|
+
return p(e, (s) => R.set(i, s)), R.addWatch(i, (s) => {
|
|
3748
|
+
e.value = s;
|
|
3749
|
+
}), X[i] = e, e;
|
|
3750
|
+
}
|
|
3751
|
+
const X = {};
|
|
3752
|
+
let mt = G(1e5, 9e5);
|
|
3753
|
+
function H(i, t) {
|
|
3754
|
+
const e = K(i);
|
|
3755
|
+
return e ? (O(e.id) || e.setAttribute("id", `id-${mt++}`), t ? `#${e.id}${t}`.trim() : e.id) : `id-${mt++}`;
|
|
3756
|
+
}
|
|
3757
|
+
const Be = () => {
|
|
3758
|
+
const i = {}, t = "IntersectionObserver" in window ? new IntersectionObserver(
|
|
3759
|
+
(s) => {
|
|
3760
|
+
s.forEach((n) => {
|
|
3761
|
+
const a = H(n.target);
|
|
3762
|
+
a in i && (i[a].status.value = n.isIntersecting);
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
{
|
|
3766
|
+
rootMargin: "128px 0px"
|
|
3767
|
+
}
|
|
3768
|
+
) : void 0, e = (s) => {
|
|
3769
|
+
if (s) {
|
|
3770
|
+
const n = H(s);
|
|
3771
|
+
n in i && (t?.unobserve(s), i[n]?.stopWatch(), delete i[n]);
|
|
3772
|
+
}
|
|
3773
|
+
};
|
|
3774
|
+
return {
|
|
3775
|
+
intersectionObserver: t,
|
|
3776
|
+
/**
|
|
3777
|
+
* Adding an element for tracking.
|
|
3778
|
+
*
|
|
3779
|
+
* Добавление элемента для отслеживания.
|
|
3780
|
+
* @param element element for tracking/ элемента для отслеживания
|
|
3781
|
+
*/
|
|
3782
|
+
addLazyItem(s) {
|
|
3783
|
+
const n = W(!t);
|
|
3784
|
+
if (t) {
|
|
3785
|
+
const a = p(s, (o, u) => {
|
|
3786
|
+
if (u && t.unobserve(u), s.value) {
|
|
3787
|
+
const h = H(s.value);
|
|
3788
|
+
i[h] = {
|
|
3789
|
+
status: n,
|
|
3790
|
+
stopWatch: a
|
|
3791
|
+
}, t.observe(s.value);
|
|
3792
|
+
} else
|
|
3793
|
+
e(s.value);
|
|
3794
|
+
}, { immediate: !0 });
|
|
3795
|
+
}
|
|
3796
|
+
return n;
|
|
3797
|
+
},
|
|
3798
|
+
/**
|
|
3799
|
+
* Removing an element from tracking.
|
|
3800
|
+
*
|
|
3801
|
+
* Удаление элемента из отслеживания.
|
|
3802
|
+
*/
|
|
3803
|
+
removeLazyItem: e,
|
|
3804
|
+
/**
|
|
3805
|
+
* Removing all elements from tracking.
|
|
3806
|
+
*
|
|
3807
|
+
* Удаление всех элементов из отслеживания.
|
|
3808
|
+
*/
|
|
3809
|
+
disconnectLazy: () => t?.disconnect()
|
|
3810
|
+
};
|
|
3811
|
+
};
|
|
3812
|
+
function Fe() {
|
|
3813
|
+
const i = W(ht.is());
|
|
3814
|
+
return ht.registrationEvent(({ detail: t }) => {
|
|
3815
|
+
i.value = t.loading;
|
|
3816
|
+
}), i;
|
|
3817
|
+
}
|
|
3818
|
+
function xe(i, t) {
|
|
3819
|
+
if (i in tt)
|
|
3820
|
+
return tt[i];
|
|
3821
|
+
const e = new Y(i, !0), s = $(e.get(t));
|
|
3822
|
+
return p(s, (n) => e.set(n)), tt[i] = s, s;
|
|
3823
|
+
}
|
|
3824
|
+
const tt = {};
|
|
3825
|
+
function Ee(i, t, e) {
|
|
3826
|
+
if (i in et)
|
|
3827
|
+
return et[i];
|
|
3828
|
+
const s = new Y(i), n = $(s.get(t, e));
|
|
3829
|
+
return p(n, (a) => s.set(a)), et[i] = n, n;
|
|
3830
|
+
}
|
|
3831
|
+
const et = {};
|
|
3832
|
+
function re(i) {
|
|
3833
|
+
const t = W(z.getListSync(i, !0)), e = async () => {
|
|
3834
|
+
t.value = { ...await z.getList(i) };
|
|
3835
|
+
};
|
|
3836
|
+
p(wt.getLanguage(), e);
|
|
3837
|
+
for (const s in t.value)
|
|
3838
|
+
if (t.value[s] === s || t.value[s] === " ") {
|
|
3839
|
+
e().then();
|
|
3840
|
+
break;
|
|
3841
|
+
}
|
|
3842
|
+
return t;
|
|
3843
|
+
}
|
|
3844
|
+
const Re = (i) => re(i);
|
|
3845
|
+
function Oe(i) {
|
|
3846
|
+
return nt(i) ? i.trim() : ct(i) && i.findIndex((t) => m(t)) === -1 ? i.join(",") : m(i) ? JSON.stringify(i) : i === !0 ? "1" : i === !1 ? "0" : i?.toString() ?? "";
|
|
3847
|
+
}
|
|
3848
|
+
function ne(i, t) {
|
|
3849
|
+
return Array(t).fill(i);
|
|
3850
|
+
}
|
|
3851
|
+
function We(i) {
|
|
3852
|
+
if (d())
|
|
3853
|
+
return document.querySelector(i) ?? void 0;
|
|
3854
|
+
}
|
|
3855
|
+
function Pe(i) {
|
|
3856
|
+
if (d())
|
|
3857
|
+
return document.querySelectorAll(i);
|
|
3858
|
+
}
|
|
3859
|
+
function je(i) {
|
|
3860
|
+
i.preventDefault(), i.stopPropagation();
|
|
3861
|
+
}
|
|
3862
|
+
const Dt = [], ae = G(1e5, 999999);
|
|
3863
|
+
function He(i, t = !0, e = !1, s = !0) {
|
|
3864
|
+
let n;
|
|
3865
|
+
const a = `__execute_use${ae}::${H()}`, o = (...u) => {
|
|
3866
|
+
if (!e && s) {
|
|
3867
|
+
const h = Wt(a, void 0);
|
|
3868
|
+
if (h)
|
|
3869
|
+
return h;
|
|
3870
|
+
{
|
|
3871
|
+
let l = Object.freeze(i(...u));
|
|
3872
|
+
return Pt(a, l), t && st(() => {
|
|
3873
|
+
l = void 0;
|
|
3874
|
+
}), l;
|
|
3875
|
+
}
|
|
3876
|
+
} else n || (n = Object.freeze(i(...u)), t && st(() => {
|
|
3877
|
+
n = void 0;
|
|
3878
|
+
}));
|
|
3879
|
+
return n;
|
|
3880
|
+
};
|
|
3881
|
+
return e && Dt.push(o), o;
|
|
3882
|
+
}
|
|
3883
|
+
function Ge() {
|
|
3884
|
+
Dt.forEach((i) => i());
|
|
3885
|
+
}
|
|
3886
|
+
function oe(i, t, e) {
|
|
3887
|
+
const s = () => {
|
|
3888
|
+
i(), t?.() ? oe(i, t, e) : e?.();
|
|
3889
|
+
};
|
|
3890
|
+
d() ? requestAnimationFrame(s) : s();
|
|
3891
|
+
}
|
|
3892
|
+
function ze(i) {
|
|
3893
|
+
const t = {}, e = K(i);
|
|
3894
|
+
if (e)
|
|
3895
|
+
for (const s of e.attributes)
|
|
3896
|
+
t[s.name] = (s?.value || s?.textContent) ?? void 0;
|
|
3897
|
+
return t;
|
|
3898
|
+
}
|
|
3899
|
+
async function Ue(i) {
|
|
3900
|
+
return i?.clipboardData?.getData("text") ?? (await navigator.clipboard.readText() || "");
|
|
3901
|
+
}
|
|
3902
|
+
function ce(i, t) {
|
|
3903
|
+
const e = t.split(".", 2), s = e[0];
|
|
3904
|
+
return s && i?.[s] && C(i[s]) && e?.[1] ? ce(i[s], e[1]) : (s && i?.[s]) ?? "";
|
|
3905
|
+
}
|
|
3906
|
+
function Ze(i) {
|
|
3907
|
+
return i?.key ?? i?.code ?? i?.keyCode?.toString();
|
|
3908
|
+
}
|
|
3909
|
+
function kt(i) {
|
|
3910
|
+
return f(i, (t) => t.length);
|
|
3911
|
+
}
|
|
3912
|
+
function Ye(i) {
|
|
3913
|
+
return Math.max(...kt(i));
|
|
3914
|
+
}
|
|
3915
|
+
function Ke(i) {
|
|
3916
|
+
return Math.min(...kt(i));
|
|
3917
|
+
}
|
|
3918
|
+
function ue(i) {
|
|
3919
|
+
return i?.clientX || i?.targetTouches?.[0]?.clientX || i?.touches?.[0]?.clientX || 0;
|
|
3920
|
+
}
|
|
3921
|
+
function he(i) {
|
|
3922
|
+
return i?.clientY || i?.targetTouches?.[0]?.clientY || i?.touches?.[0]?.clientY || 0;
|
|
3923
|
+
}
|
|
3924
|
+
function Ve(i) {
|
|
3925
|
+
return {
|
|
3926
|
+
x: ue(i),
|
|
3927
|
+
y: he(i)
|
|
3928
|
+
};
|
|
3929
|
+
}
|
|
3930
|
+
function qe(i, t) {
|
|
3931
|
+
const e = {};
|
|
3932
|
+
return t.forEach((s) => {
|
|
3933
|
+
s in i && i[s] !== void 0 && (e[s] = i[s]);
|
|
3934
|
+
}), e;
|
|
3935
|
+
}
|
|
3936
|
+
function Je(i, t = void 0) {
|
|
3937
|
+
const e = {};
|
|
3938
|
+
return f(i, (s, n) => {
|
|
3939
|
+
s !== t && (e[n] = s);
|
|
3940
|
+
}), e;
|
|
3941
|
+
}
|
|
3942
|
+
function _e(i) {
|
|
3943
|
+
return C(i) ? i : {};
|
|
3944
|
+
}
|
|
3945
|
+
function le(i, t) {
|
|
3946
|
+
return ne(i, t).join("");
|
|
3947
|
+
}
|
|
3948
|
+
function Qe(i, t, e = "#", s = 2, n = 12) {
|
|
3949
|
+
const a = G(i, t), o = [];
|
|
3950
|
+
for (let u = 0; u < a; u++)
|
|
3951
|
+
o.push(le(e, G(s, n)));
|
|
3952
|
+
return o.join(" ");
|
|
3953
|
+
}
|
|
3954
|
+
function Xe(i, t) {
|
|
3955
|
+
const e = i ?? 0;
|
|
3956
|
+
return t > e ? 100 / (t - e) : 0;
|
|
3957
|
+
}
|
|
3958
|
+
function ts(i, t) {
|
|
3959
|
+
const e = i ?? 0;
|
|
3960
|
+
return t > e ? (t - e) / 100 : 0;
|
|
3961
|
+
}
|
|
3962
|
+
const yt = 0;
|
|
3963
|
+
function es(i, t, e) {
|
|
3964
|
+
const s = t?.closest(i);
|
|
3965
|
+
if (t && s && s.scrollHeight !== s.offsetHeight)
|
|
3966
|
+
if (e) {
|
|
3967
|
+
const n = e.getBoundingClientRect(), a = s.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
3968
|
+
s.scrollTop = t.offsetTop - (n.top - a.top) - (n.height / 2 - o.height / 2), s.scrollTop + s.offsetHeight < t.offsetTop + t.offsetHeight && (s.scrollTop = t.offsetTop + t.offsetHeight - s.offsetHeight);
|
|
3969
|
+
} else s.scrollTop > t.offsetTop ? s.scrollTop = t.offsetTop - yt : s.scrollTop + s.offsetHeight < t.offsetTop + t.offsetHeight && (s.scrollTop = t.offsetTop + t.offsetHeight - s.offsetHeight + yt);
|
|
3970
|
+
}
|
|
3971
|
+
function ss(i, t) {
|
|
3972
|
+
return i.indexOf(t) !== -1;
|
|
3973
|
+
}
|
|
3974
|
+
async function is() {
|
|
3975
|
+
if (d()) {
|
|
3976
|
+
const i = await vt.get();
|
|
3977
|
+
document.body.style.setProperty("--sys-scrollbar-offset", `${i}px`);
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
function rs(i, t) {
|
|
3981
|
+
const e = {};
|
|
3982
|
+
return m(i) && m(t) && f(i, (s, n) => {
|
|
3983
|
+
n in t && (e[n] = s);
|
|
3984
|
+
}), e;
|
|
3985
|
+
}
|
|
3986
|
+
function ns(i, t) {
|
|
3987
|
+
let e = Object.keys(i).length !== Object.keys(t).length;
|
|
3988
|
+
return e || f(i, (s, n) => {
|
|
3989
|
+
s !== t?.[n] && (e = !0);
|
|
3990
|
+
}), e;
|
|
3991
|
+
}
|
|
3992
|
+
function as(i) {
|
|
3993
|
+
switch (typeof i) {
|
|
3994
|
+
case "number":
|
|
3995
|
+
return !0;
|
|
3996
|
+
case "string":
|
|
3997
|
+
return !!i.match(/^([0-9]+|[0-9]+\.[0-9]+)$/);
|
|
3998
|
+
default:
|
|
3999
|
+
return !1;
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
function os(i, t) {
|
|
4003
|
+
const e = Math.floor(t);
|
|
4004
|
+
return i >= e && i < e + 1;
|
|
4005
|
+
}
|
|
4006
|
+
function cs(i, t) {
|
|
4007
|
+
return Array.isArray(i) ? i.every((e) => F(e, t)) : F(i, t);
|
|
4008
|
+
}
|
|
4009
|
+
function ge(i, t = {}, e = "value", s = !1) {
|
|
4010
|
+
const n = typeof t == "string", a = n ? t : e, o = n ? {} : t;
|
|
4011
|
+
return i ? i && C(i) && (a in i || s) ? rt(o, i) : rt(o, { [a]: i }) : n ? {} : { ...o };
|
|
4012
|
+
}
|
|
4013
|
+
function us(i, t = {}, e = "value") {
|
|
4014
|
+
return c(() => ge(g(i), g(t), e));
|
|
4015
|
+
}
|
|
4016
|
+
const hs = (i, t) => {
|
|
4017
|
+
const e = $();
|
|
4018
|
+
let s = !0;
|
|
4019
|
+
const n = () => {
|
|
4020
|
+
s && (jt(async () => {
|
|
4021
|
+
const a = g(await i());
|
|
4022
|
+
a !== t && (e.value = a);
|
|
4023
|
+
}), s = !1);
|
|
4024
|
+
};
|
|
4025
|
+
return c(() => (n(), e.value));
|
|
4026
|
+
};
|
|
4027
|
+
function ls(i, t) {
|
|
4028
|
+
i.value !== t && (i.value = t);
|
|
4029
|
+
}
|
|
4030
|
+
function gs(i) {
|
|
4031
|
+
let t;
|
|
4032
|
+
return c(() => (t || (t = i()), t.value));
|
|
4033
|
+
}
|
|
4034
|
+
function fe(i) {
|
|
4035
|
+
return [...new Set(i)];
|
|
4036
|
+
}
|
|
4037
|
+
function T(i, t, e = !0) {
|
|
4038
|
+
const s = x(i);
|
|
4039
|
+
return m(i) && m(t) && f(
|
|
4040
|
+
t,
|
|
4041
|
+
(n, a) => {
|
|
4042
|
+
const o = i?.[a];
|
|
4043
|
+
m(o) && m(n) ? e && Array.isArray(o) && Array.isArray(n) ? s[a] = x(fe([...o, ...n])) : s[a] = T(
|
|
4044
|
+
Array.isArray(o) ? { ...o } : o,
|
|
4045
|
+
n,
|
|
4046
|
+
e
|
|
4047
|
+
) : s[a] = m(n) ? x(n) : n;
|
|
4048
|
+
}
|
|
4049
|
+
), s;
|
|
4050
|
+
}
|
|
4051
|
+
function fs(i, t) {
|
|
4052
|
+
let e = i;
|
|
4053
|
+
return f(t, (s, n) => {
|
|
4054
|
+
e = e.replace(Ct(`[${n}]`), I(s));
|
|
4055
|
+
}), e;
|
|
4056
|
+
}
|
|
4057
|
+
function ds(i) {
|
|
4058
|
+
const t = b(i);
|
|
4059
|
+
if (t > 0) {
|
|
4060
|
+
const e = String(Math.floor(t / 60)).padStart(2, "0"), s = String(t % 60).padStart(2, "0");
|
|
4061
|
+
return `${e}:${s}`;
|
|
4062
|
+
}
|
|
4063
|
+
return "00:00";
|
|
4064
|
+
}
|
|
4065
|
+
function ms(i, t, {
|
|
4066
|
+
multiple: e = !1,
|
|
4067
|
+
maxlength: s = 0,
|
|
4068
|
+
alwaysChange: n = !0,
|
|
4069
|
+
notEmpty: a = !1
|
|
4070
|
+
}) {
|
|
4071
|
+
if (e) {
|
|
4072
|
+
if (ct(i)) {
|
|
4073
|
+
const o = i.indexOf(t), u = [...i];
|
|
4074
|
+
return o !== -1 ? (!a || u.length > 1) && u.splice(o, 1) : (!s || i.length < s) && u.push(t), u;
|
|
4075
|
+
}
|
|
4076
|
+
return i === t ? [] : i ? [i, t] : [t];
|
|
4077
|
+
}
|
|
4078
|
+
return n || i !== t ? t : i;
|
|
4079
|
+
}
|
|
4080
|
+
function ys(i, t, e) {
|
|
4081
|
+
if (m(i) && m(t)) {
|
|
4082
|
+
if (e) {
|
|
4083
|
+
let s = {}, n = !1;
|
|
4084
|
+
return f(i, (a, o) => {
|
|
4085
|
+
!n && (e === o || e === a) ? (n = !0, s = T(s, t)) : n ? s = T(s, { [o]: a }) : s[o] = m(a) ? x(a) : a;
|
|
4086
|
+
}), n ? s : T(i, t);
|
|
4087
|
+
}
|
|
4088
|
+
if (m(t))
|
|
4089
|
+
return T(i, t);
|
|
4090
|
+
}
|
|
4091
|
+
return x(i);
|
|
4092
|
+
}
|
|
4093
|
+
function ps(i) {
|
|
4094
|
+
return St(i).replace(/^([a-z])/, (t) => `${t.toUpperCase()}`);
|
|
4095
|
+
}
|
|
4096
|
+
function $s(i) {
|
|
4097
|
+
return i.toString().trim().replace(/[^\w- ]+/g, "").replace(/ +/g, "-").replace(new RegExp("(?<=[A-Z])([A-Z])", "g"), (t) => `${t.toLowerCase()}`).replace(/^[A-Z]/, (t) => t.toLowerCase()).replace(new RegExp("(?<=[\\w ])[A-Z]", "g"), (t) => `-${t.toLowerCase()}`).replace(/[A-Z]/g, (t) => t.toLowerCase());
|
|
4098
|
+
}
|
|
4099
|
+
function vs(i, t, e, s) {
|
|
4100
|
+
const n = b(i), a = b(t);
|
|
4101
|
+
return t && a < n ? `${pt(a, e, s)}+` : pt(n, e, s);
|
|
4102
|
+
}
|
|
4103
|
+
const pt = (i, t, e) => t ? new N(e).number(i) : i;
|
|
4104
|
+
function de(i, t) {
|
|
4105
|
+
return 1 / i * t;
|
|
4106
|
+
}
|
|
4107
|
+
function bs(i, t) {
|
|
4108
|
+
return de(i, t) * 100;
|
|
4109
|
+
}
|
|
4110
|
+
async function Ss(i) {
|
|
4111
|
+
if (d())
|
|
4112
|
+
try {
|
|
4113
|
+
await navigator.clipboard.writeText(i);
|
|
4114
|
+
} catch {
|
|
4115
|
+
document?.execCommand(i);
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
export {
|
|
4119
|
+
j as Api,
|
|
4120
|
+
Ls as ApiMethodItem,
|
|
4121
|
+
Gt as Cache,
|
|
4122
|
+
Ht as CacheItem,
|
|
4123
|
+
lt as CacheStatic,
|
|
4124
|
+
Zt as Cookie,
|
|
4125
|
+
Ut as CookieBlock,
|
|
4126
|
+
Y as DataStorage,
|
|
4127
|
+
ot as Datetime,
|
|
4128
|
+
we as DatetimeRef,
|
|
4129
|
+
_t as DesignAbstract,
|
|
4130
|
+
ve as DesignAsyncAbstract,
|
|
4131
|
+
Jt as DesignChanged,
|
|
4132
|
+
be as DesignComp,
|
|
4133
|
+
bt as DesignComponents,
|
|
4134
|
+
Se as DesignConstructorAbstract,
|
|
4135
|
+
Bt as EventItem,
|
|
4136
|
+
Ce as EventRef,
|
|
4137
|
+
r as GEO_FLAG_ICON_NAME,
|
|
4138
|
+
y as Geo,
|
|
4139
|
+
E as GeoFlag,
|
|
4140
|
+
Le as GeoFlagRef,
|
|
4141
|
+
N as GeoIntl,
|
|
4142
|
+
se as GeoIntlRef,
|
|
4143
|
+
ft as GeoPhone,
|
|
4144
|
+
wt as GeoRef,
|
|
4145
|
+
$e as Global,
|
|
4146
|
+
R as Hash,
|
|
4147
|
+
Ds as Icons,
|
|
4148
|
+
Lt as ListDataRef,
|
|
4149
|
+
ht as Loading,
|
|
4150
|
+
De as RouterItemRef,
|
|
4151
|
+
vt as ScrollbarWidth,
|
|
4152
|
+
ke as ScrollbarWidthRef,
|
|
4153
|
+
z as Translate,
|
|
4154
|
+
Oe as anyToString,
|
|
4155
|
+
qt as applyTemplate,
|
|
4156
|
+
ne as arrFill,
|
|
4157
|
+
x as copyObject,
|
|
4158
|
+
dt as createElement,
|
|
4159
|
+
We as domQuerySelector,
|
|
4160
|
+
Pe as domQuerySelectorAll,
|
|
4161
|
+
je as eventStopPropagation,
|
|
4162
|
+
I as executeFunction,
|
|
4163
|
+
ks as executePromise,
|
|
4164
|
+
He as executeUse,
|
|
4165
|
+
Ge as executeUseGlobalInit,
|
|
4166
|
+
f as forEach,
|
|
4167
|
+
oe as frame,
|
|
4168
|
+
ze as getAttributes,
|
|
4169
|
+
ge as getBind,
|
|
4170
|
+
us as getBindRef,
|
|
4171
|
+
Qt as getClassName,
|
|
4172
|
+
Ue as getClipboardData,
|
|
4173
|
+
it as getColumn,
|
|
4174
|
+
hs as getComputedAsync,
|
|
4175
|
+
K as getElement,
|
|
4176
|
+
H as getElementId,
|
|
4177
|
+
Yt as getElementItem,
|
|
4178
|
+
Ms as getElementOrWindow,
|
|
4179
|
+
Ct as getExp,
|
|
4180
|
+
Xt as getIndexForRender,
|
|
4181
|
+
ce as getItemByPath,
|
|
4182
|
+
Ze as getKey,
|
|
4183
|
+
kt as getLengthOfAllArray,
|
|
4184
|
+
Ye as getMaxLengthAllArray,
|
|
4185
|
+
Ke as getMinLengthAllArray,
|
|
4186
|
+
Ve as getMouseClient,
|
|
4187
|
+
ue as getMouseClientX,
|
|
4188
|
+
he as getMouseClientY,
|
|
4189
|
+
qe as getObjectByKeys,
|
|
4190
|
+
Je as getObjectNoUndefined,
|
|
4191
|
+
_e as getObjectOrNone,
|
|
4192
|
+
Qe as getRandomText,
|
|
4193
|
+
g as getRef,
|
|
4194
|
+
Tt as getRequestString,
|
|
4195
|
+
Xe as getStepPercent,
|
|
4196
|
+
ts as getStepValue,
|
|
4197
|
+
es as goScroll,
|
|
4198
|
+
ss as inArray,
|
|
4199
|
+
is as initScrollbarOffset,
|
|
4200
|
+
rs as intersectKey,
|
|
4201
|
+
ct as isArray,
|
|
4202
|
+
ns as isDifferent,
|
|
4203
|
+
d as isDomRuntime,
|
|
4204
|
+
O as isFilled,
|
|
4205
|
+
as as isFloat,
|
|
4206
|
+
As as isFunction,
|
|
4207
|
+
Is as isInDom,
|
|
4208
|
+
os as isIntegerBetween,
|
|
4209
|
+
Nt as isNull,
|
|
4210
|
+
Ns as isNumber,
|
|
4211
|
+
m as isObject,
|
|
4212
|
+
C as isObjectNotArray,
|
|
4213
|
+
F as isSelected,
|
|
4214
|
+
cs as isSelectedByList,
|
|
4215
|
+
nt as isString,
|
|
4216
|
+
Ts as isWindow,
|
|
4217
|
+
G as random,
|
|
4218
|
+
te as render,
|
|
4219
|
+
T as replaceRecursive,
|
|
4220
|
+
fs as replaceTemplate,
|
|
4221
|
+
ds as secondToTime,
|
|
4222
|
+
Ae as setApiRefGlobalConditions,
|
|
4223
|
+
Kt as setElementItem,
|
|
4224
|
+
ls as setRef,
|
|
4225
|
+
ms as setValues,
|
|
4226
|
+
ys as splice,
|
|
4227
|
+
le as strFill,
|
|
4228
|
+
Re as t,
|
|
4229
|
+
B as toArray,
|
|
4230
|
+
rt as toBind,
|
|
4231
|
+
ee as toBinds,
|
|
4232
|
+
St as toCamelCase,
|
|
4233
|
+
ps as toCamelCaseFirst,
|
|
4234
|
+
gs as toComputed,
|
|
4235
|
+
S as toDate,
|
|
4236
|
+
$s as toKebabCase,
|
|
4237
|
+
b as toNumber,
|
|
4238
|
+
vs as toNumberByMax,
|
|
4239
|
+
de as toPercent,
|
|
4240
|
+
bs as toPercentBy100,
|
|
4241
|
+
w as toRefItem,
|
|
4242
|
+
$t as transformation,
|
|
4243
|
+
fe as uniqueArray,
|
|
4244
|
+
Me as useApiRef,
|
|
4245
|
+
Ie as useCookieRef,
|
|
4246
|
+
Ne as useGeoIntlRef,
|
|
4247
|
+
Te as useHashRef,
|
|
4248
|
+
Be as useLazyRef,
|
|
4249
|
+
Fe as useLoadingRef,
|
|
4250
|
+
xe as useSessionRef,
|
|
4251
|
+
Ee as useStorageRef,
|
|
4252
|
+
re as useTranslateRef,
|
|
4253
|
+
Ss as writeClipboardData
|
|
4254
|
+
};
|