coer-elements 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/README.md +24 -0
  2. package/Signals/index.d.ts +3 -0
  3. package/Signals/src/breakpoint.signal.d.ts +1 -0
  4. package/Signals/src/isLoading.signal.d.ts +1 -0
  5. package/Signals/src/isModalOpen.signal.d.ts +1 -0
  6. package/Tools/index.d.ts +8 -0
  7. package/Tools/src/Breadcrumbs.class.d.ts +18 -0
  8. package/Tools/src/ControlValue.d.ts +23 -0
  9. package/Tools/src/DateTime.class.d.ts +11 -0
  10. package/Tools/src/Files.class.d.ts +16 -0
  11. package/Tools/src/Page.class.d.ts +66 -0
  12. package/Tools/src/Screen.class.d.ts +11 -0
  13. package/Tools/src/Source.class.d.ts +20 -0
  14. package/Tools/src/Tools.d.ts +33 -0
  15. package/components/index.d.ts +2 -0
  16. package/components/src/coer-alert/coer-alert.component.d.ts +23 -0
  17. package/components/src/components.module.d.ts +10 -0
  18. package/esm2022/Signals/index.mjs +4 -0
  19. package/esm2022/Signals/src/breakpoint.signal.mjs +4 -0
  20. package/esm2022/Signals/src/isLoading.signal.mjs +3 -0
  21. package/esm2022/Signals/src/isModalOpen.signal.mjs +3 -0
  22. package/esm2022/Tools/index.mjs +9 -0
  23. package/esm2022/Tools/src/Breadcrumbs.class.mjs +63 -0
  24. package/esm2022/Tools/src/ControlValue.mjs +44 -0
  25. package/esm2022/Tools/src/DateTime.class.mjs +22 -0
  26. package/esm2022/Tools/src/Files.class.mjs +93 -0
  27. package/esm2022/Tools/src/Page.class.mjs +160 -0
  28. package/esm2022/Tools/src/Screen.class.mjs +43 -0
  29. package/esm2022/Tools/src/Source.class.mjs +79 -0
  30. package/esm2022/Tools/src/Tools.mjs +200 -0
  31. package/esm2022/coer-elements.mjs +5 -0
  32. package/esm2022/components/index.mjs +3 -0
  33. package/esm2022/components/src/coer-alert/coer-alert.component.mjs +227 -0
  34. package/esm2022/components/src/components.module.mjs +92 -0
  35. package/esm2022/index.mjs +4 -0
  36. package/esm2022/interfaces/index.mjs +7 -0
  37. package/esm2022/interfaces/src/IAppSource.interface.mjs +2 -0
  38. package/esm2022/interfaces/src/IBreadcrumb.interface.mjs +2 -0
  39. package/esm2022/interfaces/src/ICoerRef.interface.mjs +2 -0
  40. package/esm2022/interfaces/src/IGoBack.interface.mjs +2 -0
  41. package/esm2022/interfaces/src/IPatch.interface.mjs +2 -0
  42. package/esm2022/interfaces/src/IScreenSize.interface.mjs +2 -0
  43. package/fesm2022/coer-elements.mjs +1010 -0
  44. package/fesm2022/coer-elements.mjs.map +1 -0
  45. package/index.d.ts +3 -0
  46. package/interfaces/index.d.ts +6 -0
  47. package/interfaces/index.ts +6 -0
  48. package/interfaces/src/IAppSource.interface.d.ts +4 -0
  49. package/interfaces/src/IAppSource.interface.ts +4 -0
  50. package/interfaces/src/IBreadcrumb.interface.d.ts +6 -0
  51. package/interfaces/src/IBreadcrumb.interface.ts +6 -0
  52. package/interfaces/src/ICoerRef.interface.d.ts +10 -0
  53. package/interfaces/src/ICoerRef.interface.ts +11 -0
  54. package/interfaces/src/IGoBack.interface.d.ts +6 -0
  55. package/interfaces/src/IGoBack.interface.ts +6 -0
  56. package/interfaces/src/IPatch.interface.d.ts +5 -0
  57. package/interfaces/src/IPatch.interface.ts +5 -0
  58. package/interfaces/src/IScreenSize.interface.d.ts +5 -0
  59. package/interfaces/src/IScreenSize.interface.ts +5 -0
  60. package/package.json +25 -0
  61. package/styles/coer.scss +96 -0
  62. package/styles/colors.scss +167 -0
  63. package/styles/index.css +18 -0
  64. package/styles/index.scss +2 -0
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # CoerElements
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project coer-elements` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project coer-elements`.
8
+ > Note: Don't forget to add `--project coer-elements` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build coer-elements` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build coer-elements`, go to the dist folder `cd dist/coer-elements` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test coer-elements` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,3 @@
1
+ export * from './src/breakpoint.signal';
2
+ export * from './src/isLoading.signal';
3
+ export * from './src/isModalOpen.signal';
@@ -0,0 +1 @@
1
+ export declare const breakpointSIG: import("@angular/core").WritableSignal<"xs" | "sm" | "md" | "lg" | "xl" | "xxl">;
@@ -0,0 +1 @@
1
+ export declare const isLoadingSIG: import("@angular/core").WritableSignal<boolean>;
@@ -0,0 +1 @@
1
+ export declare const isModalOpenSIG: import("@angular/core").WritableSignal<boolean>;
@@ -0,0 +1,8 @@
1
+ export * from './src/Breadcrumbs.class';
2
+ export * from './src/ControlValue';
3
+ export * from './src/DateTime.class';
4
+ export * from './src/Files.class';
5
+ export * from './src/Page.class';
6
+ export * from './src/Screen.class';
7
+ export * from './src/Source.class';
8
+ export * from './src/Tools';
@@ -0,0 +1,18 @@
1
+ import { IAppSource } from "../../interfaces";
2
+ export declare class Breadcrumbs {
3
+ private static readonly storage;
4
+ /** */
5
+ static Add(page: string, path: string): void;
6
+ /** */
7
+ static Get(): IAppSource[];
8
+ /** Source */
9
+ static GetFirst(): IAppSource | null;
10
+ /** */
11
+ static Save(breadcrumbs: IAppSource[]): void;
12
+ /** */
13
+ static Remove(path: string): void;
14
+ /** */
15
+ static SetLast(page: string, path: string): void;
16
+ /** */
17
+ static RemoveLast(): void;
18
+ }
@@ -0,0 +1,23 @@
1
+ import { ControlValueAccessor } from "@angular/forms";
2
+ export declare const CONTROL_VALUE: <T>(component: T) => {
3
+ provide: import("@angular/core").InjectionToken<readonly ControlValueAccessor[]>;
4
+ useExisting: import("@angular/core").Type<any>;
5
+ multi: boolean;
6
+ };
7
+ export declare class ControlValue implements ControlValueAccessor {
8
+ protected _value: any;
9
+ private _isTouched;
10
+ protected _UpdateValue: Function;
11
+ private _IsTouched;
12
+ get isTouched(): boolean;
13
+ /** */
14
+ protected SetValue(value: any): void;
15
+ /** */
16
+ SetTouched(isTouched: boolean): void;
17
+ /** */
18
+ writeValue(value: any): void;
19
+ /** */
20
+ registerOnChange(callback: Function): void;
21
+ /** */
22
+ registerOnTouched(callback: Function): void;
23
+ }
@@ -0,0 +1,11 @@
1
+ import moment from "moment";
2
+ export declare class DateTime {
3
+ /** Get UTC Offset */
4
+ static GetUTCOffset(): number;
5
+ /** Convert UTC Date to Local Zone */
6
+ static ToLocalZone(utcDate: string | Date | moment.Moment): string;
7
+ /** Convert Local Zone Date to UTC */
8
+ static ToUTC(utcDate: string | Date | moment.Moment): string;
9
+ /** DD MMM YYYY */
10
+ static GetDateFormat(date: string | Date | moment.Moment): string;
11
+ }
@@ -0,0 +1,16 @@
1
+ export declare class Files {
2
+ static readonly EXCEL_EXTENSIONS: string[];
3
+ /** Get Extension File */
4
+ static GetExtension(file: File): string | null;
5
+ /** Is Excel File */
6
+ static IsExcel(file: File): boolean;
7
+ /** Read excel file */
8
+ static ReadExcel<T>(file: File): Promise<{
9
+ columns: string[];
10
+ rows: T[];
11
+ }>;
12
+ /** Export to excel file */
13
+ static ExportExcel<T>(data: T[], fileName?: string, sheetName?: string): void;
14
+ /** Convert file to string base64 */
15
+ static ConvertToBase64(file: File): Promise<string>;
16
+ }
@@ -0,0 +1,66 @@
1
+ import { Router } from '@angular/router';
2
+ import { AfterViewInit, OnDestroy } from '@angular/core';
3
+ import { IBreadcrumb, IGoBack } from '../../interfaces';
4
+ import { CoerAlert } from '../../components';
5
+ import * as i0 from "@angular/core";
6
+ export declare class Page implements AfterViewInit, OnDestroy {
7
+ protected readonly alert: CoerAlert;
8
+ protected readonly router: Router;
9
+ private readonly activatedRoute;
10
+ /** */
11
+ protected isUpdate: boolean;
12
+ /** */
13
+ protected isLoading: boolean;
14
+ /** */
15
+ protected isReady: boolean;
16
+ /** */
17
+ protected enableAnimations: boolean;
18
+ /** */
19
+ protected routeParams: any;
20
+ /** */
21
+ protected queryParams: any;
22
+ /** */
23
+ protected breadcrumbs: IBreadcrumb[];
24
+ /** */
25
+ protected pageResponse: any;
26
+ /** */
27
+ protected goBack: IGoBack;
28
+ private _page;
29
+ private _source;
30
+ private _preventDestroy;
31
+ constructor(page: string);
32
+ ngAfterViewInit(): void;
33
+ ngOnDestroy(): void;
34
+ /** Main method. Starts after ngAfterViewInit() */
35
+ protected RunPage(): void;
36
+ /** Rename the last breadcrumb and update the url id */
37
+ protected SetPageName(name: string, id?: string | number | null): void;
38
+ /** */
39
+ private SetSource;
40
+ /** */
41
+ private GetSource;
42
+ /** */
43
+ protected GetPageResponse(): void;
44
+ /** */
45
+ private GetNavigation;
46
+ /** */
47
+ private SetGoBack;
48
+ /** */
49
+ private GoBack;
50
+ /** Navigate to previous page */
51
+ protected GoToSource<T>(pageResponse?: T | null): void;
52
+ /** */
53
+ protected SetPageResponse<T>(pageResponse?: T | null): void;
54
+ /** */
55
+ protected ReloadPage(): void;
56
+ /** */
57
+ protected Log(value: any, log?: string | null): void;
58
+ /** Returns true if the value is null or undefined, false otherwise */
59
+ protected IsNotNull: <T>(value: T | null | undefined) => boolean;
60
+ /** Returns true if the value is null or undefined, false otherwise */
61
+ protected IsNull: <T>(value: T | null | undefined) => boolean;
62
+ /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
63
+ protected IsOnlyWhiteSpace: <T>(value: T | null | undefined) => boolean;
64
+ static ɵfac: i0.ɵɵFactoryDeclaration<Page, never>;
65
+ static ɵcmp: i0.ɵɵComponentDeclaration<Page, "ng-component", never, {}, {}, never, never, false, never>;
66
+ }
@@ -0,0 +1,11 @@
1
+ import { IScreenSize } from "../../interfaces";
2
+ import { Observable } from "rxjs";
3
+ export declare class Screen {
4
+ static get WINDOW_WIDTH(): number;
5
+ static get WINDOW_HEIGHT(): number;
6
+ static get DEVICE_WIDTH(): number;
7
+ static get DEVICE_HEIGHT(): number;
8
+ static get BREAKPOINT(): 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
9
+ /** */
10
+ static Resize: Observable<IScreenSize>;
11
+ }
@@ -0,0 +1,20 @@
1
+ import { IAppSource } from '../../interfaces';
2
+ export declare class Source {
3
+ private static readonly storage;
4
+ /** */
5
+ static Set(page: string): void;
6
+ /** */
7
+ private static Save;
8
+ /** */
9
+ static Get(): IAppSource | null;
10
+ /** */
11
+ static GetRoot(): IAppSource | null;
12
+ /** */
13
+ static SetPageResponse<T>(pageResponse: T): void;
14
+ /** */
15
+ static GetPageResponse<T>(): T | null;
16
+ /** */
17
+ static ClearPageResponse(): void;
18
+ /** Clear Source */
19
+ static Reset(): void;
20
+ }
@@ -0,0 +1,33 @@
1
+ export declare const Tools: {
2
+ /** Generate a Guid */
3
+ GetGuid: (seed?: string) => string;
4
+ /** Returns true if the value is null or undefined, false otherwise */
5
+ IsNull: <T>(value: T | null | undefined) => boolean;
6
+ /** Returns true if the value is not null or undefined, false otherwise */
7
+ IsNotNull: <T_1>(value: T_1 | null | undefined) => boolean;
8
+ /** Returns true if the value is null or undefined or contains only whitespace, false otherwise */
9
+ IsOnlyWhiteSpace: <T_2>(value: T_2 | null | undefined) => boolean;
10
+ /** Break reference of a object or array */
11
+ BreakReference: <T_3>(object: T_3) => T_3;
12
+ /** Clean extra whitespaces */
13
+ CleanUpBlanks: (text: string | number) => string;
14
+ /** Get properties of an object */
15
+ GetObjectProperties: <T_4>(obj: T_4 | null | undefined) => string[];
16
+ /**
17
+ * Set an index and merge more arrays of the same type
18
+ * @returns A new array
19
+ * */
20
+ SetIndex: <T_5>(array: T_5[], ...args: T_5[][]) => T_5[];
21
+ /** Set First Char To Lower */
22
+ FirstCharToLower: (text: string | null | undefined) => string;
23
+ /** Set First Char To Upper */
24
+ FirstCharToUpper: (text: string | null | undefined) => string;
25
+ /** Sort an array in ascending order by property */
26
+ SortBy: <T_6>(array: T_6[], property: string, propertyType?: 'string' | 'number') => T_6[];
27
+ /** Sort an array in descending order by property */
28
+ SortByDesc: <T_7>(array: T_7[], property: string, propertyType?: 'string' | 'number') => T_7[];
29
+ /** Return a string with forman numeric */
30
+ GetNumericFormat: (value: string | number | null | undefined, decimals?: number) => string;
31
+ /** Wait the time indicated */
32
+ Sleep: (milliseconds?: number, reference?: string | null) => Promise<unknown>;
33
+ };
@@ -0,0 +1,2 @@
1
+ export * from './src/components.module';
2
+ export * from './src/coer-alert/coer-alert.component';
@@ -0,0 +1,23 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CoerAlert {
3
+ /** */
4
+ Success(message?: string | null, title?: string | null, icon?: string | null, autohide?: number | null): void;
5
+ /** */
6
+ Error(message?: string | null, title?: string | null, icon?: string | null, autohide?: number | null): void;
7
+ /** */
8
+ Info(message?: string | null, title?: string | null, icon?: string | null, autohide?: number | null): void;
9
+ /** */
10
+ Warning(message?: string | null, title?: string | null, icon?: string | null, autohide?: number | null): void;
11
+ /** */
12
+ protected Close(alert: 'alert-success' | 'alert-error' | 'alert-info' | 'alert-warning'): Promise<void>;
13
+ /** */
14
+ Confirm(message?: string, alertType?: 'warning' | 'danger' | 'success' | 'info', icon?: string | null): Promise<boolean>;
15
+ /** */
16
+ private SetIcon;
17
+ /** */
18
+ private SetAutoHide;
19
+ /** */
20
+ private GetIcon;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<CoerAlert, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<CoerAlert, "coer-alert", never, {}, {}, never, never, false, never>;
23
+ }
@@ -0,0 +1,10 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./coer-alert/coer-alert.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/router";
5
+ import * as i4 from "@angular/forms";
6
+ export declare class ComponentsModule {
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComponentsModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ComponentsModule, [typeof i1.CoerAlert], [typeof i2.CommonModule, typeof i3.RouterModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule], [typeof i1.CoerAlert]>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<ComponentsModule>;
10
+ }
@@ -0,0 +1,4 @@
1
+ export * from './src/breakpoint.signal';
2
+ export * from './src/isLoading.signal';
3
+ export * from './src/isModalOpen.signal';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL1NpZ25hbHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsMEJBQTBCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NyYy9icmVha3BvaW50LnNpZ25hbCc7XHJcbmV4cG9ydCAqIGZyb20gJy4vc3JjL2lzTG9hZGluZy5zaWduYWwnO1xyXG5leHBvcnQgKiBmcm9tICcuL3NyYy9pc01vZGFsT3Blbi5zaWduYWwnOyAiXX0=
@@ -0,0 +1,4 @@
1
+ import { Screen } from '../../Tools';
2
+ import { signal } from '@angular/core';
3
+ export const breakpointSIG = signal(Screen?.BREAKPOINT || 'xs');
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJlYWtwb2ludC5zaWduYWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL1NpZ25hbHMvc3JjL2JyZWFrcG9pbnQuc2lnbmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDckMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN2QyxNQUFNLENBQUMsTUFBTSxhQUFhLEdBQUcsTUFBTSxDQUEyQyxNQUFNLEVBQUUsVUFBVSxJQUFJLElBQUksQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgU2NyZWVuIH0gZnJvbSAnLi4vLi4vVG9vbHMnO1xyXG5pbXBvcnQgeyBzaWduYWwgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcclxuZXhwb3J0IGNvbnN0IGJyZWFrcG9pbnRTSUcgPSBzaWduYWw8J3hzJyB8ICdzbScgfCAnbWQnIHwgJ2xnJyB8ICd4bCcgfCAneHhsJz4oU2NyZWVuPy5CUkVBS1BPSU5UIHx8ICd4cycpOyJdfQ==
@@ -0,0 +1,3 @@
1
+ import { signal } from "@angular/core";
2
+ export const isLoadingSIG = signal(false);
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNMb2FkaW5nLnNpZ25hbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvZXItZWxlbWVudHMvU2lnbmFscy9zcmMvaXNMb2FkaW5nLnNpZ25hbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE1BQU0sQ0FBQyxNQUFNLFlBQVksR0FBRyxNQUFNLENBQVUsS0FBSyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBzaWduYWwgfSBmcm9tIFwiQGFuZ3VsYXIvY29yZVwiO1xyXG5leHBvcnQgY29uc3QgaXNMb2FkaW5nU0lHID0gc2lnbmFsPGJvb2xlYW4+KGZhbHNlKTsiXX0=
@@ -0,0 +1,3 @@
1
+ import { signal } from "@angular/core";
2
+ export const isModalOpenSIG = signal(false);
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNNb2RhbE9wZW4uc2lnbmFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9TaWduYWxzL3NyYy9pc01vZGFsT3Blbi5zaWduYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN2QyxNQUFNLENBQUMsTUFBTSxjQUFjLEdBQUcsTUFBTSxDQUFVLEtBQUssQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc2lnbmFsIH0gZnJvbSBcIkBhbmd1bGFyL2NvcmVcIjtcclxuZXhwb3J0IGNvbnN0IGlzTW9kYWxPcGVuU0lHID0gc2lnbmFsPGJvb2xlYW4+KGZhbHNlKTsiXX0=
@@ -0,0 +1,9 @@
1
+ export * from './src/Breadcrumbs.class';
2
+ export * from './src/ControlValue';
3
+ export * from './src/DateTime.class';
4
+ export * from './src/Files.class';
5
+ export * from './src/Page.class';
6
+ export * from './src/Screen.class';
7
+ export * from './src/Source.class';
8
+ export * from './src/Tools';
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL1Rvb2xzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsb0JBQW9CLENBQUM7QUFDbkMsY0FBYyxhQUFhLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NyYy9CcmVhZGNydW1icy5jbGFzcyc7XHJcbmV4cG9ydCAqIGZyb20gJy4vc3JjL0NvbnRyb2xWYWx1ZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vc3JjL0RhdGVUaW1lLmNsYXNzJztcclxuZXhwb3J0ICogZnJvbSAnLi9zcmMvRmlsZXMuY2xhc3MnO1xyXG5leHBvcnQgKiBmcm9tICcuL3NyYy9QYWdlLmNsYXNzJztcclxuZXhwb3J0ICogZnJvbSAnLi9zcmMvU2NyZWVuLmNsYXNzJztcclxuZXhwb3J0ICogZnJvbSAnLi9zcmMvU291cmNlLmNsYXNzJztcclxuZXhwb3J0ICogZnJvbSAnLi9zcmMvVG9vbHMnOyJdfQ==
@@ -0,0 +1,63 @@
1
+ import { Tools } from '../';
2
+ export class Breadcrumbs {
3
+ static { this.storage = 'COER-System'; }
4
+ /** */
5
+ static Add(page, path) {
6
+ const breadcrumbs = this.Get();
7
+ const paths = breadcrumbs.map(item => item.path);
8
+ if (!paths.includes(path)) {
9
+ breadcrumbs.push({ page, path });
10
+ this.Save(breadcrumbs);
11
+ }
12
+ }
13
+ /** */
14
+ static Get() {
15
+ let storage = sessionStorage.getItem(this.storage);
16
+ if (storage) {
17
+ storage = JSON.parse(storage);
18
+ if (storage.hasOwnProperty('breadcrumbs')) {
19
+ return Tools.BreakReference(storage.breadcrumbs);
20
+ }
21
+ }
22
+ return [];
23
+ }
24
+ /** Source */
25
+ static GetFirst() {
26
+ const breadcrumbs = this.Get();
27
+ return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
28
+ }
29
+ /** */
30
+ static Save(breadcrumbs) {
31
+ let storage = sessionStorage.getItem(this.storage);
32
+ if (storage)
33
+ storage = JSON.parse(storage);
34
+ storage = Object.assign({}, storage, { breadcrumbs });
35
+ sessionStorage.setItem(this.storage, JSON.stringify(storage));
36
+ }
37
+ /** */
38
+ static Remove(path) {
39
+ let breadcrumbs = this.Get();
40
+ const index = breadcrumbs.findIndex(x => x.path.toLowerCase().trim() === path.toLowerCase().trim());
41
+ if (index >= 0) {
42
+ breadcrumbs = Tools.BreakReference(breadcrumbs).splice(0, index + 1);
43
+ this.Save(breadcrumbs);
44
+ }
45
+ }
46
+ /** */
47
+ static SetLast(page, path) {
48
+ const breadcrumbs = this.Get();
49
+ if (breadcrumbs.length > 0) {
50
+ breadcrumbs[breadcrumbs.length - 1] = { page, path };
51
+ this.Save(breadcrumbs);
52
+ }
53
+ }
54
+ /** */
55
+ static RemoveLast() {
56
+ const breadcrumbs = this.Get();
57
+ if (breadcrumbs.length > 0) {
58
+ breadcrumbs.pop();
59
+ this.Save(breadcrumbs);
60
+ }
61
+ }
62
+ }
63
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQnJlYWRjcnVtYnMuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb2VyLWVsZW1lbnRzL1Rvb2xzL3NyYy9CcmVhZGNydW1icy5jbGFzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRTVCLE1BQU0sT0FBTyxXQUFXO2FBRUksWUFBTyxHQUFHLGFBQWEsQ0FBQztJQUVoRCxNQUFNO0lBQ0Ms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7XHJcblxyXG4gICAgLyoqICovXHJcbiAgICBwdWJsaWMgc3RhdGljIEFkZChwYWdlOiBzdHJpbmcsIHBhdGg6IHN0cmluZyk6IHZvaWQge1xyXG4gICAgICAgIGNvbnN0IGJyZWFkY3J1bWJzID0gdGhpcy5HZXQoKTtcclxuICAgICAgICBjb25zdCBwYXRocyA9IGJyZWFkY3J1bWJzLm1hcChpdGVtID0+IGl0ZW0ucGF0aCk7XHJcblxyXG4gICAgICAgIGlmICghcGF0aHMuaW5jbHVkZXMocGF0aCkpIHtcclxuICAgICAgICAgICAgYnJlYWRjcnVtYnMucHVzaCh7IHBhZ2UsIHBhdGggfSk7XHJcbiAgICAgICAgICAgIHRoaXMuU2F2ZShicmVhZGNydW1icyk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgR2V0KCk6IElBcHBTb3VyY2VbXSB7XHJcbiAgICAgICAgbGV0IHN0b3JhZ2UgPSBzZXNzaW9uU3RvcmFnZS5nZXRJdGVtKHRoaXMuc3RvcmFnZSkgYXMgYW55O1xyXG5cclxuICAgICAgICBpZiAoc3RvcmFnZSkge1xyXG4gICAgICAgICAgICBzdG9yYWdlID0gSlNPTi5wYXJzZShzdG9yYWdlKTtcclxuXHJcbiAgICAgICAgICAgIGlmIChzdG9yYWdlLmhhc093blByb3BlcnR5KCdicmVhZGNydW1icycpKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gVG9vbHMuQnJlYWtSZWZlcmVuY2Uoc3RvcmFnZS5icmVhZGNydW1icyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBbXTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIFNvdXJjZSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBHZXRGaXJzdCgpOiBJQXBwU291cmNlIHwgbnVsbCB7XHJcbiAgICAgICAgY29uc3Qg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ICB0aGlzLlNhdmUoYnJlYWRjcnVtYnMpO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqICovXHJcbiAgICBwdWJsaWMgc3RhdGljIFNldExhc3QocGFnZTogc3RyaW5nLCBwYXRoOiBzdHJpbmcpOiB2b2lkIHtcclxuICAgICAgICBjb25zdCBicmVhZGNydW1icyA9IHRoaXMuR2V0KCk7XHJcblxyXG4gICAgICAgIGlmIChicmVhZGNydW1icy5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgIGJyZWFkY3J1bWJzW2JyZWFkY3J1bWJzLmxlbmd0aCAtIDFdID0geyBwYWdlLCBwYXRoIH07XHJcbiAgICAgICAgICAgIHRoaXMuU2F2ZShicmVhZGNydW1icyk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyBzdGF0aWMgUmVtb3ZlTGFzdCgpOiB2b2lkIHtcclxuICAgICAgICBjb25zdCBicmVhZGNydW1icyA9IHRoaXMuR2V0KCk7XHJcblxyXG4gICAgICAgIGlmIChicmVhZGNydW1icy5sZW5ndGggPiAwKSB7XHJcbiAgICAgICAgICAgIGJyZWFkY3J1bWJzLnBvcCgpO1xyXG4gICAgICAgICAgICB0aGlzLlNhdmUoYnJlYWRjcnVtYnMpO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxufSJdfQ==
@@ -0,0 +1,44 @@
1
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
2
+ import { forwardRef } from "@angular/core";
3
+ export const CONTROL_VALUE = (component) => {
4
+ return {
5
+ provide: NG_VALUE_ACCESSOR,
6
+ useExisting: forwardRef(() => component),
7
+ multi: true
8
+ };
9
+ };
10
+ export class ControlValue {
11
+ constructor() {
12
+ this._isTouched = false;
13
+ }
14
+ get isTouched() {
15
+ return this._isTouched;
16
+ }
17
+ /** */
18
+ SetValue(value) {
19
+ if (typeof this._UpdateValue === 'function') {
20
+ this._UpdateValue(value);
21
+ }
22
+ this._value = value;
23
+ }
24
+ /** */
25
+ SetTouched(isTouched) {
26
+ if (typeof this._IsTouched === 'function') {
27
+ this._IsTouched(isTouched);
28
+ }
29
+ this._isTouched = isTouched;
30
+ }
31
+ /** */
32
+ writeValue(value) {
33
+ this._value = value;
34
+ }
35
+ /** */
36
+ registerOnChange(callback) {
37
+ this._UpdateValue = callback;
38
+ }
39
+ /** */
40
+ registerOnTouched(callback) {
41
+ this._IsTouched = callback;
42
+ }
43
+ }
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29udHJvbFZhbHVlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29lci1lbGVtZW50cy9Ub29scy9zcmMvQ29udHJvbFZhbHVlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBd0IsaUJBQWlCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN6RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTNDLE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBRyxDQUFJLFNBQVksRUFBRSxFQUFFO0lBQzdDLE9BQU87UUFDSCxPQUFPLEVBQUUsaUJBQWlCO1FBQzFCLFdBQVcsRUFBRSxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsU0FBUyxDQUFDO1FBQ3hDLEtBQUssRUFBRSxJQUFJO0tBQ2QsQ0FBQTtBQUNMLENBQUMsQ0FBQTtBQUdELE1BQU0sT0FBTyxZQUFZO0lBQXpCO1FBSVksZUFBVSxHQUFZLEtBQUssQ0FBQztJQThDeEMsQ0FBQztJQXpDRyxJQUFXLFNBQVM7UUFDaEIsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDO0lBQzNCLENBQUM7SUFHRCxNQUFNO0lBQ0ksUUFBUSxD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ICAgICAgICAgIHRoaXMuX0lzVG91Y2hlZChpc1RvdWNoZWQpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdGhpcy5faXNUb3VjaGVkID0gaXNUb3VjaGVkO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyB3cml0ZVZhbHVlKHZhbHVlOiBhbnkpOiB2b2lkIHtcclxuICAgICAgICB0aGlzLl92YWx1ZSA9IHZhbHVlO1xyXG4gICAgfVxyXG5cclxuXHJcbiAgICAvKiogKi9cclxuICAgIHB1YmxpYyByZWdpc3Rlck9uQ2hhbmdlKGNhbGxiYWNrOiBGdW5jdGlvbik6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuX1VwZGF0ZVZhbHVlID0gY2FsbGJhY2s7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiAqL1xyXG4gICAgcHVibGljIHJlZ2lzdGVyT25Ub3VjaGVkKGNhbGxiYWNrOiBGdW5jdGlvbik6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuX0lzVG91Y2hlZCA9IGNhbGxiYWNrO1xyXG4gICAgfVxyXG59Il19
@@ -0,0 +1,22 @@
1
+ import moment from "moment";
2
+ export class DateTime {
3
+ /** Get UTC Offset */
4
+ static GetUTCOffset() {
5
+ return moment().utcOffset();
6
+ }
7
+ /** Convert UTC Date to Local Zone */
8
+ static ToLocalZone(utcDate) {
9
+ return moment(utcDate).add(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
10
+ }
11
+ /** Convert Local Zone Date to UTC */
12
+ static ToUTC(utcDate) {
13
+ return moment(utcDate).subtract(DateTime.GetUTCOffset(), 'minutes').format('YYYY-MM-DD HH:mm:ss');
14
+ }
15
+ /** DD MMM YYYY */
16
+ static GetDateFormat(date) {
17
+ if ((typeof date === 'string'))
18
+ date = date.replaceAll('/', '-');
19
+ return moment(date).parseZone().local(true).format('DD MMM YYYY');
20
+ }
21
+ }
22
+ //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OnNzJyk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBERCBNTU0gWVlZWSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBHZXREYXRlRm9ybWF0KGRhdGU6IHN0cmluZyB8IERhdGUgfCBtb21lbnQuTW9tZW50KTogc3RyaW5nIHtcclxuICAgICAgICBpZiAoKHR5cGVvZiBkYXRlID09PSAnc3RyaW5nJykpIGRhdGUgPSBkYXRlLnJlcGxhY2VBbGwoJy8nLCAnLScpO1xyXG4gICAgICAgIHJldHVybiBtb21lbnQoZGF0ZSkucGFyc2Vab25lKCkubG9jYWwodHJ1ZSkuZm9ybWF0KCdERCBNTU0gWVlZWScpO1xyXG4gICAgfVxyXG59Il19
@@ -0,0 +1,93 @@
1
+ import { Tools } from "../";
2
+ import * as XLSX from 'xlsx';
3
+ export class Files {
4
+ static { this.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv']; }
5
+ /** Get Extension File */
6
+ static GetExtension(file) {
7
+ const fileName = file.name;
8
+ if (fileName.includes('.')) {
9
+ let worlds = fileName.split('.');
10
+ if (worlds.length > 0) {
11
+ let extension = worlds.pop();
12
+ extension = extension.trim().toLowerCase();
13
+ if (extension.length > 0)
14
+ return extension;
15
+ }
16
+ }
17
+ return null;
18
+ }
19
+ /** Is Excel File */
20
+ static IsExcel(file) {
21
+ const EXTENSION = Files.GetExtension(file);
22
+ return Tools.IsNotNull(EXTENSION)
23
+ ? this.EXCEL_EXTENSIONS.includes(EXTENSION)
24
+ : false;
25
+ }
26
+ /** Read excel file */
27
+ static ReadExcel(file) {
28
+ return new Promise(Resolve => {
29
+ let columns = [];
30
+ let rows = [];
31
+ const reader = new FileReader();
32
+ reader.readAsArrayBuffer(file);
33
+ reader.onload = () => {
34
+ const dataBytes = new Uint8Array(reader.result);
35
+ if (dataBytes) {
36
+ const workbook = XLSX.read(dataBytes, {});
37
+ const sheet = workbook.Sheets[workbook.SheetNames[0]];
38
+ let dataSheet = XLSX.utils.sheet_to_json(sheet, {
39
+ header: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
40
+ });
41
+ //Get Headers
42
+ for (const column in dataSheet[0]) {
43
+ columns.push(Tools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
44
+ }
45
+ //Get Rows
46
+ rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
47
+ rows.shift();
48
+ rows = rows.map(row => {
49
+ const item = Tools.BreakReference(row);
50
+ delete item['__rowNum__'];
51
+ return item;
52
+ });
53
+ }
54
+ Resolve({ columns, rows });
55
+ };
56
+ reader.onerror = () => { Resolve({ columns, rows }); };
57
+ });
58
+ }
59
+ /** Export to excel file */
60
+ static ExportExcel(data, fileName = 'coer_report', sheetName = 'Sheet1') {
61
+ sheetName = Tools.CleanUpBlanks(sheetName);
62
+ fileName = Tools.CleanUpBlanks(fileName);
63
+ if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
64
+ if (fileName.includes('.xls')) {
65
+ fileName = fileName.replaceAll('.xls', '.xlsx');
66
+ }
67
+ if (fileName.includes('.csv')) {
68
+ fileName = fileName.replaceAll('.csv', '.xlsx');
69
+ }
70
+ }
71
+ else {
72
+ fileName += '.xlsx';
73
+ }
74
+ const WORK_SHEET = XLSX.utils.json_to_sheet(data);
75
+ const WORK_BOOK = XLSX.utils.book_new();
76
+ XLSX.utils.book_append_sheet(WORK_BOOK, WORK_SHEET, 'Sheet1');
77
+ XLSX.writeFile(WORK_BOOK, fileName);
78
+ }
79
+ /** Convert file to string base64 */
80
+ static ConvertToBase64(file) {
81
+ return new Promise(Resolve => {
82
+ const reader = new FileReader();
83
+ reader.readAsDataURL(file);
84
+ reader.onload = () => {
85
+ Resolve(reader.result?.toString() || '');
86
+ };
87
+ reader.onerror = () => {
88
+ Resolve('');
89
+ };
90
+ });
91
+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gY29uc3QgRVhURU5TSU9OID0gRmlsZXMuR2V0RXh0ZW5zaW9uKGZpbGUpO1xyXG5cclxuICAgICAgICByZXR1cm4gVG9vbHMuSXNOb3ROdWxsKEVYVEVOU0lPTilcclxuICAgICAgICAgICAgPyB0aGlzLkVYQ0VMX0VYVEVOU0lPTlMuaW5jbHVkZXMoRVhURU5TSU9OISlcclxuICAgICAgICAgICAgOiBmYWxzZTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIFJlYWQgZXhjZWwgZmlsZSAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBSZWFkRXhjZWw8VD4oZmlsZTogRmlsZSkge1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZTx7IGNvbHVtbnM6IHN0cmluZ1tdOyByb3dzOiBUW107IH0+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBsZXQgY29sdW1uczogc3RyaW5nW10gPSBbXTtcclxuICAgICAgICAgICAgbGV0IHJvd3M6IFRbXSA9IFtdO1xyXG5cclxuICAgICAgICAgICAgY29uc3QgcmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTtcclxuICAgICAgICAgICAgcmVhZGVyLnJlYWRBc0FycmF5QnVmZmVyKGZpbGUpO1xyXG5cclxuICAgICAgICAgICAgcmVhZGVyLm9ubG9hZCA9ICgpID0+IHtcclxuICAgICAgICAgICAgICAgIGNvbnN0IGRhdGFCeXRlcyA9IG5ldyBVaW50OEFycmF5KHJlYWRlci5yZXN1bHQgYXMgYW55KTtcclxuXHJcbiAgICAgICAgICAgICAgICBpZiAoZGF0YUJ5dGVzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgd29ya2Jvb2sgPSBYTFNYLnJlYWQoZGF0YUJ5dGVzLCB7fSk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hlZXQgPSB3b3JrYm9vay5TaGVldHNbd29ya2Jvb2suU2hlZXROYW1lc1swXV07XHJcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFTaGVldDogYW55W10gPSBYTFNYLnV0aWxzLnNoZWV0X3RvX2pzb24oc2hlZXQsIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyOiBbJ0EnLCAnQicsICdDJywgJ0QnLCAnRScsICdGJywgJ0cnLCAnSCcsICdJJywgJ0onLCAnSycsICdMJywgJ00nLCAnTicsICdPJywgJ1AnLCAnUScsICdSJywgJ1MnLCAnVCcsICdVJywgJ1YnLCAnVycsICdYJywgJ1knLCAnWiddXHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vR2V0IEhlYWRlcnNcclxuICAgICAgICAgICAgICAgICAgICBmb3IoY29uc3QgY29sdW1uIGluIGRhdGFTaGVldFswXSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goVG9vbHMuRmlyc3RDaGFyVG9Mb3dlcihTdHJpbmcoZGF0YVNoZWV0WzBdW2NvbHVtbl0pLnJlcGxhY2VBbGwoJyAnLCAnJykpKTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIC8vR2V0IFJvd3NcclxuICAgICAgICAgICAgICAgICAgICByb3dzID0gWExTWC51dGlscy5zaGVldF90b19qc29uKHNoZWV0LCB7IGhlYWRlcjogY29sdW1ucyB9KTtcclxuICAgICAgICAgICAgICAgICAgICByb3dzLnNoaWZ0KCk7XHJcblxyXG4gICAgICAgICAgICAgICAgICAgIHJvd3MgPSByb3dzLm1hcChyb3cgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpdGVtID0gVG9vbHMuQnJlYWtSZWZlcmVuY2U8YW55Pihyb3cpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgaXRlbVsnX19yb3dOdW1fXyddO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXRlbTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICBSZXNvbHZlKHsgY29sdW1ucywgcm93cyB9KTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgcmVhZGVyLm9uZXJyb3IgPSAoKSA9PiB7IFJlc29sdmUoeyBjb2x1bW5zLCByb3dzIH0pIH1cclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcblxyXG4gICAgLyoqIEV4cG9ydCB0byBleGNlbCBmaWxlICovXHJcbiAgICBwdWJsaWMgc3RhdGljIEV4cG9ydEV4Y2VsPFQ+KGRhdGE6IFRbXSwgZmlsZU5hbWU6IHN0cmluZyA9ICdjb2VyX3JlcG9ydCcsIHNoZWV0TmFtZTogc3RyaW5nID0gJ1NoZWV0MScpIHtcclxuICAgICAgICBzaGVldE5hbWUgPSBUb29scy5DbGVhblVwQmxhbmtzKHNoZWV0TmFtZSk7XHJcbiAgICAgICAgZmlsZU5hbWUgPSBUb29scy5DbGVhblVwQmxhbmtzKGZpbGVOYW1lKTtcclxuXHJcbiAgICAgICAgaWYoZmlsZU5hbWUuZW5kc1dpdGgoJy54bHMnKSB8fCBmaWxlTmFtZS5lbmRzV2l0aCgnLnhsc3gnKSB8fCBmaWxlTmFtZS5lbmRzV2l0aCgnLmNzdicpKSB7XHJcbiAgICAgICAgICAgIGlmIChmaWxlTmFtZS5pbmNsdWRlcygnLnhscycpKSB7XHJcbiAgICAgICAgICAgICAgICBmaWxlTmFtZSA9IGZpbGVOYW1lLnJlcGxhY2VBbGwoJy54bHMnLCAnLnhsc3gnKTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKGZpbGVOYW1lLmluY2x1ZGVzKCcuY3N2JykpIHtcclxuICAgICAgICAgICAgICAgIGZpbGVOYW1lID0gZmlsZU5hbWUucmVwbGFjZUFsbCgnLmNzdicsICcueGxzeCcpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgZmlsZU5hbWUgKz0gJy54bHN4JztcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGNvbnN0IFdPUktfU0hFRVQgPSBYTFNYLnV0aWxzLmpzb25fdG9fc2hlZXQoZGF0YSk7XHJcbiAgICAgICAgY29uc3QgV09SS19CT09LID0gWExTWC51dGlscy5ib29rX25ldygpO1xyXG4gICAgICAgIFhMU1gudXRpbHMuYm9va19hcHBlbmRfc2hlZXQoV09SS19CT09LLCBXT1JLX1NIRUVULCAnU2hlZXQxJyk7XHJcbiAgICAgICAgWExTWC53cml0ZUZpbGUoV09SS19CT09LLCBmaWxlTmFtZSk7XHJcbiAgICB9XHJcblxyXG5cclxuICAgIC8qKiBDb252ZXJ0IGZpbGUgdG8gc3RyaW5nIGJhc2U2NCAqL1xyXG4gICAgcHVibGljIHN0YXRpYyBDb252ZXJ0VG9CYXNlNjQoZmlsZTogRmlsZSkge1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZTxzdHJpbmc+KFJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBjb25zdCByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xyXG4gICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTtcclxuXHJcbiAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSAoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBSZXNvbHZlKHJlYWRlci5yZXN1bHQ/LnRvU3RyaW5nKCkgfHwgJycpO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICByZWFkZXIub25lcnJvciA9ICgpID0+IHtcclxuICAgICAgICAgICAgICAgIFJlc29sdmUoJycpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcbn0iXX0=