@stemy/ngx-utils 17.4.2 → 17.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.
@@ -3,7 +3,7 @@ import { InjectionToken, PLATFORM_ID, Inject, Injectable, Optional, Injector, Ev
3
3
  import 'reflect-metadata';
4
4
  import * as i2 from '@angular/router';
5
5
  import { ActivatedRouteSnapshot, Scroll, NavigationEnd, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer } from '@angular/router';
6
- import { BehaviorSubject, Observable, firstValueFrom, Subject, Subscription, from, TimeoutError, combineLatest } from 'rxjs';
6
+ import { BehaviorSubject, Observable, firstValueFrom, isObservable, Subject, Subscription, from, TimeoutError, combineLatest } from 'rxjs';
7
7
  import { skipWhile, debounceTime, distinctUntilChanged, map, filter, first, mergeMap, timeout } from 'rxjs/operators';
8
8
  import * as i1$3 from '@angular/common';
9
9
  import { isPlatformBrowser, isPlatformServer, DOCUMENT, APP_BASE_HREF, CommonModule } from '@angular/common';
@@ -1092,6 +1092,132 @@ function cachedFactory(providers) {
1092
1092
  };
1093
1093
  }
1094
1094
 
1095
+ const iso8061 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:.\d+)?(?:Z|[+-]\d\d:\d\d)$/;
1096
+ function serializer(replacer, cycleReplacer) {
1097
+ const stack = [], keys = [];
1098
+ if (cycleReplacer == null)
1099
+ cycleReplacer = function (key, value) {
1100
+ if (stack[0] === value)
1101
+ return "[Circular ~]";
1102
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
1103
+ };
1104
+ return (key, value) => {
1105
+ if (isObservable(value))
1106
+ return "[Observable ~]";
1107
+ if (stack.length > 0) {
1108
+ const thisPos = stack.indexOf(this);
1109
+ ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
1110
+ ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
1111
+ if (~stack.indexOf(value))
1112
+ value = cycleReplacer.call(this, key, value);
1113
+ }
1114
+ else
1115
+ stack.push(value);
1116
+ if (typeof value === "string" && value.match(iso8061)) {
1117
+ value = new Date(value);
1118
+ }
1119
+ return replacer == null ? value : replacer.call(this, key, value);
1120
+ };
1121
+ }
1122
+ function stringify(value, replacer = null, spaces = 2, cycleReplacer = null) {
1123
+ return JSON.stringify(value, serializer(replacer, cycleReplacer), spaces);
1124
+ }
1125
+
1126
+ const S = [
1127
+ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14,
1128
+ 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21,
1129
+ 6, 10, 15, 21,
1130
+ ];
1131
+ const K = [
1132
+ 3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955,
1133
+ 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195,
1134
+ 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605,
1135
+ 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501,
1136
+ 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562,
1137
+ 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074,
1138
+ 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452,
1139
+ 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497,
1140
+ 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259,
1141
+ 3951481745,
1142
+ ];
1143
+ function leftRotate(x, c) {
1144
+ return (x << c) | (x >>> (32 - c));
1145
+ }
1146
+ function md5(input) {
1147
+ // UTF-8 encode the string
1148
+ const encoder = new TextEncoder();
1149
+ const data = encoder.encode(stringify(input ?? "") || "");
1150
+ const originalBitLength = data.length * 8;
1151
+ // --- Padding: append 0x80 then 0x00 until len ≡ 56 (mod 64)
1152
+ let msgLen = data.length + 1;
1153
+ while (msgLen % 64 !== 56)
1154
+ msgLen++;
1155
+ const buffer = new Uint8Array(msgLen + 8); // +8 bytes for length
1156
+ buffer.set(data);
1157
+ buffer[data.length] = 0x80;
1158
+ // Append original length in bits, little-endian 64-bit
1159
+ let bitLen = originalBitLength;
1160
+ for (let i = 0; i < 8; i++) {
1161
+ buffer[msgLen + i] = bitLen & 0xff;
1162
+ bitLen = Math.floor(bitLen / 256);
1163
+ }
1164
+ // Initial state
1165
+ let a0 = 0x67452301;
1166
+ let b0 = 0xefcdab89;
1167
+ let c0 = 0x98badcfe;
1168
+ let d0 = 0x10325476;
1169
+ const view = new DataView(buffer.buffer);
1170
+ // Process 512-bit chunks
1171
+ for (let offset = 0; offset < buffer.length; offset += 64) {
1172
+ const M = new Uint32Array(16);
1173
+ for (let i = 0; i < 16; i++) {
1174
+ M[i] = view.getUint32(offset + i * 4, true); // little-endian
1175
+ }
1176
+ let A = a0;
1177
+ let B = b0;
1178
+ let C = c0;
1179
+ let D = d0;
1180
+ for (let i = 0; i < 64; i++) {
1181
+ let F, g;
1182
+ if (i < 16) {
1183
+ F = (B & C) | (~B & D);
1184
+ g = i;
1185
+ }
1186
+ else if (i < 32) {
1187
+ F = (D & B) | (~D & C);
1188
+ g = (5 * i + 1) % 16;
1189
+ }
1190
+ else if (i < 48) {
1191
+ F = B ^ C ^ D;
1192
+ g = (3 * i + 5) % 16;
1193
+ }
1194
+ else {
1195
+ F = C ^ (B | ~D);
1196
+ g = (7 * i) % 16;
1197
+ }
1198
+ F = (F + A + K[i] + M[g]) >>> 0;
1199
+ A = D;
1200
+ D = C;
1201
+ C = B;
1202
+ B = (B + leftRotate(F, S[i])) >>> 0;
1203
+ }
1204
+ a0 = (a0 + A) >>> 0;
1205
+ b0 = (b0 + B) >>> 0;
1206
+ c0 = (c0 + C) >>> 0;
1207
+ d0 = (d0 + D) >>> 0;
1208
+ }
1209
+ // Output as hex (little-endian)
1210
+ const words = [a0, b0, c0, d0];
1211
+ let out = "";
1212
+ for (const w of words) {
1213
+ for (let i = 0; i < 4; i++) {
1214
+ const byte = (w >>> (8 * i)) & 0xff;
1215
+ out += byte.toString(16).padStart(2, "0");
1216
+ }
1217
+ }
1218
+ return out;
1219
+ }
1220
+
1095
1221
  class BlurStack {
1096
1222
  constructor() {
1097
1223
  this.r = 0;
@@ -1804,51 +1930,6 @@ class Initializer {
1804
1930
  }
1805
1931
  }
1806
1932
 
1807
- class JSONfn {
1808
- static parse(text) {
1809
- return JSON.parse(text, JSONfn.reviver);
1810
- }
1811
- static stringify(obj) {
1812
- return JSON.stringify(obj, JSONfn.replacer);
1813
- }
1814
- static reviver(key, value) {
1815
- const iso8061 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:.\d+)?(?:Z|[+-]\d\d:\d\d)$/;
1816
- if (typeof value !== "string")
1817
- return value;
1818
- if (value.length < 8) {
1819
- return value;
1820
- }
1821
- if (value.match(iso8061)) {
1822
- return new Date(value);
1823
- }
1824
- const prefix = value.substring(0, 8);
1825
- if (prefix === "function") {
1826
- return new Function(`return ${value}`)();
1827
- }
1828
- if (prefix === "_NuFrRa_") {
1829
- return new Function(`return ${value.slice(8)}`)();
1830
- }
1831
- if (prefix === "_PxEgEr_") {
1832
- return new Function(`return ${value.slice(8)}`)();
1833
- }
1834
- return value;
1835
- }
1836
- static replacer(key, value) {
1837
- if (value instanceof Function || typeof value === "function") {
1838
- const fnBody = value.toString();
1839
- if (fnBody.length < 8 || fnBody.substring(0, 8) !== "function") {
1840
- // this is ES6 Arrow Function
1841
- return "_NuFrRa_" + fnBody;
1842
- }
1843
- return fnBody;
1844
- }
1845
- if (value instanceof RegExp) {
1846
- return "_PxEgEr_" + value;
1847
- }
1848
- return value;
1849
- }
1850
- }
1851
-
1852
1933
  class LoaderUtils {
1853
1934
  static { this.scriptPromises = {}; }
1854
1935
  static { this.stylePromises = {}; }
@@ -2281,6 +2362,51 @@ function provideWithOptions(type, options) {
2281
2362
  };
2282
2363
  }
