@smarterplan/ngx-smarterplan-core 0.4.16 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/esm2020/lib/components/csv-export/csv-export.component.mjs +59 -59
- package/esm2020/lib/components/loader/loader.component.mjs +14 -14
- package/esm2020/lib/components/menu-bar/avatar/avatar.component.mjs +75 -75
- package/esm2020/lib/components/menu-bar/menu-bar.component.mjs +115 -115
- package/esm2020/lib/components/menu-bar/navigation-bar/navigation-bar.component.mjs +254 -254
- package/esm2020/lib/components/menu-bar/range-date-picker/range-date-picker.component.mjs +81 -81
- package/esm2020/lib/components/modal-switch-visit/modal-switch-visit.component.mjs +39 -39
- package/esm2020/lib/components/search-bar/search-bar.component.mjs +63 -63
- package/esm2020/lib/components/support-modal/support-modal.component.mjs +66 -66
- package/esm2020/lib/config.mjs +4 -4
- package/esm2020/lib/helpers.service.mjs +468 -468
- package/esm2020/lib/mattertagData.mjs +175 -175
- package/esm2020/lib/ngx-smarterplan-core.module.mjs +117 -117
- package/esm2020/lib/ngx-smarterplan-core.service.mjs +14 -14
- package/esm2020/lib/pipes/duration-to-string.pipe.mjs +66 -66
- package/esm2020/lib/pipes/hashtag-from-id.pipe.mjs +26 -26
- package/esm2020/lib/pipes/safe-url.pipe.mjs +20 -20
- package/esm2020/lib/pipes/time-date-to-local-string.pipe.mjs +104 -104
- package/esm2020/lib/pipes/username-from-id.pipe.mjs +29 -29
- package/esm2020/lib/services/base-tab.service.mjs +24 -24
- package/esm2020/lib/services/baseVisibility.service.mjs +17 -17
- package/esm2020/lib/services/booking.service.mjs +174 -174
- package/esm2020/lib/services/content.service.mjs +135 -135
- package/esm2020/lib/services/filter.service.mjs +560 -560
- package/esm2020/lib/services/intervention.service.mjs +236 -236
- package/esm2020/lib/services/locale.service.mjs +45 -45
- package/esm2020/lib/services/matterport-import.service.mjs +339 -339
- package/esm2020/lib/services/matterport.service.mjs +869 -866
- package/esm2020/lib/services/models/affectation.service.mjs +60 -60
- package/esm2020/lib/services/models/base-object.service.mjs +70 -70
- package/esm2020/lib/services/models/capture.service.mjs +34 -34
- package/esm2020/lib/services/models/comment.service.mjs +98 -98
- package/esm2020/lib/services/models/domain.service.mjs +77 -77
- package/esm2020/lib/services/models/equipment.service.mjs +629 -629
- package/esm2020/lib/services/models/event.service.mjs +128 -128
- package/esm2020/lib/services/models/feature.service.mjs +339 -339
- package/esm2020/lib/services/models/hashtag.service.mjs +38 -38
- package/esm2020/lib/services/models/layer.service.mjs +33 -33
- package/esm2020/lib/services/models/measurement.service.mjs +158 -158
- package/esm2020/lib/services/models/mission.service.mjs +185 -185
- package/esm2020/lib/services/models/navigation.service.mjs +76 -76
- package/esm2020/lib/services/models/node.service.mjs +31 -31
- package/esm2020/lib/services/models/operation.service.mjs +59 -59
- package/esm2020/lib/services/models/organisation.service.mjs +73 -73
- package/esm2020/lib/services/models/plan.service.mjs +613 -573
- package/esm2020/lib/services/models/poi.service.mjs +48 -48
- package/esm2020/lib/services/models/profile.service.mjs +54 -54
- package/esm2020/lib/services/models/property.service.mjs +34 -34
- package/esm2020/lib/services/models/space.service.mjs +184 -184
- package/esm2020/lib/services/models/template.service.mjs +41 -41
- package/esm2020/lib/services/models/ticket.service.mjs +454 -454
- package/esm2020/lib/services/models/visit.service.mjs +130 -130
- package/esm2020/lib/services/models/zone.service.mjs +184 -184
- package/esm2020/lib/services/navigator.service.mjs +165 -165
- package/esm2020/lib/services/s3.service.mjs +124 -124
- package/esm2020/lib/services/search.service.mjs +124 -124
- package/esm2020/lib/services/support.service.mjs +42 -42
- package/esm2020/lib/services/tag.service.mjs +103 -103
- package/esm2020/lib/services/user.service.mjs +456 -456
- package/esm2020/lib/services/validators.service.mjs +47 -47
- package/esm2020/lib/services/viewer.service.mjs +314 -314
- package/esm2020/lib/services/zone-drawer.service.mjs +76 -76
- package/esm2020/lib/types.service.mjs +281 -281
- package/esm2020/lib/validators/email.directive.mjs +7 -7
- package/esm2020/lib/validators/no-empty.directive.mjs +12 -12
- package/esm2020/lib/validators/number.directive.mjs +12 -12
- package/esm2020/lib/validators/text.directive.mjs +12 -12
- package/esm2020/public-api.mjs +70 -70
- package/esm2020/smarterplan-ngx-smarterplan-core.mjs +4 -4
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +9947 -9904
- package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +9280 -9237
- package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/components/csv-export/csv-export.component.d.ts +18 -18
- package/lib/components/loader/loader.component.d.ts +8 -8
- package/lib/components/menu-bar/avatar/avatar.component.d.ts +18 -18
- package/lib/components/menu-bar/menu-bar.component.d.ts +35 -35
- package/lib/components/menu-bar/navigation-bar/navigation-bar.component.d.ts +66 -66
- package/lib/components/menu-bar/range-date-picker/range-date-picker.component.d.ts +24 -24
- package/lib/components/modal-switch-visit/modal-switch-visit.component.d.ts +22 -22
- package/lib/components/search-bar/search-bar.component.d.ts +16 -16
- package/lib/components/support-modal/support-modal.component.d.ts +26 -26
- package/lib/config.d.ts +17 -17
- package/lib/helpers.service.d.ts +79 -79
- package/lib/mattertagData.d.ts +58 -58
- package/lib/ngx-smarterplan-core.module.d.ts +28 -28
- package/lib/ngx-smarterplan-core.service.d.ts +6 -6
- package/lib/pipes/duration-to-string.pipe.d.ts +12 -12
- package/lib/pipes/hashtag-from-id.pipe.d.ts +10 -10
- package/lib/pipes/safe-url.pipe.d.ts +10 -10
- package/lib/pipes/time-date-to-local-string.pipe.d.ts +16 -16
- package/lib/pipes/username-from-id.pipe.d.ts +11 -11
- package/lib/services/base-tab.service.d.ts +10 -10
- package/lib/services/baseVisibility.service.d.ts +8 -8
- package/lib/services/booking.service.d.ts +24 -24
- package/lib/services/content.service.d.ts +28 -28
- package/lib/services/filter.service.d.ts +58 -58
- package/lib/services/intervention.service.d.ts +25 -25
- package/lib/services/locale.service.d.ts +23 -23
- package/lib/services/matterport-import.service.d.ts +46 -46
- package/lib/services/matterport.service.d.ts +139 -138
- package/lib/services/models/affectation.service.d.ts +14 -14
- package/lib/services/models/base-object.service.d.ts +20 -20
- package/lib/services/models/capture.service.d.ts +13 -13
- package/lib/services/models/comment.service.d.ts +26 -26
- package/lib/services/models/domain.service.d.ts +19 -19
- package/lib/services/models/equipment.service.d.ts +88 -88
- package/lib/services/models/event.service.d.ts +43 -43
- package/lib/services/models/feature.service.d.ts +71 -71
- package/lib/services/models/hashtag.service.d.ts +13 -13
- package/lib/services/models/layer.service.d.ts +11 -11
- package/lib/services/models/measurement.service.d.ts +43 -43
- package/lib/services/models/mission.service.d.ts +32 -32
- package/lib/services/models/navigation.service.d.ts +22 -22
- package/lib/services/models/node.service.d.ts +12 -12
- package/lib/services/models/operation.service.d.ts +15 -15
- package/lib/services/models/organisation.service.d.ts +19 -19
- package/lib/services/models/plan.service.d.ts +130 -117
- package/lib/services/models/poi.service.d.ts +15 -15
- package/lib/services/models/profile.service.d.ts +15 -15
- package/lib/services/models/property.service.d.ts +13 -13
- package/lib/services/models/space.service.d.ts +38 -38
- package/lib/services/models/template.service.d.ts +15 -15
- package/lib/services/models/ticket.service.d.ts +86 -86
- package/lib/services/models/visit.service.d.ts +24 -24
- package/lib/services/models/zone.service.d.ts +25 -25
- package/lib/services/navigator.service.d.ts +55 -55
- package/lib/services/s3.service.d.ts +13 -13
- package/lib/services/search.service.d.ts +20 -20
- package/lib/services/support.service.d.ts +17 -17
- package/lib/services/tag.service.d.ts +45 -45
- package/lib/services/user.service.d.ts +105 -105
- package/lib/services/validators.service.d.ts +18 -18
- package/lib/services/viewer.service.d.ts +101 -101
- package/lib/services/zone-drawer.service.d.ts +7 -7
- package/lib/types.service.d.ts +759 -759
- package/lib/validators/email.directive.d.ts +2 -2
- package/lib/validators/no-empty.directive.d.ts +2 -2
- package/lib/validators/number.directive.d.ts +2 -2
- package/lib/validators/text.directive.d.ts +2 -2
- package/package.json +1 -1
- package/public-api.d.ts +62 -62
- package/smarterplan-ngx-smarterplan-core.d.ts +5 -5
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# NgxSmarterplanCore
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project ngx-smarterplan-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-smarterplan-core`.
|
|
8
|
-
> Note: Don't forget to add `--project ngx-smarterplan-core` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build ngx-smarterplan-core` 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 ngx-smarterplan-core`, go to the dist folder `cd dist/ngx-smarterplan-core` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test ngx-smarterplan-core` 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.
|
|
1
|
+
# NgxSmarterplanCore
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project ngx-smarterplan-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-smarterplan-core`.
|
|
8
|
+
> Note: Don't forget to add `--project ngx-smarterplan-core` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build ngx-smarterplan-core` 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 ngx-smarterplan-core`, go to the dist folder `cd dist/ngx-smarterplan-core` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test ngx-smarterplan-core` 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.
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "@ngx-translate/core";
|
|
4
|
-
export class CsvExportComponent {
|
|
5
|
-
constructor() {
|
|
6
|
-
/** Header of the CSV, titles for each columns */
|
|
7
|
-
this.headers = [];
|
|
8
|
-
/** Array of each rows (array of array of string), if it's not set, then the function getRows() will be used */
|
|
9
|
-
this.rowsInput = undefined;
|
|
10
|
-
/** Function used to get rows if rowsInput is not set, call each time the user click on the button to generate the CSV file */
|
|
11
|
-
this.getRows = undefined;
|
|
12
|
-
/** Title of the file to download */
|
|
13
|
-
this.title = "file";
|
|
14
|
-
/** Label for the button to click */
|
|
15
|
-
this.buttonLabel = "Export";
|
|
16
|
-
/** Delimiter for the CSV */
|
|
17
|
-
this.delimeter = ";";
|
|
18
|
-
}
|
|
19
|
-
async onClickDownload() {
|
|
20
|
-
let rows = this.rowsInput;
|
|
21
|
-
if (!rows) {
|
|
22
|
-
rows = await Promise.resolve(this.getRows());
|
|
23
|
-
}
|
|
24
|
-
const data = `data:text/csv;charset=utf-8,${this.headers.join(this.delimeter)}\n${rows
|
|
25
|
-
.map((row) =>
|
|
26
|
-
/** Clean each rows/cells */
|
|
27
|
-
row
|
|
28
|
-
.map((value) => value
|
|
29
|
-
.replace(this.delimeter, " ")
|
|
30
|
-
.replace("\n", " ")
|
|
31
|
-
.replace("\r", " "))
|
|
32
|
-
.join(this.delimeter))
|
|
33
|
-
.join("\n")}`;
|
|
34
|
-
/** Create a link to download the file */
|
|
35
|
-
const link = document.createElement("a");
|
|
36
|
-
link.setAttribute("href", encodeURI(data));
|
|
37
|
-
link.setAttribute("download", `${this.title}.csv`);
|
|
38
|
-
document.body.append(link);
|
|
39
|
-
link.click();
|
|
40
|
-
link.remove();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
CsvExportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CsvExportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
44
|
-
CsvExportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: CsvExportComponent, selector: "lib-csv-export", inputs: { headers: "headers", rowsInput: "rowsInput", getRows: "getRows", title: "title", buttonLabel: "buttonLabel" }, ngImport: i0, template: "<span [style.cursor]=\"'pointer'\" (click)=\"onClickDownload()\" class=\"download-csv d-flex\">\
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CsvExportComponent, decorators: [{
|
|
46
|
-
type: Component,
|
|
47
|
-
args: [{ selector: 'lib-csv-export', template: "<span [style.cursor]=\"'pointer'\" (click)=\"onClickDownload()\" class=\"download-csv d-flex\">\
|
|
48
|
-
}], propDecorators: { headers: [{
|
|
49
|
-
type: Input
|
|
50
|
-
}], rowsInput: [{
|
|
51
|
-
type: Input
|
|
52
|
-
}], getRows: [{
|
|
53
|
-
type: Input
|
|
54
|
-
}], title: [{
|
|
55
|
-
type: Input
|
|
56
|
-
}], buttonLabel: [{
|
|
57
|
-
type: Input
|
|
58
|
-
}] } });
|
|
59
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "@ngx-translate/core";
|
|
4
|
+
export class CsvExportComponent {
|
|
5
|
+
constructor() {
|
|
6
|
+
/** Header of the CSV, titles for each columns */
|
|
7
|
+
this.headers = [];
|
|
8
|
+
/** Array of each rows (array of array of string), if it's not set, then the function getRows() will be used */
|
|
9
|
+
this.rowsInput = undefined;
|
|
10
|
+
/** Function used to get rows if rowsInput is not set, call each time the user click on the button to generate the CSV file */
|
|
11
|
+
this.getRows = undefined;
|
|
12
|
+
/** Title of the file to download */
|
|
13
|
+
this.title = "file";
|
|
14
|
+
/** Label for the button to click */
|
|
15
|
+
this.buttonLabel = "Export";
|
|
16
|
+
/** Delimiter for the CSV */
|
|
17
|
+
this.delimeter = ";";
|
|
18
|
+
}
|
|
19
|
+
async onClickDownload() {
|
|
20
|
+
let rows = this.rowsInput;
|
|
21
|
+
if (!rows) {
|
|
22
|
+
rows = await Promise.resolve(this.getRows());
|
|
23
|
+
}
|
|
24
|
+
const data = `data:text/csv;charset=utf-8,${this.headers.join(this.delimeter)}\n${rows
|
|
25
|
+
.map((row) =>
|
|
26
|
+
/** Clean each rows/cells */
|
|
27
|
+
row
|
|
28
|
+
.map((value) => value
|
|
29
|
+
.replace(this.delimeter, " ")
|
|
30
|
+
.replace("\n", " ")
|
|
31
|
+
.replace("\r", " "))
|
|
32
|
+
.join(this.delimeter))
|
|
33
|
+
.join("\n")}`;
|
|
34
|
+
/** Create a link to download the file */
|
|
35
|
+
const link = document.createElement("a");
|
|
36
|
+
link.setAttribute("href", encodeURI(data));
|
|
37
|
+
link.setAttribute("download", `${this.title}.csv`);
|
|
38
|
+
document.body.append(link);
|
|
39
|
+
link.click();
|
|
40
|
+
link.remove();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
CsvExportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CsvExportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
44
|
+
CsvExportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: CsvExportComponent, selector: "lib-csv-export", inputs: { headers: "headers", rowsInput: "rowsInput", getRows: "getRows", title: "title", buttonLabel: "buttonLabel" }, ngImport: i0, template: "<span [style.cursor]=\"'pointer'\" (click)=\"onClickDownload()\" class=\"download-csv d-flex\">\n <span class=\"iconify\" data-icon=\"mdi:file-download-outline\"></span>\n {{ buttonLabel | translate}}\n</span>\n", styles: [".download-csv{color:var(--smarterplan-primary)}\n"], pipes: { "translate": i1.TranslatePipe } });
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CsvExportComponent, decorators: [{
|
|
46
|
+
type: Component,
|
|
47
|
+
args: [{ selector: 'lib-csv-export', template: "<span [style.cursor]=\"'pointer'\" (click)=\"onClickDownload()\" class=\"download-csv d-flex\">\n <span class=\"iconify\" data-icon=\"mdi:file-download-outline\"></span>\n {{ buttonLabel | translate}}\n</span>\n", styles: [".download-csv{color:var(--smarterplan-primary)}\n"] }]
|
|
48
|
+
}], propDecorators: { headers: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}], rowsInput: [{
|
|
51
|
+
type: Input
|
|
52
|
+
}], getRows: [{
|
|
53
|
+
type: Input
|
|
54
|
+
}], title: [{
|
|
55
|
+
type: Input
|
|
56
|
+
}], buttonLabel: [{
|
|
57
|
+
type: Input
|
|
58
|
+
}] } });
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3N2LWV4cG9ydC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc21hcnRlcnBsYW4tY29yZS9zcmMvbGliL2NvbXBvbmVudHMvY3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QElucHV0KCkgYnV0dG9uTGFiZWw6IHN0cmluZyA9IFwiRXhwb3J0XCI7XG5cbiAgICAvKiogRGVsaW1pdGVyIGZvciB0aGUgQ1NWICovXG4gICAgZGVsaW1ldGVyOiBzdHJpbmcgPSBcIjtcIjtcblxuICAgIGFzeW5jIG9uQ2xpY2tEb3dubG9hZCgpIHtcbiAgICAgICAgbGV0IHJvd3M6IHN0cmluZ1tdW10gPSB0aGlzLnJvd3NJbnB1dDtcbiAgICAgICAgaWYgKCFyb3dzKSB7XG4gICAgICAgICAgICByb3dzID0gYXdhaXQgUHJvbWlzZS5yZXNvbHZlKHRoaXMuZ2V0Um93cygpKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBkYXRhID0gYGRhdGE6dGV4dC9jc3Y7Y2hhcnNldD11dGYtOCwke3RoaXMuaGVhZGVycy5qb2luKFxuICAgICAgICAgICAgdGhpcy5kZWxpbWV0ZXIsXG4gICAgICAgICl9XFxuJHtyb3dzXG4gICAgICAgICAgICAubWFwKChyb3cpID0+XG4gICAgICAgICAgICAgICAgLyoqIENsZWFuIGVhY2ggcm93cy9jZWxscyAqL1xuICAgICAgICAgICAgICAgIHJvd1xuICAgICAgICAgICAgICAgICAgICAubWFwKCh2YWx1ZSkgPT5cbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UodGhpcy5kZWxpbWV0ZXIsIFwiIFwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKFwiXFxuXCIsIFwiIFwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKFwiXFxyXCIsIFwiIFwiKSxcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAuam9pbih0aGlzLmRlbGltZXRlciksXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAuam9pbihcIlxcblwiKX1gO1xuXG4gICAgICAgIC8qKiBDcmVhdGUgYSBsaW5rIHRvIGRvd25sb2FkIHRoZSBmaWxlICovXG4gICAgICAgIGNvbnN0IGxpbmsgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwiYVwiKTtcbiAgICAgICAgbGluay5zZXRBdHRyaWJ1dGUoXCJocmVmXCIsIGVuY29kZVVSSShkYXRhKSk7XG4gICAgICAgIGxpbmsuc2V0QXR0cmlidXRlKFwiZG93bmxvYWRcIiwgYCR7dGhpcy50aXRsZX0uY3N2YCk7XG4gICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kKGxpbmspO1xuICAgICAgICBsaW5rLmNsaWNrKCk7XG4gICAgICAgIGxpbmsucmVtb3ZlKCk7XG4gICAgfVxufVxuIiwiPHNwYW4gW3N0eWxlLmN1cnNvcl09XCIncG9pbnRlcidcIiAoY2xpY2spPVwib25DbGlja0Rvd25sb2FkKClcIiBjbGFzcz1cImRvd25sb2FkLWNzdiBkLWZsZXhcIj5cbiAgICA8c3BhbiBjbGFzcz1cImljb25pZnlcIiBkYXRhLWljb249XCJtZGk6ZmlsZS1kb3dubG9hZC1vdXRsaW5lXCI+PC9zcGFuPlxuICAgIHt7IGJ1dHRvbkxhYmVsIHwgdHJhbnNsYXRlfX1cbjwvc3Bhbj5cbiJdfQ==
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class LoaderComponent {
|
|
4
|
-
constructor() { }
|
|
5
|
-
ngOnInit() {
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
LoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: LoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9
|
-
LoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: LoaderComponent, selector: "lib-loader", ngImport: i0, template: "<div class=\"sk-fading-circle\">\
|
|
10
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
11
|
-
type: Component,
|
|
12
|
-
args: [{ selector: 'lib-loader', template: "<div class=\"sk-fading-circle\">\
|
|
13
|
-
}], ctorParameters: function () { return []; } });
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class LoaderComponent {
|
|
4
|
+
constructor() { }
|
|
5
|
+
ngOnInit() {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
LoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: LoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9
|
+
LoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: LoaderComponent, selector: "lib-loader", ngImport: i0, template: "<div class=\"sk-fading-circle\">\n <img src=\"../../../../assets/icons/smarterplan.svg\">\n <div class=\"sk-circle1 sk-circle\"></div>\n <div class=\"sk-circle2 sk-circle\"></div>\n <div class=\"sk-circle3 sk-circle\"></div>\n <div class=\"sk-circle4 sk-circle\"></div>\n <div class=\"sk-circle5 sk-circle\"></div>\n <div class=\"sk-circle6 sk-circle\"></div>\n <div class=\"sk-circle7 sk-circle\"></div>\n <div class=\"sk-circle8 sk-circle\"></div>\n <div class=\"sk-circle9 sk-circle\"></div>\n <div class=\"sk-circle10 sk-circle\"></div>\n <div class=\"sk-circle11 sk-circle\"></div>\n <div class=\"sk-circle12 sk-circle\"></div>\n</div>\n", styles: [".sk-fading-circle{width:88px;height:88px;position:relative}.sk-fading-circle img{width:2rem;position:absolute;left:calc(50% - 16px);top:calc(50% - 16px)}.sk-fading-circle .sk-circle{width:100%;height:100%;position:absolute;left:0;top:0}.sk-fading-circle .sk-circle:before{content:\"\";display:block;margin:0 auto;width:15%;height:15%;background-color:var(--smarterplan-primary);border-radius:100%;animation:sk-circleFadeDelay 1.2s infinite ease-in-out both}.sk-fading-circle .sk-circle2{transform:rotate(30deg)}.sk-fading-circle .sk-circle3{transform:rotate(60deg)}.sk-fading-circle .sk-circle4{transform:rotate(90deg)}.sk-fading-circle .sk-circle5{transform:rotate(120deg)}.sk-fading-circle .sk-circle6{transform:rotate(150deg)}.sk-fading-circle .sk-circle7{transform:rotate(180deg)}.sk-fading-circle .sk-circle8{transform:rotate(210deg)}.sk-fading-circle .sk-circle9{transform:rotate(240deg)}.sk-fading-circle .sk-circle10{transform:rotate(270deg)}.sk-fading-circle .sk-circle11{transform:rotate(300deg)}.sk-fading-circle .sk-circle12{transform:rotate(330deg)}.sk-fading-circle .sk-circle2:before{animation-delay:-1.1s}.sk-fading-circle .sk-circle3:before{animation-delay:-1s}.sk-fading-circle .sk-circle4:before{animation-delay:-.9s}.sk-fading-circle .sk-circle5:before{animation-delay:-.8s}.sk-fading-circle .sk-circle6:before{animation-delay:-.7s}.sk-fading-circle .sk-circle7:before{animation-delay:-.6s}.sk-fading-circle .sk-circle8:before{animation-delay:-.5s}.sk-fading-circle .sk-circle9:before{animation-delay:-.4s}.sk-fading-circle .sk-circle10:before{animation-delay:-.3s}.sk-fading-circle .sk-circle11:before{animation-delay:-.2s}.sk-fading-circle .sk-circle12:before{animation-delay:-.1s}@keyframes sk-circleFadeDelay{0%,39%,to{opacity:0}40%{opacity:1}}\n"] });
|
|
10
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
11
|
+
type: Component,
|
|
12
|
+
args: [{ selector: 'lib-loader', template: "<div class=\"sk-fading-circle\">\n <img src=\"../../../../assets/icons/smarterplan.svg\">\n <div class=\"sk-circle1 sk-circle\"></div>\n <div class=\"sk-circle2 sk-circle\"></div>\n <div class=\"sk-circle3 sk-circle\"></div>\n <div class=\"sk-circle4 sk-circle\"></div>\n <div class=\"sk-circle5 sk-circle\"></div>\n <div class=\"sk-circle6 sk-circle\"></div>\n <div class=\"sk-circle7 sk-circle\"></div>\n <div class=\"sk-circle8 sk-circle\"></div>\n <div class=\"sk-circle9 sk-circle\"></div>\n <div class=\"sk-circle10 sk-circle\"></div>\n <div class=\"sk-circle11 sk-circle\"></div>\n <div class=\"sk-circle12 sk-circle\"></div>\n</div>\n", styles: [".sk-fading-circle{width:88px;height:88px;position:relative}.sk-fading-circle img{width:2rem;position:absolute;left:calc(50% - 16px);top:calc(50% - 16px)}.sk-fading-circle .sk-circle{width:100%;height:100%;position:absolute;left:0;top:0}.sk-fading-circle .sk-circle:before{content:\"\";display:block;margin:0 auto;width:15%;height:15%;background-color:var(--smarterplan-primary);border-radius:100%;animation:sk-circleFadeDelay 1.2s infinite ease-in-out both}.sk-fading-circle .sk-circle2{transform:rotate(30deg)}.sk-fading-circle .sk-circle3{transform:rotate(60deg)}.sk-fading-circle .sk-circle4{transform:rotate(90deg)}.sk-fading-circle .sk-circle5{transform:rotate(120deg)}.sk-fading-circle .sk-circle6{transform:rotate(150deg)}.sk-fading-circle .sk-circle7{transform:rotate(180deg)}.sk-fading-circle .sk-circle8{transform:rotate(210deg)}.sk-fading-circle .sk-circle9{transform:rotate(240deg)}.sk-fading-circle .sk-circle10{transform:rotate(270deg)}.sk-fading-circle .sk-circle11{transform:rotate(300deg)}.sk-fading-circle .sk-circle12{transform:rotate(330deg)}.sk-fading-circle .sk-circle2:before{animation-delay:-1.1s}.sk-fading-circle .sk-circle3:before{animation-delay:-1s}.sk-fading-circle .sk-circle4:before{animation-delay:-.9s}.sk-fading-circle .sk-circle5:before{animation-delay:-.8s}.sk-fading-circle .sk-circle6:before{animation-delay:-.7s}.sk-fading-circle .sk-circle7:before{animation-delay:-.6s}.sk-fading-circle .sk-circle8:before{animation-delay:-.5s}.sk-fading-circle .sk-circle9:before{animation-delay:-.4s}.sk-fading-circle .sk-circle10:before{animation-delay:-.3s}.sk-fading-circle .sk-circle11:before{animation-delay:-.2s}.sk-fading-circle .sk-circle12:before{animation-delay:-.1s}@keyframes sk-circleFadeDelay{0%,39%,to{opacity:0}40%{opacity:1}}\n"] }]
|
|
13
|
+
}], ctorParameters: function () { return []; } });
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGVyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zbWFydGVycGxhbi1jb3JlL3NyYy9saWIvY29tcG9uZW50cy9sb2FkZXIvbG9hZGVyLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zbWFydGVycGxhbi1jb3JlL3NyYy9saWIvY29tcG9uZW50cy9sb2FkZXIvbG9hZGVyLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVUsTUFBTSxlQUFlLENBQUM7O0FBT2xELE1BQU0sT0FBTyxlQUFlO0lBRXhCLGdCQUFnQixDQUFDO0lBRWpCLFFBQVE7SUFDUixDQUFDOzs0R0FMUSxlQUFlO2dHQUFmLGVBQWUsa0RDUDVCLDJxQkFlQTsyRkRSYSxlQUFlO2tCQUwzQixTQUFTOytCQUNFLFlBQVkiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb21wb25lbnQsIE9uSW5pdCB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5AQ29tcG9uZW50KHtcbiAgc2VsZWN0b3I6ICdsaWItbG9hZGVyJyxcbiAgdGVtcGxhdGVVcmw6ICcuL2xvYWRlci5jb21wb25lbnQuaHRtbCcsXG4gIHN0eWxlVXJsczogWycuL2xvYWRlci5jb21wb25lbnQuc2NzcyddXG59KVxuZXhw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iXX0=
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { uploadFileToS3, getSignedImageUrlForProfile } from '../../../services/s3.service';
|
|
3
|
-
import { ProfileEntity } from '../../../types.service';
|
|
4
|
-
import { Md5 } from "ts-md5/dist/md5";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "../../../services/user.service";
|
|
7
|
-
import * as i2 from "../../../services/models/profile.service";
|
|
8
|
-
const cache = {};
|
|
9
|
-
export class AvatarComponent {
|
|
10
|
-
constructor(userService, profileService) {
|
|
11
|
-
this.userService = userService;
|
|
12
|
-
this.profileService = profileService;
|
|
13
|
-
this.size = 45;
|
|
14
|
-
this.userService.isChanged.subscribe(() => {
|
|
15
|
-
if (!this.currentUser) {
|
|
16
|
-
this.currentUser = this.userService.cu;
|
|
17
|
-
this.setAvatar(this.currentUser);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
async ngOnInit() {
|
|
22
|
-
if (this.userID) {
|
|
23
|
-
const profile = await this.profileService.getProfile(this.userID);
|
|
24
|
-
if (profile) {
|
|
25
|
-
const user = new ProfileEntity(profile);
|
|
26
|
-
this.setAvatar(user);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.currentUser = this.userService.cu;
|
|
31
|
-
this.setAvatar(this.currentUser);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async setAvatar(user) {
|
|
35
|
-
const { id, avatar, email } = user;
|
|
36
|
-
// If avatar is not cached, check first if we have an avatar URL to fetch
|
|
37
|
-
// from S3. If not, retrieve it from libravatar.
|
|
38
|
-
// TODO use in a Service to be able to change/upload freely.
|
|
39
|
-
if (!cache.hasOwnProperty(id)) {
|
|
40
|
-
if (!avatar && email) {
|
|
41
|
-
const md5 = new Md5();
|
|
42
|
-
const md5hash = md5.appendStr(email).end();
|
|
43
|
-
const avatar = `https://seccdn.libravatar.org/avatar/${md5hash}?s=${this.size}&default=identicon`;
|
|
44
|
-
const url = await fetch(avatar)
|
|
45
|
-
.then((res) => res.blob())
|
|
46
|
-
.then((blob) => {
|
|
47
|
-
const file = new File([blob], "avatar.jpeg", {
|
|
48
|
-
type: "image/jpeg",
|
|
49
|
-
});
|
|
50
|
-
return uploadFileToS3("avatars/", file, id);
|
|
51
|
-
});
|
|
52
|
-
await this.profileService.updateProfile({ id, avatar: url });
|
|
53
|
-
user.avatar = url;
|
|
54
|
-
cache[id] = avatar;
|
|
55
|
-
}
|
|
56
|
-
if (avatar) {
|
|
57
|
-
// TODO generating signed urls for avatar makes NO SENSE ($$$)
|
|
58
|
-
// Sorry got to copypaste that, but really need to get rid of
|
|
59
|
-
cache[id] = await getSignedImageUrlForProfile(user);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
this.avatar = cache[id];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
AvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AvatarComponent, deps: [{ token: i1.BaseUserService }, { token: i2.ProfileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
66
|
-
AvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: AvatarComponent, selector: "lib-avatar", inputs: { size: "size", userID: "userID" }, ngImport: i0, template: `<img [src]="avatar" />`, isInline: true, styles: ["img{max-width:100%;max-height:100%;height:100%;width:100%;border-radius:50%}\n"] });
|
|
67
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AvatarComponent, decorators: [{
|
|
68
|
-
type: Component,
|
|
69
|
-
args: [{ selector: 'lib-avatar', template: `<img [src]="avatar" />`, styles: ["img{max-width:100%;max-height:100%;height:100%;width:100%;border-radius:50%}\n"] }]
|
|
70
|
-
}], ctorParameters: function () { return [{ type: i1.BaseUserService }, { type: i2.ProfileService }]; }, propDecorators: { size: [{
|
|
71
|
-
type: Input
|
|
72
|
-
}], userID: [{
|
|
73
|
-
type: Input
|
|
74
|
-
}] } });
|
|
75
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { uploadFileToS3, getSignedImageUrlForProfile } from '../../../services/s3.service';
|
|
3
|
+
import { ProfileEntity } from '../../../types.service';
|
|
4
|
+
import { Md5 } from "ts-md5/dist/md5";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "../../../services/user.service";
|
|
7
|
+
import * as i2 from "../../../services/models/profile.service";
|
|
8
|
+
const cache = {};
|
|
9
|
+
export class AvatarComponent {
|
|
10
|
+
constructor(userService, profileService) {
|
|
11
|
+
this.userService = userService;
|
|
12
|
+
this.profileService = profileService;
|
|
13
|
+
this.size = 45;
|
|
14
|
+
this.userService.isChanged.subscribe(() => {
|
|
15
|
+
if (!this.currentUser) {
|
|
16
|
+
this.currentUser = this.userService.cu;
|
|
17
|
+
this.setAvatar(this.currentUser);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async ngOnInit() {
|
|
22
|
+
if (this.userID) {
|
|
23
|
+
const profile = await this.profileService.getProfile(this.userID);
|
|
24
|
+
if (profile) {
|
|
25
|
+
const user = new ProfileEntity(profile);
|
|
26
|
+
this.setAvatar(user);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.currentUser = this.userService.cu;
|
|
31
|
+
this.setAvatar(this.currentUser);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async setAvatar(user) {
|
|
35
|
+
const { id, avatar, email } = user;
|
|
36
|
+
// If avatar is not cached, check first if we have an avatar URL to fetch
|
|
37
|
+
// from S3. If not, retrieve it from libravatar.
|
|
38
|
+
// TODO use in a Service to be able to change/upload freely.
|
|
39
|
+
if (!cache.hasOwnProperty(id)) {
|
|
40
|
+
if (!avatar && email) {
|
|
41
|
+
const md5 = new Md5();
|
|
42
|
+
const md5hash = md5.appendStr(email).end();
|
|
43
|
+
const avatar = `https://seccdn.libravatar.org/avatar/${md5hash}?s=${this.size}&default=identicon`;
|
|
44
|
+
const url = await fetch(avatar)
|
|
45
|
+
.then((res) => res.blob())
|
|
46
|
+
.then((blob) => {
|
|
47
|
+
const file = new File([blob], "avatar.jpeg", {
|
|
48
|
+
type: "image/jpeg",
|
|
49
|
+
});
|
|
50
|
+
return uploadFileToS3("avatars/", file, id);
|
|
51
|
+
});
|
|
52
|
+
await this.profileService.updateProfile({ id, avatar: url });
|
|
53
|
+
user.avatar = url;
|
|
54
|
+
cache[id] = avatar;
|
|
55
|
+
}
|
|
56
|
+
if (avatar) {
|
|
57
|
+
// TODO generating signed urls for avatar makes NO SENSE ($$$)
|
|
58
|
+
// Sorry got to copypaste that, but really need to get rid of
|
|
59
|
+
cache[id] = await getSignedImageUrlForProfile(user);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.avatar = cache[id];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
AvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AvatarComponent, deps: [{ token: i1.BaseUserService }, { token: i2.ProfileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
66
|
+
AvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: AvatarComponent, selector: "lib-avatar", inputs: { size: "size", userID: "userID" }, ngImport: i0, template: `<img [src]="avatar" />`, isInline: true, styles: ["img{max-width:100%;max-height:100%;height:100%;width:100%;border-radius:50%}\n"] });
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AvatarComponent, decorators: [{
|
|
68
|
+
type: Component,
|
|
69
|
+
args: [{ selector: 'lib-avatar', template: `<img [src]="avatar" />`, styles: ["img{max-width:100%;max-height:100%;height:100%;width:100%;border-radius:50%}\n"] }]
|
|
70
|
+
}], ctorParameters: function () { return [{ type: i1.BaseUserService }, { type: i2.ProfileService }]; }, propDecorators: { size: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], userID: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}] } });
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXZhdGFyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zbWFydGVycGxhbi1jb3JlL3NyYy9saWIvY29tcG9uZW50cy9tZW51LWJhci9hdmF0YXIvYXZhdGFyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBVSxNQUFNLGVBQWUsQ0FBQztBQUV6RCxPQUFPLEVBQUUsY0FBYyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFFM0YsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQzs7OztBQUV0QyxNQUFNLEtBQUssR0FBRyxFQUFFLENBQUM7QUFNakIsTUFBTSxPQUFPLGVBQWU7SUFVeEIsWUFDWSxXQUE0QixFQUM1QixjQUE4QjtRQUQ5QixnQkFBVyxHQUFYLFdBQVcsQ0FBaUI7UUFDNUIsbUJBQWMsR0FBZCxjQUFjLENBQWdCO1FBVmpDLFNBQUksR0FBVyxFQUFFLENBQUM7UUFZdkIsSUFBSSxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUMsU0FBUyxDQUFDLEdBQUcsRUFBRTtZQUN0QyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQ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tZW50cyBPbkluaXQge1xuXG4gICAgQElucHV0KCkgc2l6ZTogbnVtYmVyID0gNDU7XG5cbiAgICBASW5wdXQoKSB1c2VySUQ6IHN0cmluZztcblxuICAgIGN1cnJlbnRVc2VyOiBQcm9maWxlRW50aXR5O1xuXG4gICAgYXZhdGFyO1xuXG4gICAgY29uc3RydWN0b3IoXG4gICAgICAgIHByaXZhdGUgdXNlclNlcnZpY2U6IEJhc2VVc2VyU2VydmljZSxcbiAgICAgICAgcHJpdmF0ZSBwcm9maWxlU2VydmljZTogUHJvZmlsZVNlcnZpY2UsXG4gICAgKSB7XG4gICAgICAgIHRoaXMudXNlclNlcnZpY2UuaXNDaGFuZ2VkLnN1YnNjcmliZSgoKSA9PiB7XG4gICAgICAgICAgICBpZiAoIXRoaXMuY3VycmVudFVzZXIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRVc2VyID0gdGhpcy51c2VyU2VydmljZS5jdTtcbiAgICAgICAgICAgICAgICB0aGlzLnNldEF2YXRhcih0aGlzLmN1cnJlbnRVc2VyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgYXN5bmMgbmdPbkluaXQoKTogUHJvbWlzZTx2b2lkPiB7XG4gICAgICAgIGlmICh0aGlzLnVzZXJJRCkge1xuICAgICAgICAgICAgY29uc3QgcHJvZmlsZSA9IGF3YWl0IHRoaXMucHJvZmlsZVNlcnZpY2UuZ2V0UHJvZmlsZSh0aGlzLnVzZXJJRCk7XG4gICAgICAgICAgICBpZiAocHJvZmlsZSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHVzZXIgPSBuZXcgUHJvZmlsZUVudGl0eShwcm9maWxlKTtcbiAgICAgICAgICAgICAgICB0aGlzLnNldEF2YXRhcih1c2VyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudFVzZXIgPSB0aGlzLnVzZXJTZXJ2aWNlLmN1O1xuICAgICAgICAgICAgdGhpcy5zZXRBdmF0YXIodGhpcy5jdXJyZW50VXNlcik7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBhc3luYyBzZXRBdmF0YXIodXNlcjogUHJvZmlsZUVudGl0eSkge1xuICAgICAgICBjb25zdCB7IGlkLCBhdmF0YXIsIGVtYWlsIH0gPSB1c2VyO1xuXG4gICAgICAgIC8vIElmIGF2YXRhciBpcyBub3QgY2FjaGVkLCBjaGVjayBmaXJzdCBpZiB3ZSBoYXZlIGFuIGF2YXRhciBVUkwgdG8gZmV0Y2hcbiAgICAgICAgLy8gZnJvbSBTMy4gSWYgbm90LCByZXRyaWV2ZSBpdCBmcm9tIGxpYnJhdmF0YXIuXG4gICAgICAgIC8vIFRPRE8gdXNlIGluIGEgU2VydmljZSB0byBiZSBhYmxlIHRvIGNoYW5nZS91cGxvYWQgZnJlZWx5LlxuICAgICAgICBpZiAoIWNhY2hlLmhhc093blByb3BlcnR5KGlkKSkge1xuICAgICAgICAgICAgaWYgKCFhdmF0YXIgJiYgZW1haWwpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBtZDUgPSBuZXcgTWQ1KCk7XG4gICAgICAgICAgICAgICAgY29uc3QgbWQ1aGFzaCA9IG1kNS5hcHBlbmRTdHIoZW1haWwpLmVuZCgpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGF2YXRhciA9IGBodHRwczovL3NlY2Nkbi5saWJyYXZhdGFyLm9yZy9hdmF0YXIvJHttZDVoYXNofT9zPSR7dGhpcy5zaXplfSZkZWZhdWx0PWlkZW50aWNvbmA7XG4gICAgICAgICAgICAgICAgY29uc3QgdXJsID0gYXdhaXQgZmV0Y2goYXZhdGFyKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigocmVzKSA9PiByZXMuYmxvYigpKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoYmxvYikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmlsZSA9IG5ldyBGaWxlKFtibG9iXSwgXCJhdmF0YXIuanBlZ1wiLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXCJpbWFnZS9qcGVnXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cGxvYWRGaWxlVG9TMyhcImF2YXRhcnMvXCIsIGZpbGUsIGlkKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5wcm9maWxlU2VydmljZS51cGRhdGVQcm9maWxlKHsgaWQsIGF2YXRhcjogdXJsIH0pO1xuICAgICAgICAgICAgICAgIHVzZXIuYXZhdGFyID0gdXJsO1xuICAgICAgICAgICAgICAgIGNhY2hlW2lkXSA9IGF2YXRhcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChhdmF0YXIpIHtcbiAgICAgICAgICAgICAgICAvLyBUT0RPIGdlbmVyYXRpbmcgc2lnbmVkIHVybHMgZm9yIGF2YXRhciBtYWtlcyBOTyBTRU5TRSAoJCQkKVxuICAgICAgICAgICAgICAgIC8vIFNvcnJ5IGdvdCB0byBjb3B5cGFzdGUgdGhhdCwgYnV0IHJlYWxseSBuZWVkIHRvIGdldCByaWQgb2ZcbiAgICAgICAgICAgICAgICBjYWNoZVtpZF0gPSBhd2FpdCBnZXRTaWduZWRJbWFnZVVybEZvclByb2ZpbGUodXNlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5hdmF0YXIgPSBjYWNoZVtpZF07XG4gICAgfVxufVxuIl19
|