@osovitny/anatoly 3.17.1 → 3.17.3

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.
@@ -12,7 +12,7 @@ import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG,
12
12
  import { BrowserUtils, EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PromptValue, PublicClientApplication, LogLevel } from '@azure/msal-browser';
13
13
  import * as i1$2 from '@angular/common';
14
14
  import { LOCATION_INITIALIZED, DOCUMENT, CommonModule } from '@angular/common';
15
- import { isValid, format, formatDistance, formatDistanceToNow } from 'date-fns';
15
+ import { format, formatDistance, formatDistanceToNow } from 'date-fns';
16
16
  import { utcToZonedTime } from 'date-fns-tz';
17
17
  import enUS from 'date-fns/locale/en-US';
18
18
  import * as i1$3 from '@ngx-translate/core';
@@ -95,6 +95,11 @@ const ClientApps = AppCoreSettings?.clientApps;
95
95
  //ClientApp
96
96
  const AppName = document.getElementById('appName').getAttribute('data-appname');
97
97
  const AppSettings = getAppSettingsByName(AppName);
98
+ //DateFormats
99
+ const DateFormats = {
100
+ date: 'dd MMM yyyy',
101
+ dateTime: 'dd MMM yyyy HH:mm'
102
+ };
98
103
 
99
104
  /*
100
105
  <file>
@@ -191,7 +196,52 @@ class Convert {
191
196
  return Boolean(value);
192
197
  }
193
198
  }
194
- /* Date ---------------------------------------------------------------------BEGIN*/
199
+ }
200
+
201
+ /*
202
+ <file>
203
+ Project:
204
+ @osovitny/anatoly
205
+
206
+ Authors:
207
+ Vadim Osovitny vadim@osovitny.com
208
+ Anatoly Osovitny anatoly@osovitny.com
209
+
210
+ Created:
211
+ 09 Feb 2024
212
+
213
+ Source:
214
+ https://github.com/date-fns/date-fns/blob/main/src/toDate/index.ts
215
+
216
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
217
+ </file>
218
+ */
219
+ class DateConvert {
220
+ static toDate(argument) {
221
+ const argStr = Object.prototype.toString.call(argument);
222
+ if (argument instanceof Date || (typeof argument === "object" && argStr === "[object Date]")) {
223
+ return argument;
224
+ }
225
+ else if (typeof argument === "number" || argStr === "[object Number]" ||
226
+ typeof argument === "string" || argStr === "[object String]") {
227
+ return new Date(argument);
228
+ }
229
+ else {
230
+ return new Date(NaN);
231
+ }
232
+ }
233
+ static localToUtcDate(value) {
234
+ if (value) {
235
+ return new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate());
236
+ }
237
+ return null;
238
+ }
239
+ static localToUtcDateTime(value) {
240
+ if (value) {
241
+ return new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
242
+ }
243
+ return null;
244
+ }
195
245
  static utcToLocalDate(value) {
196
246
  if (value) {
197
247
  return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate()));
@@ -204,14 +254,6 @@ class Convert {
204
254
  }
205
255
  return null;
206
256
  }
207
- static dateToString(date) {
208
- return date.getFullYear() +
209
- '-' + this.pad(date.getMonth() + 1) +
210
- '-' + this.pad(date.getDate()) +
211
- ' ' + this.pad(date.getHours()) +
212
- ':' + this.pad(date.getMinutes()) +
213
- ':' + this.pad(date.getSeconds());
214
- }
215
257
  }
216
258
 
217
259
  /*
@@ -1603,92 +1645,74 @@ class Subs {
1603
1645
  Anatoly Osovitny anatoly@osovitny.com
1604
1646
 
1605
1647
  Created:
1606
- 19 March 2020
1648
+ 09 Feb 2024
1649
+
1650
+ Sources:
1651
+ https://github.com/date-fns/date-fns/blob/main/src/isDate/index.ts
1652
+ https://github.com/date-fns/date-fns/blob/main/src/isValid/index.ts
1607
1653
 
1608
1654
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1609
1655
  </file>
1610
1656
  */