2283
2364
 
2365
+ class JSONfn {
2366
+ static parse(text) {
2367
+ return JSON.parse(text, JSONfn.reviver);
2368
+ }
2369
+ static stringify(obj) {
2370
+ return JSON.stringify(obj, JSONfn.replacer);
2371
+ }
2372
+ static reviver(key, value) {
2373
+ const iso8061 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:.\d+)?(?:Z|[+-]\d\d:\d\d)$/;
2374
+ if (typeof value !== "string")
2375
+ return value;
2376
+ if (value.length < 8) {
2377
+ return value;
2378
+ }
2379
+ if (value.match(iso8061)) {
2380
+ return new Date(value);
2381
+ }
2382
+ const prefix = value.substring(0, 8);
2383
+ if (prefix === "function") {
2384
+ return new Function(`return ${value}`)();
2385
+ }
2386
+ if (prefix === "_NuFrRa_") {
2387
+ return new Function(`return ${value.slice(8)}`)();
2388
+ }
2389
+ if (prefix === "_PxEgEr_") {
2390
+ return new Function(`return ${value.slice(8)}`)();
2391
+ }
2392
+ return value;
2393
+ }
2394
+ static replacer(key, value) {
2395
+ if (value instanceof Function || typeof value === "function") {
2396
+ const fnBody = value.toString();
2397
+ if (fnBody.length < 8 || fnBody.substring(0, 8) !== "function") {
2398
+ // this is ES6 Arrow Function
2399
+ return "_NuFrRa_" + fnBody;
2400
+ }
2401
+ return fnBody;
2402
+ }
2403
+ if (value instanceof RegExp) {
2404
+ return "_PxEgEr_" + value;
2405
+ }
2406
+ return value;
2407
+ }
2408
+ }
2409
+
2284
2410
  function workerFunction(JSONfn, logTimes) {
2285
2411
  let wasmResolve = null;
2286
2412
  const wasmInstance = new Promise(resolve => {
@@ -3349,14 +3475,13 @@ class StaticLanguageService {
3349
3475
  this.mergedTranslations = this.translations;
3350
3476
  }
3351
3477
  getTranslationSync(key, params = null) {
3352
- const lowerKey = (key || "").toLocaleLowerCase();
3353
- const translation = this.dictionary[lowerKey] || lowerKey;
3354
- return this.interpolate(translation == lowerKey ? key : translation, params);
3478
+ key = String(key || "");
3479
+ const lowerKey = key.toLocaleLowerCase();
3480
+ const translation = !key ? "" : this.dictionary[lowerKey] || key;
3481
+ return this.interpolate(translation, params);
3355
3482
  }
3356
- getTranslation(key, params) {
3357
- const lowerKey = (key || "").toLocaleLowerCase();
3358
- const translation = this.dictionary[lowerKey] || lowerKey;
3359
- return this.promises.resolve(this.interpolate(translation, params));
3483
+ async getTranslation(key, params) {
3484
+ return this.getTranslationSync(key, params);
3360
3485
  }
3361
3486
  getTranslations(...keys) {
3362
3487
  return this.promises.create(resolve => {
@@ -3499,7 +3624,7 @@ class LanguageService extends StaticLanguageService {
3499
3624
  async getTranslation(key, params = null) {
3500
3625
  try {
3501
3626
  await this.getDictionary();
3502
- return super.getTranslation(key, params);
3627
+ return super.getTranslationSync(key, params);
3503
3628
  }
3504
3629
  catch (reason) {
3505
3630
  console.log("ERROR IN TRANSLATIONS", reason);
@@ -6472,5 +6597,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
6472
6597
  * Generated bundle index. Do not edit.
6473
6598
  */
6474
6599
 
6475
- export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, IncludesPipe, Initializer, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, ValuedPromise, ValuesPipe, Vector, WASI_IMPLEMENTATION, WasmService, cachedFactory, cancelablePromise, getCssVariables, impatientPromise, provideWithOptions };
6600
+ export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, IncludesPipe, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, ValuedPromise, ValuesPipe, Vector, WASI_IMPLEMENTATION, WasmService, cachedFactory, cancelablePromise, getCssVariables, impatientPromise, md5, provideWithOptions, stringify };
6476
6601
  //# sourceMappingURL=stemy-ngx-utils.mjs.map