PageSourceSearch

https://coolertorg.ru/bitrix/js/main/popup/dist/main.popup.bundle.js?1770980644118788

js coolertorg.ru collected 2026-10-01 14:40:27 UTC 118,788 bytes, 3,406 lines download raw bytes

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