1 | import { NgModule, Component, Input, Output, EventEmitter, Optional, ChangeDetectionStrategy, ContentChildren, ViewEncapsulation } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import { trigger, style, transition, animate } from '@angular/animations';
|
---|
4 | import { PrimeTemplate } from 'primeng/api';
|
---|
5 | import { RippleModule } from 'primeng/ripple';
|
---|
6 | import * as i0 from "@angular/core";
|
---|
7 | import * as i1 from "primeng/api";
|
---|
8 | import * as i2 from "@angular/common";
|
---|
9 | import * as i3 from "primeng/ripple";
|
---|
10 | export class Messages {
|
---|
11 | constructor(messageService, el, cd) {
|
---|
12 | this.messageService = messageService;
|
---|
13 | this.el = el;
|
---|
14 | this.cd = cd;
|
---|
15 | this.closable = true;
|
---|
16 | this.enableService = true;
|
---|
17 | this.escape = true;
|
---|
18 | this.showTransitionOptions = '300ms ease-out';
|
---|
19 | this.hideTransitionOptions = '200ms cubic-bezier(0.86, 0, 0.07, 1)';
|
---|
20 | this.valueChange = new EventEmitter();
|
---|
21 | }
|
---|
22 | ngAfterContentInit() {
|
---|
23 | this.templates.forEach((item) => {
|
---|
24 | switch (item.getType()) {
|
---|
25 | case 'content':
|
---|
26 | this.contentTemplate = item.template;
|
---|
27 | break;
|
---|
28 | default:
|
---|
29 | this.contentTemplate = item.template;
|
---|
30 | break;
|
---|
31 | }
|
---|
32 | });
|
---|
33 | if (this.messageService && this.enableService && !this.contentTemplate) {
|
---|
34 | this.messageSubscription = this.messageService.messageObserver.subscribe((messages) => {
|
---|
35 | if (messages) {
|
---|
36 | if (messages instanceof Array) {
|
---|
37 | let filteredMessages = messages.filter(m => this.key === m.key);
|
---|
38 | this.value = this.value ? [...this.value, ...filteredMessages] : [...filteredMessages];
|
---|
39 | }
|
---|
40 | else if (this.key === messages.key) {
|
---|
41 | this.value = this.value ? [...this.value, ...[messages]] : [messages];
|
---|
42 | }
|
---|
43 | this.cd.markForCheck();
|
---|
44 | }
|
---|
45 | });
|
---|
46 | this.clearSubscription = this.messageService.clearObserver.subscribe(key => {
|
---|
47 | if (key) {
|
---|
48 | if (this.key === key) {
|
---|
49 | this.value = null;
|
---|
50 | }
|
---|
51 | }
|
---|
52 | else {
|
---|
53 | this.value = null;
|
---|
54 | }
|
---|
55 | this.cd.markForCheck();
|
---|
56 | });
|
---|
57 | }
|
---|
58 | }
|
---|
59 | hasMessages() {
|
---|
60 | let parentEl = this.el.nativeElement.parentElement;
|
---|
61 | if (parentEl && parentEl.offsetParent) {
|
---|
62 | return this.contentTemplate != null || this.value && this.value.length > 0;
|
---|
63 | }
|
---|
64 | return false;
|
---|
65 | }
|
---|
66 | clear() {
|
---|
67 | this.value = [];
|
---|
68 | this.valueChange.emit(this.value);
|
---|
69 | }
|
---|
70 | removeMessage(i) {
|
---|
71 | this.value = this.value.filter((msg, index) => index !== i);
|
---|
72 | this.valueChange.emit(this.value);
|
---|
73 | }
|
---|
74 | get icon() {
|
---|
75 | const severity = this.severity || (this.hasMessages() ? this.value[0].severity : null);
|
---|
76 | if (this.hasMessages()) {
|
---|
77 | switch (severity) {
|
---|
78 | case 'success':
|
---|
79 | return 'pi-check';
|
---|
80 | break;
|
---|
81 | case 'info':
|
---|
82 | return 'pi-info-circle';
|
---|
83 | break;
|
---|
84 | case 'error':
|
---|
85 | return 'pi-times';
|
---|
86 | break;
|
---|
87 | case 'warn':
|
---|
88 | return 'pi-exclamation-triangle';
|
---|
89 | break;
|
---|
90 | default:
|
---|
91 | return 'pi-info-circle';
|
---|
92 | break;
|
---|
93 | }
|
---|
94 | }
|
---|
95 | return null;
|
---|
96 | }
|
---|
97 | ngOnDestroy() {
|
---|
98 | if (this.messageSubscription) {
|
---|
99 | this.messageSubscription.unsubscribe();
|
---|
100 | }
|
---|
101 | if (this.clearSubscription) {
|
---|
102 | this.clearSubscription.unsubscribe();
|
---|
103 | }
|
---|
104 | }
|
---|
105 | }
|
---|
106 | Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Messages, deps: [{ token: i1.MessageService, optional: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
107 | Messages.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Messages, selector: "p-messages", inputs: { value: "value", closable: "closable", style: "style", styleClass: "styleClass", enableService: "enableService", key: "key", escape: "escape", severity: "severity", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, outputs: { valueChange: "valueChange" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
---|
108 | <div class="p-messages p-component" role="alert" [ngStyle]="style" [class]="styleClass">
|
---|
109 | <ng-container *ngIf="!contentTemplate; else staticMessage">
|
---|
110 | <div *ngFor="let msg of value; let i=index" [ngClass]="'p-message p-message-' + msg.severity" role="alert"
|
---|
111 | [@messageAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}">
|
---|
112 | <div class="p-message-wrapper">
|
---|
113 | <span [class]="'p-message-icon pi' + (msg.icon ? ' ' + msg.icon : '')" [ngClass]="{'pi-info-circle': msg.severity === 'info',
|
---|
114 | 'pi-check': msg.severity === 'success',
|
---|
115 | 'pi-exclamation-triangle': msg.severity === 'warn',
|
---|
116 | 'pi-times-circle': msg.severity === 'error'}"></span>
|
---|
117 | <ng-container *ngIf="!escape; else escapeOut">
|
---|
118 | <span *ngIf="msg.summary" class="p-message-summary" [innerHTML]="msg.summary"></span>
|
---|
119 | <span *ngIf="msg.detail" class="p-message-detail" [innerHTML]="msg.detail"></span>
|
---|
120 | </ng-container>
|
---|
121 | <ng-template #escapeOut>
|
---|
122 | <span *ngIf="msg.summary" class="p-message-summary">{{msg.summary}}</span>
|
---|
123 | <span *ngIf="msg.detail" class="p-message-detail">{{msg.detail}}</span>
|
---|
124 | </ng-template>
|
---|
125 | <button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable" type="button" pRipple>
|
---|
126 | <i class="p-message-close-icon pi pi-times"></i>
|
---|
127 | </button>
|
---|
128 | </div>
|
---|
129 | </div>
|
---|
130 | </ng-container>
|
---|
131 | <ng-template #staticMessage>
|
---|
132 | <div [ngClass]="'p-message p-message-' + severity" role="alert">
|
---|
133 | <div class="p-message-wrapper">
|
---|
134 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
135 | </div>
|
---|
136 | </div>
|
---|
137 | </ng-template>
|
---|
138 | </div>
|
---|
139 | `, isInline: true, styles: [".p-message-wrapper{display:flex;align-items:center}.p-message-close{display:flex;align-items:center;justify-content:center}.p-message-close.p-link{margin-left:auto;overflow:hidden;position:relative}\n"], directives: [{ type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.Ripple, selector: "[pRipple]" }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
|
---|
140 | trigger('messageAnimation', [
|
---|
141 | transition(':enter', [
|
---|
142 | style({ opacity: 0, transform: 'translateY(-25%)' }),
|
---|
143 | animate('{{showTransitionParams}}')
|
---|
144 | ]),
|
---|
145 | transition(':leave', [
|
---|
146 | animate('{{hideTransitionParams}}', style({ height: 0, marginTop: 0, marginBottom: 0, marginLeft: 0, marginRight: 0, overflow: 'hidden', opacity: 0 }))
|
---|
147 | ])
|
---|
148 | ])
|
---|
149 | ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
150 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Messages, decorators: [{
|
---|
151 | type: Component,
|
---|
152 | args: [{ selector: 'p-messages', template: `
|
---|
153 | <div class="p-messages p-component" role="alert" [ngStyle]="style" [class]="styleClass">
|
---|
154 | <ng-container *ngIf="!contentTemplate; else staticMessage">
|
---|
155 | <div *ngFor="let msg of value; let i=index" [ngClass]="'p-message p-message-' + msg.severity" role="alert"
|
---|
156 | [@messageAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}">
|
---|
157 | <div class="p-message-wrapper">
|
---|
158 | <span [class]="'p-message-icon pi' + (msg.icon ? ' ' + msg.icon : '')" [ngClass]="{'pi-info-circle': msg.severity === 'info',
|
---|
159 | 'pi-check': msg.severity === 'success',
|
---|
160 | 'pi-exclamation-triangle': msg.severity === 'warn',
|
---|
161 | 'pi-times-circle': msg.severity === 'error'}"></span>
|
---|
162 | <ng-container *ngIf="!escape; else escapeOut">
|
---|
163 | <span *ngIf="msg.summary" class="p-message-summary" [innerHTML]="msg.summary"></span>
|
---|
164 | <span *ngIf="msg.detail" class="p-message-detail" [innerHTML]="msg.detail"></span>
|
---|
165 | </ng-container>
|
---|
166 | <ng-template #escapeOut>
|
---|
167 | <span *ngIf="msg.summary" class="p-message-summary">{{msg.summary}}</span>
|
---|
168 | <span *ngIf="msg.detail" class="p-message-detail">{{msg.detail}}</span>
|
---|
169 | </ng-template>
|
---|
170 | <button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable" type="button" pRipple>
|
---|
171 | <i class="p-message-close-icon pi pi-times"></i>
|
---|
172 | </button>
|
---|
173 | </div>
|
---|
174 | </div>
|
---|
175 | </ng-container>
|
---|
176 | <ng-template #staticMessage>
|
---|
177 | <div [ngClass]="'p-message p-message-' + severity" role="alert">
|
---|
178 | <div class="p-message-wrapper">
|
---|
179 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
180 | </div>
|
---|
181 | </div>
|
---|
182 | </ng-template>
|
---|
183 | </div>
|
---|
184 | `, animations: [
|
---|
185 | trigger('messageAnimation', [
|
---|
186 | transition(':enter', [
|
---|
187 | style({ opacity: 0, transform: 'translateY(-25%)' }),
|
---|
188 | animate('{{showTransitionParams}}')
|
---|
189 | ]),
|
---|
190 | transition(':leave', [
|
---|
191 | animate('{{hideTransitionParams}}', style({ height: 0, marginTop: 0, marginBottom: 0, marginLeft: 0, marginRight: 0, overflow: 'hidden', opacity: 0 }))
|
---|
192 | ])
|
---|
193 | ])
|
---|
194 | ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
195 | 'class': 'p-element'
|
---|
196 | }, styles: [".p-message-wrapper{display:flex;align-items:center}.p-message-close{display:flex;align-items:center;justify-content:center}.p-message-close.p-link{margin-left:auto;overflow:hidden;position:relative}\n"] }]
|
---|
197 | }], ctorParameters: function () { return [{ type: i1.MessageService, decorators: [{
|
---|
198 | type: Optional
|
---|
199 | }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { value: [{
|
---|
200 | type: Input
|
---|
201 | }], closable: [{
|
---|
202 | type: Input
|
---|
203 | }], style: [{
|
---|
204 | type: Input
|
---|
205 | }], styleClass: [{
|
---|
206 | type: Input
|
---|
207 | }], enableService: [{
|
---|
208 | type: Input
|
---|
209 | }], key: [{
|
---|
210 | type: Input
|
---|
211 | }], escape: [{
|
---|
212 | type: Input
|
---|
213 | }], severity: [{
|
---|
214 | type: Input
|
---|
215 | }], showTransitionOptions: [{
|
---|
216 | type: Input
|
---|
217 | }], hideTransitionOptions: [{
|
---|
218 | type: Input
|
---|
219 | }], templates: [{
|
---|
220 | type: ContentChildren,
|
---|
221 | args: [PrimeTemplate]
|
---|
222 | }], valueChange: [{
|
---|
223 | type: Output
|
---|
224 | }] } });
|
---|
225 | export class MessagesModule {
|
---|
226 | }
|
---|
227 | MessagesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
228 | MessagesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessagesModule, declarations: [Messages], imports: [CommonModule, RippleModule], exports: [Messages] });
|
---|
229 | MessagesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessagesModule, imports: [[CommonModule, RippleModule]] });
|
---|
230 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MessagesModule, decorators: [{
|
---|
231 | type: NgModule,
|
---|
232 | args: [{
|
---|
233 | imports: [CommonModule, RippleModule],
|
---|
234 | exports: [Messages],
|
---|
235 | declarations: [Messages]
|
---|
236 | }]
|
---|
237 | }] });
|
---|
238 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvbWVzc2FnZXMvbWVzc2FnZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQVcsS0FBSyxFQUFDLE1BQU0sRUFBQyxZQUFZLEVBQWtCLFFBQVEsRUFBWSx1QkFBdUIsRUFBQyxlQUFlLEVBQXdCLGlCQUFpQixFQUFvQixNQUFNLGVBQWUsQ0FBQztBQUM5TixPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDN0MsT0FBTyxFQUFDLE9BQU8sRUFBTyxLQUFLLEVBQUMsVUFBVSxFQUFDLE9BQU8sRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBQzNFLE9BQU8sRUFBUyxhQUFhLEVBQWdCLE1BQU0sYUFBYSxDQUFDO0FBRWpFLE9BQU8sRUFBQyxZQUFZL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T1cImFsZXJ0XCJcbiAgICAgICAgICAgICAgICAgICAgW0BtZXNzYWdlQW5pbWF0aW9uXT1cInt2YWx1ZTogJ3Zpc2libGUnLCBwYXJhbXM6IHtzaG93VHJhbnNpdGlvblBhcmFtczogc2hvd1RyYW5zaXRpb25PcHRpb25zLCBoaWRlVHJhbnNpdGlvblBhcmFtczogaGlkZVRyYW5zaXRpb25PcHRpb25zfX1cIj5cbiAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInAtbWVzc2FnZS13cmFwcGVyXCI+XG4gICAgICAgICAgICAgICAgICAgICAgIDxzcGFuIFtjbGFzc109XCIncC1tZXNzYWdlLWljb24gcGknICsgKG1zZy5pY29uID8gJyAnICsgbXNnLmljb24gOiAnJylcIiBbbmdDbGFzc109XCJ7J3BpLWluZm8tY2lyY2xlJzogbXNnLnNldmVyaXR5ID09PSAnaW5mbycsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BpLWNoZWNrJzogbXNnLnNldmVyaXR5ID09PSAnc3VjY2VzcycsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BpLWV4Y2xhbWF0aW9uLXRyaWFuZ2xlJzogbXNnLnNldmVyaXR5ID09PSAnd2FybicsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BpLXRpbWVzLWNpcmNsZSc6IG1zZy5zZXZlcml0eSA9PT0gJ2Vycm9yJ31cIj48L3NwYW4+XG4gICAgICAgICAgICAgICAgICAgICAgICA8bmctY29udGFpbmVyICpuZ0lmPVwiIWVzY2FwZTsgZWxzZSBlc2NhcGVPdXRcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8c3BhbiAqbmdJZj1cIm1zZy5zdW1tYXJ5XCIgY2xhc3M9XCJwLW1lc3NhZ2Utc3VtbWFyeVwiIFtpbm5lckhUTUxdPVwibXNnLnN1bW1hcnlcIj48L3NwYW4+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNwYW4gKm5nSWY9XCJtc2cuZGV0YWlsXCIgY2xhc3M9XCJwLW1lc3NhZ2UtZGV0YWlsXCIgW2lubmVySFRNTF09XCJtc2cuZGV0YWlsXCI+PC9zcGFuPlxuICAgICAgICAgICAgICAgICAgICAgICAgPC9uZy1jb250YWluZXI+XG4gICAgICAgICAgICAgICAgICAgICAgICA8bmctdGVtcGxhdGUgI2VzY2FwZU91dD5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8c3BhbiAqbmdJZj1cIm1zZy5zdW1tYXJ5XCIgY2xhc3M9XCJwLW1lc3NhZ2Utc3VtbWFyeVwiPnt7bXNnLnN1bW1hcnl9fTwvc3Bhbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8c3BhbiAqbmdJZj1cIm1zZy5kZXRhaWxcIiBjbGFzcz1cInAtbWVzc2FnZS1kZXRhaWxcIj57e21zZy5kZXRhaWx9fTwvc3Bhbj5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvbmctdGVtcGxhdGU+XG4gICAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIGNsYXNzPVwicC1tZXNzYWdlLWNsb3NlIHAtbGlua1wiIChjbGljayk9XCJyZW1vdmVNZXNzYWdlKGkpXCIgKm5nSWY9XCJjbG9zYWJsZVwiIHR5cGU9XCJidXR0b25cIiBwUmlwcGxlPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxpIGNsYXNzPVwicC1tZXNzYWdlLWNsb3NlLWljb24gcGkgcGktdGltZXNcIj48L2k+XG4gICAgICAgICAgICAgICAgICAgICAgICA8L2J1dHRvbj5cbiAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICA8L25nLWNvbnRhaW5lcj5cbiAgICAgICAgICAgIDxuZy10ZW1wbGF0ZSAjc3RhdGljTWVzc2FnZT5cbiAgICAgICAgICAgICAgICA8ZGl2IFtuZ0NsYXNzXT1cIidwLW1lc3NhZ2UgcC1tZXN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GFuY2VvZiBBcnJheSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZpbHRlcmVkTWVzc2FnZXMgPSBtZXNzYWdlcy5maWx0ZXIobSA9PiB0aGlzLmtleSA9PT0gbS5rZXkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHRoaXMudmFsdWUgPyBbLi4udGhpcy52YWx1ZSwgLi4uZmlsdGVyZWRNZXNzYWdlc10gOiBbLi4uZmlsdGVyZWRNZXNzYWdlc107XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5rZXkgPT09IG1lc3NhZ2VzLmtleSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHRoaXMudmFsdWUgPyBbLi4udGhpcy52YWx1ZSwgLi4uW21lc3NhZ2VzXV0gOiBbbWVzc2FnZXNdO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jZC5tYXJrRm9yQ2hlY2soKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgdGhpcy5jbGVhclN1YnNjcmlwdGlvbiA9IHRoaXMubWVzc2FnZVNlcnZpY2UuY2xlYXJPYnNlcnZlci5zdWJzY3JpYmUoa2V5ID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoa2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmtleSA9PT0ga2V5KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZhbHVlID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy52YWx1ZSA9IG51bGw7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGhpcy5jZC5tYXJr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gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlICdpbmZvJzpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdwaS1pbmZvLWNpcmNsZSc7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICBjYXNlICdlcnJvcic6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncGktdGltZXMnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgY2FzZSAnd2Fybic6XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAncGktZXhjbGFtYXRpb24tdHJpYW5nbGUnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdwaS1pbmZvLWNpcmNsZSc7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG5cbiAgICBuZ09uRGVzdHJveSgpIHtcbiAgICAgICAgaWYgKHRoaXMubWVzc2FnZVN1YnNjcmlwdGlvbikge1xuICAgICAgICAgICAgdGhpcy5tZXNzYWdlU3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5jbGVhclN1YnNjcmlwdGlvbikge1xuICAgICAgICAgICAgdGhpcy5jbGVhclN1YnNjcmlwdGlvbi51bnN1YnNjcmliZSgpO1xuICAgICAgICB9XG4gICAgfVxufVxuXG5ATmdNb2R1bGUoe1xuICAgIGltcG9ydHM6IFtDb21tb25Nb2R1bGUsUmlwcGxlTW9kdWxlXSxcbiAgICBleHBvcnRzOiBbTWVzc2FnZXNdLFxuICAgIGRlY2xhcmF0aW9uczogW01lc3NhZ2VzXVxufSlcbmV4cG9ydCBjbGFzcyBNZXNzYWdlc01vZHVsZSB7IH1cbiJdfQ== |
---|