PageSourceSearch

http://lkpf.ru/bitrix/js/main/popup/dist/main.popup.bundle.js?1654775050109107

js lkpf.ru collected 2026-10-07 22:24:27 UTC 109,107 bytes, 3,644 lines download raw bytes

1this.BX = this.BX || {};
2(function (exports,main_core_zIndexManager,main_core_events,main_core) {
3	'use strict';
4
5	/**
6	 * @memberOf BX.Main.Popup
7	 * @deprecated use BX.UI.Button
8	 */
9	var Button = /*#__PURE__*/function () {
10	  function Button(params) {
11	    babelHelpers.classCallCheck(this, Button);
12	    this.popupWindow = null;
13	    this.params = params || {};
14	    this.text = this.params.text || '';
15	    this.id = this.params.id || '';
16	    this.className = this.params.className || '';
17	    this.events = this.params.events || {};
18	    this.contextEvents = {};
19
20	    for (var eventName in this.events) {
21	      if (main_core.Type.isFunction(this.events[eventName])) {
22	        this.contextEvents[eventName] = this.events[eventName].bind(this);
23	      }
24	    }
25
26	    this.buttonNode = main_core.Dom.create('span', {
27	      props: {
28	        className: 'popup-window-button' + (this.className.length > 0 ? ' ' + this.className : ''),
29	        id: this.id
30	      },
31	      events: this.contextEvents,
32	      text: this.text
33	    });
34	  }
35
36	  babelHelpers.createClass(Button, [{
37	    key: "render",
38	    value: function render() {
39	      return this.buttonNode;
40	    }
41	  }, {
42	    key: "getId",
43	    value: function getId() {
44	      return this.id;
45	    }
46	  }, {
47	    key: "getContainer",
48	    value: function getContainer() {
49	      return this.buttonNode;
50	    }
51	  }, {
52	    key: "getName",
53	    value: function getName() {
54	      return this.text;
55	    }
56	  }, {
57	    key: "setName",
58	    value: function setName(name) {
59	      this.text = name || '';
60
61	      if (this.buttonNode) {
62	        main_core.Dom.clean(this.buttonNode);
63	        main_core.Dom.adjust(this.buttonNode, {
64	          text: this.text
65	        });
66	      }
67	    }
68	  }, {
69	    key: "setClassName",
70	    value: function setClassName(className) {
71	      if (this.buttonNode) {
72	        if (main_core.Type.isString(this.className) && this.className !== '') {
73	          main_core.Dom.removeClass(this.buttonNode, this.className);
74	        }
75
76	        main_core.Dom.addClass(this.buttonNode, className);
77	      }
78
79	      this.className = className;
80	    }
81	  }, {
82	    key: "addClassName",
83	    value: function addClassName(className) {
84	      if (this.buttonNode) {
85	        main_core.Dom.addClass(this.buttonNode, className);
86	        this.className = this.buttonNode.className;
87	      }
88	    }
89	  }, {
90	    key: "removeClassName",
91	    value: function removeClassName(className) {
92	      if (this.buttonNode) {
93	        main_core.Dom.removeClass(this.buttonNode, className);
94	        this.className = this.buttonNode.className;
95	      }
96	    }
97	  }]);
98	  return Button;
99	}();
100
101	function _templateObject8() {
102	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t\t<div class=\"popup-window-overlay\" id=\"popup-window-overlay-", "\"></div>\n\t\t\t\t"]);
103
104	  _templateObject8 = function _templateObject8() {
105	    return data;
106	  };
107
108	  return data;
109	}
110
111	function _templateObject7() {
112	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t\t<div class=\"popup-window-resize\" onmousedown=\"", "\"></div>\n\t\t\t\t"]);
113
114	  _templateObject7 = function _templateObject7() {
115	    return data;
116	  };
117
118	  return data;
119	}
120
121	function _templateObject6() {
122	  var data = babelHelpers.taggedTemplateLiteral(["<div class=\"", " ", "-", "\"></div>"]);
123
124	  _templateObject6 = function _templateObject6() {
125	    return data;
126	  };
127
128	  return data;
129	}
130
131	function _templateObject5() {
132	  var data = babelHelpers.taggedTemplateLiteral(["<div class=\"popup-window-buttons\">", "</div>"]);
133
134	  _templateObject5 = function _templateObject5() {
135	    return data;
136	  };
137
138	  return data;
139	}
140
141	function _templateObject4() {
142	  var data = babelHelpers.taggedTemplateLiteral(["<div \n\t\t\t\tclass=\"", "\" \n\t\t\t\tid=\"", "\"\n\t\t\t\tstyle=\"display: none; position: absolute; left: 0; top: 0;\"\n\t\t\t>", "</div>"]);
143
144	  _templateObject4 = function _templateObject4() {
145	    return data;
146	  };
147
148	  return data;
149	}
150
151	function _templateObject3() {
152	  var data = babelHelpers.taggedTemplateLiteral(["<div id=\"popup-window-content-", "\" class=\"popup-window-content\"></div>"]);
153
154	  _templateObject3 = function _templateObject3() {
155	    return data;
156	  };
157
158	  return data;
159	}
160
161	function _templateObject2() {
162	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<span class=\"", "\" onclick=\"", "\"></span>\n\t\t\t"]);
163
164	  _templateObject2 = function _templateObject2() {
165	    return data;
166	  };
167
168	  return data;
169	}
170
171	function _templateObject() {
172	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<div class=\"popup-window-titlebar\" id=\"popup-window-titlebar-", "\"></div>\n\t\t\t"]);
173
174	  _templateObject = function _templateObject() {
175	    return data;
176	  };
177
178	  return data;
179	}
180	var aliases = {
181	  onPopupWindowInit: {
182	    namespace: 'BX.Main.Popup',
183	    eventName: 'onInit'
184	  },
185	  onPopupWindowIsInitialized: {
186	    namespace: 'BX.Main.Popup',
187	    eventName: 'onAfterInit'
188	  },
189	  onPopupFirstShow: {
190	    namespace: 'BX.Main.Popup',
191	    eventName: 'onFirstShow'
192	  },
193	  onPopupShow: {
194	    namespace: 'BX.Main.Popup',
195	    eventName: 'onShow'
196	  },
197	  onAfterPopupShow: {
198	    namespace: 'BX.Main.Popup',
199	    eventName: 'onAfterShow'
200	  },
201	  onPopupClose: {
202	    namespace: 'BX.Main.Popup',
203	    eventName: 'onClose'
204	  },
205	  onPopupAfterClose: {
206	    namespace: 'BX.Main.Popup',
207	    eventName: 'onAfterClose'
208	  },
209	  onPopupDestroy: {
210	    namespace: 'BX.Main.Popup',
211	    eventName: 'onDestroy'
212	  },
213	  onPopupFullscreenLeave: {
214	    namespace: 'BX.Main.Popup',
215	    eventName: 'onFullscreenLeave'
216	  },
217	  onPopupFullscreenEnter: {
218	    namespace: 'BX.Main.Popup',
219	    eventName: 'onFullscreenEnter'
220	  },
221	  onPopupDragStart: {
222	    namespace: 'BX.Main.Popup',
223	    eventName: 'onDragStart'
224	  },
225	  onPopupDrag: {
226	    namespace: 'BX.Main.Popup',
227	    eventName: 'onDrag'
228	  },
229	  onPopupDragEnd: {
230	    namespace: 'BX.Main.Popup',
231	    eventName: 'onDragEnd'
232	  },
233	  onPopupResizeStart: {
234	    namespace: 'BX.Main.Popup',
235	    eventName: 'onResizeStart'
236	  },
237	  onPopupResize: {
238	    namespace: 'BX.Main.Popup',
239	    eventName: 'onResize'
240	  },
241	  onPopupResizeEnd: {
242	    namespace: 'BX.Main.Popup',
243	    eventName: 'onResizeEnd'
244	  }
245	};
246	main_core_events.EventEmitter.registerAliases(aliases);
247	/**
248	 * @memberof BX.Main
249	 */
250
251	var Popup = /*#__PURE__*/function (_EventEmitter) {
252	  babelHelpers.inherits(Popup, _EventEmitter);
253	  babelHelpers.createClass(Popup, null, [{
254	    key: "setOptions",
255
256	    /**
257	     * @private
258	     */
259
260	    /**
261	     * @private
262	     */
263	    value: function setOptions(options) {
264	      if (!main_core.Type.isPlainObject(options)) {
265	        return;
266	      }
267
268	      for (var option in options) {
269	        this.options[option] = options[option];
270	      }
271	    }
272	  }, {
273	    key: "getOption",
274	    value: function getOption(option, defaultValue) {
275	      if (!main_core.Type.isUndefined(this.options[option])) {
276	        return this.options[option];
277	      } else if (!main_core.Type.isUndefined(defaultValue)) {
278	        return defaultValue;
279	      } else {
280	        return this.defaultOptions[option];
281	      }
282	    }
283	  }]);
284
285	  function Popup(options) {
286	    var _this;
287
288	    babelHelpers.classCallCheck(this, Popup);
289	    _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Popup).call(this));
290
291	    _this.setEventNamespace('BX.Main.Popup');
292
293	    var _arguments = Array.prototype.slice.call(arguments),
294	        popupId = _arguments[0],
295	        bindElement = _arguments[1],
296	        params = _arguments[2]; //compatible arguments
297
298
299	    _this.compatibleMode = params && main_core.Type.isBoolean(params.compatibleMode) ? params.compatibleMode : true;
300
301	    if (main_core.Type.isPlainObject(options) && !bindElement && !params) {
302	      params = options;
303	      popupId = options.id;
304	      bindElement = options.bindElement;
305	      _this.compatibleMode = false;
306	    }
307
308	    params = params || {};
309	    _this.params = params;
310
311	    if (!main_core.Type.isStringFilled(popupId)) {
312	      popupId = 'popup-window-' + main_core.Text.getRandom().toLowerCase();
313	    }
314
315	    _this.emit('onInit', new main_core_events.BaseEvent({
316	      compatData: [popupId, bindElement, params]
317	    }));
318	    /**
319	     * @private
320	     */
321
322
323	    _this.uniquePopupId = popupId;
324	    _this.params.zIndex = main_core.Type.isNumber(params.zIndex) ? parseInt(params.zIndex) : 0;
325	    _this.params.zIndexAbsolute = main_core.Type.isNumber(params.zIndexAbsolute) ? parseInt(params.zIndexAbsolute) : 0;
326	    _this.buttons = params.buttons && main_core.Type.isArray(params.buttons) ? params.buttons : [];
327	    _this.offsetTop = Popup.getOption('offsetTop');
328	    _this.offsetLeft = Popup.getOption('offsetLeft');
329	    _this.firstShow = false;
330	    _this.bordersWidth = 20;
331	    _this.bindElementPos = null;
332	    _this.closeIcon = null;
333	    _this.resizeIcon = null;
334	    _this.angle = null;
335	    _this.overlay = null;
336	    _this.titleBar = null;
337	    _this.bindOptions = babelHelpers.typeof(params.bindOptions) === 'object' ? params.bindOptions : {};
338	    _this.autoHide = params.autoHide === true;
339	    _this.autoHideHandler = main_core.Type.isFunction(params.autoHideHandler) ? params.autoHideHandler : null;
340	    _this.handleAutoHide = _this.handleAutoHide.bind(babelHelpers.assertThisInitialized(_this));
341	    _this.handleOverlayClick = _this.handleOverlayClick.bind(babelHelpers.assertThisInitialized(_this));
342	    _this.isAutoHideBinded = false;
343	    _this.closeByEsc = params.closeByEsc === true;
344	    _this.isCloseByEscBinded = false;
345	    _this.toFrontOnShow = true;
346	    _this.cacheable = true;
347	    _this.destroyed = false;
348	    _this.width = null;
349	    _this.height = null;
350	    _this.minWidth = null;
351	    _this.minHeight = null;
352	    _this.maxWidth = null;
353	    _this.maxHeight = null;
354	    _this.padding = null;
355	    _this.contentPadding = null;
356	    _this.background = null;
357	    _this.contentBackground = null;
358	    _this.targetContainer = main_core.Type.isElementNode(params.targetContainer) ? params.targetContainer : document.body;
359	    _this.dragOptions = {
360	      cursor: '',
361	      callback: function callback() {},
362	      eventName: ''
363	    };
364	    _this.dragged = false;
365	    _this.dragPageX = 0;
366	    _this.dragPageY = 0;
367	    _this.animationShowClassName = null;
368	    _this.animationCloseClassName = null;
369	    _this.animationCloseEventType = null;
370	    _this.handleDocumentMouseMove = _this.handleDocumentMouseMove.bind(babelHelpers.assertThisInitialized(_this));
371	    _this.handleDocumentMouseUp = _this.handleDocumentMouseUp.bind(babelHelpers.assertThisInitialized(_this));
372	    _this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(babelHelpers.assertThisInitialized(_this));
373	    _this.handleResizeWindow = _this.handleResizeWindow.bind(babelHelpers.assertThisInitialized(_this));
374	    _this.handleResize = _this.handleResize.bind(babelHelpers.assertThisInitialized(_this));
375	    _this.handleMove = _this.handleMove.bind(babelHelpers.assertThisInitialized(_this));
376	    _this.onTitleMouseDown = _this.onTitleMouseDown.bind(babelHelpers.assertThisInitialized(_this));
377	    _this.handleFullScreen = _this.handleFullScreen.bind(babelHelpers.assertThisInitialized(_this));
378
379	    _this.subscribeFromOptions(params.events);
380
381	    var popupClassName = 'popup-window';
382
383	    if (params.contentColor && main_core.Type.isStringFilled(params.contentColor)) {
384	      popupClassName += ' popup-window-content-' + params.contentColor;
385	    }
386
387	    if (params.titleBar) {
388	      popupClassName += ' popup-window-with-titlebar';
389	    }
390
391	    if (params.className && main_core.Type.isStringFilled(params.className)) {
392	      popupClassName += ' ' + params.className;
393	    }
394
395	    if (params.darkMode) {
396	      popupClassName += ' popup-window-dark';
397	    }
398
399	    if (params.titleBar) {
400	      _this.titleBar = main_core.Tag.render(_templateObject(), popupId);
401	    }
402
403	    if (params.closeIcon) {
404	      var className = 'popup-window-close-icon' + (params.titleBar ? ' popup-window-titlebar-close-icon' : '');
405	      _this.closeIcon = main_core.Tag.render(_templateObject2(), className, _this.handleCloseIconClick.bind(babelHelpers.assertThisInitialized(_this)));
406
407	      if (main_core.Type.isPlainObject(params.closeIcon)) {
408	        main_core.Dom.style(_this.closeIcon, params.closeIcon);
409	      }
410	    }
411	    /**
412	     * @private
413	     */
414
415
416	    _this.contentContainer = main_core.Tag.render(_templateObject3(), popupId);
417	    /**
418	     * @private
419	     */
420
421	    _this.popupContainer = main_core.Tag.render(_templateObject4(), popupClassName, popupId, [_this.titleBar, _this.contentContainer, _this.closeIcon]);
422
423	    _this.targetContainer.appendChild(_this.popupContainer);
424
425	    _this.zIndexComponent = main_core_zIndexManager.ZIndexManager.register(_this.popupContainer, params.zIndexOptions);
426	    _this.buttonsContainer = null;
427
428	    if (params.angle) {
429	      _this.setAngle(params.angle);
430	    }
431
432	    if (params.overlay) {
433	      _this.setOverlay(params.overlay);
434	    }
435
436	    _this.setOffset(params);
437
438	    _this.setBindElement(bindElement);
439
440	    _this.setTitleBar(params.titleBar);
441
442	    _this.setContent(params.content);
443
444	    _this.setButtons(params.buttons);
445
446	    _this.setWidth(params.width);
447
448	    _this.setHeight(params.height);
449
450	    _this.setMinWidth(params.minWidth);
451
452	    _this.setMinHeight(params.minHeight);
453
454	    _this.setMaxWidth(params.maxWidth);
455
456	    _this.setMaxHeight(params.maxHeight);
457
458	    _this.setResizeMode(params.resizable);
459
460	    _this.setPadding(params.padding);
461
462	    _this.setContentPadding(params.contentPadding);
463
464	    _this.setBackground(params.background);
465
466	    _this.setContentBackground(params.contentBackground);
467
468	    _this.setAnimation(params.animation);
469
470	    _this.setCacheable(params.cacheable);
471
472	    _this.setToFrontOnShow(params.toFrontOnShow); // Compatibility
473
474
475	    if (params.contentNoPaddings) {
476	      _this.setContentPadding(0);
477	    }
478
479	    if (params.noAllPaddings) {
480	      _this.setPadding(0);
481
482	      _this.setContentPadding(0);
483	    }
484
485	    if (params.bindOnResize !== false) {
486	      main_core.Event.bind(window, 'resize', _this.handleResizeWindow);
487	    }
488
489	    _this.emit('onAfterInit', new main_core_events.BaseEvent({
490	      compatData: [popupId, babelHelpers.assertThisInitialized(_this)]
491	    }));
492
493	    return _this;
494	  }
495	  /**
496	   * @private
497	   */
498
499
500	  babelHelpers.createClass(Popup, [{
501	    key: "subscribeFromOptions",
502	    value: function subscribeFromOptions(events) {
503	      babelHelpers.get(babelHelpers.getPrototypeOf(Popup.prototype), "subscribeFromOptions", this).call(this, events, aliases);
504	    }
505	  }, {
506	    key: "getId",
507	    value: function getId() {
508	      return this.uniquePopupId;
509	    }
510	  }, {
511	    key: "isCompatibleMode",
512	    value: function isCompatibleMode() {
513	      return this.compatibleMode;
514	    }
515	  }, {
516	    key: "setContent",
517	    value: function setContent(content) {
518	      if (!this.contentContainer || !content) {
519	        return;
520	      }
521
522	      if (main_core.Type.isElementNode(content)) {
523	        main_core.Dom.clean(this.contentContainer);
524	        var hasParent = main_core.Type.isDomNode(content.parentNode);
525	        this.contentContainer.appendChild(content);
526
527	        if (this.isCompatibleMode() || hasParent) {
528	          content.style.display = 'block';
529	        }
530	      } else if (main_core.Type.isString(content)) {
531	        this.contentContainer.innerHTML = content;
532	      } else {
533	        this.contentContainer.innerHTML = '&nbsp;';
534	      }
535	    }
536	  }, {
537	    key: "setButtons",
538	    value: function setButtons(buttons) {
539	      this.buttons = buttons && main_core.Type.isArray(buttons) ? buttons : [];
540
541	      if (this.buttonsContainer) {
542	        main_core.Dom.remove(this.buttonsContainer);
543	      }
544
545	      var ButtonClass = main_core.Reflection.getClass('BX.UI.Button');
546
547	      if (this.buttons.length > 0 && this.contentContainer) {
548	        var newButtons = [];
549
550	        for (var i = 0; i < this.buttons.length; i++) {
551	          var button = this.buttons[i];
552
553	          if (button instanceof Button) {
554	            button.popupWindow = this;
555	            newButtons.push(button.render());
556	          } else if (ButtonClass && button instanceof ButtonClass) {
557	            button.setContext(this);
558	            newButtons.push(button.render());
559	          }
560	        }
561
562	        this.buttonsContainer = this.contentContainer.parentNode.appendChild(main_core.Tag.render(_templateObject5(), newButtons));
563	      }
564	    }
565	  }, {
566	    key: "getButtons",
567	    value: function getButtons() {
568	      return this.buttons;
569	    }
570	  }, {
571	    key: "getButton",
572	    value: function getButton(id) {
573	      for (var i = 0; i < this.buttons.length; i++) {
574	        var button = this.buttons[i];
575
576	        if (button.getId() === id) {
577	          return button;
578	        }
579	      }
580
581	      return null;
582	    }
583	  }, {
584	    key: "setBindElement",
585	    value: function setBindElement(bindElement) {
586	      if (bindElement === null) {
587	        this.bindElement = null;
588	      } else if (babelHelpers.typeof(bindElement) === 'object') {
589	        if (main_core.Type.isDomNode(bindElement) || main_core.Type.isNumber(bindElement.top) && main_core.Type.isNumber(bindElement.left)) {
590	          this.bindElement = bindElement;
591	        } else if (main_core.Type.isNumber(bindElement.clientX) && main_core.Type.isNumber(bindElement.clientY)) {
592	          this.bindElement = {
593	            left: bindElement.pageX,
594	            top: bindElement.pageY,
595	            bottom: bindElement.pageY
596	          };
597	        }
598	      }
599	    }
600	    /**
601	     * @private
602	     */
603
604	  }, {
605	    key: "getBindElementPos",
606	    value: function getBindElementPos(bindElement) {
607	      if (main_core.Type.isDomNode(bindElement)) {
608	        if (this.isTargetDocumentBody()) {
609	          return main_core.Dom.getPosition(bindElement);
610	        } else {
611	          return this.getPositionRelativeToTarget(bindElement);
612	        }
613	      } else if (bindElement && babelHelpers.typeof(bindElement) === 'object') {
614	        if (!main_core.Type.isNumber(bindElement.bottom)) {
615	          bindElement.bottom = bindElement.top;
616	        }
617
618	        return bindElement;
619	      } else {
620	        var windowSize = this.getWindowSize();
621	        var windowScroll = this.getWindowScroll();
622	        var popupWidth = this.getPopupContainer().offsetWidth;
623	        var popupHeight = this.getPopupContainer().offsetHeight;
624	        this.bindOptions.forceTop = true;
625	        return {
626	          left: windowSize.innerWidth / 2 - popupWidth / 2 + windowScroll.scrollLeft,
627	          top: windowSize.innerHeight / 2 - popupHeight / 2 + windowScroll.scrollTop,
628	          bottom: windowSize.innerHeight / 2 - popupHeight / 2 + windowScroll.scrollTop,
629	          //for optimisation purposes
630	          windowSize: windowSize,
631	          windowScroll: windowScroll,
632	          popupWidth: popupWidth,
633	          popupHeight: popupHeight
634	        };
635	      }
636	    }
637	    /**
638	     * @internal
639	     */
640
641	  }, {
642	    key: "getPositionRelativeToTarget",
643	    value: function getPositionRelativeToTarget(element) {
644	      var offsetLeft = element.offsetLeft;
645	      var offsetTop = element.offsetTop;
646	      var offsetElement = element.offsetParent;
647
648	      while (offsetElement && offsetElement !== this.getTargetContainer()) {
649	        offsetLeft += offsetElement.offsetLeft;
650	        offsetTop += offsetElement.offsetTop;
651	        offsetElement = offsetElement.offsetParent;
652	      }
653
654	      var elementRect = element.getBoundingClientRect();
655	      return new DOMRect(offsetLeft, offsetTop, elementRect.width, elementRect.height);
656	    } // private
657
658	  }, {
659	    key: "getWindowSize",
660	    value: function getWindowSize() {
661	      if (this.isTargetDocumentBody()) {
662	        return {
663	          innerWidth: window.innerWidth,
664	          innerHeight: window.innerHeight
665	        };
666	      } else {
667	        return {
668	          innerWidth: this.getTargetContainer().offsetWidth,
669	          innerHeight: this.getTargetContainer().offsetHeight
670	        };
671	      }
672	    } // private
673
674	  }, {
675	    key: "getWindowScroll",
676	    value: function getWindowScroll() {
677	      if (this.isTargetDocumentBody()) {
678	        return {
679	          scrollLeft: window.pageXOffset,
680	          scrollTop: window.pageYOffset
681	        };
682	      } else {
683	        return {
684	          scrollLeft: this.getTargetContainer().scrollLeft,
685	          scrollTop: this.getTargetContainer().scrollTop
686	        };
687	      }
688	    }
689	  }, {
690	    key: "setAngle",
691	    value: function setAngle(params) {
692	      if (params === false) {
693	        if (this.angle !== null) {
694	          main_core.Dom.remove(this.angle.element);
695	        }
696
697	        this.angle = null;
698	        return;
699	      }
700
701	      var className = 'popup-window-angly';
702
703	      if (this.angle === null) {
704	        var position = this.bindOptions.position && this.bindOptions.position === 'top' ? 'bottom' : 'top';
705	        var angleMinLeft = Popup.getOption(position === 'top' ? 'angleMinTop' : 'angleMinBottom');
706	        var defaultOffset = main_core.Type.isNumber(params.offset) ? params.offset : 0;
707	        var angleLeftOffset = Popup.getOption('angleLeftOffset', null);
708
709	        if (defaultOffset > 0 && main_core.Type.isNumber(angleLeftOffset)) {
710	          defaultOffset += angleLeftOffset - Popup.defaultOptions.angleLeftOffset;
711	        }
712
713	        this.angle = {
714	          element: main_core.Tag.render(_templateObject6(), className, className, position),
715	          position: position,
716	          offset: 0,
717	          defaultOffset: Math.max(defaultOffset, angleMinLeft) //Math.max(Type.isNumber(params.offset) ? params.offset : 0, angleMinLeft)
718
719	        };
720	        this.getPopupContainer().appendChild(this.angle.element);
721	      }
722
723	      if (babelHelpers.typeof(params) === 'object' && params.position && ['top', 'right', 'bottom', 'left', 'hide'].includes(params.position)) {
724	        main_core.Dom.removeClass(this.angle.element, className + '-' + this.angle.position);
725	        main_core.Dom.addClass(this.angle.element, className + '-' + params.position);
726	        this.angle.position = params.position;
727	      }
728
729	      if (babelHelpers.typeof(params) === 'object' && main_core.Type.isNumber(params.offset)) {
730	        var offset = params.offset;
731	        var minOffset, maxOffset;
732
733	        if (this.angle.position === 'top') {
734	          minOffset = Popup.getOption('angleMinTop');
735	          maxOffset = this.getPopupContainer().offsetWidth - Popup.getOption('angleMaxTop');
736	          maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset;
737	          this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset);
738	          this.angle.element.style.left = this.angle.offset + 'px';
739	          this.angle.element.style.marginLeft = 0;
740	          this.angle.element.style.removeProperty('top');
741	        } else if (this.angle.position === 'bottom') {
742	          minOffset = Popup.getOption('angleMinBottom');
743	          maxOffset = this.getPopupContainer().offsetWidth - Popup.getOption('angleMaxBottom');
744	          maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset;
745	          this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset);
746	          this.angle.element.style.marginLeft = this.angle.offset + 'px';
747	          this.angle.element.style.left = 0;
748	          this.angle.element.style.removeProperty('top');
749	        } else if (this.angle.position === 'right') {
750	          minOffset = Popup.getOption('angleMinRight');
751	          maxOffset = this.getPopupContainer().offsetHeight - Popup.getOption('angleMaxRight');
752	          maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset;
753	          this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset);
754	          this.angle.element.style.top = this.angle.offset + 'px';
755	          this.angle.element.style.removeProperty('left');
756	          this.angle.element.style.removeProperty('margin-left');
757	        } else if (this.angle.position === 'left') {
758	          minOffset = Popup.getOption('angleMinLeft');
759	          maxOffset = this.getPopupContainer().offsetHeight - Popup.getOption('angleMaxLeft');
760	          maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset;
761	          this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset);
762	          this.angle.element.style.top = this.angle.offset + 'px';
763	          this.angle.element.style.removeProperty('left');
764	          this.angle.element.style.removeProperty('margin-left');
765	        }
766	      }
767	    }
768	  }, {
769	    key: "getWidth",
770	    value: function getWidth() {
771	      return this.width;
772	    }
773	  }, {
774	    key: "setWidth",
775	    value: function setWidth(width) {
776	      this.setWidthProperty('width', width);
777	    }
778	  }, {
779	    key: "getHeight",
780	    value: function getHeight() {
781	      return this.height;
782	    }
783	  }, {
784	    key: "setHeight",
785	    value: function setHeight(height) {
786	      this.setHeightProperty('height', height);
787	    }
788	  }, {
789	    key: "getMinWidth",
790	    value: function getMinWidth() {
791	      return this.minWidth;
792	    }
793	  }, {
794	    key: "setMinWidth",
795	    value: function setMinWidth(width) {
796	      this.setWidthProperty('minWidth', width);
797	    }
798	  }, {
799	    key: "getMinHeight",
800	    value: function getMinHeight() {
801	      return this.minHeight;
802	    }
803	  }, {
804	    key: "setMinHeight",
805	    value: function setMinHeight(height) {
806	      this.setHeightProperty('minHeight', height);
807	    }
808	  }, {
809	    key: "getMaxWidth",
810	    value: function getMaxWidth() {
811	      return this.maxWidth;
812	    }
813	  }, {
814	    key: "setMaxWidth",
815	    value: function setMaxWidth(width) {
816	      this.setWidthProperty('maxWidth', width);
817	    }
818	  }, {
819	    key: "getMaxHeight",
820	    value: function getMaxHeight() {
821	      return this.maxHeight;
822	    }
823	  }, {
824	    key: "setMaxHeight",
825	    value: function setMaxHeight(height) {
826	      this.setHeightProperty('maxHeight', height);
827	    }
828	    /**
829	     * @private
830	     */
831
832	  }, {
833	    key: "setWidthProperty",
834	    value: function setWidthProperty(property, width) {
835	      var props = ['width', 'minWidth', 'maxWidth'];
836
837	      if (props.indexOf(property) === -1) {
838	        return;
839	      }
840
841	      if (main_core.Type.isNumber(width) && width >= 0) {
842	        this[property] = width;
843	        this.getResizableContainer().style[property] = width + 'px';
844	        this.getContentContainer().style.overflowX = 'auto';
845	        this.getPopupContainer().classList.add('popup-window-fixed-width');
846
847	        if (this.getTitleContainer() && main_core.Browser.isIE11()) {
848	          this.getTitleContainer().style[property] = width + 'px';
849	        }
850	      } else if (width === null || width === false) {
851	        this[property] = null;
852	        this.getResizableContainer().style.removeProperty(main_core.Text.toKebabCase(property));
853	        var hasOtherProps = props.some(function (prop) {
854	          return this.getResizableContainer().style.getPropertyValue(main_core.Text.toKebabCase(prop)) !== '';
855	        }, this);
856
857	        if (!hasOtherProps) {
858	          this.getContentContainer().style.removeProperty('overflow-x');
859	          this.getPopupContainer().classList.remove('popup-window-fixed-width');
860	        }
861
862	        if (this.getTitleContainer() && main_core.Browser.isIE11()) {
863	          this.getTitleContainer().style.removeProperty(main_core.Text.toKebabCase(property));
864	        }
865	      }
866	    }
867	    /**
868	     * @private
869	     */
870
871	  }, {
872	    key: "setHeightProperty",
873	    value: function setHeightProperty(property, height) {
874	      var props = ['height', 'minHeight', 'maxHeight'];
875
876	      if (props.indexOf(property) === -1) {
877	        return;
878	      }
879
880	      if (main_core.Type.isNumber(height) && height >= 0) {
881	        this[property] = height;
882	        this.getResizableContainer().style[property] = height + 'px';
883	        this.getContentContainer().style.overflowY = 'auto';
884	        this.getPopupContainer().classList.add('popup-window-fixed-height');
885	      } else if (height === null || height === false) {
886	        this[property] = null;
887	        this.getResizableContainer().style.removeProperty(main_core.Text.toKebabCase(property));
888	        var hasOtherProps = props.some(function (prop) {
889	          return this.getResizableContainer().style.getPropertyValue(main_core.Text.toKebabCase(prop)) !== '';
890	        }, this);
891
892	        if (!hasOtherProps) {
893	          this.getContentContainer().style.removeProperty('overflow-y');
894	          this.getPopupContainer().classList.remove('popup-window-fixed-height');
895	        }
896	      }
897	    }
898	  }, {
899	    key: "setPadding",
900	    value: function setPadding(padding) {
901	      if (main_core.Type.isNumber(padding) && padding >= 0) {
902	        this.padding = padding;
903	        this.getPopupContainer().style.padding = padding + 'px';
904	      } else if (padding === null) {
905	        this.padding = null;
906	        this.getPopupContainer().style.removeProperty('padding');
907	      }
908	    }
909	  }, {
910	    key: "getPadding",
911	    value: function getPadding() {
912	      return this.padding;
913	    }
914	  }, {
915	    key: "setContentPadding",
916	    value: function setContentPadding(padding) {
917	      if (main_core.Type.isNumber(padding) && padding >= 0) {
918	        this.contentPadding = padding;
919	        this.getContentContainer().style.padding = padding + 'px';
920	      } else if (padding === null) {
921	        this.contentPadding = null;
922	        this.getContentContainer().style.removeProperty('padding');
923	      }
924	    }
925	  }, {
926	    key: "getContentPadding",
927	    value: function getContentPadding() {
928	      return this.contentPadding;
929	    }
930	  }, {
931	    key: "setBackground",
932	    value: function setBackground(background) {
933	      if (main_core.Type.isStringFilled(background)) {
934	        this.background = background;
935	        this.getPopupContainer().style.background = background;
936	      } else if (background === null) {
937	        this.background = null;
938	        this.getPopupContainer().style.removeProperty('background');
939	      }
940	    }
941	  }, {
942	    key: "getBackground",
943	    value: function getBackground() {
944	      return this.background;
945	    }
946	  }, {
947	    key: "setContentBackground",
948	    value: function setContentBackground(background) {
949	      if (main_core.Type.isStringFilled(background)) {
950	        this.contentBackground = background;
951	        this.getContentContainer().style.background = background;
952	      } else if (background === null) {
953	        this.contentBackground = null;
954	        this.getContentContainer().style.removeProperty('background');
955	      }
956	    }
957	  }, {
958	    key: "getContentBackground",
959	    value: function getContentBackground() {
960	      return this.contentBackground;
961	    }
962	  }, {
963	    key: "isDestroyed",
964	    value: function isDestroyed() {
965	      return this.destroyed;
966	    }
967	  }, {
968	    key: "setCacheable",
969	    value: function setCacheable(cacheable) {
970	      this.cacheable = cacheable !== false;
971	    }
972	  }, {
973	    key: "isCacheable",
974	    value: function isCacheable() {
975	      return this.cacheable;
976	    }
977	  }, {
978	    key: "setToFrontOnShow",
979	    value: function setToFrontOnShow(flag) {
980	      this.toFrontOnShow = flag !== false;
981	    }
982	  }, {
983	    key: "shouldFrontOnShow",
984	    value: function shouldFrontOnShow() {
985	      return this.toFrontOnShow;
986	    }
987	  }, {
988	    key: "setResizeMode",
989	    value: function setResizeMode(mode) {
990	      if (mode === true || main_core.Type.isPlainObject(mode)) {
991	        if (!this.resizeIcon) {
992	          this.resizeIcon = main_core.Tag.render(_templateObject7(), this.handleResizeMouseDown.bind(this));
993	          this.getPopupContainer().appendChild(this.resizeIcon);
994	        } //Compatibility
995
996
997	        this.setMinWidth(mode.minWidth);
998	        this.setMinHeight(mode.minHeight);
999	      } else if (mode === false && this.resizeIcon) {
1000	        main_core.Dom.remove(this.resizeIcon);
1001	        this.resizeIcon = null;
1002	      }
1003	    }
1004	  }, {
1005	    key: "getTargetContainer",
1006	    value: function getTargetContainer() {
1007	      return this.targetContainer;
1008	    }
1009	  }, {
1010	    key: "isTargetDocumentBody",
1011	    value: function isTargetDocumentBody() {
1012	      return this.getTargetContainer() === document.body;
1013	    }
1014	  }, {
1015	    key: "getPopupContainer",
1016	    value: function getPopupContainer() {
1017	      return this.popupContainer;
1018	    }
1019	  }, {
1020	    key: "getContentContainer",
1021	    value: function getContentContainer() {
1022	      return this.contentContainer;
1023	    }
1024	  }, {
1025	    key: "getResizableContainer",
1026	    value: function getResizableContainer() {
1027	      return main_core.Browser.isIE11() ? this.getContentContainer() : this.getPopupContainer();
1028	    }
1029	  }, {
1030	    key: "getTitleContainer",
1031	    value: function getTitleContainer() {
1032	      return this.titleBar;
1033	    }
1034	    /**
1035	     * @private
1036	     */
1037
1038	  }, {
1039	    key: "onTitleMouseDown",
1040	    value: function onTitleMouseDown(event) {
1041	      this._startDrag(event, {
1042	        cursor: 'move',
1043	        callback: this.handleMove,
1044	        eventName: 'Drag'
1045	      });
1046	    }
1047	    /**
1048	     * @private
1049	     */
1050
1051	  }, {
1052	    key: "handleResizeMouseDown",
1053	    value: function handleResizeMouseDown(event) {
1054	      this._startDrag(event, {
1055	        cursor: 'nwse-resize',
1056	        eventName: 'Resize',
1057	        callback: this.handleResize
1058	      });
1059
1060	      if (this.isTargetDocumentBody()) {
1061	        this.resizeContentPos = main_core.Dom.getPosition(this.getResizableContainer());
1062	        this.resizeContentOffset = this.resizeContentPos.left - main_core.Dom.getPosition(this.getPopupContainer()).left;
1063	      } else {
1064	        this.resizeContentPos = this.getPositionRelativeToTarget(this.getResizableContainer());
1065	        this.resizeContentOffset = this.resizeContentPos.left - this.getPositionRelativeToTarget(this.getPopupContainer()).left;
1066	      }
1067
1068	      this.resizeContentPos.offsetX = 0;
1069	      this.resizeContentPos.offsetY = 0;
1070	    }
1071	    /**
1072	     * @private
1073	     */
1074
1075	  }, {
1076	    key: "handleResize",
1077	    value: function handleResize(offsetX, offsetY, pageX, pageY) {
1078	      this.resizeContentPos.offsetX += offsetX;
1079	      this.resizeContentPos.offsetY += offsetY;
1080	      var width = this.resizeContentPos.width + this.resizeContentPos.offsetX;
1081	      var height = this.resizeContentPos.height + this.resizeContentPos.offsetY;
1082	      var scrollWidth = this.isTargetDocumentBody() ? document.documentElement.scrollWidth : this.getTargetContainer().scrollWidth;
1083
1084	      if (this.resizeContentPos.left + width + this.resizeContentOffset >= scrollWidth) {
1085	        width = scrollWidth - this.resizeContentPos.left - this.resizeContentOffset;
1086	      }
1087
1088	      width = Math.max(width, this.getMinWidth());
1089	      height = Math.max(height, this.getMinHeight());
1090
1091	      if (this.getMaxWidth() !== null) {
1092	        width = Math.min(width, this.getMaxWidth());
1093	      }
1094
1095	      if (this.getMaxHeight() !== null) {
1096	        height = Math.min(height, this.getMaxHeight());
1097	      }
1098
1099	      this.setWidth(width);
1100	      this.setHeight(height);
1101	    }
1102	  }, {
1103	    key: "isTopAngle",
1104	    value: function isTopAngle() {
1105	      return this.angle !== null && this.angle.position === 'top';
1106	    }
1107	  }, {
1108	    key: "isBottomAngle",
1109	    value: function isBottomAngle() {
1110	      return this.angle !== null && this.angle.position === 'bottom';
1111	    }
1112	  }, {
1113	    key: "isTopOrBottomAngle",
1114	    value: function isTopOrBottomAngle() {
1115	      return this.angle !== null && (this.angle.position === 'top' || this.angle.position === 'bottom');
1116	    }
1117	    /**
1118	     * @private
1119	     */
1120
1121	  }, {
1122	    key: "getAngleHeight",
1123	    value: function getAngleHeight() {
1124	      return this.isTopOrBottomAngle() ? Popup.getOption('angleTopOffset') : 0;
1125	    }
1126	  }, {
1127	    key: "setOffset",
1128	    value: function setOffset(params) {
1129	      if (!main_core.Type.isPlainObject(params)) {
1130	        return;
1131	      }
1132
1133	      if (main_core.Type.isNumber(params.offsetLeft)) {
1134	        this.offsetLeft = params.offsetLeft + Popup.getOption('offsetLeft');
1135	      }
1136
1137	      if (main_core.Type.isNumber(params.offsetTop)) {
1138	        this.offsetTop = params.offsetTop + Popup.getOption('offsetTop');
1139	      }
1140	    }
1141	  }, {
1142	    key: "setTitleBar",
1143	    value: function setTitleBar(params) {
1144	      if (!this.titleBar) {
1145	        return;
1146	      }
1147
1148	      if (babelHelpers.typeof(params) === 'object' && main_core.Type.isDomNode(params.content)) {
1149	        this.titleBar.innerHTML = '';
1150	        this.titleBar.appendChild(params.content);
1151	      } else if (typeof params === 'string') {
1152	        this.titleBar.innerHTML = '';
1153	        this.titleBar.appendChild(main_core.Dom.create('span', {
1154	          props: {
1155	            className: 'popup-window-titlebar-text'
1156	          },
1157	          text: params
1158	        }));
1159	      }
1160
1161	      if (this.params.draggable) {
1162	        this.titleBar.style.cursor = 'move';
1163	        main_core.Event.bind(this.titleBar, 'mousedown', this.onTitleMouseDown);
1164	      }
1165	    }
1166	  }, {
1167	    key: "setClosingByEsc",
1168	    value: function setClosingByEsc(enable) {
1169	      enable = main_core.Type.isBoolean(enable) ? enable : true;
1170
1171	      if (enable) {
1172	        this.closeByEsc = true;
1173	        this.bindClosingByEsc();
1174	      } else {
1175	        this.closeByEsc = false;
1176	        this.unbindClosingByEsc();
1177	      }
1178	    }
1179	    /**
1180	     * @private
1181	     */
1182
1183	  }, {
1184	    key: "bindClosingByEsc",
1185	    value: function bindClosingByEsc() {
1186	      if (this.closeByEsc && !this.isCloseByEscBinded) {
1187	        main_core.Event.bind(document, 'keyup', this.handleDocumentKeyUp);
1188	        this.isCloseByEscBinded = true;
1189	      }
1190	    }
1191	    /**
1192	     * @private
1193	     */
1194
1195	  }, {
1196	    key: "unbindClosingByEsc",
1197	    value: function unbindClosingByEsc() {
1198	      if (this.isCloseByEscBinded) {
1199	        main_core.Event.unbind(document, 'keyup', this.handleDocumentKeyUp);
1200	        this.isCloseByEscBinded = false;
1201	      }
1202	    }
1203	  }, {
1204	    key: "setAutoHide",
1205	    value: function setAutoHide(enable) {
1206	      enable = main_core.Type.isBoolean(enable) ? enable : true;
1207
1208	      if (enable) {
1209	        this.autoHide = true;
1210	        this.bindAutoHide();
1211	      } else {
1212	        this.autoHide = false;
1213	        this.unbindAutoHide();
1214	      }
1215	    }
1216	    /**
1217	     * @private
1218	     */
1219
1220	  }, {
1221	    key: "bindAutoHide",
1222	    value: function bindAutoHide() {
1223	      if (this.autoHide && !this.isAutoHideBinded && this.isShown()) {
1224	        this.isAutoHideBinded = true;
1225
1226	        if (this.isCompatibleMode()) {
1227	          main_core.Event.bind(this.getPopupContainer(), 'click', this.handleContainerClick);
1228	        }
1229
1230	        if (this.overlay && this.overlay.element) {
1231	          main_core.Event.bind(this.overlay.element, 'click', this.handleOverlayClick);
1232	        } else {
1233	          if (this.isCompatibleMode()) {
1234	            main_core.Event.bind(document, 'click', this.handleAutoHide);
1235	          } else {
1236	            document.addEventListener('click', this.handleAutoHide, true);
1237	          }
1238	        }
1239	      }
1240	    }
1241	    /**
1242	     * @private
1243	     */
1244
1245	  }, {
1246	    key: "unbindAutoHide",
1247	    value: function unbindAutoHide() {
1248	      if (this.isAutoHideBinded) {
1249	        this.isAutoHideBinded = false;
1250
1251	        if (this.isCompatibleMode()) {
1252	          main_core.Event.unbind(this.getPopupContainer(), 'click', this.handleContainerClick);
1253	        }
1254
1255	        if (this.overlay && this.overlay.element) {
1256	          main_core.Event.unbind(this.overlay.element, 'click', this.handleOverlayClick);
1257	        } else {
1258	          if (this.isCompatibleMode()) {
1259	            main_core.Event.unbind(document, 'click', this.handleAutoHide);
1260	          } else {
1261	            document.removeEventListener('click', this.handleAutoHide, true);
1262	          }
1263	        }
1264	      }
1265	    }
1266	    /**
1267	     * @private
1268	     */
1269
1270	  }, {
1271	    key: "handleAutoHide",
1272	    value: function handleAutoHide(event) {
1273	      if (this.isDestroyed()) {
1274	        return;
1275	      }
1276
1277	      if (this.autoHideHandler !== null) {
1278	        if (this.autoHideHandler(event)) {
1279	          this._tryCloseByEvent(event);
1280	        }
1281	      } else if (event.target !== this.getPopupContainer() && !this.getPopupContainer().contains(event.target)) {
1282	        this._tryCloseByEvent(event);
1283	      }
1284	    }
1285	    /**
1286	     * @private
1287	     */
1288
1289	  }, {
1290	    key: "_tryCloseByEvent",
1291	    value: function _tryCloseByEvent(event) {
1292	      var _this2 = this;
1293
1294	      if (this.isCompatibleMode()) {
1295	        this.tryCloseByEvent(event);
1296	      } else {
1297	        setTimeout(function () {
1298	          _this2.tryCloseByEvent(event);
1299	        }, 0);
1300	      }
1301	    }
1302	    /**
1303	     * @private
1304	     */
1305
1306	  }, {
1307	    key: "tryCloseByEvent",
1308	    value: function tryCloseByEvent(event) {
1309	      if (event.button === 0) {
1310	        this.close();
1311	      }
1312	    }
1313	    /**
1314	     * @private
1315	     */
1316
1317	  }, {
1318	    key: "handleOverlayClick",
1319	    value: function handleOverlayClick(event) {
1320	      this.tryCloseByEvent(event);
1321	      event.stopPropagation();
1322	    }
1323	  }, {
1324	    key: "setOverlay",
1325	    value: function setOverlay(params) {
1326	      if (this.overlay === null) {
1327	        this.overlay = {
1328	          element: main_core.Tag.render(_templateObject8(), this.getId())
1329	        };
1330	        this.resizeOverlay();
1331	        this.targetContainer.appendChild(this.overlay.element);
1332	        this.getZIndexComponent().setOverlay(this.overlay.element);
1333	      }
1334
1335	      if (params && main_core.Type.isNumber(params.opacity) && params.opacity >= 0 && params.opacity <= 100) {
1336	        this.overlay.element.style.opacity = parseFloat(params.opacity / 100).toPrecision(3);
1337	      }
1338
1339	      if (params && params.backgroundColor) {
1340	        this.overlay.element.style.backgroundColor = params.backgroundColor;
1341	      }
1342	    }
1343	  }, {
1344	    key: "removeOverlay",
1345	    value: function removeOverlay() {
1346	      if (this.overlay !== null && this.overlay.element !== null) {
1347	        main_core.Dom.remove(this.overlay.element);
1348	        this.getZIndexComponent().setOverlay(null);
1349	      }
1350
1351	      if (this.overlayTimeout) {
1352	        clearInterval(this.overlayTimeout);
1353	        this.overlayTimeout = null;
1354	      }
1355
1356	      this.overlay = null;
1357	    }
1358	  }, {
1359	    key: "hideOverlay",
1360	    value: function hideOverlay() {
1361	      if (this.overlay !== null && this.overlay.element !== null) {
1362	        if (this.overlayTimeout) {
1363	          clearInterval(this.overlayTimeout);
1364	          this.overlayTimeout = null;
1365	        }
1366
1367	        this.overlay.element.style.display = 'none';
1368	      }
1369	    }
1370	  }, {
1371	    key: "showOverlay",
1372	    value: function showOverlay() {
1373	      var _this3 = this;
1374
1375	      if (this.overlay !== null && this.overlay.element !== null) {
1376	        this.overlay.element.style.display = 'block';
1377	        var popupHeight = this.getPopupContainer().offsetHeight;
1378	        this.overlayTimeout = setInterval(function () {
1379	          if (popupHeight !== _this3.getPopupContainer().offsetHeight) {
1380	            _this3.resizeOverlay();
1381
1382	            popupHeight = _this3.getPopupContainer().offsetHeight;
1383	          }
1384	        }, 1000);
1385	      }
1386	    }
1387	  }, {
1388	    key: "resizeOverlay",
1389	    value: function resizeOverlay() {
1390	      if (this.overlay !== null && this.overlay.element !== null) {
1391	        var scrollWidth;
1392	        var scrollHeight;
1393
1394	        if (this.isTargetDocumentBody()) {
1395	          scrollWidth = document.documentElement.scrollWidth;
1396	          scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
1397	        } else {
1398	          scrollWidth = this.getTargetContainer().scrollWidth;
1399	          scrollHeight = this.getTargetContainer().scrollHeight;
1400	        }
1401
1402	        this.overlay.element.style.width = scrollWidth + 'px';
1403	        this.overlay.element.style.height = scrollHeight + 'px';
1404	      }
1405	    }
1406	  }, {
1407	    key: "getZindex",
1408	    value: function getZindex() {
1409	      return this.getZIndexComponent().getZIndex();
1410	    }
1411	  }, {
1412	    key: "getZIndexComponent",
1413	    value: function getZIndexComponent() {
1414	      return this.zIndexComponent;
1415	    }
1416	  }, {
1417	    key: "show",
1418	    value: function show() {
1419	      var _this4 = this;
1420
1421	      if (this.isShown() || this.isDestroyed()) {
1422	        return;
1423	      }
1424
1425	      if (!this.firstShow) {
1426	        this.emit('onFirstShow', new main_core_events.BaseEvent({
1427	          compatData: [this]
1428	        }));
1429	        this.firstShow = true;
1430	      }
1431
1432	      this.emit('onShow', new main_core_events.BaseEvent({
1433	        compatData: [this]
1434	      }));
1435	      this.showOverlay();
1436	      this.getPopupContainer().style.display = 'block';
1437
1438	      if (this.shouldFrontOnShow()) {
1439	        this.bringToFront();
1440	      }
1441
1442	      this.adjustPosition();
1443	      this.animateOpening(function () {
1444	        if (_this4.isDestroyed()) {
1445	          return;
1446	        }
1447
1448	        main_core.Dom.removeClass(_this4.getPopupContainer(), _this4.animationShowClassName);
1449
1450	        _this4.emit('onAfterShow', new main_core_events.BaseEvent({
1451	          compatData: [_this4]
1452	        }));
1453	      });
1454	      this.bindClosingByEsc();
1455
1456	      if (this.isCompatibleMode()) {
1457	        setTimeout(function () {
1458	          _this4.bindAutoHide();
1459	        }, 100);
1460	      } else {
1461	        this.bindAutoHide();
1462	      }
1463	    }
1464	  }, {
1465	    key: "close",
1466	    value: function close() {
1467	      var _this5 = this;
1468
1469	      if (this.isDestroyed() || !this.isShown()) {
1470	        return;
1471	      }
1472
1473	      this.emit('onClose', new main_core_events.BaseEvent({
1474	        compatData: [this]
1475	      }));
1476
1477	      if (this.isDestroyed()) {
1478	        return;
1479	      }
1480
1481	      this.animateClosing(function () {
1482	        if (_this5.isDestroyed()) {
1483	          return;
1484	        }
1485
1486	        _this5.hideOverlay();
1487
1488	        _this5.getPopupContainer().style.display = 'none';
1489	        main_core.Dom.removeClass(_this5.getPopupContainer(), _this5.animationCloseClassName);
1490
1491	        _this5.unbindClosingByEsc();
1492
1493	        if (_this5.isCompatibleMode()) {
1494	          setTimeout(function () {
1495	            _this5.unbindAutoHide();
1496	          }, 0);
1497	        } else {
1498	          _this5.unbindAutoHide();
1499	        }
1500
1501	        _this5.emit('onAfterClose', new main_core_events.BaseEvent({
1502	          compatData: [_this5]
1503	        }));
1504
1505	        if (!_this5.isCacheable()) {
1506	          _this5.destroy();
1507	        }
1508	      });
1509	    }
1510	  }, {
1511	    key: "bringToFront",
1512	    value: function bringToFront() {
1513	      if (this.isShown()) {
1514	        main_core_zIndexManager.ZIndexManager.bringToFront(this.getPopupContainer());
1515	      }
1516	    }
1517	  }, {
1518	    key: "toggle",
1519	    value: function toggle() {
1520	      this.isShown() ? this.close() : this.show();
1521	    }
1522	    /**
1523	     *
1524	     * @private
1525	     */
1526
1527	  }, {
1528	    key: "animateOpening",
1529	    value: function animateOpening(callback) {
1530	      main_core.Dom.removeClass(this.getPopupContainer(), this.animationCloseClassName);
1531
1532	      if (this.animationShowClassName !== null) {
1533	        main_core.Dom.addClass(this.getPopupContainer(), this.animationShowClassName);
1534
1535	        if (this.animationCloseEventType !== null) {
1536	          var eventName = this.animationCloseEventType + 'end';
1537	          this.getPopupContainer().addEventListener(eventName, function handleTransitionEnd() {
1538	            this.removeEventListener(eventName, handleTransitionEnd);
1539	            callback();
1540	          });
1541	        } else {
1542	          callback();
1543	        }
1544	      } else {
1545	        callback();
1546	      }
1547	    }
1548	    /**
1549	     * @private
1550	     */
1551
1552	  }, {
1553	    key: "animateClosing",
1554	    value: function animateClosing(callback) {
1555	      main_core.Dom.removeClass(this.getPopupContainer(), this.animationShowClassName);
1556
1557	      if (this.animationCloseClassName !== null) {
1558	        main_core.Dom.addClass(this.getPopupContainer(), this.animationCloseClassName);
1559
1560	        if (this.animationCloseEventType !== null) {
1561	          var eventName = this.animationCloseEventType + 'end';
1562	          this.getPopupContainer().addEventListener(eventName, function handleTransitionEnd() {
1563	            this.removeEventListener(eventName, handleTransitionEnd);
1564	            callback();
1565	          });
1566	        } else {
1567	          callback();
1568	        }
1569	      } else {
1570	        callback();
1571	      }
1572	    }
1573	  }, {
1574	    key: "setAnimation",
1575	    value: function setAnimation(options) {
1576	      if (main_core.Type.isPlainObject(options)) {
1577	        this.animationShowClassName = main_core.Type.isStringFilled(options.showClassName) ? options.showClassName : null;
1578	        this.animationCloseClassName = main_core.Type.isStringFilled(options.closeClassName) ? options.closeClassName : null;
1579	        this.animationCloseEventType = options.closeAnimationType === 'animation' || options.closeAnimationType === 'transition' ? options.closeAnimationType : null;
1580	      } else if (main_core.Type.isStringFilled(options)) {
1581	        var animationName = options;
1582
1583	        if (animationName === 'fading') {
1584	          this.animationShowClassName = 'popup-window-show-animation-opacity';
1585	          this.animationCloseClassName = 'popup-window-close-animation-opacity';
1586	          this.animationCloseEventType = 'animation';
1587	        } else if (animationName === 'fading-slide') {
1588	          this.animationShowClassName = 'popup-window-show-animation-opacity-transform';
1589	          this.animationCloseClassName = 'popup-window-close-animation-opacity';
1590	          this.animationCloseEventType = 'animation';
1591	        } else if (animationName === 'scale') {
1592	          this.animationShowClassName = 'popup-window-show-animation-scale';
1593	          this.animationCloseClassName = 'popup-window-close-animation-opacity';
1594	          this.animationCloseEventType = 'animation';
1595	        }
1596	      } else if (options === false || options === null) {
1597	        this.animationShowClassName = null;
1598	        this.animationCloseClassName = null;
1599	        this.animationCloseEventType = null;
1600	      }
1601	    }
1602	  }, {
1603	    key: "isShown",
1604	    value: function isShown() {
1605	      return !this.isDestroyed() && this.getPopupContainer().style.display === 'block';
1606	    }
1607	  }, {
1608	    key: "destroy",
1609	    value: function destroy() {
1610	      var _this6 = this;
1611
1612	      if (this.destroyed) {
1613	        return;
1614	      }
1615
1616	      this.destroyed = true;
1617	      this.emit('onDestroy', new main_core_events.BaseEvent({
1618	        compatData: [this]
1619	      }));
1620	      this.unbindClosingByEsc();
1621
1622	      if (this.isCompatibleMode()) {
1623	        setTimeout(function () {
1624	          _this6.unbindAutoHide();
1625	        }, 0);
1626	      } else {
1627	        this.unbindAutoHide();
1628	      }
1629
1630	      main_core.Event.unbindAll(this);
1631	      main_core.Event.unbind(document, 'mousemove', this.handleDocumentMouseMove);
1632	      main_core.Event.unbind(document, 'mouseup', this.handleDocumentMouseUp);
1633	      main_core.Event.unbind(window, 'resize', this.handleResizeWindow);
1634	      this.removeOverlay();
1635	      main_core_zIndexManager.ZIndexManager.unregister(this.popupContainer);
1636	      this.zIndexComponent = null;
1637	      main_core.Dom.remove(this.popupContainer);
1638	      this.popupContainer = null;
1639	      this.contentContainer = null;
1640	      this.closeIcon = null;
1641	      this.titleBar = null;
1642	      this.buttonsContainer = null;
1643	      this.angle = null;
1644	      this.resizeIcon = null;
1645	    }
1646	  }, {
1647	    key: "adjustPosition",
1648	    value: function adjustPosition(bindOptions) {
1649	      if (bindOptions && babelHelpers.typeof(bindOptions) === 'object') {
1650	        this.bindOptions = bindOptions;
1651	      }
1652
1653	      var bindElementPos = this.getBindElementPos(this.bindElement);
1654
1655	      if (!this.bindOptions.forceBindPosition && this.bindElementPos !== null && bindElementPos.top === this.bindElementPos.top && bindElementPos.left === this.bindElementPos.left) {
1656	        return;
1657	      }
1658
1659	      this.bindElementPos = bindElementPos;
1660	      var windowSize = bindElementPos.windowSize ? bindElementPos.windowSize : this.getWindowSize();
1661	      var windowScroll = bindElementPos.windowScroll ? bindElementPos.windowScroll : this.getWindowScroll();
1662	      var popupWidth = bindElementPos.popupWidth ? bindElementPos.popupWidth : this.popupContainer.offsetWidth;
1663	      var popupHeight = bindElementPos.popupHeight ? bindElementPos.popupHeight : this.popupContainer.offsetHeight;
1664	      var angleTopOffset = Popup.getOption('angleTopOffset');
1665	      var left = this.bindElementPos.left + this.offsetLeft - (this.isTopOrBottomAngle() ? Popup.getOption('angleLeftOffset') : 0);
1666
1667	      if (!this.bindOptions.forceLeft && left + popupWidth + this.bordersWidth >= windowSize.innerWidth + windowScroll.scrollLeft && windowSize.innerWidth + windowScroll.scrollLeft - popupWidth - this.bordersWidth > 0) {
1668	        var bindLeft = left;
1669	        left = windowSize.innerWidth + windowScroll.scrollLeft - popupWidth - this.bordersWidth;
1670
1671	        if (this.isTopOrBottomAngle()) {
1672	          this.setAngle({
1673	            offset: bindLeft - left + this.angle.defaultOffset
1674	          });
1675	        }
1676	      } else if (this.isTopOrBottomAngle()) {
1677	        this.setAngle({
1678	          offset: this.angle.defaultOffset + (left < 0 ? left : 0)
1679	        });
1680	      }
1681
1682	      if (left < 0) {
1683	        left = 0;
1684	      }
1685
1686	      var top = 0;
1687
1688	      if (this.bindOptions.position && this.bindOptions.position === 'top') {
1689	        top = this.bindElementPos.top - popupHeight - this.offsetTop - (this.isBottomAngle() ? angleTopOffset : 0);
1690
1691	        if (top < 0 || !this.bindOptions.forceTop && top < windowScroll.scrollTop) {
1692	          top = this.bindElementPos.bottom + this.offsetTop;
1693
1694	          if (this.angle !== null) {
1695	            top += angleTopOffset;
1696	            this.setAngle({
1697	              position: 'top'
1698	            });
1699	          }
1700	        } else if (this.isTopAngle()) {
1701	          top = top - angleTopOffset + Popup.getOption('positionTopXOffset');
1702	          this.setAngle({
1703	            position: 'bottom'
1704	          });
1705	        } else {
1706	          top += Popup.getOption('positionTopXOffset');
1707	        }
1708	      } else {
1709	        top = this.bindElementPos.bottom + this.offsetTop + this.getAngleHeight();
1710
1711	        if (!this.bindOptions.forceTop && top + popupHeight >
1711 windowSize.innerHeight + windowScroll.scrollTop && this.bindElementPos.top - popupHeight - this.getAngleHeight() >= 0) //Can we place the PopupWindow above the bindElement?
1712	          {
1713	            //The PopupWindow doesn't place below the bindElement. We should place it above.
1714	            top = this.bindElementPos.top - popupHeight;
1715
1716	            if (this.isTopOrBottomAngle()) {
1717	              top -= angleTopOffset;
1718	              this.setAngle({
1719	                position: 'bottom'
1720	              });
1721	            }
1722
1723	            top += Popup.getOption('positionTopXOffset');
1724	          } else if (this.isBottomAngle()) {
1725	          top += angleTopOffset;
1726	          this.setAngle({
1727	            position: 'top'
1728	          });
1729	        }
1730	      }
1731
1732	      if (top < 0) {
1733	        top = 0;
1734	      }
1735
1736	      main_core.Dom.adjust(this.popupContainer, {
1737	        style: {
1738	          top: top + 'px',
1739	          left: left + 'px'
1740	        }
1741	      });
1742	    }
1743	  }, {
1744	    key: "enterFullScreen",
1745	    value: function enterFullScreen() {
1746	      if (Popup.fullscreenStatus) {
1747	        if (document.cancelFullScreen) {
1748	          document.cancelFullScreen();
1749	        } else if (document.mozCancelFullScreen) {
1750	          document.mozCancelFullScreen();
1751	        } else if (document.webkitCancelFullScreen) {
1752	          document.webkitCancelFullScreen();
1753	        }
1754	      } else {
1755	        if (this.contentContainer.requestFullScreen) {
1756	          this.contentContainer.requestFullScreen();
1757	          main_core.Event.bind(window, 'fullscreenchange', this.handleFullScreen);
1758	        } else if (this.contentContainer.mozRequestFullScreen) {
1759	          this.contentContainer.mozRequestFullScreen();
1760	          main_core.Event.bind(window, 'mozfullscreenchange', this.handleFullScreen);
1761	        } else if (this.contentContainer.webkitRequestFullScreen) {
1762	          this.contentContainer.webkitRequestFullScreen();
1763	          main_core.Event.bind(window, 'webkitfullscreenchange', this.handleFullScreen);
1764	        } else {
1765	          console.log('fullscreen mode is not supported');
1766	        }
1767	      }
1768	    }
1769	    /**
1770	     * @private
1771	     */
1772
1773	  }, {
1774	    key: "handleFullScreen",
1775	    value: function handleFullScreen(event) {
1776	      if (Popup.fullscreenStatus) {
1777	        main_core.Event.unbind(window, 'fullscreenchange', this.handleFullScreen);
1778	        main_core.Event.unbind(window, 'webkitfullscreenchange', this.handleFullScreen);
1779	        main_core.Event.unbind(window, 'mozfullscreenchange', this.handleFullScreen);
1780	        Popup.fullscreenStatus = false;
1781
1782	        if (!this.isDestroyed()) {
1783	          main_core.Dom.removeClass(this.contentContainer, 'popup-window-fullscreen');
1784	          this.emit('onFullscreenLeave');
1785	          this.adjustPosition();
1786	        }
1787	      } else {
1788	        Popup.fullscreenStatus = true;
1789
1790	        if (!this.isDestroyed()) {
1791	          main_core.Dom.addClass(this.contentContainer, 'popup-window-fullscreen');
1792	          this.emit('onFullscreenEnter');
1793	          this.adjustPosition();
1794	        }
1795	      }
1796	    }
1797	    /**
1798	     * @private
1799	     */
1800
1801	  }, {
1802	    key: "handleCloseIconClick",
1803	    value: function handleCloseIconClick(event) {
1804	      this.tryCloseByEvent(event);
1805	      event.stopPropagation();
1806	    }
1807	    /**
1808	     * @private
1809	     */
1810
1811	  }, {
1812	    key: "handleContainerClick",
1813	    value: function handleContainerClick(event) {
1814	      event.stopPropagation();
1815	    }
1816	    /**
1817	     * @private
1818	     */
1819
1820	  }, {
1821	    key: "handleDocumentKeyUp",
1822	    value: function handleDocumentKeyUp(event) {
1823	      var _this7 = this;
1824
1825	      if (event.keyCode === 27) {
1826	        checkEscPressed(this.getZindex(), function () {
1827	          _this7.close();
1828	        });
1829	      }
1830	    }
1831	    /**
1832	     * @private
1833	     */
1834
1835	  }, {
1836	    key: "handleResizeWindow",
1837	    value: function handleResizeWindow() {
1838	      if (this.isShown()) {
1839	        this.adjustPosition();
1840
1841	        if (this.overlay !== null) {
1842	          this.resizeOverlay();
1843	        }
1844	      }
1845	    }
1846	    /**
1847	     * @private
1848	     */
1849
1850	  }, {
1851	    key: "handleMove",
1852	    value: function handleMove(offsetX, offsetY, pageX, pageY) {
1853	      var left = parseInt(this.popupContainer.style.left) + offsetX;
1854	      var top = parseInt(this.popupContainer.style.top) + offsetY;
1855
1856	      if (babelHelpers.typeof(this.params.draggable) === 'object' && this.params.draggable.restrict) {
1857	        //Left side
1858	        if (left < 0) {
1859	          left = 0;
1860	        }
1861
1862	        var scrollWidth;
1863	        var scrollHeight;
1864
1865	        if (this.isTargetDocumentBody()) {
1866	          scrollWidth = document.documentElement.scrollWidth;
1867	          scrollHeight = document.documentElement.scrollHeight;
1868	        } else {
1869	          scrollWidth = this.getTargetContainer().scrollWidth;
1870	          scrollHeight = this.getTargetContainer().scrollHeight;
1871	        } //Right side
1872
1873
1874	        var floatWidth = this.popupContainer.offsetWidth;
1875	        var floatHeight = this.popupContainer.offsetHeight;
1876
1877	        if (left > scrollWidth - floatWidth) {
1878	          left = scrollWidth - floatWidth;
1879	        }
1880
1881	        if (top > scrollHeight - floatHeight) {
1882	          top = scrollHeight - floatHeight;
1883	        } //Top side
1884
1885
1886	        if (top < 0) {
1887	          top = 0;
1888	        }
1889	      }
1890
1891	      this.popupContainer.style.left = left + 'px';
1892	      this.popupContainer.style.top = top + 'px';
1893	    }
1894	    /**
1895	     * @private
1896	     */
1897
1898	  }, {
1899	    key: "_startDrag",
1900	    value: function _startDrag(event, options) {
1901	      options = options || {};
1902
1903	      if (main_core.Type.isStringFilled(options.cursor)) {
1904	        this.dragOptions.cursor = options.cursor;
1905	      }
1906
1907	      if (main_core.Type.isStringFilled(options.eventName)) {
1908	        this.dragOptions.eventName = options.eventName;
1909	      }
1910
1911	      if (main_core.Type.isFunction(options.callback)) {
1912	        this.dragOptions.callback = options.callback;
1913	      }
1914
1915	      this.dragPageX = event.pageX;
1916	      this.dragPageY = event.pageY;
1917	      this.dragged = false;
1918	      main_core.Event.bind(document, 'mousemove', this.handleDocumentMouseMove);
1919	      main_core.Event.bind(document, 'mouseup', this.handleDocumentMouseUp);
1920
1921	      if (document.body.setCapture) {
1922	        document.body.setCapture();
1923	      }
1924
1925	      document.body.ondrag = function () {
1926	        return false;
1927	      };
1928
1929	      document.body.onselectstart = function () {
1930	        return false;
1931	      };
1932
1933	      document.body.style.cursor = this.dragOptions.cursor;
1934	      document.body.style.MozUserSelect = 'none';
1935	      this.popupContainer.style.MozUserSelect = 'none';
1936
1937	      if (this.shouldFrontOnShow()) {
1938	        this.bringToFront();
1939	      }
1940
1941	      event.preventDefault();
1942	    }
1943	    /**
1944	     * @private
1945	     */
1946
1947	  }, {
1948	    key: "handleDocumentMouseMove",
1949	    value: function handleDocumentMouseMove(event) {
1950	      if (this.dragPageX === event.pageX && this.dragPageY === event.pageY) {
1951	        return;
1952	      }
1953
1954	      this.dragOptions.callback(event.pageX - this.dragPageX, event.pageY - this.dragPageY, event.pageX, event.pageY);
1955	      this.dragPageX = event.pageX;
1956	      this.dragPageY = event.pageY;
1957
1958	      if (!this.dragged) {
1959	        this.emit("on".concat(this.dragOptions.eventName, "Start"), new main_core_events.BaseEvent({
1960	          compatData: [this]
1961	        }));
1962	        this.dragged = true;
1963	      }
1964
1965	      this.emit("on".concat(this.dragOptions.eventName), new main_core_events.BaseEvent({
1966	        compatData: [this]
1967	      }));
1968	    }
1969	    /**
1970	     * @private
1971	     */
1972
1973	  }, {
1974	    key: "handleDocumentMouseUp",
1975	    value: function handleDocumentMouseUp(event) {
1976	      if (document.body.releaseCapture) {
1977	        document.body.releaseCapture();
1978	      }
1979
1980	      main_core.Event.unbind(document, 'mousemove', this.handleDocumentMouseMove);
1981	      main_core.Event.unbind(document, 'mouseup', this.handleDocumentMouseUp);
1982	      document.body.ondrag = null;
1983	      document.body.onselectstart = null;
1984	      document.body.style.cursor = '';
1985	      document.body.style.MozUserSelect = '';
1986	      this.popupContainer.style.MozUserSelect = '';
1987	      this.emit("on".concat(this.dragOptions.eventName, "End"), new main_core_events.BaseEvent({
1988	        compatData: [this]
1989	      }));
1990	      this.dragged = false;
1991	      event.preventDefault();
1992	    }
1993	  }]);
1994	  return Popup;
1995	}(main_core_events.EventEmitter);
1996
1997	babelHelpers.defineProperty(Popup, "options", {});
1998	babelHelpers.defineProperty(Popup, "defaultOptions", {
1999	  //left offset for popup about target
2000	  angleLeftOffset: 40,
2001	  //when popup position is 'top' offset distance between popup body and target node
2002	  positionTopXOffset: -11,
2003	  //offset distance between popup body and target node if use angle, sum with positionTopXOffset
2004	  angleTopOffset: 10,
2005	  popupZindex: 1000,
2006	  popupOverlayZindex: 1100,
2007	  angleMinLeft: 10,
2008	  angleMaxLeft: 30,
2009	  angleMinRight: 10,
2010	  angleMaxRight: 30,
2011	  angleMinBottom: 23,
2012	  angleMaxBottom: 25,
2013	  angleMinTop: 23,
2014	  angleMaxTop: 25,
2015	  offsetLeft: 0,
2016	  offsetTop: 0
2017	});
2018	var escCallbackIndex = -1;
2019	var escCallback = null;
2020
2021	function checkEscPressed(zIndex, callback) {
2022	  if (zIndex === false) {
2023	    if (escCallback && escCallback.length > 0) {
2024	      for (var i = 0; i < escCallback.length; i++) {
2025	        escCallback[i]();
2026	      }
2027
2028	      escCallback = null;
2029	      escCallbackIndex = -1;
2030	    }
2031	  } else {
2032	    if (escCallback === null) {
2033	      escCallback = [];
2034	      escCallbackIndex = -1;
2035	      setTimeout(function () {
2036	        checkEscPressed(false);
2037	      }, 10);
2038	    }
2039
2040	    if (zIndex > escCallbackIndex) {
2041	      escCallbackIndex = zIndex;
2042	      escCallback = [callback];
2043	    } else if (zIndex === escCallbackIndex) {
2044	      escCallback.push(callback);
2045	    }
2046	  }
2047	}
2048
2049	var PopupManager = /*#__PURE__*/function () {
2050	  function PopupManager() {
2051	    babelHelpers.classCallCheck(this, PopupManager);
2052	    throw new Error('You cannot make an instance of PopupManager.');
2053	  }
2054
2055	  babelHelpers.createClass(PopupManager, null, [{
2056	    key: "create",
2057	    value: function create(options) {
2058	      var _arguments = Array.prototype.slice.call(arguments),
2059	          popupId = _arguments[0],
2060	          bindElement = _arguments[1],
2061	          params = _arguments[2]; //compatible arguments
2062
2063
2064	      var id = popupId;
2065	      var compatMode = true;
2066
2067	      if (main_core.Type.isPlainObject(popupId) && !bindElement && !params) {
2068	        compatMode = false;
2069	        id = popupId.id;
2070
2071	        if (!main_core.Type.isStringFilled(id)) {
2072	          throw new Error('BX.Main.Popup.Manager: "id" parameter is required.');
2073	        }
2074	      }
2075
2076	      var popupWindow = this.getPopupById(id);
2077
2078	      if (popupWindow === null) {
2079	        popupWindow = compatMode ? new Popup(popupId, bindElement, params) : new Popup(options);
2080	        popupWindow.subscribe('onShow', this.handlePopupShow);
2081	        popupWindow.subscribe('onClose', this.handlePopupClose);
2082	      }
2083
2084	      return popupWindow;
2085	    }
2086	    /**
2087	     * @private
2088	     */
2089
2090	  }, {
2091	    key: "handleOnAfterInit",
2092	    value: function handleOnAfterInit(event) {
2093	      event.getTarget().subscribeOnce('onDestroy', this.handlePopupDestroy);
2094
2095	      this._popups.forEach(function (popup) {
2096	        if (popup.getId() === event.getTarget().getId()) {
2097	          console.error("Duplicate id (".concat(popup.getId(), ") for the BX.Main.Popup instance."));
2098	        }
2099	      });
2100
2101	      this._popups.push(event.getTarget());
2102	    }
2103	    /**
2104	     * @private
2105	     */
2106
2107	  }, {
2108	    key: "handlePopupDestroy",
2109	    value: function handlePopupDestroy(event) {
2110	      this._popups = this._popups.filter(function (popup) {
2111	        return popup !== event.getTarget();
2112	      });
2113	    }
2114	    /**
2115	     * @private
2116	     */
2117
2118	  }, {
2119	    key: "handlePopupShow",
2120	    value: function handlePopupShow(event) {
2121	      if (this._currentPopup !== null) {
2122	        this._currentPopup.close();
2123	      }
2124
2125	      this._currentPopup = event.getTarget();
2126	    }
2127	    /**
2128	     * @private
2129	     */
2130
2131	  }, {
2132	    key: "handlePopupClose",
2133	    value: function handlePopupClose() {
2134	      this._currentPopup = null;
2135	    }
2136	  }, {
2137	    key: "getCurrentPopup",
2138	    value: function getCurrentPopup() {
2139	      return this._currentPopup;
2140	    }
2141	  }, {
2142	    key: "isPopupExists",
2143	    value: function isPopupExists(id) {
2144	      return this.getPopupById(id) !== null;
2145	    }
2146	  }, {
2147	    key: "isAnyPopupShown",
2148	    value: function isAnyPopupShown() {
2149	      for (var i = 0, length = this._popups.length; i < length; i++) {
2150	        if (this._popups[i].isShown()) {
2151	          return true;
2152	        }
2153	      }
2154
2155	      return false;
2156	    }
2157	  }, {
2158	    key: "getPopupById",
2159	    value: function getPopupById(id) {
2160	      for (var i = 0; i < this._popups.length; i++) {
2161	        if (this._popups[i].getId() === id) {
2162	          return this._popups[i];
2163	        }
2164	      }
2165
2166	      return null;
2167	    }
2168	  }, {
2169	    key: "getMaxZIndex",
2170	    value: function getMaxZIndex() {
2171	      var zIndex = 0;
2172	      this.getPopups().forEach(function (popup) {
2173	        zIndex = Math.max(zIndex, popup.getZindex());
2174	      });
2175	      return zIndex;
2176	    }
2177	  }, {
2178	    key: "getPopups",
2179	    value: function getPopups() {
2180	      return this._popups;
2181	    }
2182	  }]);
2183	  return PopupManager;
2184	}();
2185
2186	babelHelpers.defineProperty(PopupManager, "_popups", []);
2187	babelHelpers.defineProperty(PopupManager, "_currentPopup", null);
2188	PopupManager.handlePopupDestroy = PopupManager.handlePopupDestroy.bind(PopupManager);
2189	PopupManager.handlePopupShow = PopupManager.handlePopupShow.bind(PopupManager);
2190	PopupManager.handlePopupClose = PopupManager.handlePopupClose.bind(PopupManager);
2191	PopupManager.handleOnAfterInit = PopupManager.handleOnAfterInit.bind(PopupManager);
2192	main_core_events.EventEmitter.subscribe('BX.Main.Popup:onAfterInit', PopupManager.handleOnAfterInit);
2193
2194	function _templateObject$1() {
2195	  var data = babelHelpers.taggedTemplateLiteral(["<span class=\"popup-window-delimiter\">"]);
2196
2197	  _templateObject$1 = function _templateObject() {
2198	    return data;
2199	  };
2200
2201	  return data;
2202	}
2203	var aliases$1 = {
2204	  onSubMenuShow: {
2205	    namespace: 'BX.Main.Menu.Item',
2206	    eventName: 'SubMenu:onShow'
2207	  },
2208	  onSubMenuClose: {
2209	    namespace: 'BX.Main.Menu.Item',
2210	    eventName: 'SubMenu:onClose'
2211	  }
2212	};
2213	var reEscape = /[<>'"]/g;
2214	var escapeEntities = {
2215	  '<': '&lt;',
2216	  '>': '&gt;',
2217	  "'": '&#39;',
2218	  '"': '&quot;'
2219	};
2220
2221	function encodeSafe(value) {
2222	  if (main_core.Type.isString(value)) {
2223	    return value.replace(reEscape, function (item) {
2224	      return escapeEntities[item];
2225	    });
2226	  }
2227
2228	  return value;
2229	}
2230
2231	main_core_events.EventEmitter.registerAliases(aliases$1);
2232
2233	var MenuItem = /*#__PURE__*/function (_EventEmitter) {
2234	  babelHelpers.inherits(MenuItem, _EventEmitter);
2235
2236	  function MenuItem(options) {
2237	    var _this;
2238
2239	    babelHelpers.classCallCheck(this, MenuItem);
2240	    _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(MenuItem).call(this));
2241
2242	    _this.setEventNamespace('BX.Main.Menu.Item');
2243
2244	    options = options || {};
2245	    _this.options = options;
2246	    _this.id = options.id || main_core.Text.getRandom();
2247	    _this.text = '';
2248	    _this.allowHtml = false;
2249
2250	    if (main_core.Type.isStringFilled(options.html)) {
2251	      _this.text = options.html;
2252	      _this.allowHtml = true;
2253	    } else if (main_core.Type.isStringFilled(options.text)) {
2254	      _this.text = options.text;
2255
2256	      if (_this.text.match(/<[^>]+>/)) {
2257	        console.warn('BX.Main.MenuItem: use "html" option for the html item content.', _this.getText());
2258	      }
2259	    }
2260
2261	    _this.title = main_core.Type.isStringFilled(options.title) ? options.title : '';
2262	    _this.delimiter = options.delimiter === true;
2263	    _this.href = main_core.Type.isStringFilled(options.href) ? options.href : null;
2264	    _this.target = main_core.Type.isStringFilled(options.target) ? options.target : null;
2265	    _this.dataset = main_core.Type.isPlainObject(options.dataset) ? options.dataset : null;
2266	    _this.className = main_core.Type.isStringFilled(options.className) ? options.className : null;
2267	    _this.menuShowDelay = main_core.Type.isNumber(options.menuShowDelay) ? options.menuShowDelay : 300;
2268	    _this.subMenuOffsetX = main_core.Type.isNumber(options.subMenuOffsetX) ? options.subMenuOffsetX : 4;
2269	    _this._items = main_core.Type.isArray(options.items) ? options.items : [];
2270	    _this.disabled = options.disabled === true;
2271	    _this.cacheable = options.cacheable === true;
2272	    /**
2273	     *
2274	     * @type {function|string}
2275	     */
2276
2277	    _this.onclick = main_core.Type.isStringFilled(options.onclick) || main_core.Type.isFunction(options.onclick) ? options.onclick : null;
2278
2279	    _this.subscribeFromOptions(options.events, aliases$1);
2280	    /**
2281	     *
2282	     * @type {Menu}
2283	     */
2284
2285
2286	    _this.menuWindow = null;
2287	    /**
2288	     *
2289	     * @type {Menu}
2290	     */
2291
2292	    _this.subMenuWindow = null;
2293	    /**
2294	     *
2295	     * @type {{item: HTMLElement, text: HTMLElement}}
2296	     */
2297
2298	    _this.layout = {
2299	      item: null,
2300	      text: null
2301	    };
2302
2303	    _this.getLayout(); //compatibility
2304	    //compatibility
2305	    //now use this.options
2306
2307
2308	    _this.events = {};
2309	    _this.items = [];
2310
2311	    for (var property in options) {
2312	      if (options.hasOwnProperty(property) && typeof _this[property] === 'undefined') {
2313	        _this[property] = options[property];
2314	      }
2315	    }
2316
2317	    return _this;
2318	  }
2319
2320	  babelHelpers.createClass(MenuItem, [{
2321	    key: "getLayout",
2322	    value: function getLayout() {
2323	      if (this.layout.item) {
2324	        return this.layout;
2325	      }
2326
2327	      if (this.delimiter) {
2328	        if (main_core.Type.isStringFilled(this.getText())) {
2329	          this.layout.item = main_core.Dom.create('span', {
2330	            props: {
2331	              className: 'popup-window-delimiter-section'
2332	            },
2333	            children: [this.layout.text = main_core.Dom.create('span', {
2334	              props: {
2335	                className: 'popup-window-delimiter-text'
2336	              },
2337	              html: this.allowHtml ? this.getText() : encodeSafe(this.getText())
2338	            })]
2339	          });
2340	        } else {
2341	          this.layout.item = main_core.Tag.render(_templateObject$1());
2342	        }
2343	      } else {
2344	        this.layout.item = main_core.Dom.create(this.href ? 'a' : 'span', {
2345	          props: {
2346	            className: ['menu-popup-item', this.className ? this.className : 'menu-popup-no-icon', this.hasSubMenu() ? 'menu-popup-item-submenu' : ''].join(' ')
2347	          },
2348	          attrs: {
2349	            title: this.title,
2350	            onclick: main_core.Type.isString(this.onclick) ? this.onclick : '',
2351	            // compatibility
2352	            target: this.target ? this.target : ''
2353	          },
2354	          dataset: this.dataset,
2355	          events: main_core.Type.isFunction(this.onclick) ? {
2356	            click: this.onItemClick.bind(this)
2357	          } : null,
2358	          children: [main_core.Dom.create('span', {
2359	            props: {
2360	              className: 'menu-popup-item-icon'
2361	            }
2362	          }), this.layout.text = main_core.Dom.create('span', {
2363	            props: {
2364	              className: 'menu-popup-item-text'
2365	            },
2366	            html: this.allowHtml ? this.getText() : encodeSafe(this.getText())
2367	          })]
2368	        });
2369
2370	        if (this.href) {
2371	          this.layout.item.href = this.href;
2372	        }
2373
2374	        if (this.isDisabled()) {
2375	          this.disable();
2376	        }
2377
2378	        main_core.Event.bind(this.layout.item, 'mouseenter', this.onItemMouseEnter.bind(this));
2379	        main_core.Event.bind(this.layout.item, 'mouseleave', this.onItemMouseLeave.bind(this));
2380	      }
2381
2382	      return this.layout;
2383	    }
2384	  }, {
2385	    key: "getContainer",
2386	    value: function getContainer() {
2387	      return this.getLayout().item;
2388	    }
2389	  }, {
2390	    key: "getTextContainer",
2391	    value: function getTextContainer() {
2392	      return this.getLayout().text;
2393	    }
2394	  }, {
2395	    key: "getText",
2396	    value: function getText() {
2397	      return this.text;
2398	    }
2399	  }, {
2400	    key: "setText",
2401	    value: function setText(text) {
2402	      if (main_core.Type.isString(text)) {
2403	        this.text = text;
2404	        this.getTextContainer().innerHTML = text;
2405	      }
2406	    }
2407	  }, {
2408	    key: "hasSubMenu",
2409	    value: function hasSubMenu() {
2410	      return this.subMenuWindow !== null || this._items.length;
2411	    }
2412	  }, {
2413	    key: "showSubMenu",
2414	    value: function showSubMenu() {
2415	      this.addSubMenu(this._items);
2416
2417	      if (this.subMenuWindow) {
2418	        main_core.Dom.addClass(this.layout.item, 'menu-popup-item-open');
2419	        this.closeSiblings();
2420	        this.closeChildren();
2421	        var popupWindow = this.subMenuWindow.getPopupWindow();
2422
2423	        if (!popupWindow.isShown()) {
2424	          this.emit('SubMenu:onShow');
2425	          popupWindow.show();
2426	        }
2427
2428	        this.adjustSubMenu();
2429	      }
2430	    }
2431	  }, {
2432	    key: "addSubMenu",
2433	    value: function addSubMenu(items) {
2434	      if (this.subMenuWindow !== null || !main_core.Type.isArray(items) || !items.length) {
2435	        return;
2436	      }
2437
2438	      var rootMenuWindow = this.getMenuWindow().getRootMenuWindow() || this.getMenuWindow();
2439	      var options = rootMenuWindow.params; //Override root menu options
2440
2441	      options.autoHide = false;
2442	      options.menuShowDelay = this.menuShowDelay;
2443	      options.cacheable = this.isCacheable();
2444	      options.targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer();
2445	      options.bindOptions = {
2446	        forceTop: true,
2447	        forceLeft: true,
2448	        forceBindPosition: true
2449	      };
2450	      delete options.events;
2451	      delete options.angle;
2452	      delete options.overlay;
2453	      this.subMenuWindow = new Menu('popup-submenu-' + this.id, this.layout.item, items, options);
2454	      this.subMenuWindow.setParentMenuWindow(this.getMenuWindow());
2455	      this.subMenuWindow.setParentMenuItem(this);
2456	      this.subMenuWindow.getPopupWindow().subscribe('onDestroy', this.handleSubMenuDestroy.bind(this));
2457	      main_core.Dom.addClass(this.layout.item, 'menu-popup-item-submenu');
2458	      return this.subMenuWindow;
2459	    }
2460	  }, {
2461	    key: "closeSubMenu",
2462	    value: function closeSubMenu() {
2463	      this.clearSubMenuTimeout();
2464
2465	      if (this.subMenuWindow) {
2466	        main_core.Dom.removeClass(this.layout.item, 'menu-popup-item-open');
2467	        this.closeChildren();
2468	        var popup = this.subMenuWindow.getPopupWindow();
2469
2470	        if (popup.isShown()) {
2471	          this.emit('SubMenu:onClose');
2472	        }
2473
2474	        this.subMenuWindow.close();
2475	      }
2476	    }
2477	  }, {
2478	    key: "closeSiblings",
2479	    value: function closeSiblings() {
2480	      var siblings = this.menuWindow.getMenuItems();
2481
2482	      for (var i = 0; i < siblings.length; i++) {
2483	        if (siblings[i] !== this) {
2484	          siblings[i].closeSubMenu();
2485	        }
2486	      }
2487	    }
2488	  }, {
2489	    key: "closeChildren",
2490	    value: function closeChildren() {
2491	      if (this.subMenuWindow) {
2492	        var children = this.subMenuWindow.getMenuItems();
2493
2494	        for (var i = 0; i < children.length; i++) {
2495	          children[i].closeSubMenu();
2496	        }
2497	      }
2498	    }
2499	  }, {
2500	    key: "destroySubMenu",
2501	    value: function destroySubMenu() {
2502	      if (this.subMenuWindow) {
2503	        main_core.Dom.removeClass(this.layout.item, 'menu-popup-item-open menu-popup-item-submenu');
2504	        this.destroyChildren();
2505	        this.subMenuWindow.destroy();
2506	        this.subMenuWindow = null;
2507	        this._items = [];
2508	      }
2509	    }
2510	  }, {
2511	    key: "destroyChildren",
2512	    value: function destroyChildren() {
2513	      if (this.subMenuWindow) {
2514	        var children = this.subMenuWindow.getMenuItems();
2515
2516	        for (var i = 0; i < children.length; i++) {
2517	          children[i].destroySubMenu();
2518	        }
2519	      }
2520	    }
2521	  }, {
2522	    key: "adjustSubMenu",
2523	    value: function adjustSubMenu() {
2524	      if (!this.subMenuWindow || !this.layout.item) {
2525	        return;
2526	      }
2527
2528	      var popupWindow = this.subMenuWindow.getPopupWindow();
2529	      var itemRect = this.getBoundingClientRect();
2530	      var offsetLeft = itemRect.width + this.subMenuOffsetX;
2531	      var offsetTop = itemRect.height + this.getPopupPadding();
2532	      var angleOffset = itemRect.height / 2 - this.getPopupPadding();
2533	      var anglePosition = 'left';
2534	      var popupWidth = popupWindow.getPopupContainer().offsetWidth;
2535	      var popupHeight = popupWindow.getPopupContainer().offsetHeight;
2536	      var popupBottom = itemRect.top + popupHeight;
2537	      var targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer();
2538	      var isGlobalContext = this.getMenuWindow().getPopupWindow().isTargetDocumentBody();
2539	      var clientWidth = isGlobalContext ? document.documentElement.clientWidth : targetContainer.offsetWidth;
2540	      var clientHeight = isGlobalContext ? document.documentElement.clientHeight : targetContainer.offsetHeight; // let's try to fit a submenu to the browser viewport
2541
2542	      var exceeded = popupBottom - clientHeight;
2543
2544	      if (exceeded > 0) {
2545	        var roundOffset = Math.ceil(exceeded / itemRect.height) * itemRect.height;
2546
2547	        if (roundOffset > itemRect.top) {
2548	          // it cannot be higher than the browser viewport.
2549	          roundOffset -= Math.ceil((roundOffset - itemRect.top) / itemRect.height) * itemRect.height;
2550	        }
2551
2552	        if (itemRect.bottom > popupBottom - roundOffset) {
2553	          // let's sync bottom boundaries.
2554	          roundOffset -= itemRect.bottom - (popupBottom - roundOffset) + this.getPopupPadding();
2555	        }
2556
2557	        offsetTop += roundOffset;
2558	        angleOffset += roundOffset;
2559	      }
2560
2561	      if (itemRect.left + offsetLeft + popupWidth > clientWidth) {
2562	        var left = itemRect.left - popupWidth - this.subMenuOffsetX;
2563
2564	        if (left > 0) {
2565	          offsetLeft = -popupWidth - this.subMenuOffsetX;
2566	          anglePosition = 'right';
2567	        }
2568	      }
2569
2570	      popupWindow.setBindElement(this.layout.item);
2571	      popupWindow.setOffset({
2572	        offsetLeft: offsetLeft,
2573	        offsetTop: -offsetTop
2574	      });
2575	      popupWindow.setAngle({
2576	        position: anglePosition,
2577	        offset: angleOffset
2578	      });
2579	      popupWindow.adjustPosition();
2580	    }
2581	  }, {
2582	    key: "getBoundingClientRect",
2583	    value: function getBoundingClientRect() {
2584	      var popup = this.getMenuWindow().getPopupWindow();
2585
2586	      if (popup.isTargetDocumentBody()) {
2587	        return this.layout.item.getBoundingClientRect();
2588	      } else {
2589	        var rect = popup.getPositionRelativeToTarget(this.layout.item);
2590	        var targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer();
2591	        return new DOMRect(rect.left - targetContainer.scrollLeft, rect.top - targetContainer.scrollTop, rect.width, rect.height);
2592	      }
2593	    }
2594	  }, {
2595	    key: "getPopupPadding",
2596	    value: function getPopupPadding() {
2597	      if (!main_core.Type.isNumber(this.popupPadding)) {
2598	        if (this.subMenuWindow) {
2599	          var menuContainer = this.subMenuWindow.layout.menuContainer;
2600	          this.popupPadding = parseInt(main_core.Dom.style(menuContainer, 'paddingTop'), 10);
2601	        } else {
2602	          this.popupPadding = 0;
2603	        }
2604	      }
2605
2606	      return this.popupPadding;
2607	    }
2608	  }, {
2609	    key: "getSubMenu",
2610	    value: function getSubMenu() {
2611	      return this.subMenuWindow;
2612	    }
2613	  }, {
2614	    key: "getId",
2615	    value: function getId() {
2616	      return this.id;
2617	    }
2618	  }, {
2619	    key: "setMenuWindow",
2620	    value: function setMenuWindow(menu) {
2621	      this.menuWindow = menu;
2622	    }
2623	  }, {
2624	    key: "getMenuWindow",
2625	    value: function getMenuWindow() {
2626	      return this.menuWindow;
2627	    }
2628	  }, {
2629	    key: "getMenuShowDelay",
2630	    value: function getMenuShowDelay() {
2631	      return this.menuShowDelay;
2632	    }
2633	  }, {
2634	    key: "enable",
2635	    value: function enable() {
2636	      this.disabled = false;
2637	      this.getContainer().classList.remove('menu-popup-item-disabled');
2638	    }
2639	  }, {
2640	    key: "disable",
2641	    value: function disable() {
2642	      this.disabled = true;
2643	      this.closeSubMenu();
2644	      this.getContainer().classList.add('menu-popup-item-disabled');
2645	    }
2646	  }, {
2647	    key: "isDisabled",
2648	    value: function isDisabled() {
2649	      return this.disabled;
2650	    }
2651	  }, {
2652	    key: "setCacheable",
2653	    value: function setCacheable(cacheable) {
2654	      this.cacheable = cacheable !== false;
2655	    }
2656	  }, {
2657	    key: "isCacheable",
2658	    value: function isCacheable() {
2659	      return this.cacheable;
2660	    }
2661	    /**
2662	     * @private
2663	     */
2664
2665	  }, {
2666	    key: "onItemClick",
2667	    value: function onItemClick(event) {
2668	      this.onclick.call(this.menuWindow, event, this); //compatibility
2669	    }
2670	    /**
2671	     * @private
2672	     */
2673
2674	  }, {
2675	    key: "onItemMouseEnter",
2676	    value: function onItemMouseEnter(event) {
2677	      if (this.isDisabled()) {
2678	        return;
2679	      }
2680
2681	      main_core_events.EventEmitter.emit(this, 'onMouseEnter', undefined, {
2682	        thisArg: this
2683	      });
2684	      this.clearSubMenuTimeout();
2685
2686	      if (this.hasSubMenu()) {
2687	        this.subMenuTimeout = setTimeout(function () {
2688	          this.showSubMenu();
2689	        }.bind(this), this.menuShowDelay);
2690	      } else {
2691	        this.subMenuTimeout = setTimeout(function () {
2692	          this.closeSiblings();
2693	        }.bind(this), this.menuShowDelay);
2694	      }
2695	    }
2696	    /**
2697	     * @private
2698	     */
2699
2700	  }, {
2701	    key: "onItemMouseLeave",
2702	    value: function onItemMouseLeave(event) {
2703	      if (this.isDisabled()) {
2704	        return;
2705	      }
2706
2707	      main_core_events.EventEmitter.emit(this, 'onMouseLeave', undefined, {
2708	        thisArg: this
2709	      });
2710	      this.clearSubMenuTimeout();
2711	    }
2712	    /**
2713	     * @private
2714	     */
2715
2716	  }, {
2717	    key: "clearSubMenuTimeout",
2718	    value: function clearSubMenuTimeout() {
2719	      if (this.subMenuTimeout) {
2720	        clearTimeout(this.subMenuTimeout);
2721	      }
2722
2723	      this.subMenuTimeout = null;
2724	    }
2725	    /**
2726	     * @private
2727	     */
2728
2729	  }, {
2730	    key: "handleSubMenuDestroy",
2731	    value: function handleSubMenuDestroy() {
2732	      this.subMenuWindow = null;
2733	    }
2734	  }]);
2735	  return MenuItem;
2736	}(main_core_events.EventEmitter);
2737
2738	function _templateObject2$1() {
2739	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div class=\"menu-popup\">", "</div>\n\t\t"]);
2740
2741	  _templateObject2$1 = function _templateObject2() {
2742	    return data;
2743	  };
2744
2745	  return data;
2746	}
2747
2748	function _templateObject$2() {
2749	  var data = babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div class=\"menu-popup-items\">", "</div>\n\t\t"]);
2750
2751	  _templateObject$2 = function _templateObject() {
2752	    return data;
2753	  };
2754
2755	  return data;
2756	}
2757
2758	/**
2759	 * @memberof BX.Main
2760	 */
2761	var Menu = /*#__PURE__*/function () {
2762	  function Menu(options) {
2763	    babelHelpers.classCallCheck(this, Menu);
2764
2765	    var _arguments = Array.prototype.slice.call(arguments),
2766	        id = _arguments[0],
2767	        bindElement = _arguments[1],
2768	        menuItems = _arguments[2],
2769	        params = _arguments[3];
2770
2771	    if (main_core.Type.isPlainObject(options) && !bindElement && !menuItems && !params) {
2772	      params = options;
2773	      params.compatibleMode = false;
2774	      id = options.id;
2775	      bindElement = options.bindElement;
2776	      menuItems = options.items;
2777
2778	      if (!main_core.Type.isStringFilled(id)) {
2779	        id = 'menu-popup-' + main_core.Text.getRandom();
2780	      }
2781	    }
2782
2783	    this.id = id;
2784	    this.bindElement = bindElement;
2785	    /**
2786	     *
2787	     * @type {MenuItem[]}
2788	     */
2789
2790	    this.menuItems = [];
2791	    this.itemsContainer = null;
2792	    this.params = params && babelHelpers.typeof(params) === 'object' ? params : {};
2793	    this.parentMenuWindow = null;
2794	    this.parentMenuItem = null;
2795
2796	    if (menuItems && main_core.Type.isArray(menuItems)) {
2797	      for (var i = 0; i < menuItems.length; i++) {
2798	        this.addMenuItemInternal(menuItems[i], null);
2799	      }
2800	    }
2801
2802	    this.layout = {
2803	      menuContainer: null,
2804	      itemsContainer: null
2805	    };
2806	    this.popupWindow = this.__createPopup();
2807	  }
2808	  /**
2809	   * @private
2810	   */
2811
2812
2813	  babelHelpers.createClass(Menu, [{
2814	    key: "__createPopup",
2815	    value: function __createPopup() {
2816	      var domItems = [];
2817
2818	      for (var i = 0; i < this.menuItems.length; i++) {
2819	        var item = this.menuItems[i];
2820	        var itemLayout = item.getLayout();
2821	        domItems.push(itemLayout.item);
2822	      }
2823
2824	      var defaults = {
2825	        closeByEsc: false,
2826	        angle: false,
2827	        autoHide: true,
2828	        offsetTop: 1,
2829	        offsetLeft: 0,
2830	        animation: 'fading'
2831	      };
2832	      var options = Object.assign(defaults, this.params); //Override user params
2833
2834	      options.noAllPaddings = true;
2835	      options.darkMode = false;
2836	      options.autoHideHandler = this.handleAutoHide.bind(this);
2837	      this.layout.itemsContainer = main_core.Tag.render(_templateObject$2(), domItems);
2838	      this.layout.menuContainer = main_core.Tag.render(_templateObject2$1(), this.layout.itemsContainer);
2839	      this.itemsContainer = this.layout.itemsContainer;
2840	      options.content = this.layout.menuContainer; //Make internal event handlers first in the queue.
2841
2842	      options.events = {
2843	        onClose: this.handlePopupClose.bind(this),
2844	        onDestroy: this.handlePopupDestroy.bind(this)
2845	      };
2846	      var id = options.compatibleMode === false ? this.getId() : 'menu-popup-' + this.getId();
2847	      var popup = new Popup(id, this.bindElement, options);
2848
2849	      if (this.params && this.params.events) {
2850	        popup.subscribeFromOptions(this.params.events);
2851	      }
2852
2853	      return popup;
2854	    }
2855	  }, {
2856	    key: "getPopupWindow",
2857	    value: function getPopupWindow() {
2858	      return this.popupWindow;
2859	    }
2860	  }, {
2861	    key: "show",
2862	    value: function show() {
2863	      this.getPopupWindow().show();
2864	    }
2865	  }, {
2866	    key: "close",
2867	    value: function close() {
2868	      this.getPopupWindow().close();
2869	    }
2870	  }, {
2871	    key: "destroy",
2872	    value: function destroy() {
2873	      this.getPopupWindow().destroy();
2874	    }
2875	  }, {
2876	    key: "toggle",
2877	    value: function toggle() {
2878	      if (this.getPopupWindow().isShown()) {
2879	        this.close();
2880	      } else {
2881	        this.show();
2882	      }
2883	    }
2884	  }, {
2885	    key: "getId",
2886	    value: function getId() {
2887	      return this.id;
2888	    }
2889	    /**
2890	     * @private
2891	     */
2892
2893	  }, {
2894	    key: "handlePopupClose",
2895	    value: function handlePopupClose() {
2896	      for (var i = 0; i < this.menuItems.length; i++) {
2897	        var item = this.menuItems[i];
2898	        item.closeSubMenu();
2899	      }
2900	    }
2901	    /**
2902	     * @private
2903	     */
2904
2905	  }, {
2906	    key: "handlePopupDestroy",
2907	    value: function handlePopupDestroy() {
2908	      for (var i = 0; i < this.menuItems.length; i++) {
2909	        var item = this.menuItems[i];
2910	        item.destroySubMenu();
2911	      }
2912	    }
2913	    /**
2914	     * @private
2915	     */
2916
2917	  }, {
2918	    key: "handleAutoHide",
2919	    value: function handleAutoHide(event) {
2920	      return !this.containsTarget(event.target);
2921	    }
2922	    /**
2923	     * @private
2924	     */
2925
2926	  }, {
2927	    key: "containsTarget",
2928	    value: function containsTarget(target) {
2929	      var el = this.getPopupWindow().getPopupContainer();
2930
2931	      if (this.getPopupWindow().isShown() && (target === el || el.contains(target))) {
2932	        return true;
2933	      }
2934
2935	      return this.getMenuItems().some(function (item) {
2936	        return item.getSubMenu() && item.getSubMenu().containsTarget(target);
2937	      });
2938	    }
2939	  }, {
2940	    key: "setParentMenuWindow",
2941	    value: function setParentMenuWindow(parentMenu) {
2942	      if (parentMenu instanceof Menu) {
2943	        this.parentMenuWindow = parentMenu;
2944	      }
2945	    }
2946	  }, {
2947	    key: "getParentMenuWindow",
2948	    value: function getParentMenuWindow() {
2949	      return this.parentMenuWindow;
2950	    }
2951	  }, {
2952	    key: "getRootMenuWindow",
2953	    value: function getRootMenuWindow() {
2954	      var root = null;
2955	      var parent = this.getParentMenuWindow();
2956
2957	      while (parent !== null) {
2958	        root = parent;
2959	        parent = parent.getParentMenuWindow();
2960	      }
2961
2962	      return root;
2963	    }
2964	  }, {
2965	    key: "setParentMenuItem",
2966	    value: function setParentMenuItem(parentItem) {
2967	      if (parentItem instanceof MenuItem) {
2968	        this.parentMenuItem = parentItem;
2969	      }
2970	    }
2971	  }, {
2972	    key: "getParentMenuItem",
2973	    value: function getParentMenuItem() {
2974	      return this.parentMenuItem;
2975	    }
2976	  }, {
2977	    key: "addMenuItem",
2978	    value: function addMenuItem(menuItemJson, targetItemId) {
2979	      var menuItem = this.addMenuItemInternal(menuItemJson, targetItemId);
2980
2981	      if (!menuItem) {
2982	        return null;
2983	      }
2984
2985	      var itemLayout = menuItem.getLayout();
2986	      var targetItem = this.getMenuItem(targetItemId);
2987
2988	      if (targetItem !== null) {
2989	        var targetLayout = targetItem.getLayout();
2990	        this.itemsContainer.insertBefore(itemLayout.item, targetLayout.item);
2991	      } else {
2992	        this.itemsContainer.appendChild(itemLayout.item);
2993	      }
2994
2995	      return menuItem;
2996	    }
2997	    /**
2998	     * @private
2999	     */
3000
3001	  }, {
3002	    key: "addMenuItemInternal",
3003	    value: function addMenuItemInternal(menuItemJson, targetItemId) {
3004	      if (!menuItemJson || !menuItemJson.delimiter && !main_core.Type.isStringFilled(menuItemJson.text) && !main_core.Type.isStringFilled(menuItemJson.html) || menuItemJson.id && this.getMenuItem(menuItemJson.id) !== null) {
3005	        return null;
3006	      }
3007
3008	      if (main_core.Type.isNumber(this.params.menuShowDelay)) {
3009	        menuItemJson.menuShowDelay = this.params.menuShowDelay;
3010	      }
3011
3012	      var menuItem = new MenuItem(menuItemJson);
3013	      menuItem.setMenuWindow(this);
3014	      var position = this.getMenuItemPosition(targetItemId);
3015
3016	      if (position >= 0) {
3017	        this.menuItems.splice(position, 0, menuItem);
3018	      } else {
3019	        this.menuItems.push(menuItem);
3020	      }
3021
3022	      return menuItem;
3023	    }
3024	  }, {
3025	    key: "removeMenuItem",
3026	    value: function removeMenuItem(itemId) {
3027	      var item = this.getMenuItem(itemId);
3028
3029	      if (!item) {
3030	        return;
3031	      }
3032
3033	      for (var position = 0; position < this.menuItems.length; position++) {
3034	        if (this.menuItems[position] === item) {
3035	          item.destroySubMenu();
3036	          this.menuItems.splice(position, 1);
3037	          break;
3038	        }
3039	      }
3040
3041	      if (!this.menuItems.length) {
3042	        var menuWindow = item.getMenuWindow();
3043
3044	        if (menuWindow) {
3045	          var parentMenuItem = menuWindow.getParentMenuItem();
3046
3047	          if (parentMenuItem) {
3048	            parentMenuItem.destroySubMenu();
3049	          } else {
3050	            menuWindow.destroy();
3051	          }
3052	        }
3053	      }
3054
3055	      item.layout.item.parentNode.removeChild(item.layout.item);
3056	      item.layout = {
3057	        item: null,
3058	        text: null
3059	      };
3060	    }
3061	  }, {
3062	    key: "getMenuItem",
3063	    value: function getMenuItem(itemId) {
3064	      for (var i = 0; i < this.menuItems.length; i++) {
3065	        if (this.menuItems[i].id && this.menuItems[i].id === itemId) {
3066	          return this.menuItems[i];
3067	        }
3068	      }
3069
3070	      return null;
3071	    }
3072	  }, {
3073	    key: "getMenuItems",
3074	    value: function getMenuItems() {
3075	      return this.menuItems;
3076	    }
3077	  }, {
3078	    key: "getMenuItemPosition",
3079	    value: function getMenuItemPosition(itemId) {
3080	      if (itemId) {
3081	        for (var i = 0; i < this.menuItems.length; i++) {
3082	          if (this.menuItems[i].id && this.menuItems[i].id === itemId) {
3083	            return i;
3084	          }
3085	        }
3086	      }
3087
3088	      return -1;
3089	    }
3090	  }, {
3091	    key: "getMenuContainer",
3092	    value: function getMenuContainer() {
3093	      return this.getPopupWindow().getPopupContainer();
3094	    }
3095	  }]);
3096	  return Menu;
3097	}();
3098
3099	var MenuManager = /*#__PURE__*/function () {
3100	  /**
3101	   * @private
3102	   */
3103
3104	  /**
3105	   * @private
3106	   */
3107	  function MenuManager() {
3108	    babelHelpers.classCallCheck(this, MenuManager);
3109	    throw new Error('You cannot make an instance of MenuManager.');
3110	  }
3111
3112	  babelHelpers.createClass(MenuManager, null, [{
3113	    key: "show",
3114	    value: function show() {
3115	      if (this.currentItem !== null) {
3116	        this.currentItem.popupWindow.close();
3117	      }
3118
3119	      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3120	        args[_key] = arguments[_key];
3121	      }
3122
3123	      this.currentItem = this.create.apply(this, args);
3124	      this.currentItem.popupWindow.show();
3125	    }
3126	  }, {
3127	    key: "create",
3128	    value: function create(options) {
3129	      var menuId = null; //Compatibility
3130
3131	      var bindElement = arguments[1];
3132	      var menuItems = arguments[2];
3133	      var params = arguments[3];
3134
3135	      if (main_core.Type.isPlainObject(options) && !bindElement && !menuItems && !params) {
3136	        menuId = options.id;
3137
3138	        if (!main_core.Type.isStringFilled(menuId)) {
3139	          throw new Error('BX.Main.Menu.create: "id" parameter is required.');
3140	        }
3141	      } else {
3142	        menuId = options;
3143	      }
3144
3145	      if (!this.Data[menuId]) {
3146	        var menu = new Menu(options, bindElement, menuItems, params);
3147	        menu.getPopupWindow().subscribe('onDestroy', function () {
3148	          MenuManager.destroy(menuId);
3149	        });
3150	        this.Data[menuId] = menu;
3151	      }
3152
3153	      return this.Data[menuId];
3154	    }
3155	  }, {
3156	    key: "getCurrentMenu",
3157	    value: function getCurrentMenu() {
3158	      return this.currentItem;
3159	    }
3160	  }, {
3161	    key: "getMenuById",
3162	    value: function getMenuById(id) {
3163	      return this.Data[id] ? this.Data[id] : null;
3164	    }
3165	    /**
3166	     * compatibility
3167	     * @private
3168	     */
3169
3170	  }, {
3171	    key: "onPopupDestroy",
3172	    value: function onPopupDestroy(popupMenuWindow) {
3173	      this.destroy(popupMenuWindow.id);
3174	    }
3175	  }, {
3176	    key: "destroy",
3177	    value: function destroy(id) {
3178	      var menu = this.getMenuById(id);
3179
3180	      if (menu) {
3181	        if (this.currentItem === menu) {
3182	          this.currentItem = null;
3183	        }
3184
3185	        delete this.Data[id];
3186	        menu.getPopupWindow().destroy();
3187	      }
3188	    }
3189	  }]);
3190	  return MenuManager;
3191	}();
3192
3193	babelHelpers.defineProperty(MenuManager, "Data", {});
3194	babelHelpers.defineProperty(MenuManager, "currentItem", null);
3195
3196	/**
3197	 * @deprecated use Popup class instead: import { Popup } from 'main.popup'
3198	 */
3199
3200	var PopupWindow = /*#__PURE__*/function (_Popup) {
3201	  babelHelpers.inherits(PopupWindow, _Popup);
3202
3203	  function PopupWindow() {
3204	    babelHelpers.classCallCheck(this, PopupWindow);
3205	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindow).apply(this, arguments));
3206	  }
3207
3208	  return PopupWindow;
3209	}(Popup);
3210
3211	/**
3212	 * @deprecated use BX.UI.Button
3213	 */
3214
3215	var PopupWindowButton = /*#__PURE__*/function (_Button) {
3216	  babelHelpers.inherits(PopupWindowButton, _Button);
3217
3218	  function PopupWindowButton() {
3219	    babelHelpers.classCallCheck(this, PopupWindowButton);
3220	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowButton).apply(this, arguments));
3221	  }
3222
3223	  return PopupWindowButton;
3224	}(Button);
3225
3226	/**
3227	 * @deprecated use BX.UI.Button
3228	 */
3229
3230	var ButtonLink = /*#__PURE__*/function (_Button) {
3231	  babelHelpers.inherits(ButtonLink, _Button);
3232
3233	  function ButtonLink(params) {
3234	    var _this;
3235
3236	    babelHelpers.classCallCheck(this, ButtonLink);
3237	    _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ButtonLink).call(this, params));
3238	    _this.buttonNode = main_core.Dom.create('span', {
3239	      props: {
3240	        className: 'popup-window-button popup-window-button-link' + (_this.className.length > 0 ? ' ' + _this.className : ''),
3241	        id: _this.id
3242	      },
3243	      text: _this.text,
3244	      events: _this.contextEvents
3245	    });
3246	    return _this;
3247	  }
3248
3249	  return ButtonLink;
3250	}(Button);
3251
3252	/**
3253	 * @deprecated use BX.UI.Button
3254	 */
3255
3256	var PopupWindowButtonLink = /*#__PURE__*/function (_ButtonLink) {
3257	  babelHelpers.inherits(PopupWindowButtonLink, _ButtonLink);
3258
3259	  function PopupWindowButtonLink() {
3260	    babelHelpers.classCallCheck(this, PopupWindowButtonLink);
3261	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowButtonLink).apply(this, arguments));
3262	  }
3263
3264	  return PopupWindowButtonLink;
3265	}(ButtonLink);
3266
3267	/**
3268	 * @deprecated use BX.UI.Button
3269	 */
3270
3271	var CustomButton = /*#__PURE__*/function (_Button) {
3272	  babelHelpers.inherits(CustomButton, _Button);
3273
3274	  function CustomButton(params) {
3275	    var _this;
3276
3277	    babelHelpers.classCallCheck(this, CustomButton);
3278	    _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CustomButton).call(this, params));
3279	    _this.buttonNode = main_core.Dom.create('span', {
3280	      props: {
3281	        className: _this.className.length > 0 ? _this.className : '',
3282	        id: _this.id
3283	      },
3284	      events: _this.contextEvents,
3285	      text: _this.text
3286	    });
3287	    return _this;
3288	  }
3289
3290	  return CustomButton;
3291	}(Button);
3292
3293	/**
3294	 * @deprecated use BX.UI.Button
3295	 */
3296
3297	var PopupWindowCustomButton = /*#__PURE__*/function (_CustomButton) {
3298	  babelHelpers.inherits(PopupWindowCustomButton, _CustomButton);
3299
3300	  function PopupWindowCustomButton() {
3301	    babelHelpers.classCallCheck(this, PopupWindowCustomButton);
3302	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowCustomButton).apply(this, arguments));
3303	  }
3304
3305	  return PopupWindowCustomButton;
3306	}(CustomButton);
3307
3308	/**
3309	 * @deprecated use Menu class instead: import { Menu } from 'main.popup'
3310	 */
3311
3312	var PopupMenuWindow = /*#__PURE__*/function (_Menu) {
3313	  babelHelpers.inherits(PopupMenuWindow, _Menu);
3314
3315	  function PopupMenuWindow() {
3316	    babelHelpers.classCallCheck(this, PopupMenuWindow);
3317	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupMenuWindow).apply(this, arguments));
3318	  }
3319
3320	  return PopupMenuWindow;
3321	}(Menu);
3322
3323	/**
3324	 * @deprecated use Menu.Item class instead: import { MenuItem } from 'main.popup'
3325	 */
3326
3327	var PopupMenuItem = /*#__PURE__*/function (_MenuItem) {
3328	  babelHelpers.inherits(PopupMenuItem, _MenuItem);
3329
3330	  function PopupMenuItem() {
3331	    babelHelpers.classCallCheck(this, PopupMenuItem);
3332	    return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupMenuItem).apply(this, arguments));
3333	  }
3334
3335	  return PopupMenuItem;
3336	}(MenuItem);
3337
3338	/**
3339	 * @deprecated
3340	 */
3341
3342	var InputPopup = /*#__PURE__*/function () {
3343	  function InputPopup(params) {
3344	    babelHelpers.classCallCheck(this, InputPopup);
3345	    this.id = params.id || 'bx-inp-popup-' + Math.round(Math.random() * 1000000);
3346	    this.handler = params.handler || false;
3347	    this.values = params.values || false;
3348	    this.pInput = params.input;
3349	    this.bValues = !!this.values;
3350	    this.defaultValue = params.defaultValue || '';
3351	    this.openTitle = params.openTitle || '';
3352	    this.className = params.className || '';
3353	    this.noMRclassName = params.noMRclassName || 'ec-no-rm';
3354	    this.emptyClassName = params.noMRclassName || 'ec-label';
3355
3356	    var _this = this;
3357
3358	    this.curInd = false;
3359
3360	    if (this.bValues) {
3361	      this.pInput.onfocus = this.pInput.onclick = function (e) {
3362	        if (this.value == _this.defaultValue) {
3363	          this.value = '';
3364	          this.className = _this.className;
3365	        }
3366
3367	        _this.ShowPopup();
3368
3369	        return e.preventDefault();
3370	      };
3371
3372	      this.pInput.onblur = function () {
3373	        if (_this.bShowed) {
3374	          setTimeout(function () {
3375	            _this.ClosePopup(true);
3376	          }, 200);
3377	        }
3378
3379	        _this.OnChange();
3380	      };
3381	    } else {
3382	      this.pInput.className = this.noMRclassName;
3383	      this.pInput.onblur = this.OnChange.bind(this);
3384	    }
3385	  }
3386
3387	  babelHelpers.createClass(InputPopup, [{
3388	    key: "ShowPopup",
3389	    value: function ShowPopup() {
3390	      if (this.bShowed) {
3391	        return;
3392	      }
3393
3394	      var _this = this;
3395
3396	      if (!this.oPopup) {
3397	        var pWnd = main_core.Dom.create('DIV', {
3398	          props: {
3399	            className: 'bxecpl-loc-popup ' + this.className
3400	          }
3401	        });
3402
3403	        for (var i = 0, l = this.values.length; i < l; i++) {
3404	          var pRow = pWnd.appendChild(main_core.Dom.create('DIV', {
3405	            props: {
3406	              id: 'bxecmr_' + i
3407	            },
3408	            text: this.values[i].NAME,
3409	            events: {
3410	              mouseover: function mouseover() {
3411	                main_core.Dom.addClass(this, 'bxecplloc-over');
3412	              },
3413	              mouseout: function mouseout() {
3414	                main_core.Dom.removeClass(this, 'bxecplloc-over');
3415	              },
3416	              click: function click() {
3417	                var ind = this.id.substr('bxecmr_'.length);
3418	                _this.pInput.value = _this.values[ind].NAME;
3419	                _this.curInd = ind;
3420
3421	                _this.OnChange();
3422
3423	                _this.ClosePopup(true);
3424	              }
3425	            }
3426	          }));
3427
3428	          if (this.values[i].DESCRIPTION) {
3429	            pRow.title = this.values[i].DESCRIPTION;
3430	          }
3431
3432	          if (this.values[i].CLASS_NAME) {
3433	            main_core.Dom.addClass(pRow, this.values[i].CLASS_NAME);
3434	          }
3435
3436	          if (this.values[i].URL) {
3437	            pRow.appendChild(main_core.Dom.create('a', {
3438	              props: {
3439	                href: this.values[i].URL,
3440	                className: 'bxecplloc-view',
3441	                target: '_blank',
3442	                title: this.openTitle
3443	              }
3444	            }));
3445	          }
3446	        }
3447
3448	        this.oPopup = new Popup(this.id, this.pInput, {
3449	          autoHide: true,
3450	          offsetTop: 1,
3451	          offsetLeft: 0,
3452	          lightShadow: true,
3453	          closeByEsc: true,
3454	          content: pWnd,
3455	          events: {
3456	            onClose: this.ClosePopup.bind(this)
3457	          }
3458	        });
3459	      }
3460
3461	      this.oPopup.show();
3462	      this.pInput.select();
3463	      this.bShowed = true;
3464	      main_core_events.EventEmitter.emit(this, 'onInputPopupShow', new main_core_events.BaseEvent({
3465	        compatData: [this]
3466	      }));
3467	    }
3468	  }, {
3469	    key: "ClosePopup",
3470	    value: function ClosePopup(bClosePopup) {
3471	      this.bShowed = false;
3472
3473	      if (this.pInput.value === '') {
3474	        this.OnChange();
3475	      }
3476
3477	      main_core_events.EventEmitter.emit(this, 'onInputPopupClose', new main_core_events.BaseEvent({
3478	        compatData: [this]
3479	      }));
3480
3481	      if (bClosePopup === true) {
3482	        this.oPopup.close();
3483	      }
3484	    }
3485	  }, {
3486	    key: "OnChange",
3487	    value: function OnChange() {
3488	      var val = this.pInput.value;
3489
3490	      if (this.bValues) {
3491	        if (this.pInput.value == '' || this.pInput.value == this.defaultValue) {
3492	          this.pInput.value = this.defaultValue;
3493	          this.pInput.className = this.emptyClassName;
3494	          val = '';
3495	        } else {
3496	          this.pInput.className = '';
3497	        }
3498	      }
3499
3500	      if (isNaN(parseInt(this.curInd)) || this.curInd !== false && val != this.values[this.curInd].NAME) {
3501	        this.curInd = false;
3502	      } else {
3503	        this.curInd = parseInt(this.curInd);
3504	      }
3505
3506	      main_core_events.EventEmitter.emit(this, 'onInputPopupChanged', new main_core_events.BaseEvent({
3507	        compatData: [this, this.curInd, val]
3508	      }));
3509
3510	      if (this.handler && typeof this.handler == 'function') {
3511	        this.handler({
3512	          ind: this.curInd,
3513	          value: val
3514	        });
3515	      }
3516	    }
3517	  }, {
3518	    key: "Set",
3519	    value: function Set(ind, val, bOnChange) {
3520	      this.curInd = ind;
3521
3522	      if (this.curInd !== false) {
3523	        this.pInput.value = this.values[this.curInd].NAME;
3524	      } else {
3525	        this.pInput.value = val;
3526	      }
3527
3528	      if (bOnChange !== false) {
3529	        this.OnChange();
3530	      }
3531	    }
3532	  }, {
3533	    key: "Get",
3534	    value: function Get(ind) {
3535	      var id = false;
3536
3537	      if (typeof ind == 'undefined') {
3538	        ind = this.curInd;
3539	      }
3540
3541	      if (ind !== false && this.values[ind]) {
3542	        id = this.values[ind].ID;
3543	      }
3544
3545	      return id;
3546	    }
3547	  }, {
3548	    key: "GetIndex",
3549	    value: function GetIndex(id) {
3550	      for (var i = 0, l = this.values.length; i < l; i++) {
3551	        if (this.values[i].ID == id) {
3552	          return i;
3553	        }
3554	      }
3555
3556	      return false;
3557	    }
3558	  }, {
3559	    key: "Deactivate",
3560	    value: function Deactivate(bDeactivate) {
3561	      if (this.pInput.value == '' || this.pInput.value == this.defaultValue) {
3562	        if (bDeactivate) {
3563	          this.pInput.value = '';
3564	          this.pInput.className = this.noMRclassName;
3565	        } else if (this.oEC.bUseMR) {
3566	          this.pInput.value = this.defaultValue;
3567	          this.pInput.className = this.emptyClassName;
3568	        }
3569	      }
3570
3571	      this.pInput.disabled = bDeactivate;
3572	    }
3573	  }]);
3574	  return InputPopup;
3575	}();
3576
3577	/*
3578
3579	//ES6
3580	import { Popup, PopupManager } from 'main.popup';
3581	const popup = new Popup();
3582	PopupManager.create();
3583
3584	//ES5
3585	var popup = new BX.Main.Popup();
3586	BX.Main.PopupManager.create();
3587
3588	//ES6
3589	import { Menu, MenuItem, MenuManager } from 'main.popup';
3590	const menu = new Menu();
3591	const item = new MenuItem();
3592	MenuManager.create();
3593
3594	//ES5
3595	var menu = new BX.Main.Menu();
3596	var item = new BX.Main.MenuItem();
3597	BX.Main.MenuManager.create();
3598
3599	 */
3600	var BX = main_core.Reflection.namespace('BX');
3601	/** @deprecated use BX.Main.Popup or import { Popup } from 'main.popup' */
3602
3603	BX.PopupWindow = Popup;
3604	/** @deprecated use BX.Main.PopupManager or import { PopupManager } from 'main.popup' */
3605
3606	BX.PopupWindowManager = PopupManager;
3607	/** @deprecated use BX.Main.Menu or import { Menu } from 'main.popup' */
3608
3609	BX.PopupMenuWindow = Menu;
3610	/** @deprecated use BX.Main.MenuManager or import { MenuManager } from 'main.popup' */
3611
3612	BX.PopupMenu = MenuManager;
3613	/** @deprecated use BX.Main.MenuItem or import { MenuItem } from 'main.popup' */
3614
3615	BX.PopupMenuItem = MenuItem;
3616	/** @deprecated use BX.UI.Button */
3617
3618	BX.PopupWindowButton = Button;
3619	/** @deprecated use BX.UI.Button */
3620
3621	BX.PopupWindowButtonLink = ButtonLink;
3622	/** @deprecated use BX.UI.Button */
3623
3624	BX.PopupWindowCustomButton = CustomButton;
3625	/** @deprecated use another API */
3626
3627	window.BXInputPopup = InputPopup;
3628
3629	exports.Popup = Popup;
3630	exports.Menu = Menu;
3631	exports.MenuItem = MenuItem;
3632	exports.PopupManager = PopupManager;
3633	exports.MenuManager = MenuManager;
3634	exports.PopupWindow = PopupWindow;
3635	exports.PopupMenuWindow = PopupMenuWindow;
3636	exports.PopupMenuItem = PopupMenuItem;
3637	exports.PopupWindowManager = PopupManager;
3638	exports.PopupMenu = MenuManager;
3639	exports.PopupWindowButton = PopupWindowButton;
3640	exports.PopupWindowButtonLink = PopupWindowButtonLink;
3641	exports.PopupWindowCustomButton = PopupWindowCustomButton;
3642
3643}((this.BX.Main = this.BX.Main || {}),BX,BX.Event,BX));
3644//# sourceMappingURL=main.popup.bundle.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.