1611
- class Utils {
1612
- static idExistsInQS() {
1613
- let id = Utils.getValueByNameInQS("id");
1614
- if (id)
1615
- return true;
1616
- return false;
1617
- }
1618
- static getValueByNameInQS(name) {
1619
- return Utils.getValueByName(location.search, name);
1620
- }
1621
- static getValueByName(url, name) {
1622
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1623
- // tslint:disable-next-line:one-variable-per-declaration
1624
- const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1625
- return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1657
+ class is {
1658
+ /**
1659
+ * @name isDate
1660
+ * @summary Is the given value a date?
1661
+ */
1662
+ static date(value) {
1663
+ return (value instanceof Date ||
1664
+ (typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"));
1626
1665
  }
1627
- static copyToClipBoard(event, val) {
1628
- event.preventDefault();
1629
- const selBox = document.createElement('textarea');
1630
- selBox.style.position = 'fixed';
1631
- selBox.style.left = '0';
1632
- selBox.style.top = '0';
1633
- selBox.style.opacity = '0';
1634
- selBox.value = val;
1635
- document.body.appendChild(selBox);
1636
- selBox.focus();
1637
- selBox.select();
1638
- document.execCommand('copy');
1639
- document.body.removeChild(selBox);
1666
+ /**
1667
+ * @name isDateValid
1668
+ * @summary Is the given date valid?
1669
+ */
1670
+ static dateValid(date) {
1671
+ if (!is.date(date) && typeof date !== "number") {
1672
+ return false;
1673
+ }
1674
+ let d = new Date(date);
1675
+ return !isNaN(Number(d));
1640
1676
  }
1641
- static downloadFile(name, url) {
1642
- const link = document.createElement('a');
1643
- link.download = name;
1644
- link.href = url;
1645
- link.click();
1677
+ static dateInvalid(date) {
1678
+ return !is.dateValid(date);
1646
1679
  }
1647
- static downloadBlobFile(value, fileName) {
1648
- const nav = window.navigator;
1649
- if (nav.msSaveOrOpenBlob) {
1650
- nav.msSaveOrOpenBlob(value, fileName);
1651
- }
1652
- else {
1653
- const downloadURL = window.URL.createObjectURL(value);
1654
- Utils.downloadFile(fileName, downloadURL);
1655
- }
1680
+ static string(value) {
1681
+ return (typeof value === 'string' || value instanceof String);
1656
1682
  }
1657
- /*
1658
- Author:
1659
- https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
1660
- */
1661
- static slugify(text, prefix = '', postfix = '') {
1662
- const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
1663
- const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
1664
- const p = new RegExp(a.split('').join('|'), 'g');
1665
- /*
1666
- https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
1667
- https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
1668
- */
1669
- text = text.replace(/(<([^>]+)>)/gi, '');
1670
- let result = text
1671
- .toString()
1672
- .toLowerCase()
1673
- .replace(/\s+/g, '-') // Replace spaces with -
1674
- .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
1675
- .replace(/&/g, '-and-') // Replace & with 'and'
1676
- .replace(/[^\w\-]+/g, '') // Remove all non-word characters
1677
- .replace(/\-\-+/g, '-') // Replace multiple - with single -
1678
- .replace(/^-+/, '') // Trim - from start of text
1679
- .replace(/-+$/, ''); // Trim - from end of text
1680
- return prefix + result + postfix;
1683
+ static number(value) {
1684
+ return (typeof value === 'number');
1681
1685
  }
1682
- static generateRandom(start, end) {
1683
- return Math.floor(Math.random() * (end - start + 1)) + start;
1686
+ static boolean(value) {
1687
+ return (typeof value === 'boolean');
1684
1688
  }
1685
- static isObjectNullOrEmpty(obj) {
1689
+ static objectNullOrEmpty(obj) {
1686
1690
  return !obj || Object.keys(obj).length == 0;
1687
1691
  }
1688
- static isString(value) {
1689
- return typeof value === 'string' || value instanceof String;
1690
- }
1691
1692
  }
1693
+ /*
1694
+
1695
+ is = {
1696
+ DONE string: function (obj) { return (typeof obj === 'string'); },
1697
+ DONE number: function (obj) { return (typeof obj === 'number'); },
1698
+ DONE bool: function (obj) { return (typeof obj === 'boolean'); },
1699
+ array: function (obj) { return (obj instanceof Array); },
1700
+ undefined: function (obj) { return (typeof obj === 'undefined'); },
1701
+ 'null': function (obj) { return (obj === null); },
1702
+ notNull: function (obj) { return (obj !== null); },
1703
+ invalid: function (obj) { return (is['null'](obj) || is.undefined(obj)); },
1704
+ valid: function (obj) { return (!is['null'](obj) && !is.undefined(obj)); },
1705
+ emptyString: function (obj) { return (is.string(obj) && (obj.length == 0)); },
1706
+ nonEmptyString: function (obj) { return (is.string(obj) && (obj.length > 0)); },
1707
+ emptyArray: function (obj) { return (is.array(obj) && (obj.length == 0)); },
1708
+ nonEmptyArray: function (obj) { return (is.array(obj) && (obj.length > 0)); },
1709
+ document: function (obj) { return (obj === document); },
1710
+ window: function (obj) { return (obj === window); },
1711
+ element: function (obj) { return (obj instanceof HTMLElement); },
1712
+ event: function (obj) { return (obj instanceof Event); },
1713
+ link: function (obj) { return (is.element(obj) && (obj.tagName == 'A')); }
1714
+ };
1715
+ */
1692
1716
 
1693
1717
  /*
1694
1718
  <file>
@@ -1702,6 +1726,10 @@ class Utils {
1702
1726
  Created:
1703
1727
  05 May 2020
1704
1728
 
1729
+ Source:
1730
+ https://date-fns.org/v3.3.1/docs/formatDistance
1731
+ https://date-fns.org/v3.3.1/docs/formatDistanceToNow
1732
+
1705
1733
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1706
1734
  </file>
1707
1735
  */
@@ -1766,7 +1794,7 @@ class LocalizationService {
1766
1794
  }
1767
1795
  return dfnLocale;
1768
1796
  }
1769
- //getLocalized...
1797
+ //getLocalized
1770
1798
  getLocalizedValue(key, params) {
1771
1799
  const value = this.translate.instant(key);
1772
1800
  if (!params || params.length === 0) {
@@ -1774,91 +1802,36 @@ class LocalizationService {
1774
1802
  }
1775
1803
  return this.format(value, params);
1776
1804
  }
1777
- getLocalizedDate(key) {
1778
- let date = new Date(key);
1779
- if (isValid(date)) {
1780
- let localDate = Convert.utcToLocalDate(date);
1781
- return format(localDate, 'dd MMM yyyy', this.dateFnsLocale);
1805
+ getLocalizedDate(value) {
1806
+ let date = DateConvert.toDate(value);
1807
+ if (is.dateInvalid(date)) {
1808
+ return "Invalid Date";
1782
1809
  }
1783
- return "Invalid Date";
1810
+ return format(date, DateFormats.date, this.dateFnsLocale);
1784
1811
  }
1785
- getLocalizedDateTime(key) {
1786
- let date = new Date(key);
1787
- if (isValid(date)) {
1788
- let localDate = Convert.utcToLocalDateTime(date);
1789
- return format(localDate, 'dd MMM yyyy HH:mm', this.dateFnsLocale);
1812
+ getLocalizedDateTime(value) {
1813
+ let date = DateConvert.toDate(value);
1814
+ if (is.dateInvalid(date)) {
1815
+ return "Invalid Date";
1790
1816
  }
1791
- return "Invalid Date";
1817
+ return format(date, DateFormats.dateTime, this.dateFnsLocale);
1792
1818
  }
1793
- getLocalizedDistanceInWords(endedDate, startedDate) {
1794
- if (isValid(new Date(endedDate)) && isValid(new Date(startedDate))) {
1795
- return formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
1796
- }
1797
- return "Invalid Date";
1819
+ //UTC ---------------------------------------------------------------------BEGIN
1820
+ getUTCToLocalizedDate(value) {
1821
+ return this.safeUtcToZonedTime(value, DateFormats.date);
1798
1822
  }
1799
- getLocalizedDistanceToNowInWords(date) {
1800
- if (isValid(new Date(date))) {
1801
- return formatDistanceToNow(new Date(date), this.dateFnsLocale);
1802
- }
1803
- return "Invalid Date";
1823
+ getUTCToLocalizedDateTime(value) {
1824
+ return this.safeUtcToZonedTime(value, DateFormats.dateTime);
1804
1825
  }
1805
- //UTC Operations --------------------------------------------------------------
1806
- getUTCToLocalizedDate(key) {
1807
- if (!Utils.isString(key)) {
1808
- key = key.toString();
1809
- }
1810
- if (key) {
1811
- if (key.indexOf("T") == -1) {
1812
- key = key.replace(" ", "T");
1813
- }
1814
- if (key.indexOf("Z") == -1) {
1815
- key = key + "Z";
1816
- }
1817
- }
1818
- let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1819
- if (browserTimeZone) {
1820
- let localDateTime = utcToZonedTime(key, browserTimeZone);
1821
- return format(localDateTime, 'dd.MM.yyyy', this.dateFnsLocale);
1822
- }
1823
- else {
1824
- return format(new Date(key), 'dd.MM.yyyy', this.dateFnsLocale);
1825
- }
1826
- }
1827
- getUTCToLocalizedDateTime(key) {
1828
- if (!Utils.isString(key)) {
1829
- key = key.toString();
1830
- }
1831
- if (key) {
1832
- if (key.indexOf("T") == -1) {
1833
- key = key.replace(" ", "T");
1834
- }
1835
- if (key.indexOf("Z") == -1) {
1836
- key = key + "Z";
1837
- }
1838
- }
1839
- let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1840
- if (browserTimeZone) {
1841
- let localDateTime = utcToZonedTime(key, browserTimeZone);
1842
- return format(localDateTime, 'dd.MM.yyyy HH:mm', this.dateFnsLocale);
1843
- }
1844
- else {
1845
- return format(new Date(key), 'dd.MM.yyyy HH:mm', this.dateFnsLocale);
1846
- }
1847
- }
1848
- //https://date-fns.org/v1.30.1/docs/distanceInWords
1849
- getUTCToLocalizedDistanceToNowInWords(date) {
1850
- date = this.safeUtcToZonedTime(date);
1851
- if (isValid(new Date(date))) {
1852
- return formatDistanceToNow(new Date(date), this.dateFnsLocale);
1826
+ safeUtcToZonedTime(date, conversionFormat = null) {
1827
+ if (!date) {
1828
+ return null;
1853
1829
  }
1854
- return "Invalid Date";
1855
- }
1856
- safeUtcToZonedTime(date) {
1857
1830
  let result = date;
1858
1831
  try {
1859
- if (date) {
1860
- if (date.indexOf("T") == -1) {
1861
- date = date.replace(" ", "T");
1832
+ if (typeof date === 'string') {
1833
+ if (date.indexOf("T") > -1) {
1834
+ date = date.replace("T", " ");
1862
1835
  }
1863
1836
  if (date.indexOf("Z") == -1) {
1864
1837
  date = date + "Z";
@@ -1866,19 +1839,45 @@ class LocalizationService {
1866
1839
  }
1867
1840
  let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1868
1841
  if (browserTimeZone) {
1869
- result = utcToZonedTime(date, browserTimeZone).toString();
1842
+ if (conversionFormat) {
1843
+ result = utcToZonedTime(date, browserTimeZone);
1844
+ result = format(result, conversionFormat, this.dateFnsLocale);
1845
+ }
1846
+ else {
1847
+ result = utcToZonedTime(date, browserTimeZone).toString();
1848
+ }
1870
1849
  }
1871
1850
  else {
1872
- result = new Date(date).toString();
1851
+ if (conversionFormat) {
1852
+ result = format(new Date(date), conversionFormat, this.dateFnsLocale);
1853
+ }
1854
+ else {
1855
+ result = new Date(date).toString();
1856
+ }
1873
1857
  }
1874
1858
  }
1875
1859
  catch {
1876
- if (date) {
1877
- console.log("UTC to Local conversion failed for :" + date.toString());
1878
- }
1860
+ result = "Invalid Date";
1879
1861
  }
1880
1862
  return result;
1881
1863
  }
1864
+ //UTC ---------------------------------------------------------------------END
1865
+ //Distance ----------------------------------------------------------------BEGIN
1866
+ getLocalizedDistanceInWords(endedDateStr, startedDateStr) {
1867
+ let endedDate = DateConvert.toDate(endedDateStr);
1868
+ let startedDate = DateConvert.toDate(startedDateStr);
1869
+ if (is.dateInvalid(endedDate) || is.dateInvalid(startedDate)) {
1870
+ return "Invalid Date";
1871
+ }
1872
+ return formatDistance(endedDate, startedDate, this.dateFnsLocale);
1873
+ }
1874
+ getLocalizedDistanceToNowInWords(value) {
1875
+ let date = DateConvert.toDate(value);
1876
+ if (is.dateInvalid(date)) {
1877
+ return "Invalid Date";
1878
+ }
1879
+ return formatDistanceToNow(date, this.dateFnsLocale);
1880
+ }
1882
1881
  static { this.ɵfac = function LocalizationService_Factory(t) { return new (t || LocalizationService)(i0.ɵɵinject(i1$3.TranslateService)); }; }
1883
1882
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LocalizationService, factory: LocalizationService.ɵfac, providedIn: 'root' }); }
1884
1883
  }
@@ -1930,6 +1929,17 @@ class LocalizePipe {
1930
1929
  if (type === 'dt') {
1931
1930
  return this.localizeService.getLocalizedDateTime(inputData);
1932
1931
  }
1932
+ //UTC ---------------------------------------------------------------------BEGIN
1933
+ //Date
1934
+ if (type === 'utc2d') {
1935
+ return this.localizeService.getUTCToLocalizedDate(inputData);
1936
+ }
1937
+ //DateTime
1938
+ if (type === 'utc2dt') {
1939
+ return this.localizeService.getUTCToLocalizedDateTime(inputData);
1940
+ }
1941
+ //UTC ---------------------------------------------------------------------END
1942
+ //Distance ----------------------------------------------------------------BEGIN
1933
1943
  //DistanceInWords
1934
1944
  if (type === 'dis') {
1935
1945
  return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
@@ -1938,19 +1948,7 @@ class LocalizePipe {
1938
1948
  if (type === 'dis2now') {
1939
1949
  return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
1940
1950
  }
1941
- //UTC Operations --------------------------------------------------------------
1942
- //UTC Date
1943
- if (type === 'utcd') {
1944
- return this.localizeService.getUTCToLocalizedDate(inputData);
1945
- }
1946
- //UTC DateTime
1947
- if (type === 'utcdt') {
1948
- return this.localizeService.getUTCToLocalizedDateTime(inputData);
1949
- }
1950
- //UTC DistanceToNowInWords
1951
- if (type === 'utcdis2now') {
1952
- return this.localizeService.getUTCToLocalizedDistanceToNowInWords(inputData);
1953
- }
1951
+ //Distance ----------------------------------------------------------------END
1954
1952
  return inputData;
1955
1953
  }
1956
1954
  static { this.ɵfac = function LocalizePipe_Factory(t) { return new (t || LocalizePipe)(i0.ɵɵdirectiveInject(LocalizationService, 16)); }; }
@@ -2636,7 +2634,7 @@ class StarterServiceBase extends ApiServiceBase {
2636
2634
  }
2637
2635
  applicationStarting() {
2638
2636
  let context = this.appContext.current;
2639
- if (!Utils.isObjectNullOrEmpty(context)) {
2637
+ if (!is.objectNullOrEmpty(context)) {
2640
2638
  this.appContext.init(context);
2641
2639
  return of(context);
2642
2640
  }
@@ -2889,6 +2887,97 @@ class Guid {
2889
2887
  }
2890
2888
  }
2891
2889
 
2890
+ /*
2891
+ <file>
2892
+ Project:
2893
+ @osovitny/anatoly
2894
+
2895
+ Authors:
2896
+ Vadim Osovitny vadim@osovitny.com
2897
+ Anatoly Osovitny anatoly@osovitny.com
2898
+
2899
+ Created:
2900
+ 19 March 2020
2901
+
2902
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2903
+ </file>
2904
+ */
2905
+ class Utils {
2906
+ static idExistsInQS() {
2907
+ let id = Utils.getValueByNameInQS("id");
2908
+ if (id)
2909
+ return true;
2910
+ return false;
2911
+ }
2912
+ static getValueByNameInQS(name) {
2913
+ return Utils.getValueByName(location.search, name);
2914
+ }
2915
+ static getValueByName(url, name) {
2916
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
2917
+ // tslint:disable-next-line:one-variable-per-declaration
2918
+ const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
2919
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
2920
+ }
2921
+ static copyToClipBoard(event, val) {
2922
+ event.preventDefault();
2923
+ const selBox = document.createElement('textarea');
2924
+ selBox.style.position = 'fixed';
2925
+ selBox.style.left = '0';
2926
+ selBox.style.top = '0';
2927
+ selBox.style.opacity = '0';
2928
+ selBox.value = val;
2929
+ document.body.appendChild(selBox);
2930
+ selBox.focus();
2931
+ selBox.select();
2932
+ document.execCommand('copy');
2933
+ document.body.removeChild(selBox);
2934
+ }
2935
+ static downloadFile(name, url) {
2936
+ const link = document.createElement('a');
2937
+ link.download = name;
2938
+ link.href = url;
2939
+ link.click();
2940
+ }
2941
+ static downloadBlobFile(value, fileName) {
2942
+ const nav = window.navigator;
2943
+ if (nav.msSaveOrOpenBlob) {
2944
+ nav.msSaveOrOpenBlob(value, fileName);
2945
+ }
2946
+ else {
2947
+ const downloadURL = window.URL.createObjectURL(value);
2948
+ Utils.downloadFile(fileName, downloadURL);
2949
+ }
2950
+ }
2951
+ /*
2952
+ Author:
2953
+ https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
2954
+ */
2955
+ static slugify(text, prefix = '', postfix = '') {
2956
+ const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
2957
+ const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
2958
+ const p = new RegExp(a.split('').join('|'), 'g');
2959
+ /*
2960
+ https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
2961
+ https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
2962
+ */
2963
+ text = text.replace(/(<([^>]+)>)/gi, '');
2964
+ let result = text
2965
+ .toString()
2966
+ .toLowerCase()
2967
+ .replace(/\s+/g, '-') // Replace spaces with -
2968
+ .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
2969
+ .replace(/&/g, '-and-') // Replace & with 'and'
2970
+ .replace(/[^\w\-]+/g, '') // Remove all non-word characters
2971
+ .replace(/\-\-+/g, '-') // Replace multiple - with single -
2972
+ .replace(/^-+/, '') // Trim - from start of text
2973
+ .replace(/-+$/, ''); // Trim - from end of text
2974
+ return prefix + result + postfix;
2975
+ }
2976
+ static generateRandom(start, end) {
2977
+ return Math.floor(Math.random() * (end - start + 1)) + start;
2978
+ }
2979
+ }
2980
+
2892
2981
  /*
2893
2982
  <file>
2894
2983
  Project:
@@ -7343,5 +7432,5 @@ class AnatolyModule {
7343
7432
  * Generated bundle index. Do not edit.
7344
7433
  */
7345
7434
 
7346
- export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, ItemValidationSummaryComponent, L10NUrl, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, getAppSettingsById, getAppSettingsByName, localizationInitializerFactory, throwIfAlreadyLoaded, translateLoaderFactory };
7435
+ export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DateConvert, DateFormats, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, ItemValidationSummaryComponent, L10NUrl, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, getAppSettingsById, getAppSettingsByName, is, localizationInitializerFactory, throwIfAlreadyLoaded, translateLoaderFactory };
7347
7436
  //# sourceMappingURL=osovitny-anatoly.mjs.map