hrenpack_js 3.4.3 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +189 -2191
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // @ts-nocheck
2
- // ===== File: arraywork.js =====
3
2
  "use strict";
4
3
  function arrayIsEmpty(arr) {
5
4
  return arr.length === 0 || !arr[0];
@@ -17,15 +16,9 @@ function arraysIsEqual(array1, array2, strict = true) {
17
16
  return true;
18
17
  }
19
18
  }
20
- //# sourceMappingURL=arraywork.js.map
21
19
 
22
- // ===== File: auto.js =====
23
- "use strict";
24
20
  const stylesRoot = getComputedStyle(document.documentElement);
25
- //# sourceMappingURL=auto.js.map
26
21
 
27
- // ===== File: classes.js =====
28
- "use strict";
29
22
  class ClickableLinksFactory {
30
23
  constructor() {
31
24
  Object.defineProperty(this, "urlRegex", {
@@ -127,10 +120,7 @@ class GETParamsManager {
127
120
  window.history.pushState({}, '', newUrl);
128
121
  }
129
122
  }
130
- //# sourceMappingURL=classes.js.map
131
123
 
132
- // ===== File: compiler.js =====
133
- "use strict";
134
124
  function downloadTextAsFile(filename, text) {
135
125
  const blob = new Blob([text], { type: 'text/plain' });
136
126
  const url = URL.createObjectURL(blob);
@@ -141,10 +131,7 @@ function downloadTextAsFile(filename, text) {
141
131
  a.click();
142
132
  URL.revokeObjectURL(url);
143
133
  }
144
- //# sourceMappingURL=compiler.js.map
145
134
 
146
- // ===== File: cookie.js =====
147
- "use strict";
148
135
  function getCookie(name) {
149
136
  const nameEQ = `${name}=`;
150
137
  const cookiesArray = document.cookie.split(';');
@@ -168,2181 +155,217 @@ function setCookie(name, value, days = null, path = '/') {
168
155
  }
169
156
  document.cookie = `${name}=${value || ''}${expires}; path=${path}`;
170
157
  }
171
- function hasCookie(name) {
172
- return getCookie(name) != null;
173
- }
174
- //# sourceMappingURL=cookie.js.map
175
-
176
- // ===== File: datework.js =====
177
- "use strict";
178
- class datetime {
179
- constructor(_year, _month, _days, _hours, _minutes, _seconds) {
180
- Object.defineProperty(this, "_year", {
181
- enumerable: true,
182
- configurable: true,
183
- writable: true,
184
- value: _year
185
- });
186
- Object.defineProperty(this, "_month", {
187
- enumerable: true,
188
- configurable: true,
189
- writable: true,
190
- value: _month
191
- });
192
- Object.defineProperty(this, "_days", {
193
- enumerable: true,
194
- configurable: true,
195
- writable: true,
196
- value: _days
197
- });
198
- Object.defineProperty(this, "_hours", {
199
- enumerable: true,
200
- configurable: true,
201
- writable: true,
202
- value: _hours
203
- });
204
- Object.defineProperty(this, "_minutes", {
205
- enumerable: true,
206
- configurable: true,
207
- writable: true,
208
- value: _minutes
209
- });
210
- Object.defineProperty(this, "_seconds", {
211
- enumerable: true,
212
- configurable: true,
213
- writable: true,
214
- value: _seconds
215
- });
216
- Object.defineProperty(this, "date", {
217
- enumerable: true,
218
- configurable: true,
219
- writable: true,
220
- value: void 0
221
- });
222
- this.date = new Date(this._year, this._month, this._days, this._hours, this._minutes, this._seconds);
223
- }
224
- static newObject(dateObject) {
225
- return new datetime(dateObject.getFullYear(), dateObject.getMonth(), dateObject.getDate(), dateObject.getHours(), dateObject.getMinutes(), dateObject.getSeconds());
226
- }
227
- static now() {
228
- return datetime.newObject(new Date());
229
- }
230
- static fromTimestamp(timestamp) {
231
- return datetime.newObject(new Date(timestamp));
232
- }
233
- get year() { return this._year; }
234
- get month() { return this._month; }
235
- get days() { return this._days; }
236
- get hours() { return this._hours; }
237
- get minutes() { return this._minutes; }
238
- get seconds() { return this._seconds; }
239
- set year(year) { this._year = year; }
240
- set month(month) { this._month = month; }
241
- set days(days) { this._days = days; }
242
- set hours(hours) { this._hours = hours; }
243
- set minutes(minutes) { this._minutes = minutes; }
244
- set seconds(seconds) { this._seconds = seconds; }
245
- timestamp() {
246
- return this.date.getTime();
247
- }
248
- }
249
- //# sourceMappingURL=datework.js.map
250
-
251
- // ===== File: exceptions.js =====
252
- "use strict";
253
- class NotAuthorizedError extends Error {
254
- constructor() {
255
- super("Пользователь не авторизован");
256
- this.name = 'NotAuthorizedError';
257
- }
258
- }
259
- //# sourceMappingURL=exceptions.js.map
260
-
261
- // ===== File: get_element_types.js =====
262
- "use strict";
263
- function button_submit(parent) {
264
- const buttons = parent.querySelectorAll('button');
265
- let submit = null;
266
- buttons.forEach(button => {
267
- if (button.type === 'submit')
268
- submit = button;
269
- });
270
- return submit;
271
- }
272
- //# sourceMappingURL=get_element_types.js.map
273
-
274
- // ===== File: html.js =====
275
- "use strict";
276
- const escapeChars = {
277
- '<': '&lt;',
278
- '>': '&gt;',
279
- '&': '&amp;',
280
- '"': '&quot;',
281
- "'": '&#39;'
282
- };
283
- function togglePassword(passwordInput) {
284
- const passwordType = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
285
- passwordInput.setAttribute('type', passwordType);
286
- }
287
- function isTextWrapped(element) {
288
- const elementHeight = element.clientHeight;
289
- const scrollHeight = element.scrollHeight;
290
- return scrollHeight > elementHeight;
291
- }
292
- function notArrayEmpty(array) {
293
- return array.length > 0;
294
- }
295
- function get_tagName(element) {
296
- return element.tagName.toLowerCase();
297
- }
298
- function element_toHTMLText(element) {
299
- const tag = get_tagName(element);
300
- const attrs = element.attributes;
301
- let text = `<${tag}`;
302
- if (attrs.length > 0) {
303
- for (let attr of attrs) {
304
- text += ` ${attr.name}="${attr.value}"`;
305
- }
306
- }
307
- text += `>${element.innerHTML}</${tag}>`;
308
- return text;
309
- }
310
- function element_to_div(element) {
311
- const div = document.createElement('div');
312
- div.innerHTML = element.outerHTML;
313
- return div;
314
- }
315
- function password_format(shownPasswordHTML, hiddenPasswordHTML) {
316
- document.addEventListener('DOMContentLoaded', () => {
317
- const forms = document.querySelectorAll('form');
318
- forms.forEach(form => {
319
- const inputs = form.querySelectorAll('input[type="password"]');
320
- inputs.forEach(input => {
321
- const wrapper = document.createElement('div');
322
- wrapper.style.position = 'relative';
323
- wrapper.style.display = 'inline-block';
324
- wrapper.style.width = '100%';
325
- input.parentNode.insertBefore(wrapper, input);
326
- wrapper.appendChild(input);
327
- const toggleBtn = document.createElement('button');
328
- toggleBtn.type = 'button';
329
- toggleBtn.className = 'show-password-btn';
330
- toggleBtn.innerHTML = hiddenPasswordHTML;
331
- toggleBtn.style.cssText = `
332
- position: absolute;
333
- left: 45%;
334
- top: 50%;
335
- transform: translateY(-50%);
336
- cursor: pointer;
337
- user-select: none;
338
- background: none;
339
- border: none;
340
- padding: 0;
341
- `;
342
- toggleBtn.addEventListener('click', () => {
343
- const isShowing = input.type === 'text';
344
- input.type = isShowing ? 'password' : 'text';
345
- toggleBtn.innerHTML = isShowing ? hiddenPasswordHTML : shownPasswordHTML;
346
- });
347
- wrapper.appendChild(toggleBtn);
348
- });
349
- });
350
- });
351
- }
352
- function escapeHTML(html) {
353
- return html.replace(/[<>"']/g, function (i) {
354
- return escapeChars[i] || i;
355
- });
356
- }
357
- function strFormat(template, ...args) {
358
- return template.replace(/{(\w+)}/g, (match, key) => {
359
- if (args.length > 0 && typeof args[0] === 'object' && args[0][key] !== undefined) {
360
- return args[0][key];
361
- }
362
- const index = parseInt(key);
363
- if (!isNaN(index) && args[index] !== undefined) {
364
- return args[index];
365
- }
366
- return match;
367
- });
368
- }
369
- function elementToHyperlink(element, href, cursorPointer = true, preventDefault = false) {
370
- element.addEventListener('click', function (elem) {
371
- if (elem.button === 0)
372
- window.location.href = href;
373
- else if (elem.button === 1)
374
- window.open(href, '_blank');
375
- });
376
- if (preventDefault) {
377
- element.addEventListener('auxclick', function (elem) {
378
- if (elem.button === 1)
379
- elem.preventDefault();
380
- });
381
- }
382
- if (cursorPointer)
383
- element.style.cursor = 'pointer';
384
- return element;
385
- }
386
- //# sourceMappingURL=html.js.map
387
-
388
- // ===== File: index.js =====
389
- // @ts-nocheck
390
-
391
- // ===== File: arraywork.js =====
392
- "use strict";
393
- function arrayIsEmpty(arr) {
394
- return arr.length === 0 || !arr[0];
395
- }
396
- function arraysIsEqual(array1, array2, strict = true) {
397
- if (array1.length !== array2.length)
398
- return false;
399
- if (strict)
400
- return array1.every((value, index) => value === array2[index]);
401
- else {
402
- array1.forEach(element => {
403
- if (!array2.includes(element))
404
- return false;
405
- });
406
- return true;
407
- }
408
- }
409
- //# sourceMappingURL=arraywork.js.map
410
-
411
- // ===== File: auto.js =====
412
- "use strict";
413
- const stylesRoot = getComputedStyle(document.documentElement);
414
- //# sourceMappingURL=auto.js.map
415
-
416
- // ===== File: classes.js =====
417
- "use strict";
418
- class ClickableLinksFactory {
419
- constructor() {
420
- Object.defineProperty(this, "urlRegex", {
421
- enumerable: true,
422
- configurable: true,
423
- writable: true,
424
- value: /(https?:\/\/[^\s]+)/g
425
- });
426
- }
427
- walk(node, isClickToCopy) {
428
- if (node.nodeType === Node.TEXT_NODE) {
429
- const text = node.textContent || '';
430
- const func = isClickToCopy ? this.get_clickToCopy : this.get_anchor;
431
- if (this.urlRegex.test(text)) {
432
- const parent = node.parentNode;
433
- const newContent = text.replace(this.urlRegex, url => {
434
- return func(url);
435
- });
436
- if (!parent)
437
- return;
438
- const tempDiv = document.createElement('div');
439
- tempDiv.innerHTML = newContent;
440
- while (tempDiv.firstChild) {
441
- parent.insertBefore(tempDiv.firstChild, node);
442
- }
443
- parent.removeChild(node);
444
- }
445
- }
446
- else {
447
- node.childNodes.forEach(child => {
448
- this.walk(child, isClickToCopy);
449
- });
450
- }
451
- }
452
- get_anchor(url) {
453
- return `<a href="${url}" target="_blank" rel="noopener noreferrer" data-clf-generated>${url}</a>`;
454
- }
455
- get_clickToCopy(url) {
456
- return `<click-to-copy data-clf-generated>${url}</click-to-copy>`;
457
- }
458
- clickableLinks(element) {
459
- this.walk(element, false);
460
- }
461
- clickToCopyLinks(element) {
462
- this.walk(element, true);
463
- }
464
- get generatedElements() {
465
- return document.querySelectorAll('[data-clf-generated]');
466
- }
467
- }
468
- class GETParamsManager {
469
- constructor() {
470
- Object.defineProperty(this, "params", {
471
- enumerable: true,
472
- configurable: true,
473
- writable: true,
474
- value: void 0
475
- });
476
- this.params = new URLSearchParams(window.location.search);
477
- }
478
- get(key, defaultValue) {
479
- const value = this.params.get(key);
480
- if (value === null)
481
- return defaultValue || null;
482
- if (defaultValue !== undefined) {
483
- switch (typeof defaultValue) {
484
- case 'number':
485
- return Number(value);
486
- case 'boolean':
487
- return (value === 'true');
488
- default:
489
- return value;
490
- }
491
- }
492
- return value;
493
- }
494
- set(key, value) {
495
- this.params.set(key, String(value));
496
- this.updateURL();
497
- }
498
- delete(key) {
499
- this.params.delete(key);
500
- this.updateURL();
501
- }
502
- all() {
503
- const result = {};
504
- for (const [key, value] of this.params.entries()) {
505
- result[key] = value;
506
- }
507
- return result;
508
- }
509
- clear() {
510
- const keys = Array.from(this.params.keys());
511
- keys.forEach(key => this.params.delete(key));
512
- this.updateURL();
513
- }
514
- updateURL() {
515
- const newUrl = `${window.location.pathname}?${this.params.toString()}`;
516
- window.history.pushState({}, '', newUrl);
517
- }
518
- }
519
- //# sourceMappingURL=classes.js.map
520
-
521
- // ===== File: compiler.js =====
522
- "use strict";
523
- function downloadTextAsFile(filename, text) {
524
- const blob = new Blob([text], { type: 'text/plain' });
525
- const url = URL.createObjectURL(blob);
526
- console.log(url);
527
- const a = document.createElement('a');
528
- a.href = url;
529
- a.download = filename;
530
- a.click();
531
- URL.revokeObjectURL(url);
532
- }
533
- //# sourceMappingURL=compiler.js.map
534
-
535
- // ===== File: cookie.js =====
536
- "use strict";
537
- function getCookie(name) {
538
- const nameEQ = `${name}=`;
539
- const cookiesArray = document.cookie.split(';');
540
- cookiesArray.forEach(cookie => {
541
- cookie = cookie.trim();
542
- if (cookie.indexOf(nameEQ) === 0) {
543
- return cookie.substring(nameEQ.length, cookie.length);
544
- }
545
- });
546
- return null;
547
- }
548
- function setCookie(name, value, days = null, path = '/') {
549
- let expires;
550
- if (!days) {
551
- expires = '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
552
- }
553
- else {
554
- const date = new Date();
555
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
556
- expires = `; expires=${date.toUTCString()}`;
557
- }
558
- document.cookie = `${name}=${value || ''}${expires}; path=${path}`;
559
- }
560
- function hasCookie(name) {
561
- return getCookie(name) != null;
562
- }
563
- //# sourceMappingURL=cookie.js.map
564
-
565
- // ===== File: datework.js =====
566
- "use strict";
567
- class datetime {
568
- constructor(_year, _month, _days, _hours, _minutes, _seconds) {
569
- Object.defineProperty(this, "_year", {
570
- enumerable: true,
571
- configurable: true,
572
- writable: true,
573
- value: _year
574
- });
575
- Object.defineProperty(this, "_month", {
576
- enumerable: true,
577
- configurable: true,
578
- writable: true,
579
- value: _month
580
- });
581
- Object.defineProperty(this, "_days", {
582
- enumerable: true,
583
- configurable: true,
584
- writable: true,
585
- value: _days
586
- });
587
- Object.defineProperty(this, "_hours", {
588
- enumerable: true,
589
- configurable: true,
590
- writable: true,
591
- value: _hours
592
- });
593
- Object.defineProperty(this, "_minutes", {
594
- enumerable: true,
595
- configurable: true,
596
- writable: true,
597
- value: _minutes
598
- });
599
- Object.defineProperty(this, "_seconds", {
600
- enumerable: true,
601
- configurable: true,
602
- writable: true,
603
- value: _seconds
604
- });
605
- Object.defineProperty(this, "date", {
606
- enumerable: true,
607
- configurable: true,
608
- writable: true,
609
- value: void 0
610
- });
611
- this.date = new Date(this._year, this._month, this._days, this._hours, this._minutes, this._seconds);
612
- }
613
- static newObject(dateObject) {
614
- return new datetime(dateObject.getFullYear(), dateObject.getMonth(), dateObject.getDate(), dateObject.getHours(), dateObject.getMinutes(), dateObject.getSeconds());
615
- }
616
- static now() {
617
- return datetime.newObject(new Date());
618
- }
619
- static fromTimestamp(timestamp) {
620
- return datetime.newObject(new Date(timestamp));
621
- }
622
- get year() { return this._year; }
623
- get month() { return this._month; }
624
- get days() { return this._days; }
625
- get hours() { return this._hours; }
626
- get minutes() { return this._minutes; }
627
- get seconds() { return this._seconds; }
628
- set year(year) { this._year = year; }
629
- set month(month) { this._month = month; }
630
- set days(days) { this._days = days; }
631
- set hours(hours) { this._hours = hours; }
632
- set minutes(minutes) { this._minutes = minutes; }
633
- set seconds(seconds) { this._seconds = seconds; }
634
- timestamp() {
635
- return this.date.getTime();
636
- }
637
- }
638
- //# sourceMappingURL=datework.js.map
639
-
640
- // ===== File: exceptions.js =====
641
- "use strict";
642
- class NotAuthorizedError extends Error {
643
- constructor() {
644
- super("Пользователь не авторизован");
645
- this.name = 'NotAuthorizedError';
646
- }
647
- }
648
- //# sourceMappingURL=exceptions.js.map
649
-
650
- // ===== File: get_element_types.js =====
651
- "use strict";
652
- function button_submit(parent) {
653
- const buttons = parent.querySelectorAll('button');
654
- let submit = null;
655
- buttons.forEach(button => {
656
- if (button.type === 'submit')
657
- submit = button;
658
- });
659
- return submit;
660
- }
661
- //# sourceMappingURL=get_element_types.js.map
662
-
663
- // ===== File: html.js =====
664
- "use strict";
665
- const escapeChars = {
666
- '<': '&lt;',
667
- '>': '&gt;',
668
- '&': '&amp;',
669
- '"': '&quot;',
670
- "'": '&#39;'
671
- };
672
- function togglePassword(passwordInput) {
673
- const passwordType = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
674
- passwordInput.setAttribute('type', passwordType);
675
- }
676
- function isTextWrapped(element) {
677
- const elementHeight = element.clientHeight;
678
- const scrollHeight = element.scrollHeight;
679
- return scrollHeight > elementHeight;
680
- }
681
- function notArrayEmpty(array) {
682
- return array.length > 0;
683
- }
684
- function get_tagName(element) {
685
- return element.tagName.toLowerCase();
686
- }
687
- function element_toHTMLText(element) {
688
- const tag = get_tagName(element);
689
- const attrs = element.attributes;
690
- let text = `<${tag}`;
691
- if (attrs.length > 0) {
692
- for (let attr of attrs) {
693
- text += ` ${attr.name}="${attr.value}"`;
694
- }
695
- }
696
- text += `>${element.innerHTML}</${tag}>`;
697
- return text;
698
- }
699
- function element_to_div(element) {
700
- const div = document.createElement('div');
701
- div.innerHTML = element.outerHTML;
702
- return div;
703
- }
704
- function password_format(shownPasswordHTML, hiddenPasswordHTML) {
705
- document.addEventListener('DOMContentLoaded', () => {
706
- const forms = document.querySelectorAll('form');
707
- forms.forEach(form => {
708
- const inputs = form.querySelectorAll('input[type="password"]');
709
- inputs.forEach(input => {
710
- const wrapper = document.createElement('div');
711
- wrapper.style.position = 'relative';
712
- wrapper.style.display = 'inline-block';
713
- wrapper.style.width = '100%';
714
- input.parentNode.insertBefore(wrapper, input);
715
- wrapper.appendChild(input);
716
- const toggleBtn = document.createElement('button');
717
- toggleBtn.type = 'button';
718
- toggleBtn.className = 'show-password-btn';
719
- toggleBtn.innerHTML = hiddenPasswordHTML;
720
- toggleBtn.style.cssText = `
721
- position: absolute;
722
- left: 45%;
723
- top: 50%;
724
- transform: translateY(-50%);
725
- cursor: pointer;
726
- user-select: none;
727
- background: none;
728
- border: none;
729
- padding: 0;
730
- `;
731
- toggleBtn.addEventListener('click', () => {
732
- const isShowing = input.type === 'text';
733
- input.type = isShowing ? 'password' : 'text';
734
- toggleBtn.innerHTML = isShowing ? hiddenPasswordHTML : shownPasswordHTML;
735
- });
736
- wrapper.appendChild(toggleBtn);
737
- });
738
- });
739
- });
740
- }
741
- function escapeHTML(html) {
742
- return html.replace(/[<>"']/g, function (i) {
743
- return escapeChars[i] || i;
744
- });
745
- }
746
- function strFormat(template, ...args) {
747
- return template.replace(/{(\w+)}/g, (match, key) => {
748
- if (args.length > 0 && typeof args[0] === 'object' && args[0][key] !== undefined) {
749
- return args[0][key];
750
- }
751
- const index = parseInt(key);
752
- if (!isNaN(index) && args[index] !== undefined) {
753
- return args[index];
754
- }
755
- return match;
756
- });
757
- }
758
- function elementToHyperlink(element, href, cursorPointer = true, preventDefault = false) {
759
- element.addEventListener('click', function (elem) {
760
- if (elem.button === 0)
761
- window.location.href = href;
762
- else if (elem.button === 1)
763
- window.open(href, '_blank');
764
- });
765
- if (preventDefault) {
766
- element.addEventListener('auxclick', function (elem) {
767
- if (elem.button === 1)
768
- elem.preventDefault();
769
- });
770
- }
771
- if (cursorPointer)
772
- element.style.cursor = 'pointer';
773
- return element;
774
- }
775
- //# sourceMappingURL=html.js.map
776
-
777
- // ===== File: index.js =====
778
- // @ts-nocheck
779
-
780
- // ===== File: arraywork.js =====
781
- "use strict";
782
- function arrayIsEmpty(arr) {
783
- return arr.length === 0 || !arr[0];
784
- }
785
- function arraysIsEqual(array1, array2, strict = true) {
786
- if (array1.length !== array2.length)
787
- return false;
788
- if (strict)
789
- return array1.every((value, index) => value === array2[index]);
790
- else {
791
- array1.forEach(element => {
792
- if (!array2.includes(element))
793
- return false;
794
- });
795
- return true;
796
- }
797
- }
798
- //# sourceMappingURL=arraywork.js.map
799
-
800
- // ===== File: auto.js =====
801
- "use strict";
802
- const stylesRoot = getComputedStyle(document.documentElement);
803
- //# sourceMappingURL=auto.js.map
804
-
805
- // ===== File: classes.js =====
806
- "use strict";
807
- class ClickableLinksFactory {
808
- constructor() {
809
- Object.defineProperty(this, "urlRegex", {
810
- enumerable: true,
811
- configurable: true,
812
- writable: true,
813
- value: /(https?:\/\/[^\s]+)/g
814
- });
815
- }
816
- walk(node, isClickToCopy) {
817
- if (node.nodeType === Node.TEXT_NODE) {
818
- const text = node.textContent || '';
819
- const func = isClickToCopy ? this.get_clickToCopy : this.get_anchor;
820
- if (this.urlRegex.test(text)) {
821
- const parent = node.parentNode;
822
- const newContent = text.replace(this.urlRegex, url => {
823
- return func(url);
824
- });
825
- if (!parent)
826
- return;
827
- const tempDiv = document.createElement('div');
828
- tempDiv.innerHTML = newContent;
829
- while (tempDiv.firstChild) {
830
- parent.insertBefore(tempDiv.firstChild, node);
831
- }
832
- parent.removeChild(node);
833
- }
834
- }
835
- else {
836
- node.childNodes.forEach(child => {
837
- this.walk(child, isClickToCopy);
838
- });
839
- }
840
- }
841
- get_anchor(url) {
842
- return `<a href="${url}" target="_blank" rel="noopener noreferrer" data-clf-generated>${url}</a>`;
843
- }
844
- get_clickToCopy(url) {
845
- return `<click-to-copy data-clf-generated>${url}</click-to-copy>`;
846
- }
847
- clickableLinks(element) {
848
- this.walk(element, false);
849
- }
850
- clickToCopyLinks(element) {
851
- this.walk(element, true);
852
- }
853
- get generatedElements() {
854
- return document.querySelectorAll('[data-clf-generated]');
855
- }
856
- }
857
- class GETParamsManager {
858
- constructor() {
859
- Object.defineProperty(this, "params", {
860
- enumerable: true,
861
- configurable: true,
862
- writable: true,
863
- value: void 0
864
- });
865
- this.params = new URLSearchParams(window.location.search);
866
- }
867
- get(key, defaultValue) {
868
- const value = this.params.get(key);
869
- if (value === null)
870
- return defaultValue || null;
871
- if (defaultValue !== undefined) {
872
- switch (typeof defaultValue) {
873
- case 'number':
874
- return Number(value);
875
- case 'boolean':
876
- return (value === 'true');
877
- default:
878
- return value;
879
- }
880
- }
881
- return value;
882
- }
883
- set(key, value) {
884
- this.params.set(key, String(value));
885
- this.updateURL();
886
- }
887
- delete(key) {
888
- this.params.delete(key);
889
- this.updateURL();
890
- }
891
- all() {
892
- const result = {};
893
- for (const [key, value] of this.params.entries()) {
894
- result[key] = value;
895
- }
896
- return result;
897
- }
898
- clear() {
899
- const keys = Array.from(this.params.keys());
900
- keys.forEach(key => this.params.delete(key));
901
- this.updateURL();
902
- }
903
- updateURL() {
904
- const newUrl = `${window.location.pathname}?${this.params.toString()}`;
905
- window.history.pushState({}, '', newUrl);
906
- }
907
- }
908
- //# sourceMappingURL=classes.js.map
909
-
910
- // ===== File: compiler.js =====
911
- "use strict";
912
- function downloadTextAsFile(filename, text) {
913
- const blob = new Blob([text], { type: 'text/plain' });
914
- const url = URL.createObjectURL(blob);
915
- console.log(url);
916
- const a = document.createElement('a');
917
- a.href = url;
918
- a.download = filename;
919
- a.click();
920
- URL.revokeObjectURL(url);
921
- }
922
- //# sourceMappingURL=compiler.js.map
923
-
924
- // ===== File: cookie.js =====
925
- "use strict";
926
- function getCookie(name) {
927
- const nameEQ = `${name}=`;
928
- const cookiesArray = document.cookie.split(';');
929
- cookiesArray.forEach(cookie => {
930
- cookie = cookie.trim();
931
- if (cookie.indexOf(nameEQ) === 0) {
932
- return cookie.substring(nameEQ.length, cookie.length);
933
- }
934
- });
935
- return null;
936
- }
937
- function setCookie(name, value, days = null, path = '/') {
938
- let expires;
939
- if (!days) {
940
- expires = '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
941
- }
942
- else {
943
- const date = new Date();
944
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
945
- expires = `; expires=${date.toUTCString()}`;
946
- }
947
- document.cookie = `${name}=${value || ''}${expires}; path=${path}`;
948
- }
949
- function hasCookie(name) {
950
- return getCookie(name) != null;
951
- }
952
- //# sourceMappingURL=cookie.js.map
953
-
954
- // ===== File: exceptions.js =====
955
- "use strict";
956
- class NotAuthorizedError extends Error {
957
- constructor() {
958
- super("Пользователь не авторизован");
959
- this.name = 'NotAuthorizedError';
960
- }
961
- }
962
- //# sourceMappingURL=exceptions.js.map
963
-
964
- // ===== File: get_element_types.js =====
965
- "use strict";
966
- function button_submit(parent) {
967
- const buttons = parent.querySelectorAll('button');
968
- let submit = null;
969
- buttons.forEach(button => {
970
- if (button.type === 'submit')
971
- submit = button;
972
- });
973
- return submit;
974
- }
975
- //# sourceMappingURL=get_element_types.js.map
976
-
977
- // ===== File: html.js =====
978
- "use strict";
979
- const escapeChars = {
980
- '<': '&lt;',
981
- '>': '&gt;',
982
- '&': '&amp;',
983
- '"': '&quot;',
984
- "'": '&#39;'
985
- };
986
- function togglePassword(passwordInput) {
987
- const passwordType = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
988
- passwordInput.setAttribute('type', passwordType);
989
- }
990
- function isTextWrapped(element) {
991
- const elementHeight = element.clientHeight;
992
- const scrollHeight = element.scrollHeight;
993
- return scrollHeight > elementHeight;
994
- }
995
- function notArrayEmpty(array) {
996
- return array.length > 0;
997
- }
998
- function get_tagName(element) {
999
- return element.tagName.toLowerCase();
1000
- }
1001
- function element_toHTMLText(element) {
1002
- const tag = get_tagName(element);
1003
- const attrs = element.attributes;
1004
- let text = `<${tag}`;
1005
- if (attrs.length > 0) {
1006
- for (let attr of attrs) {
1007
- text += ` ${attr.name}="${attr.value}"`;
1008
- }
1009
- }
1010
- text += `>${element.innerHTML}</${tag}>`;
1011
- return text;
1012
- }
1013
- function element_to_div(element) {
1014
- const div = document.createElement('div');
1015
- div.innerHTML = element.outerHTML;
1016
- return div;
1017
- }
1018
- function password_format(shownPasswordHTML, hiddenPasswordHTML) {
1019
- document.addEventListener('DOMContentLoaded', () => {
1020
- const forms = document.querySelectorAll('form');
1021
- forms.forEach(form => {
1022
- const inputs = form.querySelectorAll('input[type="password"]');
1023
- inputs.forEach(input => {
1024
- const wrapper = document.createElement('div');
1025
- wrapper.style.position = 'relative';
1026
- wrapper.style.display = 'inline-block';
1027
- wrapper.style.width = '100%';
1028
- input.parentNode.insertBefore(wrapper, input);
1029
- wrapper.appendChild(input);
1030
- const toggleBtn = document.createElement('button');
1031
- toggleBtn.type = 'button';
1032
- toggleBtn.className = 'show-password-btn';
1033
- toggleBtn.innerHTML = hiddenPasswordHTML;
1034
- toggleBtn.style.cssText = `
1035
- position: absolute;
1036
- left: 45%;
1037
- top: 50%;
1038
- transform: translateY(-50%);
1039
- cursor: pointer;
1040
- user-select: none;
1041
- background: none;
1042
- border: none;
1043
- padding: 0;
1044
- `;
1045
- toggleBtn.addEventListener('click', () => {
1046
- const isShowing = input.type === 'text';
1047
- input.type = isShowing ? 'password' : 'text';
1048
- toggleBtn.innerHTML = isShowing ? hiddenPasswordHTML : shownPasswordHTML;
1049
- });
1050
- wrapper.appendChild(toggleBtn);
1051
- });
1052
- });
1053
- });
1054
- }
1055
- function escapeHTML(html) {
1056
- return html.replace(/[<>"']/g, function (i) {
1057
- return escapeChars[i] || i;
1058
- });
1059
- }
1060
- function strFormat(template, ...args) {
1061
- return template.replace(/{(\w+)}/g, (match, key) => {
1062
- if (args.length > 0 && typeof args[0] === 'object' && args[0][key] !== undefined) {
1063
- return args[0][key];
1064
- }
1065
- const index = parseInt(key);
1066
- if (!isNaN(index) && args[index] !== undefined) {
1067
- return args[index];
1068
- }
1069
- return match;
1070
- });
1071
- }
1072
- function elementToHyperlink(element, href, cursorPointer = true, preventDefault = false) {
1073
- element.addEventListener('click', function (elem) {
1074
- if (elem.button === 0)
1075
- window.location.href = href;
1076
- else if (elem.button === 1)
1077
- window.open(href, '_blank');
1078
- });
1079
- if (preventDefault) {
1080
- element.addEventListener('auxclick', function (elem) {
1081
- if (elem.button === 1)
1082
- elem.preventDefault();
1083
- });
1084
- }
1085
- if (cursorPointer)
1086
- element.style.cursor = 'pointer';
1087
- return element;
1088
- }
1089
- //# sourceMappingURL=html.js.map
1090
-
1091
- // ===== File: input.js =====
1092
- "use strict";
1093
- function getInputCursorPosition(input) {
1094
- const start = input.selectionStart;
1095
- if (start == null)
1096
- throw new Error("Incorrect input type");
1097
- return start - 1;
1098
- }
1099
- function copyInputToClipboard(input) {
1100
- const disabled = input.hasAttribute("disabled");
1101
- if (disabled)
1102
- input.removeAttribute('disabled');
1103
- navigator.clipboard.writeText(input.value)
1104
- .then(() => { })
1105
- .catch(err => {
1106
- console.error('Не удалось скопировать текст: ', err);
1107
- })
1108
- .finally(() => {
1109
- if (disabled)
1110
- input.setAttribute('disabled', '');
1111
- });
1112
- }
1113
- function clearInput_and_addLastSymbol(input) {
1114
- input.value = input.value[getInputCursorPosition(input)] || '';
1115
- }
1116
- function getInputLabel(input) {
1117
- const label = document.querySelector(`label[for="${input.id}"]`);
1118
- if (!label)
1119
- throw new Error("Label не найден. Возможно, вы не использовали атрибут for в нем");
1120
- return label;
1121
- }
1122
- //# sourceMappingURL=input.js.map
1123
-
1124
- // ===== File: link.js =====
1125
- "use strict";
1126
- function loadCSS(href) {
1127
- const link = document.createElement('link');
1128
- link.rel = 'stylesheet';
1129
- link.type = 'text/css';
1130
- link.href = href;
1131
- document.head.appendChild(link);
1132
- }
1133
- //# sourceMappingURL=link.js.map
1134
-
1135
- // ===== File: notifications.js =====
1136
- "use strict";
1137
- function pushNotification(title = "Уведомление", body = "Текст уведомления", icon = null) {
1138
- if (Notification.permission !== "granted") {
1139
- Notification.requestPermission().then(permission => {
1140
- if (permission === "granted") {
1141
- if (icon)
1142
- new Notification(title, { body: body, icon: icon });
1143
- else
1144
- new Notification(title, { body: body });
1145
- }
1146
- });
1147
- }
1148
- else {
1149
- if (icon)
1150
- new Notification(title, { body: body, icon: icon });
1151
- else
1152
- new Notification(title, { body: body });
1153
- }
1154
- }
1155
- class HyperTextNotification {
1156
- constructor({ bottom = '20', right = '20', backgroundColor = '#121212', color = '#ededed', padding = '15', borderRadius = '5', timeout = 3 } = {}) {
1157
- Object.defineProperty(this, "bottom", {
1158
- enumerable: true,
1159
- configurable: true,
1160
- writable: true,
1161
- value: void 0
1162
- });
1163
- Object.defineProperty(this, "right", {
1164
- enumerable: true,
1165
- configurable: true,
1166
- writable: true,
1167
- value: void 0
1168
- });
1169
- Object.defineProperty(this, "backgroundColor", {
1170
- enumerable: true,
1171
- configurable: true,
1172
- writable: true,
1173
- value: void 0
1174
- });
1175
- Object.defineProperty(this, "color", {
1176
- enumerable: true,
1177
- configurable: true,
1178
- writable: true,
1179
- value: void 0
1180
- });
1181
- Object.defineProperty(this, "padding", {
1182
- enumerable: true,
1183
- configurable: true,
1184
- writable: true,
1185
- value: void 0
1186
- });
1187
- Object.defineProperty(this, "borderRadius", {
1188
- enumerable: true,
1189
- configurable: true,
1190
- writable: true,
1191
- value: void 0
1192
- });
1193
- Object.defineProperty(this, "timeout", {
1194
- enumerable: true,
1195
- configurable: true,
1196
- writable: true,
1197
- value: void 0
1198
- });
1199
- this.bottom = intToPixel(bottom);
1200
- this.right = intToPixel(right);
1201
- this.backgroundColor = backgroundColor;
1202
- this.color = color;
1203
- this.padding = intToPixel(padding);
1204
- this.borderRadius = intToPixel(borderRadius);
1205
- this.timeout = timeout;
1206
- }
1207
- show(message, timeout = 0) {
1208
- const notification = document.createElement("div");
1209
- notification.textContent = message;
1210
- notification.style.position = "fixed";
1211
- notification.style.bottom = this.bottom;
1212
- notification.style.right = this.right;
1213
- notification.style.backgroundColor = this.backgroundColor;
1214
- notification.style.color = this.color;
1215
- notification.style.padding = this.padding;
1216
- notification.style.borderRadius = this.borderRadius;
1217
- notification.style.zIndex = "1000";
1218
- const actualTimeout = timeout === 0 ? this.timeout : timeout;
1219
- document.body.appendChild(notification);
1220
- setTimeout(() => {
1221
- if (document.body.contains(notification)) {
1222
- document.body.removeChild(notification);
1223
- }
1224
- }, actualTimeout * 1000);
1225
- }
1226
- }
1227
- //# sourceMappingURL=notifications.js.map
1228
-
1229
- // ===== File: styles.js =====
1230
- "use strict";
1231
- function input_type_fc(input) {
1232
- return input.type !== 'hidden' && input.type !== 'reset' && input.type !== 'checkbox' && input.type !== 'radio';
1233
- }
1234
- function input_form_control(form) {
1235
- const inputs = form.querySelectorAll('input');
1236
- const selects = form.querySelectorAll('select');
1237
- const areas = form.querySelectorAll('textarea');
1238
- inputs.forEach(input => {
1239
- if (input_type_fc(input))
1240
- input.classList.add('form-control');
1241
- });
1242
- selects.forEach(select => {
1243
- select.classList.add('form-control');
1244
- });
1245
- areas.forEach(textarea => {
1246
- textarea.classList.add('form-control');
1247
- });
1248
- }
1249
- function input_form_control_unline(form) {
1250
- console.log(form.id);
1251
- const inputs = form.querySelectorAll('input');
1252
- const selects = form.querySelectorAll('select');
1253
- const areas = form.querySelectorAll('textarea');
1254
- inputs.forEach(input => {
1255
- if (input_type_fc(input))
1256
- input.classList.add('form-control-unline');
1257
- });
1258
- selects.forEach(select => {
1259
- select.classList.add('form-control-unline');
1260
- });
1261
- areas.forEach(textarea => {
1262
- textarea.classList.add('form-control-unline');
1263
- });
1264
- }
1265
- function intToPixel(number = '0') {
1266
- number = number.toString();
1267
- if (parseInt(number) === 0)
1268
- return '0';
1269
- return !isNaN(parseInt(number)) ? number + 'px' : number;
1270
- }
1271
- //# sourceMappingURL=styles.js.map
1272
-
1273
- // ===== File: system.js =====
1274
- "use strict";
1275
- function getSystemTheme() {
1276
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').media !== 'not all') {
1277
- const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
1278
- return isDark ? 'dark' : 'light';
1279
- }
1280
- return null;
1281
- }
1282
- function copyTextToClipboard(text) {
1283
- navigator.clipboard.writeText(text)
1284
- .then(() => { })
1285
- .catch(err => {
1286
- console.error('Не удалось скопировать текст: ', err);
1287
- });
1288
- }
1289
- function redirectBackOrClose(default_url = '/') {
1290
- if (document.referrer && document.referrer !== window.location.href) {
1291
- window.history.back();
1292
- }
1293
- else {
1294
- window.close();
1295
- setTimeout(() => {
1296
- if (!window.closed) {
1297
- window.location.href = default_url;
1298
- }
1299
- }, 100);
1300
- }
1301
- }
1302
- function getHost() {
1303
- return window.location.protocol + '//' + window.location.host;
1304
- }
1305
- //# sourceMappingURL=system.js.map
1306
-
1307
- // ===== File: tags.js =====
1308
- "use strict";
1309
- class AbbreviatedNumber extends HTMLElement {
1310
- constructor() {
1311
- super();
1312
- Object.defineProperty(this, "isShortened", {
1313
- enumerable: true,
1314
- configurable: true,
1315
- writable: true,
1316
- value: void 0
1317
- });
1318
- Object.defineProperty(this, "originalNumber", {
1319
- enumerable: true,
1320
- configurable: true,
1321
- writable: true,
1322
- value: void 0
1323
- });
1324
- this.isShortened = true;
1325
- this.originalNumber = parseFloat(this.textContent?.trim() || '0');
1326
- this.render();
1327
- this.addEventListener('click', this.toggle.bind(this));
1328
- if (isNaN(this.originalNumber))
1329
- throw new TypeError('The value must be a number');
1330
- }
1331
- static get observedAttributes() {
1332
- return ['lang', 'use_comma'];
1333
- }
1334
- toggle() {
1335
- this.isShortened = !this.isShortened;
1336
- this.render();
1337
- }
1338
- getCurrentLang() {
1339
- return this.getAttribute('lang') || document.documentElement.getAttribute('lang') || 'en';
1340
- }
1341
- formatNumber(num, lang) {
1342
- num = parseFloat(num.toString().replace(/[^\d.-]/g, ''));
1343
- if (isNaN(num))
1344
- return this.originalNumber.toString();
1345
- const useComma = this.hasAttribute('use_comma');
1346
- const separator = useComma ? ',' : '.';
1347
- const round = (value, digits) => {
1348
- if (digits === 0)
1349
- return Math.round(value);
1350
- const factor = Math.pow(10, digits);
1351
- return Math.round(value * factor) / factor;
1352
- };
1353
- const format = (value, digits) => {
1354
- const rounded = round(value, digits);
1355
- let str = rounded.toString();
1356
- if (digits > 0 && str.includes('.')) {
1357
- str = str.replace(/\.?0+$/, '');
1358
- }
1359
- return str.replace('.', separator);
1360
- };
1361
- const getFractionDigits = (value) => {
1362
- if (value < 10)
1363
- return 2;
1364
- if (value < 100)
1365
- return 1;
1366
- return 0;
1367
- };
1368
- if (lang.startsWith('ru')) {
1369
- if (num >= 1000000000000) {
1370
- const value = num / 1000000000000;
1371
- return format(value, getFractionDigits(value)) + ' трлн.';
1372
- }
1373
- if (num >= 1000000000) {
1374
- const value = num / 1000000000;
1375
- return format(value, getFractionDigits(value)) + ' млрд.';
1376
- }
1377
- if (num >= 1000000) {
1378
- const value = num / 1000000;
1379
- return format(value, getFractionDigits(value)) + ' млн.';
1380
- }
1381
- if (num >= 1000) {
1382
- const value = num / 1000;
1383
- return format(value, getFractionDigits(value)) + ' тыс.';
1384
- }
1385
- }
1386
- else {
1387
- if (num >= 1000000000000) {
1388
- const value = num / 1000000000000;
1389
- return format(value, getFractionDigits(value)) + 'T';
1390
- }
1391
- if (num >= 1000000000) {
1392
- const value = num / 1000000000;
1393
- return format(value, getFractionDigits(value)) + 'B';
1394
- }
1395
- if (num >= 1000000) {
1396
- const value = num / 1000000;
1397
- return format(value, getFractionDigits(value)) + 'M';
1398
- }
1399
- if (num >= 1000) {
1400
- const value = num / 1000;
1401
- return format(value, getFractionDigits(value)) + 'K';
1402
- }
1403
- }
1404
- return format(num, 0);
1405
- }
1406
- render() {
1407
- const lang = this.getCurrentLang();
1408
- this.textContent = this.isShortened
1409
- ? this.formatNumber(this.originalNumber, lang)
1410
- : this.originalNumber.toString();
1411
- }
1412
- }
1413
- class StepElement extends HTMLElement {
1414
- constructor() {
1415
- super();
1416
- if (this.textContent)
1417
- this.label = this.textContent;
1418
- this.innerHTML = `
1419
- <div data-sb-generated="circle"></div>
1420
- <div data-sb-generated="label"><slot></slot></div>
1421
- `;
1422
- }
1423
- static get observedAttributes() {
1424
- return ['active', 'completed', 'label'];
1425
- }
1426
- get index() {
1427
- return Array.from(this.parentNode.children).indexOf(this) + 1;
1428
- }
1429
- get active() {
1430
- return this.hasAttribute('active');
1431
- }
1432
- set active(force) {
1433
- this.toggleAttribute('active', force);
1434
- }
1435
- get completed() {
1436
- return this.hasAttribute('completed');
1437
- }
1438
- set completed(force) {
1439
- this.toggleAttribute('completed', force);
1440
- }
1441
- get label() {
1442
- return this.getAttribute('label') || "";
1443
- }
1444
- set label(value) {
1445
- this.setAttribute('label', value);
1446
- }
1447
- reset() {
1448
- this.active = false;
1449
- this.completed = false;
1450
- }
1451
- get status() {
1452
- if (this.active)
1453
- return 'active';
1454
- else if (this.completed)
1455
- return 'complete';
1456
- else
1457
- return 'uncomplete';
1458
- }
1459
- set status(value) {
1460
- this.reset();
1461
- switch (value) {
1462
- case 'complete':
1463
- this.completed = true;
1464
- break;
1465
- case 'active':
1466
- this.active = true;
1467
- break;
1468
- case 'uncomplete':
1469
- break;
1470
- default:
1471
- throw new TypeError(`Unknown status: ${value}`);
1472
- }
1473
- }
1474
- connectedCallback() {
1475
- this.querySelector('[data-sb-generated="circle"]').textContent = this.index.toString();
1476
- this.querySelector('[data-sb-generated="label"]').textContent = this.label;
1477
- const parent = this.parentElement;
1478
- const currentStep = parent.currentStep || 1;
1479
- if (this.index === currentStep)
1480
- this.active = true;
1481
- else if (this.index < currentStep)
1482
- this.completed = true;
1483
- }
1484
- }
1485
- class Stepbar extends HTMLElement {
1486
- constructor() {
1487
- super();
1488
- Object.defineProperty(this, "_observer", {
1489
- enumerable: true,
1490
- configurable: true,
1491
- writable: true,
1492
- value: void 0
1493
- });
1494
- this.attachShadow({ mode: 'open' });
1495
- this.shadowRoot.innerHTML = `
1496
- <slot></slot>
1497
- `;
1498
- }
1499
- static get observedAttributes() {
1500
- return ['current'];
1501
- }
1502
- attributeChangedCallback(name, oldValue, newValue) {
1503
- if (name === 'current') {
1504
- this.updateSteps();
1505
- }
1506
- }
1507
- connectedCallback() {
1508
- if (!this._observer) {
1509
- this._observer = new MutationObserver(() => this.updateSteps());
1510
- this._observer.observe(this, { childList: true });
1511
- }
1512
- this.updateSteps();
1513
- }
1514
- disconnectedCallback() {
1515
- if (this._observer) {
1516
- this._observer.disconnect();
1517
- }
1518
- }
1519
- updateSteps() {
1520
- const currentStep = parseInt(this.getAttribute('current') || '1');
1521
- const elements = Array.from(this.children).filter((el) => el.tagName === 'SB-ELEMENT');
1522
- elements.forEach((element, index) => {
1523
- const stepNumber = index + 1;
1524
- element.status = 'uncomplete';
1525
- if (stepNumber < currentStep) {
1526
- element.status = 'complete';
1527
- }
1528
- else if (stepNumber === currentStep) {
1529
- element.status = 'active';
1530
- }
1531
- });
1532
- }
1533
- get currentStep() {
1534
- return parseInt(this.getAttribute('current') || '1');
1535
- }
1536
- set currentStep(step) {
1537
- this.setAttribute('current', step.toString());
1538
- }
1539
- }
1540
- class HTMLFile extends HTMLElement {
1541
- constructor() {
1542
- super();
1543
- }
1544
- get src() {
1545
- return this.getAttribute('src') || '';
1546
- }
1547
- set src(value) {
1548
- if (value) {
1549
- this.setAttribute('src', value);
1550
- }
1551
- else {
1552
- this.removeAttribute('src');
1553
- }
1554
- }
1555
- static get observedAttributes() {
1556
- return ['src'];
1557
- }
1558
- connectedCallback() {
1559
- this.loadContent();
1560
- }
1561
- attributeChangedCallback(name, oldValue, newValue) {
1562
- if (name === 'src' && oldValue !== newValue && this.isConnected) {
1563
- this.loadContent();
1564
- }
1565
- }
1566
- async loadContent() {
1567
- const src = this.src;
1568
- if (!src)
1569
- return;
1570
- try {
1571
- const response = await fetch(src);
1572
- const content = await response.text();
1573
- this.innerHTML = content;
1574
- await this.executeScripts();
1575
- }
1576
- catch (error) {
1577
- this.innerHTML = `Ошибка загрузки: ${error.message}`;
1578
- }
1579
- }
1580
- async executeScripts() {
1581
- const scripts = this.querySelectorAll('script');
1582
- for (const script of scripts) {
1583
- if (script.src) {
1584
- await this.loadExternalScript(script.src);
1585
- }
1586
- else {
1587
- this.executeInlineScript(script.textContent || '');
1588
- }
1589
- script.remove();
1590
- }
1591
- }
1592
- loadExternalScript(src) {
1593
- return new Promise((resolve, reject) => {
1594
- const newScript = document.createElement('script');
1595
- newScript.src = src;
1596
- newScript.onload = resolve;
1597
- newScript.onerror = reject;
1598
- document.head.appendChild(newScript);
1599
- });
1600
- }
1601
- executeInlineScript(code) {
1602
- try {
1603
- const newScript = document.createElement('script');
1604
- newScript.textContent = code;
1605
- document.head.appendChild(newScript);
1606
- document.head.removeChild(newScript);
1607
- }
1608
- catch (error) {
1609
- console.error('Ошибка выполнения скрипта:', error);
1610
- }
1611
- }
1612
- get loaded() {
1613
- return this.hasAttribute('data-loaded');
1614
- }
1615
- reload() {
1616
- return this.loadContent();
1617
- }
1618
- get content() {
1619
- return this.innerHTML;
1620
- }
1621
- }
1622
- class ClickToCopy extends HTMLElement {
1623
- constructor() {
1624
- super();
1625
- Object.defineProperty(this, "notification", {
1626
- enumerable: true,
1627
- configurable: true,
1628
- writable: true,
1629
- value: void 0
1630
- });
1631
- this.notification = new HyperTextNotification({ backgroundColor: 'rgba(192,0,192,0.8)' });
1632
- }
1633
- get notificationText() {
1634
- return this.getAttribute('text') || "Скопировано";
1635
- }
1636
- set notificationText(value) {
1637
- if (value)
1638
- this.setAttribute('text', value);
1639
- else
1640
- this.removeAttribute('text');
1641
- }
1642
- get isNotified() {
1643
- return this.hasAttribute('notified');
1644
- }
1645
- set isNotified(value) {
1646
- if (value)
1647
- this.setAttribute('notified', '');
1648
- else
1649
- this.removeAttribute('notified');
1650
- }
1651
- connectedCallback() {
1652
- this.addEventListener('click', () => {
1653
- navigator.clipboard.writeText(this.textContent || '');
1654
- if (this.isNotified)
1655
- this.notification.show(this.notificationText);
1656
- });
1657
- }
1658
- }
1659
- customElements.define('sb-element', StepElement);
1660
- customElements.define('step-bar', Stepbar);
1661
- customElements.define('ab-num', AbbreviatedNumber);
1662
- customElements.define('include-html', HTMLFile);
1663
- customElements.define('click-to-copy', ClickToCopy);
1664
- //# sourceMappingURL=tags.js.map
1665
-
1666
- // ===== File: url.js =====
1667
- "use strict";
1668
- function isAbsoluteUrl(url) {
1669
- try {
1670
- new URL(url);
1671
- return true;
1672
- }
1673
- catch (e) {
1674
- return url[0] === '/' || url[0] === '\\';
1675
- }
1676
- }
1677
- function combineUrls(baseUrl, relativeUrl) {
1678
- try {
1679
- if (!baseUrl) {
1680
- if (relativeUrl.startsWith('/'))
1681
- return relativeUrl;
1682
- return '/' + relativeUrl;
1683
- }
1684
- return new URL(relativeUrl, baseUrl).toString();
1685
- }
1686
- catch (error) {
1687
- throw new Error(`Invalid URL combination: ${baseUrl}, ${relativeUrl}`);
1688
- }
1689
- }
1690
- function getScriptSite(script) {
1691
- return new URL(script.src).origin;
1692
- }
1693
- //# sourceMappingURL=url.js.map
1694
-
1695
- // ===== File: uuid.js =====
1696
- "use strict";
1697
- function generateUUIDv4() {
1698
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1699
- const r = Math.random() * 16 | 0;
1700
- const v = c === 'x' ? r : (r & 0x3 | 0x8);
1701
- return v.toString(16);
1702
- });
1703
- }
1704
- //# sourceMappingURL=uuid.js.map
1705
-
1706
-
1707
- // string.js
1708
- function stringToBoolean(input) {
1709
- if (input.toLowerCase() === "true")
1710
- return true;
1711
- if (input.toLowerCase() === "false")
1712
- return false;
1713
- return null;
1714
- }
1715
-
1716
-
1717
- // ===== File: input.js =====
1718
- "use strict";
1719
- function getInputCursorPosition(input) {
1720
- const start = input.selectionStart;
1721
- if (start == null)
1722
- throw new Error("Incorrect input type");
1723
- return start - 1;
1724
- }
1725
- function copyInputToClipboard(input) {
1726
- const disabled = input.hasAttribute("disabled");
1727
- if (disabled)
1728
- input.removeAttribute('disabled');
1729
- navigator.clipboard.writeText(input.value)
1730
- .then(() => { })
1731
- .catch(err => {
1732
- console.error('Не удалось скопировать текст: ', err);
1733
- })
1734
- .finally(() => {
1735
- if (disabled)
1736
- input.setAttribute('disabled', '');
1737
- });
1738
- }
1739
- function clearInput_and_addLastSymbol(input) {
1740
- input.value = input.value[getInputCursorPosition(input)] || '';
1741
- }
1742
- function getInputLabel(input) {
1743
- const label = document.querySelector(`label[for="${input.id}"]`);
1744
- if (!label)
1745
- throw new Error("Label не найден. Возможно, вы не использовали атрибут for в нем");
1746
- return label;
1747
- }
1748
- //# sourceMappingURL=input.js.map
1749
-
1750
- // ===== File: link.js =====
1751
- "use strict";
1752
- function loadCSS(href) {
1753
- const link = document.createElement('link');
1754
- link.rel = 'stylesheet';
1755
- link.type = 'text/css';
1756
- link.href = href;
1757
- document.head.appendChild(link);
1758
- }
1759
- //# sourceMappingURL=link.js.map
1760
-
1761
- // ===== File: notifications.js =====
1762
- "use strict";
1763
- function pushNotification(title = "Уведомление", body = "Текст уведомления", icon = null) {
1764
- if (Notification.permission !== "granted") {
1765
- Notification.requestPermission().then(permission => {
1766
- if (permission === "granted") {
1767
- if (icon)
1768
- new Notification(title, { body: body, icon: icon });
1769
- else
1770
- new Notification(title, { body: body });
1771
- }
1772
- });
1773
- }
1774
- else {
1775
- if (icon)
1776
- new Notification(title, { body: body, icon: icon });
1777
- else
1778
- new Notification(title, { body: body });
1779
- }
1780
- }
1781
- class HyperTextNotification {
1782
- constructor({ bottom = '20', right = '20', backgroundColor = '#121212', color = '#ededed', padding = '15', borderRadius = '5', timeout = 3 } = {}) {
1783
- Object.defineProperty(this, "bottom", {
1784
- enumerable: true,
1785
- configurable: true,
1786
- writable: true,
1787
- value: void 0
1788
- });
1789
- Object.defineProperty(this, "right", {
1790
- enumerable: true,
1791
- configurable: true,
1792
- writable: true,
1793
- value: void 0
1794
- });
1795
- Object.defineProperty(this, "backgroundColor", {
1796
- enumerable: true,
1797
- configurable: true,
1798
- writable: true,
1799
- value: void 0
1800
- });
1801
- Object.defineProperty(this, "color", {
1802
- enumerable: true,
1803
- configurable: true,
1804
- writable: true,
1805
- value: void 0
1806
- });
1807
- Object.defineProperty(this, "padding", {
1808
- enumerable: true,
1809
- configurable: true,
1810
- writable: true,
1811
- value: void 0
1812
- });
1813
- Object.defineProperty(this, "borderRadius", {
1814
- enumerable: true,
1815
- configurable: true,
1816
- writable: true,
1817
- value: void 0
1818
- });
1819
- Object.defineProperty(this, "timeout", {
1820
- enumerable: true,
1821
- configurable: true,
1822
- writable: true,
1823
- value: void 0
1824
- });
1825
- this.bottom = intToPixel(bottom);
1826
- this.right = intToPixel(right);
1827
- this.backgroundColor = backgroundColor;
1828
- this.color = color;
1829
- this.padding = intToPixel(padding);
1830
- this.borderRadius = intToPixel(borderRadius);
1831
- this.timeout = timeout;
1832
- }
1833
- show(message, timeout = 0) {
1834
- const notification = document.createElement("div");
1835
- notification.textContent = message;
1836
- notification.style.position = "fixed";
1837
- notification.style.bottom = this.bottom;
1838
- notification.style.right = this.right;
1839
- notification.style.backgroundColor = this.backgroundColor;
1840
- notification.style.color = this.color;
1841
- notification.style.padding = this.padding;
1842
- notification.style.borderRadius = this.borderRadius;
1843
- notification.style.zIndex = "1000";
1844
- const actualTimeout = timeout === 0 ? this.timeout : timeout;
1845
- document.body.appendChild(notification);
1846
- setTimeout(() => {
1847
- if (document.body.contains(notification)) {
1848
- document.body.removeChild(notification);
1849
- }
1850
- }, actualTimeout * 1000);
1851
- }
1852
- }
1853
- //# sourceMappingURL=notifications.js.map
1854
-
1855
- // ===== File: string.js =====
1856
- "use strict";
1857
- function stringToBoolean(input) {
1858
- if (input.toLowerCase() === "true")
1859
- return true;
1860
- if (input.toLowerCase() === "false")
1861
- return false;
1862
- return null;
1863
- }
1864
- //# sourceMappingURL=string.js.map
1865
-
1866
- // ===== File: styles.js =====
1867
- "use strict";
1868
- function input_type_fc(input) {
1869
- return input.type !== 'hidden' && input.type !== 'reset' && input.type !== 'checkbox' && input.type !== 'radio';
1870
- }
1871
- function input_form_control(form) {
1872
- const inputs = form.querySelectorAll('input');
1873
- const selects = form.querySelectorAll('select');
1874
- const areas = form.querySelectorAll('textarea');
1875
- inputs.forEach(input => {
1876
- if (input_type_fc(input))
1877
- input.classList.add('form-control');
1878
- });
1879
- selects.forEach(select => {
1880
- select.classList.add('form-control');
1881
- });
1882
- areas.forEach(textarea => {
1883
- textarea.classList.add('form-control');
1884
- });
1885
- }
1886
- function input_form_control_unline(form) {
1887
- console.log(form.id);
1888
- const inputs = form.querySelectorAll('input');
1889
- const selects = form.querySelectorAll('select');
1890
- const areas = form.querySelectorAll('textarea');
1891
- inputs.forEach(input => {
1892
- if (input_type_fc(input))
1893
- input.classList.add('form-control-unline');
1894
- });
1895
- selects.forEach(select => {
1896
- select.classList.add('form-control-unline');
1897
- });
1898
- areas.forEach(textarea => {
1899
- textarea.classList.add('form-control-unline');
1900
- });
1901
- }
1902
- function intToPixel(number = '0') {
1903
- number = number.toString();
1904
- if (parseInt(number) === 0)
1905
- return '0';
1906
- return !isNaN(parseInt(number)) ? number + 'px' : number;
1907
- }
1908
- //# sourceMappingURL=styles.js.map
1909
-
1910
- // ===== File: system.js =====
1911
- "use strict";
1912
- function getSystemTheme() {
1913
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').media !== 'not all') {
1914
- const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
1915
- return isDark ? 'dark' : 'light';
1916
- }
1917
- return null;
1918
- }
1919
- function copyTextToClipboard(text) {
1920
- navigator.clipboard.writeText(text)
1921
- .then(() => { })
1922
- .catch(err => {
1923
- console.error('Не удалось скопировать текст: ', err);
1924
- });
1925
- }
1926
- function redirectBackOrClose(default_url = '/') {
1927
- if (document.referrer && document.referrer !== window.location.href) {
1928
- window.history.back();
1929
- }
1930
- else {
1931
- window.close();
1932
- setTimeout(() => {
1933
- if (!window.closed) {
1934
- window.location.href = default_url;
1935
- }
1936
- }, 100);
1937
- }
1938
- }
1939
- function getHost() {
1940
- return window.location.protocol + '//' + window.location.host;
1941
- }
1942
- //# sourceMappingURL=system.js.map
1943
-
1944
- // ===== File: tags.js =====
1945
- "use strict";
1946
- class AbbreviatedNumber extends HTMLElement {
1947
- constructor() {
1948
- super();
1949
- Object.defineProperty(this, "isShortened", {
1950
- enumerable: true,
1951
- configurable: true,
1952
- writable: true,
1953
- value: void 0
1954
- });
1955
- Object.defineProperty(this, "originalNumber", {
1956
- enumerable: true,
1957
- configurable: true,
1958
- writable: true,
1959
- value: void 0
1960
- });
1961
- this.isShortened = true;
1962
- this.originalNumber = parseFloat(this.textContent?.trim() || '0');
1963
- this.render();
1964
- this.addEventListener('click', this.toggle.bind(this));
1965
- if (isNaN(this.originalNumber))
1966
- throw new TypeError('The value must be a number');
1967
- }
1968
- static get observedAttributes() {
1969
- return ['lang', 'use_comma'];
1970
- }
1971
- toggle() {
1972
- this.isShortened = !this.isShortened;
1973
- this.render();
1974
- }
1975
- getCurrentLang() {
1976
- return this.getAttribute('lang') || document.documentElement.getAttribute('lang') || 'en';
1977
- }
1978
- formatNumber(num, lang) {
1979
- num = parseFloat(num.toString().replace(/[^\d.-]/g, ''));
1980
- if (isNaN(num))
1981
- return this.originalNumber.toString();
1982
- const useComma = this.hasAttribute('use_comma');
1983
- const separator = useComma ? ',' : '.';
1984
- const round = (value, digits) => {
1985
- if (digits === 0)
1986
- return Math.round(value);
1987
- const factor = Math.pow(10, digits);
1988
- return Math.round(value * factor) / factor;
1989
- };
1990
- const format = (value, digits) => {
1991
- const rounded = round(value, digits);
1992
- let str = rounded.toString();
1993
- if (digits > 0 && str.includes('.')) {
1994
- str = str.replace(/\.?0+$/, '');
1995
- }
1996
- return str.replace('.', separator);
1997
- };
1998
- const getFractionDigits = (value) => {
1999
- if (value < 10)
2000
- return 2;
2001
- if (value < 100)
2002
- return 1;
2003
- return 0;
2004
- };
2005
- if (lang.startsWith('ru')) {
2006
- if (num >= 1000000000000) {
2007
- const value = num / 1000000000000;
2008
- return format(value, getFractionDigits(value)) + ' трлн.';
2009
- }
2010
- if (num >= 1000000000) {
2011
- const value = num / 1000000000;
2012
- return format(value, getFractionDigits(value)) + ' млрд.';
2013
- }
2014
- if (num >= 1000000) {
2015
- const value = num / 1000000;
2016
- return format(value, getFractionDigits(value)) + ' млн.';
2017
- }
2018
- if (num >= 1000) {
2019
- const value = num / 1000;
2020
- return format(value, getFractionDigits(value)) + ' тыс.';
2021
- }
2022
- }
2023
- else {
2024
- if (num >= 1000000000000) {
2025
- const value = num / 1000000000000;
2026
- return format(value, getFractionDigits(value)) + 'T';
2027
- }
2028
- if (num >= 1000000000) {
2029
- const value = num / 1000000000;
2030
- return format(value, getFractionDigits(value)) + 'B';
2031
- }
2032
- if (num >= 1000000) {
2033
- const value = num / 1000000;
2034
- return format(value, getFractionDigits(value)) + 'M';
2035
- }
2036
- if (num >= 1000) {
2037
- const value = num / 1000;
2038
- return format(value, getFractionDigits(value)) + 'K';
2039
- }
2040
- }
2041
- return format(num, 0);
2042
- }
2043
- render() {
2044
- const lang = this.getCurrentLang();
2045
- this.textContent = this.isShortened
2046
- ? this.formatNumber(this.originalNumber, lang)
2047
- : this.originalNumber.toString();
2048
- }
2049
- }
2050
- class StepElement extends HTMLElement {
2051
- constructor() {
2052
- super();
2053
- if (this.textContent)
2054
- this.label = this.textContent;
2055
- this.innerHTML = `
2056
- <div data-sb-generated="circle"></div>
2057
- <div data-sb-generated="label"><slot></slot></div>
2058
- `;
2059
- }
2060
- static get observedAttributes() {
2061
- return ['active', 'completed', 'label'];
2062
- }
2063
- get index() {
2064
- return Array.from(this.parentNode.children).indexOf(this) + 1;
2065
- }
2066
- get active() {
2067
- return this.hasAttribute('active');
2068
- }
2069
- set active(force) {
2070
- this.toggleAttribute('active', force);
2071
- }
2072
- get completed() {
2073
- return this.hasAttribute('completed');
2074
- }
2075
- set completed(force) {
2076
- this.toggleAttribute('completed', force);
2077
- }
2078
- get label() {
2079
- return this.getAttribute('label') || "";
2080
- }
2081
- set label(value) {
2082
- this.setAttribute('label', value);
2083
- }
2084
- reset() {
2085
- this.active = false;
2086
- this.completed = false;
2087
- }
2088
- get status() {
2089
- if (this.active)
2090
- return 'active';
2091
- else if (this.completed)
2092
- return 'complete';
2093
- else
2094
- return 'uncomplete';
2095
- }
2096
- set status(value) {
2097
- this.reset();
2098
- switch (value) {
2099
- case 'complete':
2100
- this.completed = true;
2101
- break;
2102
- case 'active':
2103
- this.active = true;
2104
- break;
2105
- case 'uncomplete':
2106
- break;
2107
- default:
2108
- throw new TypeError(`Unknown status: ${value}`);
2109
- }
2110
- }
2111
- connectedCallback() {
2112
- this.querySelector('[data-sb-generated="circle"]').textContent = this.index.toString();
2113
- this.querySelector('[data-sb-generated="label"]').textContent = this.label;
2114
- const parent = this.parentElement;
2115
- const currentStep = parent.currentStep || 1;
2116
- if (this.index === currentStep)
2117
- this.active = true;
2118
- else if (this.index < currentStep)
2119
- this.completed = true;
2120
- }
2121
- }
2122
- class Stepbar extends HTMLElement {
2123
- constructor() {
2124
- super();
2125
- Object.defineProperty(this, "_observer", {
2126
- enumerable: true,
2127
- configurable: true,
2128
- writable: true,
2129
- value: void 0
2130
- });
2131
- this.attachShadow({ mode: 'open' });
2132
- this.shadowRoot.innerHTML = `
2133
- <slot></slot>
2134
- `;
2135
- }
2136
- static get observedAttributes() {
2137
- return ['current'];
2138
- }
2139
- attributeChangedCallback(name, oldValue, newValue) {
2140
- if (name === 'current') {
2141
- this.updateSteps();
2142
- }
2143
- }
2144
- connectedCallback() {
2145
- if (!this._observer) {
2146
- this._observer = new MutationObserver(() => this.updateSteps());
2147
- this._observer.observe(this, { childList: true });
2148
- }
2149
- this.updateSteps();
2150
- }
2151
- disconnectedCallback() {
2152
- if (this._observer) {
2153
- this._observer.disconnect();
2154
- }
2155
- }
2156
- updateSteps() {
2157
- const currentStep = parseInt(this.getAttribute('current') || '1');
2158
- const elements = Array.from(this.children).filter((el) => el.tagName === 'SB-ELEMENT');
2159
- elements.forEach((element, index) => {
2160
- const stepNumber = index + 1;
2161
- element.status = 'uncomplete';
2162
- if (stepNumber < currentStep) {
2163
- element.status = 'complete';
2164
- }
2165
- else if (stepNumber === currentStep) {
2166
- element.status = 'active';
2167
- }
2168
- });
2169
- }
2170
- get currentStep() {
2171
- return parseInt(this.getAttribute('current') || '1');
2172
- }
2173
- set currentStep(step) {
2174
- this.setAttribute('current', step.toString());
2175
- }
2176
- }
2177
- class HTMLFile extends HTMLElement {
2178
- constructor() {
2179
- super();
2180
- }
2181
- get src() {
2182
- return this.getAttribute('src') || '';
2183
- }
2184
- set src(value) {
2185
- if (value) {
2186
- this.setAttribute('src', value);
2187
- }
2188
- else {
2189
- this.removeAttribute('src');
2190
- }
2191
- }
2192
- static get observedAttributes() {
2193
- return ['src'];
2194
- }
2195
- connectedCallback() {
2196
- this.loadContent();
2197
- }
2198
- attributeChangedCallback(name, oldValue, newValue) {
2199
- if (name === 'src' && oldValue !== newValue && this.isConnected) {
2200
- this.loadContent();
2201
- }
2202
- }
2203
- async loadContent() {
2204
- const src = this.src;
2205
- if (!src)
2206
- return;
2207
- try {
2208
- const response = await fetch(src);
2209
- const content = await response.text();
2210
- this.innerHTML = content;
2211
- await this.executeScripts();
2212
- }
2213
- catch (error) {
2214
- this.innerHTML = `Ошибка загрузки: ${error.message}`;
2215
- }
2216
- }
2217
- async executeScripts() {
2218
- const scripts = this.querySelectorAll('script');
2219
- for (const script of scripts) {
2220
- if (script.src) {
2221
- await this.loadExternalScript(script.src);
2222
- }
2223
- else {
2224
- this.executeInlineScript(script.textContent || '');
2225
- }
2226
- script.remove();
2227
- }
2228
- }
2229
- loadExternalScript(src) {
2230
- return new Promise((resolve, reject) => {
2231
- const newScript = document.createElement('script');
2232
- newScript.src = src;
2233
- newScript.onload = resolve;
2234
- newScript.onerror = reject;
2235
- document.head.appendChild(newScript);
2236
- });
2237
- }
2238
- executeInlineScript(code) {
2239
- try {
2240
- const newScript = document.createElement('script');
2241
- newScript.textContent = code;
2242
- document.head.appendChild(newScript);
2243
- document.head.removeChild(newScript);
2244
- }
2245
- catch (error) {
2246
- console.error('Ошибка выполнения скрипта:', error);
2247
- }
2248
- }
2249
- get loaded() {
2250
- return this.hasAttribute('data-loaded');
2251
- }
2252
- reload() {
2253
- return this.loadContent();
2254
- }
2255
- get content() {
2256
- return this.innerHTML;
2257
- }
2258
- }
2259
- class ClickToCopy extends HTMLElement {
2260
- constructor() {
2261
- super();
2262
- Object.defineProperty(this, "notification", {
158
+ function hasCookie(name) {
159
+ return getCookie(name) != null;
160
+ }
161
+
162
+ class datetime {
163
+ constructor(_year, _month, _days, _hours, _minutes, _seconds) {
164
+ Object.defineProperty(this, "_year", {
165
+ enumerable: true,
166
+ configurable: true,
167
+ writable: true,
168
+ value: _year
169
+ });
170
+ Object.defineProperty(this, "_month", {
171
+ enumerable: true,
172
+ configurable: true,
173
+ writable: true,
174
+ value: _month
175
+ });
176
+ Object.defineProperty(this, "_days", {
177
+ enumerable: true,
178
+ configurable: true,
179
+ writable: true,
180
+ value: _days
181
+ });
182
+ Object.defineProperty(this, "_hours", {
183
+ enumerable: true,
184
+ configurable: true,
185
+ writable: true,
186
+ value: _hours
187
+ });
188
+ Object.defineProperty(this, "_minutes", {
189
+ enumerable: true,
190
+ configurable: true,
191
+ writable: true,
192
+ value: _minutes
193
+ });
194
+ Object.defineProperty(this, "_seconds", {
195
+ enumerable: true,
196
+ configurable: true,
197
+ writable: true,
198
+ value: _seconds
199
+ });
200
+ Object.defineProperty(this, "date", {
2263
201
  enumerable: true,
2264
202
  configurable: true,
2265
203
  writable: true,
2266
204
  value: void 0
2267
205
  });
2268
- this.notification = new HyperTextNotification({ backgroundColor: 'rgba(192,0,192,0.8)' });
2269
- }
2270
- get notificationText() {
2271
- return this.getAttribute('text') || "Скопировано";
206
+ this.date = new Date(this._year, this._month, this._days, this._hours, this._minutes, this._seconds);
2272
207
  }
2273
- set notificationText(value) {
2274
- if (value)
2275
- this.setAttribute('text', value);
2276
- else
2277
- this.removeAttribute('text');
208
+ static newObject(dateObject) {
209
+ return new datetime(dateObject.getFullYear(), dateObject.getMonth(), dateObject.getDate(), dateObject.getHours(), dateObject.getMinutes(), dateObject.getSeconds());
2278
210
  }
2279
- get isNotified() {
2280
- return this.hasAttribute('notified');
211
+ static now() {
212
+ return datetime.newObject(new Date());
2281
213
  }
2282
- set isNotified(value) {
2283
- if (value)
2284
- this.setAttribute('notified', '');
2285
- else
2286
- this.removeAttribute('notified');
214
+ static fromTimestamp(timestamp) {
215
+ return datetime.newObject(new Date(timestamp));
2287
216
  }
2288
- connectedCallback() {
2289
- this.addEventListener('click', () => {
2290
- navigator.clipboard.writeText(this.textContent || '');
2291
- if (this.isNotified)
2292
- this.notification.show(this.notificationText);
2293
- });
217
+ get year() { return this._year; }
218
+ get month() { return this._month; }
219
+ get days() { return this._days; }
220
+ get hours() { return this._hours; }
221
+ get minutes() { return this._minutes; }
222
+ get seconds() { return this._seconds; }
223
+ set year(year) { this._year = year; }
224
+ set month(month) { this._month = month; }
225
+ set days(days) { this._days = days; }
226
+ set hours(hours) { this._hours = hours; }
227
+ set minutes(minutes) { this._minutes = minutes; }
228
+ set seconds(seconds) { this._seconds = seconds; }
229
+ timestamp() {
230
+ return this.date.getTime();
2294
231
  }
2295
232
  }
2296
- customElements.define('sb-element', StepElement);
2297
- customElements.define('step-bar', Stepbar);
2298
- customElements.define('ab-num', AbbreviatedNumber);
2299
- customElements.define('include-html', HTMLFile);
2300
- customElements.define('click-to-copy', ClickToCopy);
2301
- //# sourceMappingURL=tags.js.map
2302
233
 
2303
- // ===== File: url.js =====
2304
- "use strict";
2305
- function isAbsoluteUrl(url) {
2306
- try {
2307
- new URL(url);
2308
- return true;
2309
- }
2310
- catch (e) {
2311
- return url[0] === '/' || url[0] === '\\';
234
+ class NotAuthorizedError extends Error {
235
+ constructor() {
236
+ super("Пользователь не авторизован");
237
+ this.name = 'NotAuthorizedError';
2312
238
  }
2313
239
  }
2314
- function combineUrls(baseUrl, relativeUrl) {
2315
- try {
2316
- if (!baseUrl) {
2317
- if (relativeUrl.startsWith('/'))
2318
- return relativeUrl;
2319
- return '/' + relativeUrl;
240
+
241
+ function button_submit(parent) {
242
+ const buttons = parent.querySelectorAll('button');
243
+ let submit = null;
244
+ buttons.forEach(button => {
245
+ if (button.type === 'submit')
246
+ submit = button;
247
+ });
248
+ return submit;
249
+ }
250
+
251
+ const escapeChars = {
252
+ '<': '&lt;',
253
+ '>': '&gt;',
254
+ '&': '&amp;',
255
+ '"': '&quot;',
256
+ "'": '&#39;'
257
+ };
258
+
259
+ function togglePassword(passwordInput) {
260
+ const passwordType = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
261
+ passwordInput.setAttribute('type', passwordType);
262
+ }
263
+
264
+ function isTextWrapped(element) {
265
+ const elementHeight = element.clientHeight;
266
+ const scrollHeight = element.scrollHeight;
267
+ return scrollHeight > elementHeight;
268
+ }
269
+
270
+ function notArrayEmpty(array) {
271
+ return array.length > 0;
272
+ }
273
+
274
+ function get_tagName(element) {
275
+ return element.tagName.toLowerCase();
276
+ }
277
+
278
+ function element_toHTMLText(element) {
279
+ const tag = get_tagName(element);
280
+ const attrs = element.attributes;
281
+ let text = `<${tag}`;
282
+ if (attrs.length > 0) {
283
+ for (let attr of attrs) {
284
+ text += ` ${attr.name}="${attr.value}"`;
2320
285
  }
2321
- return new URL(relativeUrl, baseUrl).toString();
2322
- }
2323
- catch (error) {
2324
- throw new Error(`Invalid URL combination: ${baseUrl}, ${relativeUrl}`);
2325
286
  }
287
+ text += `>${element.innerHTML}</${tag}>`;
288
+ return text;
2326
289
  }
2327
- function getScriptSite(script) {
2328
- return new URL(script.src).origin;
290
+
291
+ function element_to_div(element) {
292
+ const div = document.createElement('div');
293
+ div.innerHTML = element.outerHTML;
294
+ return div;
2329
295
  }
2330
- //# sourceMappingURL=url.js.map
2331
296
 
2332
- // ===== File: uuid.js =====
2333
- "use strict";
2334
- function generateUUIDv4() {
2335
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2336
- const r = Math.random() * 16 | 0;
2337
- const v = c === 'x' ? r : (r & 0x3 | 0x8);
2338
- return v.toString(16);
297
+ function password_format(shownPasswordHTML, hiddenPasswordHTML) {
298
+ document.addEventListener('DOMContentLoaded', () => {
299
+ const forms = document.querySelectorAll('form');
300
+ forms.forEach(form => {
301
+ const inputs = form.querySelectorAll('input[type="password"]');
302
+ inputs.forEach(input => {
303
+ const wrapper = document.createElement('div');
304
+ wrapper.style.position = 'relative';
305
+ wrapper.style.display = 'inline-block';
306
+ wrapper.style.width = '100%';
307
+ input.parentNode.insertBefore(wrapper, input);
308
+ wrapper.appendChild(input);
309
+ const toggleBtn = document.createElement('button');
310
+ toggleBtn.type = 'button';
311
+ toggleBtn.className = 'show-password-btn';
312
+ toggleBtn.innerHTML = hiddenPasswordHTML;
313
+ toggleBtn.style.cssText = `
314
+ position: absolute;
315
+ left: 45%;
316
+ top: 50%;
317
+ transform: translateY(-50%);
318
+ cursor: pointer;
319
+ user-select: none;
320
+ background: none;
321
+ border: none;
322
+ padding: 0;
323
+ `;
324
+ toggleBtn.addEventListener('click', () => {
325
+ const isShowing = input.type === 'text';
326
+ input.type = isShowing ? 'password' : 'text';
327
+ toggleBtn.innerHTML = isShowing ? hiddenPasswordHTML : shownPasswordHTML;
328
+ });
329
+ wrapper.appendChild(toggleBtn);
330
+ });
331
+ });
2339
332
  });
2340
333
  }
2341
- //# sourceMappingURL=uuid.js.map
2342
-
334
+ function escapeHTML(html) {
335
+ return html.replace(/[<>"']/g, function (i) {
336
+ return escapeChars[i] || i;
337
+ });
338
+ }
339
+ function strFormat(template, ...args) {
340
+ return template.replace(/{(\w+)}/g, (match, key) => {
341
+ if (args.length > 0 && typeof args[0] === 'object' && args[0][key] !== undefined) {
342
+ return args[0][key];
343
+ }
344
+ const index = parseInt(key);
345
+ if (!isNaN(index) && args[index] !== undefined) {
346
+ return args[index];
347
+ }
348
+ return match;
349
+ });
350
+ }
351
+ function elementToHyperlink(element, href, cursorPointer = true, preventDefault = false) {
352
+ element.addEventListener('click', function (elem) {
353
+ if (elem.button === 0)
354
+ window.location.href = href;
355
+ else if (elem.button === 1)
356
+ window.open(href, '_blank');
357
+ });
358
+ if (preventDefault) {
359
+ element.addEventListener('auxclick', function (elem) {
360
+ if (elem.button === 1)
361
+ elem.preventDefault();
362
+ });
363
+ }
364
+ if (cursorPointer)
365
+ element.style.cursor = 'pointer';
366
+ return element;
367
+ }
2343
368
 
2344
- // ===== File: input.js =====
2345
- "use strict";
2346
369
  function getInputCursorPosition(input) {
2347
370
  const start = input.selectionStart;
2348
371
  if (start == null)
@@ -2372,10 +395,7 @@ function getInputLabel(input) {
2372
395
  throw new Error("Label не найден. Возможно, вы не использовали атрибут for в нем");
2373
396
  return label;
2374
397
  }
2375
- //# sourceMappingURL=input.js.map
2376
398
 
2377
- // ===== File: link.js =====
2378
- "use strict";
2379
399
  function loadCSS(href) {
2380
400
  const link = document.createElement('link');
2381
401
  link.rel = 'stylesheet';
@@ -2383,10 +403,7 @@ function loadCSS(href) {
2383
403
  link.href = href;
2384
404
  document.head.appendChild(link);
2385
405
  }
2386
- //# sourceMappingURL=link.js.map
2387
406
 
2388
- // ===== File: notifications.js =====
2389
- "use strict";
2390
407
  function pushNotification(title = "Уведомление", body = "Текст уведомления", icon = null) {
2391
408
  if (Notification.permission !== "granted") {
2392
409
  Notification.requestPermission().then(permission => {
@@ -2477,10 +494,7 @@ class HyperTextNotification {
2477
494
  }, actualTimeout * 1000);
2478
495
  }
2479
496
  }
2480
- //# sourceMappingURL=notifications.js.map
2481
497
 
2482
- // ===== File: string.js =====
2483
- "use strict";
2484
498
  function stringToBoolean(input) {
2485
499
  if (input.toLowerCase() === "true")
2486
500
  return true;
@@ -2488,10 +502,7 @@ function stringToBoolean(input) {
2488
502
  return false;
2489
503
  return null;
2490
504
  }
2491
- //# sourceMappingURL=string.js.map
2492
505
 
2493
- // ===== File: styles.js =====
2494
- "use strict";
2495
506
  function input_type_fc(input) {
2496
507
  return input.type !== 'hidden' && input.type !== 'reset' && input.type !== 'checkbox' && input.type !== 'radio';
2497
508
  }
@@ -2532,10 +543,7 @@ function intToPixel(number = '0') {
2532
543
  return '0';
2533
544
  return !isNaN(parseInt(number)) ? number + 'px' : number;
2534
545
  }
2535
- //# sourceMappingURL=styles.js.map
2536
546
 
2537
- // ===== File: system.js =====
2538
- "use strict";
2539
547
  function getSystemTheme() {
2540
548
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').media !== 'not all') {
2541
549
  const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
@@ -2566,10 +574,7 @@ function redirectBackOrClose(default_url = '/') {
2566
574
  function getHost() {
2567
575
  return window.location.protocol + '//' + window.location.host;
2568
576
  }
2569
- //# sourceMappingURL=system.js.map
2570
577
 
2571
- // ===== File: tags.js =====
2572
- "use strict";
2573
578
  class AbbreviatedNumber extends HTMLElement {
2574
579
  constructor() {
2575
580
  super();
@@ -2925,10 +930,7 @@ customElements.define('step-bar', Stepbar);
2925
930
  customElements.define('ab-num', AbbreviatedNumber);
2926
931
  customElements.define('include-html', HTMLFile);
2927
932
  customElements.define('click-to-copy', ClickToCopy);
2928
- //# sourceMappingURL=tags.js.map
2929
933
 
2930
- // ===== File: url.js =====
2931
- "use strict";
2932
934
  function isAbsoluteUrl(url) {
2933
935
  try {
2934
936
  new URL(url);
@@ -2954,10 +956,7 @@ function combineUrls(baseUrl, relativeUrl) {
2954
956
  function getScriptSite(script) {
2955
957
  return new URL(script.src).origin;
2956
958
  }
2957
- //# sourceMappingURL=url.js.map
2958
959
 
2959
- // ===== File: uuid.js =====
2960
- "use strict";
2961
960
  function generateUUIDv4() {
2962
961
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2963
962
  const r = Math.random() * 16 | 0;
@@ -2965,5 +964,4 @@ function generateUUIDv4() {
2965
964
  return v.toString(16);
2966
965
  });
2967
966
  }
2968
- //# sourceMappingURL=uuid.js.map
2969
967