@acorex/core 18.12.21 → 18.12.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/formatters/number-formatter.ts","../../../../libs/core/format/src/lib/formatters/string-formatter.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, name: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { AXEventData, AXEventService } from '@acorex/core/events';\nimport { Pipe, PipeTransform, inject } from '@angular/core';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];\n\n transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(value, name as any, options);\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(value, name as any, options);\n return of(formattedValue);\n }),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatter } from './format.config';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [],\n exports: [AXFormatPipe],\n declarations: [AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE,CAAC;AAKlC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC1B;IAED,QAAQ,CAAC,GAAG,OAAkC,EAAA;AAC5C,QAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AACpB,YAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;AACpC,gBAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;gBAClD,MAAM,EAAE,IAAI,CAAC,QAAQ;AACtB,aAAA,CAAC,CAAC;YACH,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK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,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,kBAsCL,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GAtChC,cAAc,EAAA,YAAA,EAAA,CAFV,YAAY,CAAA,EAAA,OAAA,EAAA,CADjB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;+GAGX,cAAc,EAAA,CAAA,CAAA,EAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;AAC7B,iBAAA,CAAA;;0BAuCc,MAAM;2BAAC,uBAAuB,CAAA;;;ACxD7C;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-format.mjs","sources":["../../../../libs/core/format/src/lib/format.config.ts","../../../../libs/core/format/src/lib/format.service.ts","../../../../libs/core/format/src/lib/format.pipe.ts","../../../../libs/core/format/src/lib/formatters/number-formatter.ts","../../../../libs/core/format/src/lib/formatters/string-formatter.ts","../../../../libs/core/format/src/lib/format.module.ts","../../../../libs/core/format/src/acorex-core-format.ts"],"sourcesContent":["import { AXFormatOptions } from './format.types';\n\nexport abstract class AXFormatter {\n abstract get name(): string;\n abstract format(value: unknown, options?: AXFormatOptions | string): string;\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AXFormatter } from './format.config';\nimport { AXFormatOptionsMap } from './format.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFormatterRegistryService {\n private plugins: AXFormatter[] = [];\n\n private injector: Injector;\n\n constructor(injector: Injector) {\n this.injector = injector;\n }\n\n register(...plugins: (new () => AXFormatter)[]) {\n plugins.forEach((t) => {\n const childInjector = Injector.create({\n providers: [{ provide: t, useClass: t, deps: [] }],\n parent: this.injector,\n });\n const v = childInjector.get(t);\n\n if (v && !this.plugins.some((p) => p.name == v.name)) {\n this.plugins.push(v);\n }\n });\n }\n\n get formatters(): AXFormatter[] {\n return this.plugins;\n }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXFormatService {\n constructor(private pluginRegistry: AXFormatterRegistryService) {}\n\n private renderSubject = new Subject<void>();\n\n // Observable that other services/components can subscribe to\n onRender = this.renderSubject.asObservable();\n\n render() {\n this.renderSubject.next();\n }\n\n /**\n * Resolves a formatter by its name.\n * @param name The name of the formatter.\n * @returns The formatter if found, otherwise throws an error.\n */\n resolveFormatter(name: string): AXFormatter {\n const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);\n if (!formatter) {\n throw new Error(`Formatter not found: ${name}`);\n }\n return formatter;\n }\n\n // Overload for traditional formatting\n format<K extends keyof AXFormatOptionsMap>(value: unknown, name: K, options?: AXFormatOptionsMap[K]): string;\n\n // Overload for starting fluent API chain\n format(value: unknown): AXFormatFluent;\n\n // Implementation of the format method\n format<K extends keyof AXFormatOptionsMap>(value: unknown, formatter?: K, options?: AXFormatOptionsMap[K]): string | AXFormatFluent {\n if (typeof formatter === 'string') {\n const formatterRef = this.resolveFormatter(formatter);\n return formatterRef.format(value, options);\n } else {\n return new AXFormatFluent(this, value);\n }\n }\n}\n\nclass AXFormatFluent {\n constructor(\n private formatService: AXFormatService,\n private initialValue: unknown,\n ) {}\n\n /**\n * Formats the value using the specified formatter and options.\n * @param formatter The name of the formatter to use.\n * @param options The options to pass to the formatter.\n * @returns The formatted string.\n */\n to<K extends keyof AXFormatOptionsMap>(formatter: K, options?: AXFormatOptionsMap[K]): string {\n try {\n const formatterRef = this.formatService.resolveFormatter(formatter);\n return formatterRef.format(this.initialValue, options);\n } catch (error) {\n return String(this.initialValue);\n }\n }\n}\n","import { AXEventData, AXEventService } from '@acorex/core/events';\nimport { Pipe, PipeTransform, inject } from '@angular/core';\nimport { Observable, filter, of, startWith, switchMap } from 'rxjs';\nimport { AXFormatService } from './format.service';\nimport { AXFormatOptions } from './format.types';\n\n@Pipe({\n name: 'format',\n pure: true,\n})\nexport class AXFormatPipe implements PipeTransform {\n private formatService = inject(AXFormatService);\n private eventService = inject(AXEventService);\n\n private triggers = ['AX_CALENDAR_CHANGED', 'AX_LANGUAGE_CHANGED', 'AX_LANGUAGE_LOADED'];\n\n transform(value: unknown, name: string, options?: AXFormatOptions | string): Observable<string> {\n // Initial formatted value\n const initialFormattedValue = this.formatService.format(value, name as any, options);\n\n // React to language changes and re-format the value\n return this.eventService.onEvent.pipe(\n filter((event: AXEventData) => this.triggers.includes(event.type)),\n startWith(initialFormattedValue), // Emit the initial formatted value immediately\n switchMap((event) => {\n // Re-call format method on every language change\n const formattedValue = this.formatService.format(value, name as any, options);\n return of(formattedValue);\n }),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { defaults, isInteger, padStart } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXNumberFormatterOptions extends AXFormatOptions {\n decimalPlaces?: number;\n thousandSeparator?: string;\n decimalSeparator?: string;\n zeroPadLength?: number; // New option for zero padding,\n locale?: string;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n number: AXNumberFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXNumberFormatter implements AXFormatter {\n private separatorsCache: any = {};\n\n get name(): string {\n return 'number';\n }\n\n format(value: number, options: AXNumberFormatterOptions): string {\n const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);\n // Merge user options with default options\n const effectiveOptions = defaults({}, options, {\n thousandSeparator,\n decimalSeparator,\n zeroPadLength: 0,\n locale: navigator.language,\n });\n\n const sign = value < 0 ? '-' : '';\n const absoluteValue = Math.abs(value);\n\n // Handling zero padding for integer part\n let integerPart = Math.floor(absoluteValue).toString();\n if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {\n integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');\n }\n\n // Applying thousand separator to integer part\n if (effectiveOptions.thousandSeparator) {\n integerPart = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, effectiveOptions.thousandSeparator);\n }\n\n // Constructing the final formatted value\n let formattedValue = sign + integerPart;\n if (effectiveOptions.decimalPlaces !== undefined) {\n // Limiting decimal places if specified\n const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n } else if (!isInteger(value)) {\n // Showing full decimal part if decimalPlaces is not specified\n const decimalPart = absoluteValue.toString().split('.')[1] || '';\n if (decimalPart.length > 0) {\n formattedValue += effectiveOptions.decimalSeparator + decimalPart;\n }\n }\n\n return formattedValue;\n }\n\n private getLocaleSeparators(locale = navigator.language): {\n thousandSeparator: string;\n decimalSeparator: string;\n } {\n // Use cache if available\n if (this.separatorsCache[locale]) {\n return this.separatorsCache[locale];\n }\n\n const numberFormat = new Intl.NumberFormat(locale);\n const parts = numberFormat.formatToParts(1234567.89);\n let thousandSeparator = '';\n let decimalSeparator = '';\n\n for (const part of parts) {\n if (part.type === 'group') {\n thousandSeparator = part.value;\n } else if (part.type === 'decimal') {\n decimalSeparator = part.value;\n }\n }\n\n // Cache the result\n this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };\n return this.separatorsCache[locale];\n }\n}\n","import { get } from 'lodash-es';\nimport { AXFormatter } from '../format.config';\nimport { AXFormatOptions } from '../format.types';\n\nexport interface AXStringFormatterOptions extends AXFormatOptions {\n [key: string]: any;\n}\n\ndeclare module '../format.types' {\n interface AXFormatOptionsMap {\n string: AXStringFormatterOptions;\n }\n}\n\nexport class AXStringFormatter implements AXFormatter {\n get name(): string {\n return 'string';\n }\n\n format(value: unknown, options: AXStringFormatterOptions): string {\n if (typeof value != 'string') return String(value);\n const result = get(options, value)\n ? get(options, value)\n : value.replace(/{{\\s*([^}]+)\\s*}}/g, (match, path: string) => {\n return (get(options, path.trim()) as string) ?? match;\n });\n\n return result;\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from '@angular/core';\nimport { AXFormatter } from './format.config';\nimport { AXFormatPipe } from './format.pipe';\nimport { AXFormatterRegistryService } from './format.service';\nimport { AXNumberFormatter } from './formatters/number-formatter';\nimport { AXStringFormatter } from './formatters/string-formatter';\n\nconst BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];\n\nexport interface AXFormatModuleConfigs {\n formatters: (new () => AXFormatter)[];\n}\n\n@NgModule({\n imports: [],\n exports: [AXFormatPipe],\n declarations: [AXFormatPipe],\n})\nexport class AXFormatModule {\n static forRoot(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n static forChild(configs?: AXFormatModuleConfigs): ModuleWithProviders<AXFormatModule> {\n return {\n ngModule: AXFormatModule,\n providers: [\n ...(configs?.formatters || []),\n {\n provide: 'AXFormatModuleFactory',\n useFactory: (pluginRegistry: AXFormatterRegistryService) => () => {\n pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);\n },\n deps: [AXFormatterRegistryService],\n multi: true,\n },\n ],\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Inject('AXFormatModuleFactory') instances: any[]) {\n instances.forEach((f) => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAEsB,WAAW,CAAA;AAGhC;;MCGY,0BAA0B,CAAA;AAKrC,IAAA,WAAA,CAAY,QAAkB,EAAA;QAJtB,IAAO,CAAA,OAAA,GAAkB,EAAE;AAKjC,Q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,kBAsCL,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAtChC,cAAc,EAAA,YAAA,EAAA,CAFV,YAAY,CAAA,EAAA,OAAA,EAAA,CADjB,YAAY,CAAA,EAAA,CAAA,CAAA;+GAGX,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;AAC7B,iBAAA;;0BAuCc,MAAM;2BAAC,uBAAuB;;;ACxD7C;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n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AM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AACvB,QAAA,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KACxF;8GAtCU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAd,cAAc,EAAA,CAAA,CAAA,EAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;;;ACFX;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAGa,cAAc,CAAA;IACzB,MAAM,MAAM,CAAC,OAKZ,EAAA;AACC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC;AAEnE,QAAA,IAAI,KAAuB;AAC3B,QAAA,IAAI,OAAO,CAAC,MAAM,YAAY,IAAI,EAAE;AAClC,YAAA,MAAM,CAAC,GAAG,IAAI,KAAK,EAAE;YACrB,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC;AAC3C,YAAA,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YACnD,KAAK,GAAG,CAAC;;aACJ;AACL,YAAA,KAAK,GAAG,OAAO,CAAC,MAAM;;;QAIxB,MAAM,MAAM,GAAQ,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACpD,QAAA,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;AACvB,QAAA,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM;AACzB,QAAA,IAAI,KAAK,GAAG,MAAM,EAAE;AAClB,YAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;AAC3B,gBAAA,MAAM,IAAI,OAAO,CAAC,OAAO,GAAG,KAAK;AACjC,gBAAA,KAAK,GAAG,OAAO,CAAC,OAAO;;;aAEpB;AACL,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE;AAC5B,gBAAA,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM;AACjC,gBAAA,MAAM,GAAG,OAAO,CAAC,OAAO;;;AAG5B,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK;AACpB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM;AACtB,QAAA,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC;QAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;;8GArC7E,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAd,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACFD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-memorize.mjs","sources":["../../../../libs/core/memorize/src/lib/memorize.decorator.ts","../../../../libs/core/memorize/src/acorex-core-memorize.ts"],"sourcesContent":["import memoizee from 'memoizee';\n\nexport function Memorize() {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n const originalNgOnDestroy = target.ngOnDestroy;\n const originalMethod = descriptor.value;\n const memorizedMethod = memoizee(originalMethod);\n target.ngOnDestroy = function () {\n if (originalNgOnDestroy) {\n originalNgOnDestroy.apply(this);\n }\n memorizedMethod.clear();\n };\n descriptor.value = function (...args) {\n return memorizedMethod.apply(this, args);\n };\n return descriptor;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAEgB,QAAQ,GAAA;AACtB,IAAA,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,KAAI;AAC1E,QAAA,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAAC;AAC/C,QAAA,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;AACxC,QAAA,MAAM,eAAe,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;QACjD,MAAM,CAAC,WAAW,GAAG,YAAA;YACnB,IAAI,mBAAmB,EAAE;AACvB,gBAAA,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aACjC;YACD,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,SAAC,CAAC;AACF,QAAA,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAI,EAAA;YAClC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3C,SAAC,CAAC;AACF,QAAA,OAAO,UAAU,CAAC;AACpB,KAAC,CAAC;AACJ;;AClBA;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-memorize.mjs","sources":["../../../../libs/core/memorize/src/lib/memorize.decorator.ts","../../../../libs/core/memorize/src/acorex-core-memorize.ts"],"sourcesContent":["import memoizee from 'memoizee';\n\nexport function Memorize() {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n const originalNgOnDestroy = target.ngOnDestroy;\n const originalMethod = descriptor.value;\n const memorizedMethod = memoizee(originalMethod);\n target.ngOnDestroy = function () {\n if (originalNgOnDestroy) {\n originalNgOnDestroy.apply(this);\n }\n memorizedMethod.clear();\n };\n descriptor.value = function (...args) {\n return memorizedMethod.apply(this, args);\n };\n return descriptor;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAEgB,QAAQ,GAAA;AACtB,IAAA,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,KAAI;AAC1E,QAAA,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW;AAC9C,QAAA,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK;AACvC,QAAA,MAAM,eAAe,GAAG,QAAQ,CAAC,cAAc,CAAC;QAChD,MAAM,CAAC,WAAW,GAAG,YAAA;YACnB,IAAI,mBAAmB,EAAE;AACvB,gBAAA,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;;YAEjC,eAAe,CAAC,KAAK,EAAE;AACzB,SAAC;AACD,QAAA,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAI,EAAA;YAClC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;AAC1C,SAAC;AACD,QAAA,OAAO,UAAU;AACnB,KAAC;AACH;;AClBA;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-network.mjs","sources":["../../../../libs/core/network/src/lib/network.types.ts","../../../../libs/core/network/src/lib/upload-task.ts","../../../../libs/core/network/src/lib/download-task.ts","../../../../libs/core/network/src/lib/network.service.ts","../../../../libs/core/network/src/acorex-core-network.ts"],"sourcesContent":["export enum AXUploadStatus {\n Uploading = 'Uploading...',\n UploadComplete = 'Upload complete',\n StartingUpload = 'Starting upload',\n UploadFailed = 'Upload failed',\n UploadCanceled = 'Upload Canceled',\n}\n\nexport type AXUploadResponse<T> = {\n progress: number;\n bytesTransferred: number;\n totalBytes: number;\n status: AXUploadStatus;\n result?: T;\n message?: string;\n};\n\nexport enum AXDownloadStatus {\n Downloading = 'Downloading...',\n DownloadComplete = 'Download complete',\n StartingDownload = 'Starting download',\n DownloadFailed = 'Download failed',\n}\n\nexport type AXDownloadResponse = {\n progress: number;\n bytesReceived: number;\n totalBytes: number;\n status: AXDownloadStatus;\n data?: Blob; // or any appropriate type based on your specific use case\n};\n","import { HttpClient, HttpEvent, HttpEventType, HttpRequest } from '@angular/common/http';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { AXUploadResponse, AXUploadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXUploadTask<T> {\n private cancelSignal = new Subject<void>();\n public events = new BehaviorSubject<AXUploadResponse<T>>({\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n });\n\n constructor(\n private http: HttpClient,\n private request: HttpRequest<T>,\n private totalFileSize: number,\n ) {}\n\n private handleEvent(event: HttpEvent<any>, failedMessage?: string): AXUploadResponse<T> {\n switch (event.type) {\n case HttpEventType.Sent:\n case HttpEventType.ResponseHeader:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n };\n\n case HttpEventType.UploadProgress:\n case HttpEventType.DownloadProgress: {\n const percentDone = Math.round((100 * event.loaded) / (this.totalFileSize || event.total));\n\n return {\n progress: percentDone,\n bytesTransferred: event.loaded,\n totalBytes: this.totalFileSize || event.total,\n status: AXUploadStatus.Uploading,\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadComplete,\n result: event.body,\n };\n\n case HttpEventType.User:\n return {\n progress: 0,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadCanceled,\n };\n default:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadFailed,\n message: failedMessage,\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n\n start() {\n this.http\n .request(this.request)\n .pipe(takeUntil(this.cancelSignal))\n .subscribe({\n error: (error) => {\n this.events.next(this.handleEvent({ type: -1 } as any, error.statusText));\n },\n next: (event) => {\n this.events.next(this.handleEvent(event));\n },\n });\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { takeUntil, map } from 'rxjs/operators';\nimport { HttpEvent, HttpEventType } from '@angular/common/http';\nimport { AXDownloadResponse, AXDownloadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXDownloadTask {\n private cancelSignal = new Subject<void>();\n\n constructor(private observable: Observable<HttpEvent<any>>) { }\n\n get events(): Observable<AXDownloadResponse> {\n return this.observable.pipe(\n takeUntil(this.cancelSignal),\n map(event => this.handleEvent(event)),\n );\n }\n\n private handleEvent(event: HttpEvent<any>): AXDownloadResponse {\n switch (event.type) {\n case HttpEventType.DownloadProgress:\n {\n const percentDone = Math.round(100 * event.loaded / (event.total ?? event.loaded));\n return {\n progress: percentDone,\n bytesReceived: event.loaded,\n totalBytes: event.total ?? 0,\n status: AXDownloadStatus.Downloading\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesReceived: event.body.size,\n totalBytes: event.body.size,\n status: AXDownloadStatus.DownloadComplete,\n data: event.body\n };\n\n default:\n return {\n progress: 0,\n bytesReceived: 0,\n totalBytes: 0,\n status: AXDownloadStatus.StartingDownload\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { HttpClient, HttpRequest } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { fromEvent, map, merge, startWith } from 'rxjs';\nimport { AXDownloadTask } from './download-task';\nimport { AXUploadTask } from './upload-task';\n\n@Injectable({ providedIn: 'root' })\nexport class AXNetworkService {\n private http = inject(HttpClient);\n\n private _status = signal<boolean>(true);\n\n public readonly status = this._status.asReadonly();\n\n constructor() {\n if (isBrowser()) {\n // Only subscribe to these events if on the browser platform\n const onlineEvent = fromEvent(window, 'online').pipe(map(() => true));\n const offlineEvent = fromEvent(window, 'offline').pipe(map(() => false));\n\n merge(onlineEvent, offlineEvent)\n .pipe(startWith(navigator.onLine))\n .subscribe((c) => {\n this._status.set(c);\n });\n }\n }\n\n // Overload signatures\n upload<T>(url: string, formData: FormData): AXUploadTask<T>;\n upload<T>(request: HttpRequest<any>): AXUploadTask<T>;\n\n // Unified method handling both types of inputs\n upload<T>(arg1: string | HttpRequest<any>, arg2?: FormData): AXUploadTask<T> {\n let request: HttpRequest<any>;\n let totalFilesSize = 0;\n\n if (typeof arg1 === 'string' && arg2 instanceof FormData) {\n // Calculate total file size\n arg2.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n request = new HttpRequest('POST', arg1, arg2, {\n reportProgress: true,\n responseType: 'json',\n });\n } else if (arg1 instanceof HttpRequest) {\n if (arg1.body instanceof FormData) {\n // Calculate total file size\n arg1.body.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n }\n request = arg1.clone({\n reportProgress: true,\n responseType: arg1.responseType || 'json',\n });\n } else {\n throw new Error('Invalid arguments for upload method.');\n }\n\n return new AXUploadTask<T>(this.http, request, totalFilesSize);\n }\n\n // Overload signatures\n download(url: string): AXDownloadTask;\n download(request: HttpRequest<Blob>): AXDownloadTask;\n\n // Unified method handling both types of inputs\n download(arg: string | HttpRequest<Blob>): AXDownloadTask {\n let request: HttpRequest<Blob>;\n\n if (typeof arg === 'string') {\n request = new HttpRequest('GET', arg, {\n reportProgress: true,\n responseType: 'blob',\n });\n } else {\n request = new HttpRequest(arg.method, arg.url, arg.body, {\n ...arg,\n reportProgress: true,\n responseType: 'blob',\n });\n }\n\n const events = this.http.request<Blob>(request);\n return new AXDownloadTask(events);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;IAAY,eAMX;AAND,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,cAA0B,CAAA;AAC1B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAC9B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AACpC,CAAC,EANW,cAAc,KAAd,cAAc,GAMzB,EAAA,CAAA,CAAA,CAAA;IAWW,iBAKX;AALD,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,aAAA,CAAA,GAAA,gBAA8B,CAAA;AAC9B,IAAA,gBAAA,CAAA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,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;KAChE;;AAOD,IAAA,QAAQ,CAAC,GAA+B,EAAA;AACtC,QAAA,IAAI,OAA0B,CAAC;AAE/B,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,YAAA,OAAO,GAAG,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE;AACpC,gBAAA,cAAc,EAAE,IAAI;AACpB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA,CAAC,CAAC;SACJ;aAAM;AACL,YAAA,OAAO,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;AACvD,gBAAA,GAAG,GAAG;AACN,gBAAA,cAAc,EAAE,IAAI;AACpB,gBAAA,YAAY,EAAE,MAAM;AACrB,aAAA,CAAC,CAAC;SACJ;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,OAAO,CAAC,CAAC;AAChD,QAAA,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;KACnC;8GApFU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;ACPlC;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-network.mjs","sources":["../../../../libs/core/network/src/lib/network.types.ts","../../../../libs/core/network/src/lib/upload-task.ts","../../../../libs/core/network/src/lib/download-task.ts","../../../../libs/core/network/src/lib/network.service.ts","../../../../libs/core/network/src/acorex-core-network.ts"],"sourcesContent":["export enum AXUploadStatus {\n Uploading = 'Uploading...',\n UploadComplete = 'Upload complete',\n StartingUpload = 'Starting upload',\n UploadFailed = 'Upload failed',\n UploadCanceled = 'Upload Canceled',\n}\n\nexport type AXUploadResponse<T> = {\n progress: number;\n bytesTransferred: number;\n totalBytes: number;\n status: AXUploadStatus;\n result?: T;\n message?: string;\n};\n\nexport enum AXDownloadStatus {\n Downloading = 'Downloading...',\n DownloadComplete = 'Download complete',\n StartingDownload = 'Starting download',\n DownloadFailed = 'Download failed',\n}\n\nexport type AXDownloadResponse = {\n progress: number;\n bytesReceived: number;\n totalBytes: number;\n status: AXDownloadStatus;\n data?: Blob; // or any appropriate type based on your specific use case\n};\n","import { HttpClient, HttpEvent, HttpEventType, HttpRequest } from '@angular/common/http';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { AXUploadResponse, AXUploadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXUploadTask<T> {\n private cancelSignal = new Subject<void>();\n public events = new BehaviorSubject<AXUploadResponse<T>>({\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n });\n\n constructor(\n private http: HttpClient,\n private request: HttpRequest<T>,\n private totalFileSize: number,\n ) {}\n\n private handleEvent(event: HttpEvent<any>, failedMessage?: string): AXUploadResponse<T> {\n switch (event.type) {\n case HttpEventType.Sent:\n case HttpEventType.ResponseHeader:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.StartingUpload,\n };\n\n case HttpEventType.UploadProgress:\n case HttpEventType.DownloadProgress: {\n const percentDone = Math.round((100 * event.loaded) / (this.totalFileSize || event.total));\n\n return {\n progress: percentDone,\n bytesTransferred: event.loaded,\n totalBytes: this.totalFileSize || event.total,\n status: AXUploadStatus.Uploading,\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadComplete,\n result: event.body,\n };\n\n case HttpEventType.User:\n return {\n progress: 0,\n bytesTransferred: this.totalFileSize,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadCanceled,\n };\n default:\n return {\n progress: 0,\n bytesTransferred: 0,\n totalBytes: this.totalFileSize,\n status: AXUploadStatus.UploadFailed,\n message: failedMessage,\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n\n start() {\n this.http\n .request(this.request)\n .pipe(takeUntil(this.cancelSignal))\n .subscribe({\n error: (error) => {\n this.events.next(this.handleEvent({ type: -1 } as any, error.statusText));\n },\n next: (event) => {\n this.events.next(this.handleEvent(event));\n },\n });\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { takeUntil, map } from 'rxjs/operators';\nimport { HttpEvent, HttpEventType } from '@angular/common/http';\nimport { AXDownloadResponse, AXDownloadStatus } from './network.types'; // Ensure correct import path\n\nexport class AXDownloadTask {\n private cancelSignal = new Subject<void>();\n\n constructor(private observable: Observable<HttpEvent<any>>) { }\n\n get events(): Observable<AXDownloadResponse> {\n return this.observable.pipe(\n takeUntil(this.cancelSignal),\n map(event => this.handleEvent(event)),\n );\n }\n\n private handleEvent(event: HttpEvent<any>): AXDownloadResponse {\n switch (event.type) {\n case HttpEventType.DownloadProgress:\n {\n const percentDone = Math.round(100 * event.loaded / (event.total ?? event.loaded));\n return {\n progress: percentDone,\n bytesReceived: event.loaded,\n totalBytes: event.total ?? 0,\n status: AXDownloadStatus.Downloading\n };\n }\n\n case HttpEventType.Response:\n return {\n progress: 100,\n bytesReceived: event.body.size,\n totalBytes: event.body.size,\n status: AXDownloadStatus.DownloadComplete,\n data: event.body\n };\n\n default:\n return {\n progress: 0,\n bytesReceived: 0,\n totalBytes: 0,\n status: AXDownloadStatus.StartingDownload\n };\n }\n }\n\n cancel() {\n this.cancelSignal.next();\n this.cancelSignal.complete();\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { HttpClient, HttpRequest } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { fromEvent, map, merge, startWith } from 'rxjs';\nimport { AXDownloadTask } from './download-task';\nimport { AXUploadTask } from './upload-task';\n\n@Injectable({ providedIn: 'root' })\nexport class AXNetworkService {\n private http = inject(HttpClient);\n\n private _status = signal<boolean>(true);\n\n public readonly status = this._status.asReadonly();\n\n constructor() {\n if (isBrowser()) {\n // Only subscribe to these events if on the browser platform\n const onlineEvent = fromEvent(window, 'online').pipe(map(() => true));\n const offlineEvent = fromEvent(window, 'offline').pipe(map(() => false));\n\n merge(onlineEvent, offlineEvent)\n .pipe(startWith(navigator.onLine))\n .subscribe((c) => {\n this._status.set(c);\n });\n }\n }\n\n // Overload signatures\n upload<T>(url: string, formData: FormData): AXUploadTask<T>;\n upload<T>(request: HttpRequest<any>): AXUploadTask<T>;\n\n // Unified method handling both types of inputs\n upload<T>(arg1: string | HttpRequest<any>, arg2?: FormData): AXUploadTask<T> {\n let request: HttpRequest<any>;\n let totalFilesSize = 0;\n\n if (typeof arg1 === 'string' && arg2 instanceof FormData) {\n // Calculate total file size\n arg2.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n request = new HttpRequest('POST', arg1, arg2, {\n reportProgress: true,\n responseType: 'json',\n });\n } else if (arg1 instanceof HttpRequest) {\n if (arg1.body instanceof FormData) {\n // Calculate total file size\n arg1.body.forEach((value) => {\n if (value instanceof File) {\n totalFilesSize += value.size;\n }\n });\n }\n request = arg1.clone({\n reportProgress: true,\n responseType: arg1.responseType || 'json',\n });\n } else {\n throw new Error('Invalid arguments for upload method.');\n }\n\n return new AXUploadTask<T>(this.http, request, totalFilesSize);\n }\n\n // Overload signatures\n download(url: string): AXDownloadTask;\n download(request: HttpRequest<Blob>): AXDownloadTask;\n\n // Unified method handling both types of inputs\n download(arg: string | HttpRequest<Blob>): AXDownloadTask {\n let request: HttpRequest<Blob>;\n\n if (typeof arg === 'string') {\n request = new HttpRequest('GET', arg, {\n reportProgress: true,\n responseType: 'blob',\n });\n } else {\n request = new HttpRequest(arg.method, arg.url, arg.body, {\n ...arg,\n reportProgress: true,\n responseType: 'blob',\n });\n }\n\n const events = this.http.request<Blob>(request);\n return new AXDownloadTask(events);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,cAA0B;AAC1B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;AAClC,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;AAClC,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,eAA8B;AAC9B,IAAA,cAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;AACpC,CAAC,EANW,cAAc,KAAd,cAAc,GAMzB,EAAA,CAAA,CAAA;IAWW;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,aAAA,CAAA,GAAA,gBAA8B;AAC9B,IAAA,gBAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC;AACtC,IAAA,gBAAA,CAAA,kBAAA,CAAA,GAAA,mBAAsC;AACtC,IAAA,gBAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;AACpC,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,GAK3B,EAAA,CAAA,CAAA;;MCjBY,YAAY,CAAA;AASvB,IAAA,WAAA,CACU,IAAgB,EAChB,OAAuB,EACvB,aAAqB,EAAA;QAFrB,IAAI,CAAA,IAAA,GAAJ,IAAI;QACJ,IAAO,CAAA,OAAA,GAAP,OAAO;QACP,IAAa,CAAA,aAAA,GAAb,aAAa;AAXf,QAAA,IAAA,CAAA,YAAY,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,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACPlC;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-pipes.mjs","sources":["../../../../libs/core/pipes/src/lib/safe/safe.pipe.ts","../../../../libs/core/pipes/src/acorex-core-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl } from '@angular/platform-browser';\n\n@Pipe({\n name: 'safe',\n pure: true,\n standalone: true,\n})\nexport class AXSafePipe implements PipeTransform {\n constructor(protected sanitizer: DomSanitizer) {}\n\n public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {\n if (value == null || value == undefined || value == '') return '';\n switch (type) {\n case 'html':\n return this.sanitizer.bypassSecurityTrustHtml(value);\n case 'style':\n return this.sanitizer.bypassSecurityTrustStyle(value);\n case 'script':\n return this.sanitizer.bypassSecurityTrustScript(value);\n case 'url':\n return this.sanitizer.bypassSecurityTrustUrl(value);\n case 'resourceUrl':\n return this.sanitizer.bypassSecurityTrustResourceUrl(value);\n default:\n throw new Error(`Invalid safe type specified: ${type}`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAQa,UAAU,CAAA;AACrB,IAAA,WAAA,CAAsB,SAAuB,EAAA;QAAvB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAc;KAAI;IAE1C,SAAS,CAAC,KAAU,EAAE,IAAY,EAAA;QACvC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,EAAE;AAAE,YAAA,OAAO,EAAE,CAAC;QAClE,QAAQ,IAAI;AACV,YAAA,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACvD,YAAA,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACxD,YAAA,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;AACzD,YAAA,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACtD,YAAA,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC;AAC9D,YAAA;AACE,gBAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAA,CAAE,CAAC,CAAC;SAC3D;KACF;8GAnBU,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;4GAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBALtB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,MAAM;AACZ,oBAAA,IAAI,EAAE,IAAI;AACV,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;;;ACPD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-pipes.mjs","sources":["../../../../libs/core/pipes/src/lib/safe/safe.pipe.ts","../../../../libs/core/pipes/src/acorex-core-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl } from '@angular/platform-browser';\n\n@Pipe({\n name: 'safe',\n pure: true,\n standalone: true,\n})\nexport class AXSafePipe implements PipeTransform {\n constructor(protected sanitizer: DomSanitizer) {}\n\n public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {\n if (value == null || value == undefined || value == '') return '';\n switch (type) {\n case 'html':\n return this.sanitizer.bypassSecurityTrustHtml(value);\n case 'style':\n return this.sanitizer.bypassSecurityTrustStyle(value);\n case 'script':\n return this.sanitizer.bypassSecurityTrustScript(value);\n case 'url':\n return this.sanitizer.bypassSecurityTrustUrl(value);\n case 'resourceUrl':\n return this.sanitizer.bypassSecurityTrustResourceUrl(value);\n default:\n throw new Error(`Invalid safe type specified: ${type}`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAQa,UAAU,CAAA;AACrB,IAAA,WAAA,CAAsB,SAAuB,EAAA;QAAvB,IAAS,CAAA,SAAA,GAAT,SAAS;;IAExB,SAAS,CAAC,KAAU,EAAE,IAAY,EAAA;QACvC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,EAAE;AAAE,YAAA,OAAO,EAAE;QACjE,QAAQ,IAAI;AACV,YAAA,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC;AACtD,YAAA,KAAK,OAAO;gBACV,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC;AACvD,YAAA,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,KAAK,CAAC;AACxD,YAAA,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC;AACrD,YAAA,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,KAAK,CAAC;AAC7D,YAAA;AACE,gBAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAA,CAAE,CAAC;;;8GAjBlD,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBALtB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,MAAM;AACZ,oBAAA,IAAI,EAAE,IAAI;AACV,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACPD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, Subject, fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean =>\n !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 578px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 992px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1200px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1440px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n\n themeMode = signal<AXThemeMode>('system');\n\n isRtl(): boolean {\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'light');\n this.themeMode$.next('light');\n this.themeMode.set('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'dark');\n this.themeMode$.next('dark');\n this.themeMode.set('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (isBrowser()) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n this.themeMode.set('system');\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n\n private setFullHeightRatio() {\n if (isBrowser()) {\n try {\n document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n // fromEvent(UIEvent)(window,'')\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n }\n\n private detectOnResize() {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this.setFullHeightRatio();\n });\n }\n\n private detectClickEvent() {\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectScrollEvent() {\n document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectDocumentDirectionChange() {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAWA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SA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,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AC1ID;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, Subject, fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean =>\n !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 578px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 992px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1200px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1440px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n\n themeMode = signal<AXThemeMode>('system');\n\n isRtl(): boolean {\n return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'light');\n this.themeMode$.next('light');\n this.themeMode.set('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n localStorage.setItem('AX_THEME_MODE', 'dark');\n this.themeMode$.next('dark');\n this.themeMode.set('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (isBrowser()) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n localStorage.setItem('AX_THEME_MODE', 'system');\n this.themeMode$.next('system');\n this.themeMode.set('system');\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n\n private setFullHeightRatio() {\n if (isBrowser()) {\n try {\n document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n // fromEvent(UIEvent)(window,'')\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n }\n\n private detectOnResize() {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this.setFullHeightRatio();\n });\n }\n\n private detectClickEvent() {\n document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectScrollEvent() {\n document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectDocumentDirectionChange() {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAWA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC;AAExE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAE1E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,C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Q,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;AACzC,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,SAAS,EAAE,KAAK;AAChB,YAAA,aAAa,EAAE,KAAK;AACrB,SAAA,CAAC;;8GAvLO,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1ID;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-storage.mjs","sources":["../../../../libs/core/storage/src/cookie-storage.service.ts","../../../../libs/core/storage/src/local-storage.service.ts","../../../../libs/core/storage/src/session-storage.service.ts","../../../../libs/core/storage/src/acorex-core-storage.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { AXCookieOptions, AXSameSite } from './storage.interface';\n\n@Injectable()\nexport class AXCookieStorageService {\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: Document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n @Inject(PLATFORM_ID) private platformId,\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n */\n private static getCookieRegExp(name: string): RegExp {\n const escapedName: string = name.replace(/([[\\]{}()|=;+?,.*^$])/gi, '\\\\$1');\n\n return new RegExp('(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');\n }\n\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n */\n private static safeDecodeURIComponent(encodedURIComponent: string): string {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n */\n get(name: string): string {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n const result: RegExpExecArray = regExp.exec(this.document.cookie);\n\n return result[1] ? AXCookieStorageService.safeDecodeURIComponent(result[1]) : '';\n } else {\n return '';\n }\n }\n\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n */\n getAll(): { [key: string]: string } {\n if (!this.documentIsAccessible) {\n return {};\n }\n\n const cookies: { [key: string]: string } = {};\n const document: any = this.document;\n\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach((currentCookie) => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] =\n AXCookieStorageService.safeDecodeURIComponent(cookieValue);\n });\n }\n\n return cookies;\n }\n\n /**\n * Set cookie based on provided information\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param expires Number of days until the cookies expires or an actual `Date`\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Secure flag\n * @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n *\n */\n set(\n name: string,\n value: string,\n expires?: AXCookieOptions['expires'],\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite,\n ): void;\n\n /**\n * Set cookie based on provided information\n *\n * Cookie's parameters:\n * <pre>\n * expires Number of days until the cookies expires or an actual `Date`\n * path Cookie path\n * domain Cookie domain\n * secure Secure flag\n * sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n * </pre>\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param options Body with cookie's params\n *\n */\n set(name: string, value: string, options?: AXCookieOptions): void;\n\n set(\n name: string,\n value: string,\n expiresOrOptions?: AXCookieOptions['expires'] | AXCookieOptions,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite,\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {\n const optionsBody = {\n expires: expiresOrOptions as AXCookieOptions['expires'],\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax',\n };\n\n this.set(name, value, optionsBody);\n return;\n }\n\n let cookieString: string = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n\n const options = expiresOrOptions ? expiresOrOptions : {};\n\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires: Date = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);\n\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(\n `[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +\n `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`,\n );\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n\n cookieString += 'sameSite=' + options.sameSite + ';';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n */\n delete(\n name: string,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax',\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite,\n });\n }\n\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n */\n deleteAll(\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax',\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n const cookies = this.getAll();\n\n for (const cookieName in cookies) {\n // eslint-disable-next-line no-prototype-builtins\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Inject, Injectable, InjectionToken } from '@angular/core';\nimport CryptoJS from 'crypto-es';\nimport { AXStorage } from './storage.interface';\n\nexport const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string> = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');\n\n@Injectable()\nexport class AXLocalStorageService implements AXStorage {\n constructor(@Inject(AX_LOCALSTORAGE_SECRET_KEY) private secret_key: string) {}\n\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return localStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return localStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return localStorage.removeItem(key);\n }\n }\n\n setWithEncryption<T = unknown>(key: string, value: T) {\n if (isBrowser()) {\n const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();\n return localStorage.setItem(key, encrypted);\n }\n }\n\n getWithEncription<T = unknown>(key: string): T {\n if (isBrowser()) {\n const encrypted = localStorage.getItem(key) || '';\n const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);\n return encrypted ? JSON.parse(decrypted) : {};\n } else {\n return null;\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Injectable } from '@angular/core';\nimport { AXStorage } from './storage.interface';\n\n@Injectable()\nexport class AXSessionStorageService implements AXStorage {\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = sessionStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return sessionStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return sessionStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return sessionStorage.removeItem(key);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,CAC4B,QAAkB;;IAEf,UAAU,EAAA;QA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qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;;0BAEI,MAAM;2BAAC,0BAA0B,CAAA;;;MCJnC,uBAAuB,CAAA;AAClC,IAAA,GAAG,CAAc,GAAW,EAAA;QAC1B,IAAI,SAAS,EAAE,EAAE;YACf,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC1C,YAAA,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;SACzC;aAAM;AACL,YAAA,OAAO,IAAI,CAAC;SACb;KACF;IAED,GAAG,CAAc,GAAW,EAAE,KAAQ,EAAA;QACpC,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SAC3D;KACF;IAED,KAAK,GAAA;QACH,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,KAAK,EAAE,CAAC;SAC/B;KACF;AAED,IAAA,UAAU,CAAC,GAAW,EAAA;QACpB,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACvC;KACF;8GA1BU,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;;;ACJX;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-storage.mjs","sources":["../../../../libs/core/storage/src/cookie-storage.service.ts","../../../../libs/core/storage/src/local-storage.service.ts","../../../../libs/core/storage/src/session-storage.service.ts","../../../../libs/core/storage/src/acorex-core-storage.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { AXCookieOptions, AXSameSite } from './storage.interface';\n\n@Injectable()\nexport class AXCookieStorageService {\n private readonly documentIsAccessible: boolean;\n\n constructor(\n @Inject(DOCUMENT) private document: Document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n @Inject(PLATFORM_ID) private platformId,\n ) {\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n */\n private static getCookieRegExp(name: string): RegExp {\n const escapedName: string = name.replace(/([[\\]{}()|=;+?,.*^$])/gi, '\\\\$1');\n\n return new RegExp('(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');\n }\n\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n */\n private static safeDecodeURIComponent(encodedURIComponent: string): string {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n */\n check(name: string): boolean {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n */\n get(name: string): string {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n\n const regExp: RegExp = AXCookieStorageService.getCookieRegExp(name);\n const result: RegExpExecArray = regExp.exec(this.document.cookie);\n\n return result[1] ? AXCookieStorageService.safeDecodeURIComponent(result[1]) : '';\n } else {\n return '';\n }\n }\n\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n */\n getAll(): { [key: string]: string } {\n if (!this.documentIsAccessible) {\n return {};\n }\n\n const cookies: { [key: string]: string } = {};\n const document: any = this.document;\n\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach((currentCookie) => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[AXCookieStorageService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] =\n AXCookieStorageService.safeDecodeURIComponent(cookieValue);\n });\n }\n\n return cookies;\n }\n\n /**\n * Set cookie based on provided information\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param expires Number of days until the cookies expires or an actual `Date`\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Secure flag\n * @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n *\n */\n set(\n name: string,\n value: string,\n expires?: AXCookieOptions['expires'],\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite,\n ): void;\n\n /**\n * Set cookie based on provided information\n *\n * Cookie's parameters:\n * <pre>\n * expires Number of days until the cookies expires or an actual `Date`\n * path Cookie path\n * domain Cookie domain\n * secure Secure flag\n * sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`\n * </pre>\n *\n * @param name Cookie name\n * @param value Cookie value\n * @param options Body with cookie's params\n *\n */\n set(name: string, value: string, options?: AXCookieOptions): void;\n\n set(\n name: string,\n value: string,\n expiresOrOptions?: AXCookieOptions['expires'] | AXCookieOptions,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite?: AXSameSite,\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {\n const optionsBody = {\n expires: expiresOrOptions as AXCookieOptions['expires'],\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax',\n };\n\n this.set(name, value, optionsBody);\n return;\n }\n\n let cookieString: string = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n\n const options = expiresOrOptions ? expiresOrOptions : {};\n\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires: Date = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);\n\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(\n `[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +\n `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`,\n );\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n\n cookieString += 'sameSite=' + options.sameSite + ';';\n\n this.document.cookie = cookieString;\n }\n\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n */\n delete(\n name: string,\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax',\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite,\n });\n }\n\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n */\n deleteAll(\n path?: AXCookieOptions['path'],\n domain?: AXCookieOptions['domain'],\n secure?: AXCookieOptions['secure'],\n sameSite: AXSameSite = 'Lax',\n ): void {\n if (!this.documentIsAccessible) {\n return;\n }\n\n const cookies = this.getAll();\n\n for (const cookieName in cookies) {\n // eslint-disable-next-line no-prototype-builtins\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Inject, Injectable, InjectionToken } from '@angular/core';\nimport CryptoJS from 'crypto-es';\nimport { AXStorage } from './storage.interface';\n\nexport const AX_LOCALSTORAGE_SECRET_KEY: InjectionToken<string> = new InjectionToken('AX_LOCALSTORAGE_SECRET_KEY');\n\n@Injectable()\nexport class AXLocalStorageService implements AXStorage {\n constructor(@Inject(AX_LOCALSTORAGE_SECRET_KEY) private secret_key: string) {}\n\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return localStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return localStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return localStorage.removeItem(key);\n }\n }\n\n setWithEncryption<T = unknown>(key: string, value: T) {\n if (isBrowser()) {\n const encrypted = CryptoJS.AES.encrypt(JSON.stringify(value), this.secret_key).toString();\n return localStorage.setItem(key, encrypted);\n }\n }\n\n getWithEncription<T = unknown>(key: string): T {\n if (isBrowser()) {\n const encrypted = localStorage.getItem(key) || '';\n const decrypted = CryptoJS.AES.decrypt(encrypted, this.secret_key).toString(CryptoJS.enc.Utf8);\n return encrypted ? JSON.parse(decrypted) : {};\n } else {\n return null;\n }\n }\n}\n","import { isBrowser } from '@acorex/core/platform';\nimport { Injectable } from '@angular/core';\nimport { AXStorage } from './storage.interface';\n\n@Injectable()\nexport class AXSessionStorageService implements AXStorage {\n get<T = unknown>(key: string): T {\n if (isBrowser()) {\n const value = sessionStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n } else {\n return null;\n }\n }\n\n set<T = unknown>(key: string, value: T): void {\n if (isBrowser()) {\n return sessionStorage.setItem(key, JSON.stringify(value));\n }\n }\n\n clear(): void {\n if (isBrowser()) {\n return sessionStorage.clear();\n }\n }\n\n removeItem(key: string) {\n if (isBrowser()) {\n return sessionStorage.removeItem(key);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,CAC4B,QAAkB;;IAEf,UAAU,EAAA;QAFb,IAAQ,CAAA,QAAA,GAAR,QAAQ;QAEL,IAAU,CAAA,UAAA,GAAV,UAAU;QAEvC,IAAI,CAAC,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC;;AAGhE;;;;;;AAMG;IACK,OAAO,eAAe,CAAC,IAAY,EAAA;QACzC,MAAM,WAAW,GAAW,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC;AAE3E,QAAA,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,gBAAgB,EAAE,GAAG,CAAC;;AAG1F;;;;;;;AAOG;IACK,OAAO,sBAAsB,CAAC,mBAA2B,EAAA;AAC/D,QAAA,IAAI;AACF,YAAA,OAAO,kBAAkB,CAAC,mBAAmB,CAAC;;AAC9C,QAAA,MAAM;;AAEN,YAAA,OAAO,mBAAmB;;;AAI9B;;;;;;AAMG;AACH,IAAA,KAAK,CAAC,IAAY,EAAA;AAChB,QAAA,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;AAC9B,YAAA,OAAO,KAAK;;AAEd,QAAA,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC/B,MAAM,MAAM,GAAW,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC;QACnE,OAA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I,SAAS,EAAE,EAAE;YACf,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC;AACzC,YAAA,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI;;aAClC;AACL,YAAA,OAAO,IAAI;;;IAIf,GAAG,CAAc,GAAW,EAAE,KAAQ,EAAA;QACpC,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;;;IAI7D,KAAK,GAAA;QACH,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,KAAK,EAAE;;;AAIjC,IAAA,UAAU,CAAC,GAAW,EAAA;QACpB,IAAI,SAAS,EAAE,EAAE;AACf,YAAA,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC;;;8GAxB9B,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC;;;ACJD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport { AXTranslateHashMap, AXTranslateOptions, AXTranslateParams } from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(key, this.lastActiveLang, scope, options.params);\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B,CAAC;KACnC;AACF,CAAA,EAAE;AAEU,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;EACzB;AAIc,SAAA,iBAAiB,CAAC,MAAA,GAAqC,EAAE,EAAA;AACvE,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,GAAG,0BAA0B;AAC7B,QAAA,GAAG,MAAM;KACV,CAAC;AACF,IAAA,OAAO,MAAM,CAAC;AAChB;;MCpBa,0BAA0B,CAAA;AACrC,IAAA,cAAc,CAAC,OAAmC,EAAA;AAChD,QAAA,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;KACf;AACF,CAAA;MAEY,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ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A,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EATnB,SAAA,EAAA;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,UAAU,EAAE,aAAa;AACzB,gBAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA;AACF,SAAA,EAAA,CAAA,CAAA,EAAA;;2FAEU,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAb/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AAClD,oBAAA,YAAY,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AACvD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,aAAa;AACzB,4BAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;AACnD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;AACF,iBAAA,CAAA;;;AC5BD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-translation.mjs","sources":["../../../../libs/core/translation/src/lib/translation.config.ts","../../../../libs/core/translation/src/lib/translation.loader.ts","../../../../libs/core/translation/src/lib/translation.service.ts","../../../../libs/core/translation/src/lib/translation-scope.resolver.ts","../../../../libs/core/translation/src/lib/translator.directive.ts","../../../../libs/core/translation/src/lib/translator.pipe.ts","../../../../libs/core/translation/src/lib/translation.module.ts","../../../../libs/core/translation/src/acorex-core-translation.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AXTranslateLang, AXTranslateScope } from './translation.types';\n\nexport interface AXTranslationConfig {\n defaultLang: AXTranslateLang;\n defaultScope: AXTranslateScope;\n preloadLangs?: AXTranslateLang[];\n preloadScopes?: AXTranslateLang[];\n availableLangs?: AXTranslateLang[];\n scopeResolverKey: string;\n}\n\nexport const AX_TRANSLATION_CONFIG = new InjectionToken<AXTranslationConfig>('AX_TRANSLATION_CONFIG', {\n providedIn: 'root',\n factory: () => {\n return AXTranslationDefaultConfig;\n },\n});\n\nexport const AXTranslationDefaultConfig: AXTranslationConfig = {\n defaultLang: 'en',\n defaultScope: 'common',\n scopeResolverKey: 'scope',\n};\n\nexport type AXPartialTranslationConfig = Partial<AXTranslationConfig>;\n\nexport function translationConfig(config: AXPartialTranslationConfig = {}): AXTranslationConfig {\n const result = {\n ...AXTranslationDefaultConfig,\n ...config,\n };\n return result;\n}\n","import { InjectionToken } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslateLang, AXTranslateScope, AXTranslation } from './translation.types';\n\nexport interface AXTranslationLoaderOptions {\n lang: AXTranslateLang;\n scope?: AXTranslateScope;\n}\n\nexport interface AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation>;\n}\n\nexport class AXTranslationLoaderDefault implements AXTranslationLoader {\n getTranslation(options: AXTranslationLoaderOptions): Observable<AXTranslation> {\n return of({});\n }\n}\n\nexport const AX_TRANSLATION_LOADER = new InjectionToken<AXTranslationLoader>('AX_TRANSLATION_LOADER', {\n providedIn: 'root',\n factory: () => {\n return new AXTranslationLoaderDefault();\n },\n});\n","import { AXEventService, AXEventTypes } from '@acorex/core/events';\nimport { Injectable, inject } from '@angular/core';\nimport { get as lodashGet, set as lodashSet } from 'lodash-es';\nimport {\n BehaviorSubject,\n Observable,\n catchError,\n finalize,\n firstValueFrom,\n forkJoin,\n lastValueFrom,\n map,\n of,\n shareReplay,\n startWith,\n switchMap,\n take,\n tap,\n} from 'rxjs';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AX_TRANSLATION_LOADER } from './translation.loader';\nimport { AXTranslateHashMap, AXTranslateOptions, AXTranslateParams } from './translation.types';\n\nlet service: AXTranslationService;\n\nexport function translateSync(key: string, options?: AXTranslateOptions): string {\n return service.translateSync(key, options);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXTranslationService {\n private loader = inject(AX_TRANSLATION_LOADER);\n private config = inject(AX_TRANSLATION_CONFIG);\n\n private eventService = inject(AXEventService);\n\n private translationCache: AXTranslateHashMap<AXTranslateHashMap<string>> = {};\n private ongoingRequests: Map<string, Observable<any>> = new Map();\n\n private activeLang: BehaviorSubject<string> = new BehaviorSubject<string>(this.getDefaultLang());\n langChanges$: Observable<string> = this.activeLang.asObservable();\n\n private lastActiveLang: string | null = null;\n\n /**\n * @ignore\n */\n constructor() {\n service = this;\n }\n\n public loadLanguagesAndScopes(languages: string[], scopes: string[]): Observable<unknown> {\n const requests = languages.flatMap((lang) =>\n scopes.map((scope) => {\n // Check if translations are already cached\n if (this.translationCache[lang]?.[scope]) {\n return of(this.translationCache[lang][scope]);\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(lang, scope);\n }),\n );\n\n return forkJoin(requests);\n }\n\n private getOrLoadTranslations(lang: string, scope: string): Observable<AXTranslateHashMap<string>> {\n const requestKey = `${lang}_${scope}`;\n\n // Return existing observable if the request is already in progress\n if (this.ongoingRequests.has(requestKey)) {\n return this.ongoingRequests.get(requestKey);\n }\n\n // Load translations if not in cache or ongoing requests\n const translationObservable = this.loader.getTranslation({ lang, scope }).pipe(\n tap((translations) => this.cacheTranslations(lang, scope, translations)),\n catchError((error) => {\n console.error(`Error loading translations for lang: ${lang}, scope: ${scope}`, error);\n return of(null);\n }),\n finalize(() => {\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageLoaded,\n payload: lang,\n });\n this.ongoingRequests.delete(requestKey);\n }),\n shareReplay(1),\n );\n\n this.ongoingRequests.set(requestKey, translationObservable);\n return translationObservable;\n }\n\n private cacheTranslations(lang: string, scope: string, translations: AXTranslateHashMap<string>): void {\n lodashSet(this.translationCache, `${lang}.${scope}`, translations);\n }\n\n public getDefaultLang(): string {\n return this.config.defaultLang;\n }\n\n public getActiveLang(): string {\n return this.activeLang.getValue();\n }\n\n public setActiveLang(lang: string): void {\n if (lang != this.getActiveLang()) {\n this.lastActiveLang = this.getActiveLang(); // Update last active language\n this.activeLang.next(lang);\n this.eventService.emitEvent({\n type: AXEventTypes.AXLanguageChanged,\n payload: lang,\n });\n }\n }\n\n public isLangAvailable(lang: string, scope: string = null): boolean {\n return !this.translationCache[lang] && (!scope || !this.translationCache[lang][scope]);\n }\n\n private load(key: string, options: AXTranslateOptions = {}): Observable<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options;\n\n // Function to fetch translation\n const fetchTranslation = (language: string): Observable<string> => {\n // Check if translations are available in the cache\n if (this.translationCache[language]?.[scope]) {\n return of(this.getTranslation(key, language, scope, options.params));\n }\n\n // Use the new method to handle ongoing requests and loading\n return this.getOrLoadTranslations(language, scope).pipe(\n map(() => {\n const translation = this.translationCache[language]?.[scope]?.[key] || key;\n return this.getTranslation(translation, language, scope, options.params);\n }),\n switchMap((translatedText) => {\n if (translatedText === key && language !== this.getDefaultLang()) {\n // If the translation is not found and the language is not default,\n // try fetching from the default language\n return fetchTranslation(this.getDefaultLang());\n }\n return of(translatedText);\n }),\n );\n };\n\n // First, try to fetch the translation for the requested language\n const translationForRequestedLang = fetchTranslation(lang);\n\n // If lastActiveLang is available and different from the requested language, use it as a fallback\n if (this.lastActiveLang && this.lastActiveLang !== lang) {\n const translationForLastActiveLang = this.getTranslation(key, this.lastActiveLang, scope, options.params);\n return translationForRequestedLang.pipe(startWith(translationForLastActiveLang));\n }\n\n return translationForRequestedLang;\n }\n\n private getTranslation(key: string, lang: string, scope: string, params?: AXTranslateParams): string {\n let translation: string = (lodashGet(this.translationCache, `${lang}.${scope}.${key}`) || key) as string;\n\n // Replace params like {{ name }}\n if (params) {\n Object.keys(params).forEach((paramKey) => {\n const paramValue = params[paramKey] as string;\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n translation = translation.replace(new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g'), paramValue);\n }\n });\n }\n\n if (typeof translation !== 'string') {\n console.error(`${key} is not string`, { key, lang, scope, params, translation });\n } else {\n // Replace translations like {{ t('key') }}\n const translationPattern = /{{\\s*t\\('([^']+)'\\)\\s*}}/g;\n translation = translation.replace(translationPattern, (match, innerKey) => {\n return this.getTranslation(innerKey, lang, scope, params);\n });\n }\n\n return translation;\n }\n\n public translate(key: string, options?: AXTranslateOptions): Observable<string> {\n if (options?.lang) {\n return this.load(key, options);\n }\n return this.langChanges$.pipe(\n startWith(this.getActiveLang()),\n switchMap((lang) => {\n return this.load(key, { ...options, lang: lang });\n }),\n );\n }\n\n public async translateAsync(key: string, options?: AXTranslateOptions): Promise<string> {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n if (!translation) {\n // If the translation is not in the cache, load it\n await firstValueFrom(this.load(key, { lang, scope }).pipe(take(1)));\n translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n }\n\n // If still not available, try the last active language or default language\n if (!translation && this.lastActiveLang) {\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n if (!translation) {\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n\n public translateSync(key: string, options?: AXTranslateOptions): string {\n const { lang = this.getActiveLang(), scope = this.config.defaultScope } = options || {};\n\n // Check if the translation for the active language is available\n let translation = lodashGet(this.translationCache, `${lang}.${scope}.${key}`);\n\n //\n const loadLang = () => lastValueFrom(this.getOrLoadTranslations(lang, scope));\n // If not available, check lastActiveLang\n if (!translation && this.lastActiveLang) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.lastActiveLang}.${scope}.${key}`);\n }\n\n // If still not available, use the default language\n if (!translation) {\n loadLang();\n translation = lodashGet(this.translationCache, `${this.getDefaultLang()}.${scope}.${key}`);\n }\n\n // Perform parameter replacement\n return this.getTranslation((translation || key) as any, lang, scope, options?.params);\n }\n}\n","import { inject } from '@angular/core';\nimport { ResolveFn } from '@angular/router';\nimport { AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\n\nexport const loadTranslationScope: ResolveFn<unknown> = (route, state) => {\n const translatorService = inject(AXTranslationService);\n const config = inject(AX_TRANSLATION_CONFIG);\n const scopeValue = route.data[config.scopeResolverKey];\n const scopes = Array.isArray(scopeValue) ? scopeValue : [scopeValue];\n return translatorService.loadLanguagesAndScopes([translatorService.getActiveLang()], scopes);\n};\n","import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Directive({\n selector: '[translate]',\n})\nexport class AXTranslatorDirective implements OnInit {\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private translationService: AXTranslationService,\n ) {}\n\n ngOnInit() {\n this.viewContainer.clear();\n this.viewContainer.createEmbeddedView(this.templateRef, {\n $implicit: (key: string, options?: AXTranslateOptions) => {\n return this.translationService.translate(key, options);\n },\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslateOptions } from './translation.types';\n\n@Pipe({ name: 'translate', pure: true }) // The pipe can now be pure\nexport class AXTranslatorPipe implements PipeTransform {\n constructor(private service: AXTranslationService) {}\n\n transform(key: string, options?: AXTranslateOptions): Observable<string> {\n if (!key) {\n return of(''); // Return an empty observable if the key is not provided\n }\n return this.service.translate(key, options);\n }\n}\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXTranslationConfig, AX_TRANSLATION_CONFIG } from './translation.config';\nimport { AXTranslationService } from './translation.service';\nimport { AXTranslatorDirective } from './translator.directive';\nimport { AXTranslatorPipe } from './translator.pipe';\n\nfunction initializeApp(translatorService: AXTranslationService, config: AXTranslationConfig) {\n return (): Observable<any> => {\n return translatorService.loadLanguagesAndScopes(\n config.preloadLangs ?? [config.defaultLang],\n config.preloadScopes ?? [config.defaultScope],\n );\n };\n}\n\n@NgModule({\n imports: [],\n exports: [AXTranslatorPipe, AXTranslatorDirective],\n declarations: [AXTranslatorPipe, AXTranslatorDirective],\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeApp,\n deps: [AXTranslationService, AX_TRANSLATION_CONFIG],\n multi: true,\n },\n ],\n})\nexport class AXTranslationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["lodashSet","lodashGet","i1.AXTranslationService"],"mappings":";;;;;;MAYa,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,0BAA0B;KAClC;AACF,CAAA;AAEY,MAAA,0BAA0B,GAAwB;AAC7D,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,gBAAgB,EAAE,OAAO;;AAKX,SAAA,iBAAiB,CAAC,MAAA,GAAqC,EAAE,EAAA;AACvE,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,GAAG,0BAA0B;AAC7B,QAAA,GAAG,MAAM;KACV;AACD,IAAA,OAAO,MAAM;AACf;;MCpBa,0BAA0B,CAAA;AACrC,IAAA,cAAc,CAAC,OAAmC,EAAA;AAChD,QAAA,OAAO,EAAE,CAAC,EAAE,CAAC;;AAEhB;MAEY,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB,EAAE;AACpG,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,OAAO,IAAI,0BAA0B,EA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