316 lines
36 KiB
JavaScript
316 lines
36 KiB
JavaScript
import { CommonModule } from '@angular/common';
|
|
import { Directive, HostListener, Input, NgModule, booleanAttribute } from '@angular/core';
|
|
import { DomHandler } from 'primeng/dom';
|
|
import * as i0 from "@angular/core";
|
|
/**
|
|
* StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element.
|
|
* @group Components
|
|
*/
|
|
export class StyleClass {
|
|
el;
|
|
renderer;
|
|
zone;
|
|
constructor(el, renderer, zone) {
|
|
this.el = el;
|
|
this.renderer = renderer;
|
|
this.zone = zone;
|
|
}
|
|
/**
|
|
* Selector to define the target element. Available selectors are '@next', '@prev', '@parent' and '@grandparent'.
|
|
* @group Props
|
|
*/
|
|
selector;
|
|
/**
|
|
* Style class to add when item begins to get displayed.
|
|
* @group Props
|
|
* @deprecated Use enterFromClass instead
|
|
*/
|
|
set enterClass(value) {
|
|
this._enterClass = value;
|
|
console.warn('enterClass is deprecated, use enterFromClass instead');
|
|
}
|
|
get enterClass() {
|
|
return this._enterClass;
|
|
}
|
|
/**
|
|
* Style class to add when item begins to get displayed.
|
|
* @group Props
|
|
*/
|
|
enterFromClass;
|
|
/**
|
|
* Style class to add during enter animation.
|
|
* @group Props
|
|
*/
|
|
enterActiveClass;
|
|
/**
|
|
* Style class to add when item begins to get displayed.
|
|
* @group Props
|
|
*/
|
|
enterToClass;
|
|
/**
|
|
* Style class to add when item begins to get hidden.
|
|
* @group Props
|
|
* @deprecated Use leaveFromClass instead
|
|
*/
|
|
set leaveClass(value) {
|
|
this._leaveClass = value;
|
|
console.warn('leaveClass is deprecated, use leaveFromClass instead');
|
|
}
|
|
get leaveClass() {
|
|
return this._leaveClass;
|
|
}
|
|
/**
|
|
* Style class to add when item begins to get hidden.
|
|
* @group Props
|
|
*/
|
|
leaveFromClass;
|
|
/**
|
|
* Style class to add during leave animation.
|
|
* @group Props
|
|
*/
|
|
leaveActiveClass;
|
|
/**
|
|
* Style class to add when leave animation is completed.
|
|
* @group Props
|
|
*/
|
|
leaveToClass;
|
|
/**
|
|
* Whether to trigger leave animation when outside of the element is clicked.
|
|
* @group Props
|
|
*/
|
|
hideOnOutsideClick;
|
|
/**
|
|
* Adds or removes a class when no enter-leave animation is required.
|
|
* @group Props
|
|
*/
|
|
toggleClass;
|
|
/**
|
|
* Whether to trigger leave animation when escape key pressed.
|
|
* @group Props
|
|
*/
|
|
hideOnEscape;
|
|
eventListener;
|
|
documentClickListener;
|
|
documentKeydownListener;
|
|
target;
|
|
enterListener;
|
|
leaveListener;
|
|
animating;
|
|
_enterClass;
|
|
_leaveClass;
|
|
clickListener() {
|
|
this.target = this.resolveTarget();
|
|
if (this.toggleClass) {
|
|
this.toggle();
|
|
}
|
|
else {
|
|
if (this.target.offsetParent === null)
|
|
this.enter();
|
|
else
|
|
this.leave();
|
|
}
|
|
}
|
|
toggle() {
|
|
if (DomHandler.hasClass(this.target, this.toggleClass))
|
|
DomHandler.removeClass(this.target, this.toggleClass);
|
|
else
|
|
DomHandler.addClass(this.target, this.toggleClass);
|
|
}
|
|
enter() {
|
|
if (this.enterActiveClass) {
|
|
if (!this.animating) {
|
|
this.animating = true;
|
|
if (this.enterActiveClass === 'slidedown') {
|
|
this.target.style.height = '0px';
|
|
DomHandler.removeClass(this.target, 'hidden');
|
|
this.target.style.maxHeight = this.target.scrollHeight + 'px';
|
|
DomHandler.addClass(this.target, 'hidden');
|
|
this.target.style.height = '';
|
|
}
|
|
DomHandler.addClass(this.target, this.enterActiveClass);
|
|
if (this.enterClass || this.enterFromClass) {
|
|
DomHandler.removeClass(this.target, this.enterClass || this.enterFromClass);
|
|
}
|
|
this.enterListener = this.renderer.listen(this.target, 'animationend', () => {
|
|
DomHandler.removeClass(this.target, this.enterActiveClass);
|
|
if (this.enterToClass) {
|
|
DomHandler.addClass(this.target, this.enterToClass);
|
|
}
|
|
this.enterListener && this.enterListener();
|
|
if (this.enterActiveClass === 'slidedown') {
|
|
this.target.style.maxHeight = '';
|
|
}
|
|
this.animating = false;
|
|
});
|
|
}
|
|
}
|
|
else {
|
|
if (this.enterClass || this.enterFromClass) {
|
|
DomHandler.removeClass(this.target, this.enterClass || this.enterFromClass);
|
|
}
|
|
if (this.enterToClass) {
|
|
DomHandler.addClass(this.target, this.enterToClass);
|
|
}
|
|
}
|
|
if (this.hideOnOutsideClick) {
|
|
this.bindDocumentClickListener();
|
|
}
|
|
if (this.hideOnEscape) {
|
|
this.bindDocumentKeydownListener();
|
|
}
|
|
}
|
|
leave() {
|
|
if (this.leaveActiveClass) {
|
|
if (!this.animating) {
|
|
this.animating = true;
|
|
DomHandler.addClass(this.target, this.leaveActiveClass);
|
|
if (this.leaveClass || this.leaveFromClass) {
|
|
DomHandler.removeClass(this.target, this.leaveClass || this.leaveFromClass);
|
|
}
|
|
this.leaveListener = this.renderer.listen(this.target, 'animationend', () => {
|
|
DomHandler.removeClass(this.target, this.leaveActiveClass);
|
|
if (this.leaveToClass) {
|
|
DomHandler.addClass(this.target, this.leaveToClass);
|
|
}
|
|
this.leaveListener && this.leaveListener();
|
|
this.animating = false;
|
|
});
|
|
}
|
|
}
|
|
else {
|
|
if (this.leaveClass || this.leaveFromClass) {
|
|
DomHandler.removeClass(this.target, this.leaveClass || this.leaveFromClass);
|
|
}
|
|
if (this.leaveToClass) {
|
|
DomHandler.addClass(this.target, this.leaveToClass);
|
|
}
|
|
}
|
|
if (this.hideOnOutsideClick) {
|
|
this.unbindDocumentClickListener();
|
|
}
|
|
if (this.hideOnEscape) {
|
|
this.unbindDocumentKeydownListener();
|
|
}
|
|
}
|
|
resolveTarget() {
|
|
if (this.target) {
|
|
return this.target;
|
|
}
|
|
switch (this.selector) {
|
|
case '@next':
|
|
return this.el.nativeElement.nextElementSibling;
|
|
case '@prev':
|
|
return this.el.nativeElement.previousElementSibling;
|
|
case '@parent':
|
|
return this.el.nativeElement.parentElement;
|
|
case '@grandparent':
|
|
return this.el.nativeElement.parentElement.parentElement;
|
|
default:
|
|
return document.querySelector(this.selector);
|
|
}
|
|
}
|
|
bindDocumentClickListener() {
|
|
if (!this.documentClickListener) {
|
|
this.documentClickListener = this.renderer.listen(this.el.nativeElement.ownerDocument, 'click', (event) => {
|
|
if (!this.isVisible() || getComputedStyle(this.target).getPropertyValue('position') === 'static')
|
|
this.unbindDocumentClickListener();
|
|
else if (this.isOutsideClick(event))
|
|
this.leave();
|
|
});
|
|
}
|
|
}
|
|
bindDocumentKeydownListener() {
|
|
if (!this.documentKeydownListener) {
|
|
this.zone.runOutsideAngular(() => {
|
|
this.documentKeydownListener = this.renderer.listen(this.el.nativeElement.ownerDocument, 'keydown', (event) => {
|
|
const { key, keyCode, which, type } = event;
|
|
if (!this.isVisible() || getComputedStyle(this.target).getPropertyValue('position') === 'static')
|
|
this.unbindDocumentKeydownListener();
|
|
if (this.isVisible() && key === 'Escape' && keyCode === 27 && which === 27)
|
|
this.leave();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
isVisible() {
|
|
return this.target.offsetParent !== null;
|
|
}
|
|
isOutsideClick(event) {
|
|
return !this.el.nativeElement.isSameNode(event.target) && !this.el.nativeElement.contains(event.target) && !this.target.contains(event.target);
|
|
}
|
|
unbindDocumentClickListener() {
|
|
if (this.documentClickListener) {
|
|
this.documentClickListener();
|
|
this.documentClickListener = null;
|
|
}
|
|
}
|
|
unbindDocumentKeydownListener() {
|
|
if (this.documentKeydownListener) {
|
|
this.documentKeydownListener();
|
|
this.documentKeydownListener = null;
|
|
}
|
|
}
|
|
ngOnDestroy() {
|
|
this.target = null;
|
|
if (this.eventListener) {
|
|
this.eventListener();
|
|
}
|
|
this.unbindDocumentClickListener();
|
|
this.unbindDocumentKeydownListener();
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: StyleClass, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.7", type: StyleClass, selector: "[pStyleClass]", inputs: { selector: ["pStyleClass", "selector"], enterClass: "enterClass", enterFromClass: "enterFromClass", enterActiveClass: "enterActiveClass", enterToClass: "enterToClass", leaveClass: "leaveClass", leaveFromClass: "leaveFromClass", leaveActiveClass: "leaveActiveClass", leaveToClass: "leaveToClass", hideOnOutsideClick: ["hideOnOutsideClick", "hideOnOutsideClick", booleanAttribute], toggleClass: "toggleClass", hideOnEscape: ["hideOnEscape", "hideOnEscape", booleanAttribute] }, host: { listeners: { "click": "clickListener($event)" }, classAttribute: "p-element" }, ngImport: i0 });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: StyleClass, decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: '[pStyleClass]',
|
|
host: {
|
|
class: 'p-element'
|
|
}
|
|
}]
|
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { selector: [{
|
|
type: Input,
|
|
args: ['pStyleClass']
|
|
}], enterClass: [{
|
|
type: Input
|
|
}], enterFromClass: [{
|
|
type: Input
|
|
}], enterActiveClass: [{
|
|
type: Input
|
|
}], enterToClass: [{
|
|
type: Input
|
|
}], leaveClass: [{
|
|
type: Input
|
|
}], leaveFromClass: [{
|
|
type: Input
|
|
}], leaveActiveClass: [{
|
|
type: Input
|
|
}], leaveToClass: [{
|
|
type: Input
|
|
}], hideOnOutsideClick: [{
|
|
type: Input,
|
|
args: [{ transform: booleanAttribute }]
|
|
}], toggleClass: [{
|
|
type: Input
|
|
}], hideOnEscape: [{
|
|
type: Input,
|
|
args: [{ transform: booleanAttribute }]
|
|
}], clickListener: [{
|
|
type: HostListener,
|
|
args: ['click', ['$event']]
|
|
}] } });
|
|
export class StyleClassModule {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: StyleClassModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: StyleClassModule, declarations: [StyleClass], imports: [CommonModule], exports: [StyleClass] });
|
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: StyleClassModule, imports: [CommonModule] });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: StyleClassModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [CommonModule],
|
|
exports: [StyleClass],
|
|
declarations: [StyleClass]
|
|
}]
|
|
}] });
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVjbGFzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9zdHlsZWNsYXNzL3N0eWxlY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxTQUFTLEVBQWMsWUFBWSxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQWdDLGdCQUFnQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3JJLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxhQUFhLENBQUM7O0FBRXpDOzs7R0FHRztBQU9ILE1BQU0sT0FBTyxVQUFVO0lBQ0E7SUFBdUI7SUFBNkI7SUFBdkUsWUFBbUIsRUFBYyxFQUFTLFFBQW1CLEVBQVUsSUFBWTtRQUFoRSxPQUFFLEdBQUYsRUFBRSxDQUFZO1FBQVMsYUFBUSxHQUFSLFFBQVEsQ0FBVztRQUFVLFNBQUksR0FBSixJQUFJLENBQVE7SUFBRyxDQUFDO0lBQ3ZG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oaXMuZW50ZXJGcm9tQ2xhc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgRG9tSGFuZGxlci5yZW1vdmVDbGFzcyh0aGlzLnRhcmdldCwgdGhpcy5lbnRlckNsYXNzIHx8IHRoaXMuZW50ZXJGcm9tQ2xhc3MpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuZW50ZXJMaXN0ZW5lciA9IHRoaXMucmVuZGVyZXIubGlzdGVuKHRoaXMudGFyZ2V0LCAnYW5pbWF0aW9uZW5kJywgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBEb21IYW5kbGVyLnJlbW92ZUNsYXNzKHRoaXMudGFyZ2V0LCB0aGlzLmVudGVyQWN0aXZlQ2xhc3MgYXMgc3RyaW5nKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuZW50ZXJUb0NsYXNzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBEb21IYW5kbGVyLmFkZENsYXNzKHRoaXMudGFyZ2V0LCB0aGlzLmVudGVyVG9DbGFzcyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbnRlckxpc3RlbmVyICYmIHRoaXMuZW50ZXJMaXN0ZW5lcigpO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmVudGVyQWN0aXZlQ2xhc3MgPT09ICdzbGlkZWRvd24nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAodGhpcy50YXJnZXQgYXMgSFRNTEVsZW1lbnQpLnN0eWxlLm1heEhlaWdodCA9ICcnO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYW5pbWF0aW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAodGhpcy5lbnRlckNsYXNzIHx8IHRoaXMuZW50ZXJ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AgfVxuXG4gICAgICAgICAgICAgICAgdGhpcy5sZWF2ZUxpc3RlbmVyID0gdGhpcy5yZW5kZXJlci5saXN0ZW4odGhpcy50YXJnZXQsICdhbmltYXRpb25lbmQnLCAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIERvbUhhbmRsZXIucmVtb3ZlQ2xhc3ModGhpcy50YXJnZXQsIHRoaXMubGVhdmVBY3RpdmVDbGFzcyBhcyBzdHJpbmcpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sZWF2ZVRvQ2xhc3MpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIERvbUhhbmRsZXIuYWRkQ2xhc3ModGhpcy50YXJnZXQsIHRoaXMubGVhdmVUb0NsYXNzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmxlYXZlTGlzdGVuZXIgJiYgdGhpcy5sZWF2ZUxpc3RlbmVyKCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuYW5pbWF0aW5nID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAodGhpcy5sZWF2ZUNsYXNzIHx8IHRoaXMubGVhdmVGcm9tQ2xhc3MpIHtcbiAgICAgICAgICAgICAgICBEb21IYW5kbGVyLnJlbW92ZUNsYXNzKHRoaXMudGFyZ2V0LCB0aGlzLmxlYXZlQ2xhc3MgfHwgdGhpcy5sZWF2ZUZyb21DbGFzcyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh0aGlzLmxlYXZlVG9DbGFzcykge1xuICAgICAgICAgICAgICAgIERvbUhhbmRsZXIuYWRkQ2xhc3ModGhpcy50YXJnZXQsIHRoaXMubGVhdmVUb0NsYXNzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLmhpZGVPbk91dHNpZGVDbGljaykge1xuICAgICAgICAgICAgdGhpcy51bmJpbmREb2N1bWVudENsaWNrTGlzdGVuZXIoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLmhpZGVPbkVzY2FwZSkge1xuICAgICAgICAgICAgdGhpcy51bmJpbmREb2N1bWVudEtleWRvd25MaXN0ZW5lcigpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgcmVzb2x2ZVRhcmdldCgpIHtcbiAgICAgICAgaWYgKHRoaXMudGFyZ2V0KSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy50YXJnZXQ7XG4gICAgICAgIH1cblxuICAgICAgICBzd2l0Y2ggKHRoaXMuc2VsZWN0b3IpIHtcbiAgICAgICAgICAgIGNhc2UgJ0BuZXh0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lbC5uYXRpdmVFbGVtZW50Lm5leHRFbGVtZW50U2libGluZztcblxuICAgICAgICAgICAgY2FzZSAnQHByZXYnOlxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVsLm5hdGl2ZUVsZW1lbnQucHJldmlvdXNFbGVtZW50U2libGluZztcblxuICAgICAgICAgICAgY2FzZSAnQHBhcmVudCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWwubmF0aXZlRWxlbWVudC5wYXJlbnRFbGVtZW50O1xuXG4gICAgICAgICAgICBjYXNlICdAZ3JhbmRwYXJlbnQnOlxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVsLm5hdGl2ZUVsZW1lbnQucGFyZW50RWxlbWVudC5wYXJlbnRFbGVtZW50O1xuXG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHRoaXMuc2VsZWN0b3IgYXMgc3RyaW5nKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGJpbmREb2N1bWVudENsaWNrTGlzdGVuZXIoKSB7XG4gICAgICAgIGlmICgh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W50KS5nZXRQcm9wZXJ0eVZhbHVlKCdwb3NpdGlvbicpID09PSAnc3RhdGljJykgdGhpcy51bmJpbmREb2N1bWVudEtleWRvd25MaXN0ZW5lcigpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1Zpc2libGUoKSAmJiBrZXkgPT09ICdFc2NhcGUnICYmIGtleUNvZGUgPT09IDI3ICYmIHdoaWNoID09PSAyNykgdGhpcy5sZWF2ZSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBpc1Zpc2libGUoKSB7XG4gICAgICAgIHJldHVybiAodGhpcy50YXJnZXQgYXMgSFRNTEVsZW1lbnQpLm9mZnNldFBhcmVudCAhPT0gbnVsbDtcbiAgICB9XG5cbiAgICBpc091dHNpZGVDbGljayhldmVudDogTW91c2VFdmVudCkge1xuICAgICAgICByZXR1cm4gIXRoaXMuZWwubmF0aXZlRWxlbWVudC5pc1NhbWVOb2RlKGV2ZW50LnRhcmdldCkgJiYgIXRoaXMuZWwubmF0aXZlRWxlbWVudC5jb250YWlucyhldmVudC50YXJnZXQpICYmICEodGhpcy50YXJnZXQgYXMgSFRNTEVsZW1lbnQpLmNvbnRhaW5zKDxIVE1MRWxlbWVudD5ldmVudC50YXJnZXQpO1xuICAgIH1cblxuICAgIHVuYmluZERvY3VtZW50Q2xpY2tMaXN0ZW5lcigpIHtcbiAgICAgICAgaWYgKHRoaXMuZG9jdW1lbnRDbGlja0xpc3RlbmVyKSB7XG4gICAgICAgICAgICB0aGlzLmRvY3VtZW50Q2xpY2tMaXN0ZW5lcigpO1xuICAgICAgICAgICAgdGhpcy5kb2N1bWVudENsaWNrTGlzdGVuZXIgPSBudWxsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgdW5iaW5kRG9jdW1lbnRLZXlkb3duTGlzdGVuZXIoKSB7XG4gICAgICAgIGlmICh0aGlzLmRvY3VtZW50S2V5ZG93bkxpc3R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