1this.BX=this.BX||{};(function(e,t,n,i,s,o,a){"use strict";class l extends s.BaseEvent{#e;#t;get left(){return this.#e}set left(e){if(t.Type.isNumber(e)){this.#e=e}}get top(){return this.#t}set top(e){if(t.Type.isNumber(e)){this.#t=e}}}const u=Object.freeze({LARGE:"large",SMALL:"small"});let r=function(){function e(n){babelHelpers.classCallCheck(this,e);this.popupWindow=null;this.params=n||{};this.text=this.params.text||"";this.id=this.params.id||"";this.className=this.params.className||"";this.events=this.params.events||{};this.contextEvents={};for(let e in this.events){if(t.Type.isFunction(this.events[e])){this.contextEvents[e]=this.events[e].bind(this)}}this.buttonNode=t.Dom.create("button",{props:{className:"popup-window-button"+(this.className.length>0?" "+this.className:""),id:this.id},attrs:{tabindex:"0",type:"button"},events:this.contextEvents,text:this.text})}return babelHelpers.createClass(e,[{key:"render",value:function e(){return this.buttonNode}},{key:"getId",value:function e(){return this.id}},{key:"getContainer",value:function e(){return this.buttonNode}},{key:"getName",value:function e(){return this.text}},{key:"setName",value:function e(n){this.text=n||"";if(this.buttonNode){t.Dom.clean(this.buttonNode);t.Dom.adjust(this.buttonNode,{text:this.text})}}},{key:"setClassName",value:function e(n){if(this.buttonNode){if(t.Type.isString(this.className)&&this.className!==""){t.Dom.removeClass(this.buttonNode,this.className)}t.Dom.addClass(this.buttonNode,n)}this.className=n}},{key:"addClassName",value:function e(n){if(this.buttonNode){t.Dom.addClass(this.buttonNode,n);this.className=this.buttonNode.className}}},{key:"removeClassName",value:function e(n){if(this.buttonNode){t.Dom.removeClass(this.buttonNode,n);this.className=this.buttonNode.className}}}])}();var h;function p(e,t,n){return t=babelHelpers.getPrototypeOf(t),babelHelpers.possibleConstructorReturn(e,d()?Reflect.construct(t,[],babelHelpers.getPrototypeOf(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(d=function(){return!!e})()}function c(e,t,n,i){var s=babelHelpers.get(babelHelpers.getPrototypeOf(e.prototype),t,n);return"function"==typeof s?function(e){return s.apply(n,e)}:s}function f(e,t){g(e,t),t.add(e)}function m(e,t,n){g(e,t),t.set(e,n)}function g(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y(e,t){return e.get(v(e,t))}function b(e,t,n){return e.set(v(e,t),n),n}function v(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const C={onPopupWindowInit:{namespace:"BX.Main.Popup",eventName:"onInit"},onPopupWindowIsInitialized:{namespace:"BX.Main.Popup",eventName:"onAfterInit"},onPopupFirstShow:{namespace:"BX.Main.Popup",eventName:"onFirstShow"},onPopupShow:{namespace:"BX.Main.Popup",eventName:"onShow"},onAfterPopupShow:{namespace:"BX.Main.Popup",eventName:"onAfterShow"},onPopupClose:{namespace:"BX.Main.Popup",eventName:"onClose"},onPopupAfterClose:{namespace:"BX.Main.Popup",eventName:"onAfterClose"},onPopupDestroy:{namespace:"BX.Main.Popup",eventName:"onDestroy"},onPopupFullscreenLeave:{namespace:"BX.Main.Popup",eventName:"onFullscreenLeave"},onPopupFullscreenEnter:{namespace:"BX.Main.Popup",eventName:"onFullscreenEnter"},onPopupDragStart:{namespace:"BX.Main.Popup",eventName:"onDragStart"},onPopupDrag:{namespace:"BX.Main.Popup",eventName:"onDrag"},onPopupDragEnd:{namespace:"BX.Main.Popup",eventName:"onDragEnd"},onPopupResizeStart:{namespace:"BX.Main.Popup",eventName:"onResizeStart"},onPopupResize:{namespace:"BX.Main.Popup",eventName:"onResize"},onPopupResizeEnd:{namespace:"BX.Main.Popup",eventName:"onResizeEnd"}};s.EventEmitter.registerAliases(C);const w=new WeakMap;var M=new WeakMap;var T=new WeakSet;let P=function(e){function n(e){var i;babelHelpers.classCallCheck(this,n);i=p(this,n);f(i,T);m(i,M,null);babelHelpers.defineProperty(i,"handleAutoHide",(e=>{if(i.isDestroyed()){return}if(i.autoHideHandler!==null){if(i.autoHideHandler(e)){i._tryCloseByEvent(e)}}else if(e.target!==i.getPopupContainer()&&!i.getPopupContainer().contains(e.target)){i._tryCloseByEvent(e)}}));babelHelpers.defineProperty(i,"handleDocumentKeyUp",(e=>{if(e.keyCode===27&&!i.isDestroyed()){B(i.getZindex(),(()=>{i.close()}))}}));i.setEventNamespace("BX.Main.Popup");let[o,l,r]=arguments;i.compatibleMode=r&&t.Type.isBoolean(r.compatibleMode)?r.compatibleMode:true;if(t.Type.isPlainObject(e)&&!l&&!r){r=e;o=e.id;l=e.bindElement;i.compatibleMode=false}r=r||{};i.params=r;if(!t.Type.isStringFilled(o)){o=`popup-window-${t.Text.getRandom().toLowerCase()}`}i.emit("onInit",new s.BaseEvent({compatData:[o,l,r]}));i.uniquePopupId=o;i.params.zIndex=t.Type.isNumber(r.zIndex)?parseInt(r.zIndex):0;i.params.zIndexAbsolute=t.Type.isNumber(r.zIndexAbsolute)?parseInt(r.zIndexAbsolute):0;i.buttons=r.buttons&&t.Type.isArray(r.buttons)?r.buttons:[];i.offsetTop=n.getOption("offsetTop");i.offsetLeft=n.getOption("offsetLeft");i.firstShow=false;i.bordersWidth=20;i.bindElementPos=null;i.closeIcon=null;i.resizeIcon=null;i.angle=null;i.angleArrowElement=null;i.overlay=null;i.titleBar=null;i.bindOptions=t.Type.isObject(r.bindOptions)?r.bindOptions:{};i.autoHide=r.autoHide===true;i.disableScroll=r.disableScroll===true||r.isScrollBlock===true;i.autoHideHandler=t.Type.isFunction(r.autoHideHandler)?r.autoHideHandler:null;i.isAutoHideBinded=false;i.closeByEsc=r.closeByEsc===true;i.isCloseByEscBinded=false;i.toFrontOnShow=true;i.cacheable=true;i.destroyed=false;i.fixed=false;i.width=null;i.height=null;i.minWidth=null;i.minHeight=null;i.maxWidth=null;i.maxHeight=null;i.padding=null;i.contentPadding=null;i.background=null;
1i.contentBackground=null;i.borderRadius=null;i.contentBorderRadius=null;i.setTargetContainer(r.targetContainer);i.dragOptions={cursor:"",callback:function(){},eventName:""};i.dragged=false;i.dragPageX=0;i.dragPageY=0;i.animationShowClassName=null;i.animationCloseClassName=null;i.animationCloseEventType=null;i.handleDocumentMouseMove=i.handleDocumentMouseMove.bind(i);i.handleDocumentMouseUp=i.handleDocumentMouseUp.bind(i);i.handleResizeWindow=i.handleResizeWindow.bind(i);i.handleResize=i.handleResize.bind(i);i.handleMove=i.handleMove.bind(i);i.onTitleMouseDown=i.onTitleMouseDown.bind(i);i.handleFullScreen=i.handleFullScreen.bind(i);i.subscribeFromOptions(r.events);let h="popup-window";if(r.titleBar){h+=" popup-window-with-titlebar"}if(r.className&&t.Type.isStringFilled(r.className)){h+=` ${r.className}`}if(r.darkMode){h+=" popup-window-dark"}i.designSystemContext=r.darkMode?"--ui-context-content-dark":"--ui-context-content-light";h+=` ${i.designSystemContext}`;const d=`popup-window-titlebar-${o}`;if(r.titleBar){i.titleBar=t.Tag.render`<div class="popup-window-titlebar" id="${d}"></div>`}if(r.closeIcon){let e=`popup-window-close-icon${r.titleBar?" popup-window-titlebar-close-icon":""}`;if(Object.values(u).includes(r.closeIconSize)&&r.closeIconSize!==u.SMALL){e+=` --${r.closeIconSize}`}i.closeIcon=t.Tag.render` 2 <button 3 tabindex="0" 4 type="button" 5 aria-label="Close" 6 class="${e}" 7 onclick="${i.handleCloseIconClick.bind(i)}" 8 > 9 <span class="ui-icon-set --cross-l --hoverable-default" style="--ui-icon-set__icon-size: 24px;"></span> 10 </button> 11 `;if(t.Type.isPlainObject(r.closeIcon)){t.Dom.style(i.closeIcon,r.closeIcon)}}i.contentContainer=t.Tag.render` 12 <div id="popup-window-content-${o}" role="presentation" class="popup-window-content"></div> 13 `;i.popupContainer=t.Tag.render` 14 <div 15 class="${h}" 16 id="${o}" 17 style="display: none; position: absolute; left: 0; top: 0;" 18 tabindex="-1" 19 role="${t.Type.isStringFilled(r.role)?r.role:"dialog"}" 20 >${[i.titleBar,i.contentContainer,i.closeIcon]}</div> 21 `;if(t.Type.isStringFilled(r.ariaLabel)){t.Dom.attr(i.popupContainer,"aria-label",r.ariaLabel)}if(t.Type.isStringFilled(r.ariaLabelledBy)){t.Dom.attr(i.popupContainer,"aria-labelledby",r.ariaLabelledBy)}i.getTargetContainer().append(i.popupContainer);i.zIndexComponent=a.ZIndexManager.register(i.popupContainer,r.zIndexOptions);i.buttonsContainer=null;if(r.contentColor&&t.Type.isStringFilled(r.contentColor)){i.setContentColor(r.contentColor)}if(r.angle){i.setAngle(r.angle)}if(r.overlay){i.setOverlay(r.overlay)}i.setOffset(r);i.setBindElement(l);i.setTitleBar(r.titleBar);i.setDraggable(r.draggable);i.setContent(r.content);i.setButtons(r.buttons);i.setWidth(r.width);i.setHeight(r.height);i.setMinWidth(r.minWidth);i.setMinHeight(r.minHeight);i.setMaxWidth(r.maxWidth);i.setMaxHeight(r.maxHeight);i.setResizeMode(r.resizable);i.setPadding(r.padding);i.setContentPadding(r.contentPadding);i.setBorderRadius(r.borderRadius);i.setContentBorderRadius(r.contentBorderRadius);i.setBackground(r.background);i.setContentBackground(r.contentBackground);i.setAnimation(r.animation);i.setCacheable(r.cacheable);i.setToFrontOnShow(r.toFrontOnShow);i.setFixed(r.fixed);i.setDesignSystemContext(r.designSystemContext);if(r.contentNoPaddings){i.setContentPadding(0)}if(r.noAllPaddings){i.setPadding(0);i.setContentPadding(0)}if(r.bindOnResize!==false){t.Event.bind(window,"resize",i.handleResizeWindow)}v(T,i,S).call(i,r.focusTrap);i.emit("onAfterInit",new s.BaseEvent({compatData:[o,i]}));return i}babelHelpers.inherits(n,e);return babelHelpers.createClass(n,[{key:"subscribeFromOptions",value:function e(t){c(n,"subscribeFromOptions",this)([t,C])}},{key:"getId",value:function e(){return this.uniquePopupId}},{key:"isCompatibleMode",value:function e(){return this.compatibleMode}},{key:"setContent",value:function e(n){if(!this.contentContainer||!n){return}if(t.Type.isElementNode(n)){t.Dom.clean(this.contentContainer);const e=t.Type.isDomNode(n.parentNode);this.contentContainer.appendChild(n);if(this.isCompatibleMode()||e){n.style.display="block"}}else if(t.Type.isString(n)){this.contentContainer.innerHTML=n}else{this.contentContainer.innerHTML=" "}}},{key:"setButtons",value:function e(n){this.buttons=n&&t.Type.isArray(n)?n:[];if(this.buttonsContainer){t.Dom.remove(this.buttonsContainer)}const i=t.Reflection.getClass("BX.UI.Button");if(this.buttons.length>0&&this.contentContainer){const e=[];for(let t=0;t<this.buttons.length;t++){const n=this.buttons[t];if(n instanceof r){n.popupWindow=this;e.push(n.render())}else if(i&&n instanceof i){n.setContext(this);e.push(n.render())}}this.buttonsContainer=t.Tag.render`<div class="popup-window-buttons">${e}</div>`;this.contentContainer.insertAdjacentElement("afterend",this.buttonsContainer)}}},{key:"getButtons",value:function e(){return this.buttons}},{key:"getButton",value:function e(t){for(let e=0;e<this.buttons.length;e++){const n=this.buttons[e];if(n.getId()===t){return n}}return null}},{key:"setBindElement",value:function e(n){if(n===null){this.bindElement=null}
21else if(t.Type.isObject(n)){if(t.Type.isDomNode(n)||t.Type.isNumber(n.top)&&t.Type.isNumber(n.left)){this.bindElement=n}else if(t.Type.isNumber(n.clientX)&&t.Type.isNumber(n.clientY)){this.bindElement={left:n.pageX,top:n.pageY,bottom:n.pageY}}}}},{key:"getBindElementPos",value:function e(n){if(t.Type.isDomNode(n)){if(this.isTargetDocumentBody()){return this.isFixed()?n.getBoundingClientRect():t.Dom.getPosition(n)}return this.getPositionRelativeToTarget(n)}if(n&&t.Type.isObject(n)){if(!t.Type.isNumber(n.bottom)){n.bottom=n.top}return n}const i=this.getWindowSize();const s=this.getWindowScroll();const o=this.getPopupContainer().offsetWidth;const a=this.getPopupContainer().offsetHeight;this.bindOptions.forceTop=true;return{left:i.innerWidth/2-o/2+s.scrollLeft,top:i.innerHeight/2-a/2+(this.isFixed()?0:s.scrollTop),bottom:i.innerHeight/2-a/2+(this.isFixed()?0:s.scrollTop),windowSize:i,windowScroll:s,popupWidth:o,popupHeight:a}}},{key:"getPositionRelativeToTarget",value:function e(t){let n=t.offsetLeft;let i=t.offsetTop;let s=t.offsetParent;while(s&&s!==this.getTargetContainer()){n+=s.offsetLeft;i+=s.offsetTop;s=s.offsetParent}const o=t.getBoundingClientRect();return new DOMRect(n,i,o.width,o.height)}},{key:"getWindowSize",value:function e(){if(this.isTargetDocumentBody()){return{innerWidth:window.innerWidth,innerHeight:window.innerHeight}}return{innerWidth:this.getTargetContainer().offsetWidth,innerHeight:this.getTargetContainer().offsetHeight}}},{key:"getWindowScroll",value:function e(){if(this.isTargetDocumentBody()){return{scrollLeft:window.pageXOffset,scrollTop:window.pageYOffset}}return{scrollLeft:this.getTargetContainer().scrollLeft,scrollTop:this.getTargetContainer().scrollTop}}},{key:"setAngle",value:function e(i){if(i===false){if(this.angle!==null){t.Dom.remove(this.angle.element)}this.angle=null;this.angleArrowElement=null;return}const s="popup-window-angly";if(this.angle===null){const e=this.bindOptions.position&&this.bindOptions.position==="top"?"bottom":"top";const o=n.getOption(e==="top"?"angleMinTop":"angleMinBottom");let a=t.Type.isNumber(i.offset)?i.offset:0;const l=n.getOption("angleLeftOffset",null);if(a>0&&t.Type.isNumber(l)){a+=l-n.defaultOptions.angleLeftOffset}this.angleArrowElement=t.Tag.render`<div class="popup-window-angly--arrow"></div>`;if(this.background){this.angleArrowElement.style.background=this.background}this.angle={element:t.Tag.render` 22 <div class="${s} ${s}-${e}"> 23 ${this.angleArrowElement} 24 </div> 25 `,position:e,offset:0,defaultOffset:Math.max(a,o)};this.getPopupContainer().appendChild(this.angle.element)}if(t.Type.isObject(i)&&i.position&&["top","right","bottom","left","hide"].includes(i.position)){t.Dom.removeClass(this.angle.element,`${s}-${this.angle.position}`);t.Dom.addClass(this.angle.element,`${s}-${i.position}`);this.angle.position=i.position}if(t.Type.isObject(i)&&t.Type.isNumber(i.offset)){const e=i.offset;let t,s;if(this.angle.position==="top"){t=n.getOption("angleMinTop");s=this.getPopupContainer().offsetWidth-n.getOption("angleMaxTop");s=s<t?Math.max(t,e):s;this.angle.offset=Math.min(Math.max(t,e),s);this.angle.element.style.left=`${this.angle.offset}px`;this.angle.element.style.marginLeft=0;this.angle.element.style.removeProperty("top")}else if(this.angle.position==="bottom"){t=n.getOption("angleMinBottom");s=this.getPopupContainer().offsetWidth-n.getOption("angleMaxBottom");s=s<t?Math.max(t,e):s;this.angle.offset=Math.min(Math.max(t,e),s);this.angle.element.style.marginLeft=`${this.angle.offset}px`;this.angle.element.style.left=0;this.angle.element.style.removeProperty("top")}else if(this.angle.position==="right"){t=n.getOption("angleMinRight");s=this.getPopupContainer().offsetHeight-n.getOption("angleMaxRight");s=s<t?Math.max(t,e):s;this.angle.offset=Math.min(Math.max(t,e),s);this.angle.element.style.top=`${this.angle.offset}px`;this.angle.element.style.removeProperty("left");this.angle.element.style.removeProperty("margin-left")}else if(this.angle.position==="left"){t=n.getOption("angleMinLeft");s=this.getPopupContainer().offsetHeight-n.getOption("angleMaxLeft");s=s<t?Math.max(t,e):s;this.angle.offset=Math.min(Math.max(t,e),s);this.angle.element.style.top=`${this.angle.offset}px`;this.angle.element.style.removeProperty("left");this.angle.element.style.removeProperty("margin-left")}}}},{key:"getWidth",value:function e(){return this.width}}
25,{key:"setWidth",value:function e(t){this.setWidthProperty("width",t)}},{key:"getHeight",value:function e(){return this.height}},{key:"setHeight",value:function e(t){this.setHeightProperty("height",t)}},{key:"getMinWidth",value:function e(){return this.minWidth}},{key:"setMinWidth",value:function e(t){this.setWidthProperty("minWidth",t)}},{key:"getMinHeight",value:function e(){return this.minHeight}},{key:"setMinHeight",value:function e(t){this.setHeightProperty("minHeight",t)}},{key:"getMaxWidth",value:function e(){return this.maxWidth}},{key:"setMaxWidth",value:function e(t){this.setWidthProperty("maxWidth",t)}},{key:"getMaxHeight",value:function e(){return this.maxHeight}},{key:"setMaxHeight",value:function e(t){this.setHeightProperty("maxHeight",t)}},{key:"setWidthProperty",value:function e(n,i){const s=["width","minWidth","maxWidth"];if(!s.includes(n)){return}if(t.Type.isNumber(i)&&i>=0){this[n]=i;this.getResizableContainer().style[n]=`${i}px`;this.getContentContainer().style.overflowX="auto";this.getPopupContainer().classList.add("popup-window-fixed-width")}else if(i===null||i===false){this[n]=null;this.getResizableContainer().style.removeProperty(t.Text.toKebabCase(n));const e=s.some((e=>this.getResizableContainer().style.getPropertyValue(t.Text.toKebabCase(e))!==""));if(!e){this.getContentContainer().style.removeProperty("overflow-x");this.getPopupContainer().classList.remove("popup-window-fixed-width")}}}},{key:"setHeightProperty",value:function e(n,i){const s=["height","minHeight","maxHeight"];if(!s.includes(n)){return}if(t.Type.isNumber(i)&&i>=0){this[n]=i;this.getResizableContainer().style[n]=`${i}px`;this.getContentContainer().style.overflowY="auto";this.getPopupContainer().classList.add("popup-window-fixed-height")}else if(i===null||i===false){this[n]=null;this.getResizableContainer().style.removeProperty(t.Text.toKebabCase(n));const e=s.some((e=>this.getResizableContainer().style.getPropertyValue(t.Text.toKebabCase(e))!==""));if(!e){this.getContentContainer().style.removeProperty("overflow-y");this.getPopupContainer().classList.remove("popup-window-fixed-height")}}}},{key:"setPadding",value:function e(n){if(t.Type.isNumber(n)&&n>=0){this.padding=n;this.getPopupContainer().style.padding=`${n}px`}else if(n===null){this.padding=null;this.getPopupContainer().style.removeProperty("padding")}}},{key:"getPadding",value:function e(){return this.padding}},{key:"setContentPadding",value:function e(n){if(t.Type.isNumber(n)&&n>=0){this.contentPadding=n;this.getContentContainer().style.padding=`${n}px`}else if(n===null){this.contentPadding=null;this.getContentContainer().style.removeProperty("padding")}}},{key:"getContentPadding",value:function e(){return this.contentPadding}},{key:"setBorderRadius",value:function e(n){if(t.Type.isStringFilled(n)){this.borderRadius=n;this.getPopupContainer().style.setProperty("--popup-window-border-radius",n)}else if(n===null){this.borderRadius=null;this.getPopupContainer().style.removeProperty("--popup-window-border-radius")}}},{key:"setContentBorderRadius",value:function e(n){if(t.Type.isStringFilled(n)){this.contentBorderRadius=n;this.getContentContainer().style.setProperty("--popup-window-content-border-radius",n)}else if(n===null){this.contentBorderRadius=null;this.getContentContainer().style.removeProperty("--popup-window-content-border-radius")}}},{key:"setContentColor",value:function e(n){if(t.Type.isString(n)&&this.contentContainer){this.contentContainer.style.backgroundColor=n}else if(n===null){this.contentContainer.style.style.removeProperty("background-color")}}},{key:"setBackground",value:function e(n){if(t.Type.isStringFilled(n)){this.background=n;this.getPopupContainer().style.background=n;if(this.angleArrowElement){this.angleArrowElement.style.background=n}}else if(n===null){this.background=null;this.getPopupContainer().style.removeProperty("background");if(this.angleArrowElement){this.angleArrowElement.style.removeProperty("background")}}}},{key:"getBackground",value:function e(){return this.background}},{key:"setContentBackground",value:function e(n){if(t.Type.isStringFilled(n)){this.contentBackgroun
25d=n;this.getContentContainer().style.background=n}else if(n===null){this.contentBackground=null;this.getContentContainer().style.removeProperty("background")}}},{key:"getContentBackground",value:function e(){return this.contentBackground}},{key:"isDestroyed",value:function e(){return this.destroyed}},{key:"setCacheable",value:function e(t){this.cacheable=t!==false}},{key:"isCacheable",value:function e(){return this.cacheable}},{key:"getFocusTrap",value:function e(){return y(M,this)}},{key:"setToFrontOnShow",value:function e(t){this.toFrontOnShow=t!==false}},{key:"shouldFrontOnShow",value:function e(){return this.toFrontOnShow}},{key:"setFixed",value:function e(n){if(t.Type.isBoolean(n)){this.fixed=n;if(n){t.Dom.addClass(this.getPopupContainer(),"--fixed")}else{t.Dom.removeClass(this.getPopupContainer(),"--fixed")}}}},{key:"isFixed",value:function e(){return this.fixed}},{key:"setResizeMode",value:function e(n){if(n===true||t.Type.isPlainObject(n)){if(!this.resizeIcon){this.resizeIcon=t.Tag.render` 26 <div class="popup-window-resize" onmousedown="${this.handleResizeMouseDown.bind(this)}"></div> 27 `;this.getPopupContainer().appendChild(this.resizeIcon)}this.setMinWidth(n.minWidth);this.setMinHeight(n.minHeight)}else if(n===false&&this.resizeIcon){t.Dom.remove(this.resizeIcon);this.resizeIcon=null}}},{key:"getDesignSystemContext",value:function e(){return this.designSystemContext}},{key:"setDesignSystemContext",value:function e(n){if(t.Type.isString(n)){if(this.popupContainer!==null){t.Dom.removeClass(this.popupContainer,this.designSystemContext);t.Dom.addClass(this.popupContainer,n)}this.designSystemContext=n}}},{key:"setTargetContainer",value:function e(n){const i=t.Type.isElementNode(n)?n:document.body;if(i===this.targetContainer){return}this.targetContainer=i;if(this.getPopupContainer()){a.ZIndexManager.unregister(this.getPopupContainer());this.getTargetContainer().append(this.getPopupContainer());a.ZIndexManager.register(this.getPopupContainer())}if(this.overlay){t.Dom.append(this.overlay.element,this.getTargetContainer())}}},{key:"getTargetContainer",value:function e(){return this.targetContainer}},{key:"isTargetDocumentBody",value:function e(){return this.getTargetContainer()===document.body}},{key:"getPopupContainer",value:function e(){return this.popupContainer}},{key:"getContentContainer",value:function e(){return this.contentContainer}},{key:"getResizableContainer",value:function e(){return this.getPopupContainer()}},{key:"getTitleContainer",value:function e(){return this.titleBar}},{key:"onTitleMouseDown",value:function e(t){v(T,this,D).call(this,t,{cursor:"move",callback:this.handleMove,eventName:"Drag"})}},{key:"handleResizeMouseDown",value:function e(n){v(T,this,D).call(this,n,{cursor:"nwse-resize",eventName:"Resize",callback:this.handleResize});if(this.isTargetDocumentBody()){this.resizeContentPos=t.Dom.getPosition(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-t.Dom.getPosition(this.getPopupContainer()).left}else{this.resizeContentPos=this.getPositionRelativeToTarget(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-this.getPositionRelativeToTarget(this.getPopupContainer()).left}this.resizeContentPos.offsetX=0;this.resizeContentPos.offsetY=0}},{key:"handleResize",value:function e(t,n,i,s){this.resizeContentPos.offsetX+=t;this.resizeContentPos.offsetY+=n;let o=this.resizeContentPos.width+this.resizeContentPos.offsetX;let a=this.resizeContentPos.height+this.resizeContentPos.offsetY;const l=this.isTargetDocumentBody()?document.documentElement.scrollWidth:this.getTargetContainer().scrollWidth;if(this.resizeContentPos.left+o+this.resizeContentOffset>=l){o=l-this.resizeContentPos.left-this.resizeContentOffset}o=Math.max(o,this.getMinWidth());a=Math.max(a,this.getMinHeight());if(this.getMaxWidth()!==null){o=Math.min(o,this.getMaxWidth())}if(this.getMaxHeight()!==null){a=Math.min(a,this.getMaxHeight())}this.setWidth(o);this.setHeight(a)}},{key:"isTopAngle",value:function e(){return this.angle!==null&&this.angle.position==="top"}},{key:"isBottomAngle",value:function e(){return this.angle!==null&&this.angle.position==="bottom"}},{key:"isTopOrBottomAngle",value:function e(){return this.angle!==null&&(this.angle.position==="top"||this.angle.position==="bottom")}},{key:"getAngleHeight",value:function e(){return this.isTopOrBottomAngle()?n.getOption("angleTopOffset"):0}},{key:"setOffset",value:function e(i){if(!t.Type.isPlainObject(i)){return}if(t.Type.isNumber(i.offsetLeft)){this.offsetLeft=i.offsetLeft+n.getOption("offsetLeft")}if(t.Type.isNumber(i.offsetTop)){this.offsetTop=i.offsetTop+n.getOption("offsetTop")}}},{key:"setTitleBar",value:function e(n){if(!this.titleBar){return}if(t.Type.isObject(n)&&t.Type.isDomNode(n.content)){this.titleBar.innerHTML="";this.titleBar.appendChild(n.content)}else if(t.Type.isString(n)){this.titleBar.innerHTML="";this.titleBar.appendChild(t.Dom.create("span",{props:{id:`popup-window-titlebar-text-${this.getId()}`,className:"popup-window-titlebar-text"},text:n}));if(!t.Type.isStringFilled(t.Dom.attr(this.getPopupContainer(),"aria-label"))){t.Dom.attr(this.getPopupContainer(),"aria-label",n)}}}},{key:"setDraggable",value:function e(n){this.params.draggable=n;const i=n?.element??this.titleBar;if(!n||!i){return}t.Dom.style(i,"cursor","move");t.Event.bind(i,"mousedown",this.onTitleMouseDown)}},{key:"setClosingByEsc",value:function e(n){n=t.Type.isBoolean(n)?n:true;if(n){this.closeByEsc=true;this.bindClosingByEsc()}else{this.closeByEsc=false;this.unbindClosingByEsc()}}},{key:"bindClosingByEsc",value:function e(){if(this.closeByEsc&&!this.isCloseByEscBinded){t.Event.bind(this.targetContainer.ownerDocument,"keyup",this.handleDocumentKeyUp,true);this.isCloseByEscBinded=true}}},{key:"unbindClosingByEsc",value:function e(){if(this.isCloseByEscBinded){t.Event.unbind(this.targetContainer.ownerDocument,"keyup",this.handleDocumentKeyUp,true);this.isCloseByEscBinded=false}}},{key:"setAutoHide",value:function e(n){n=t.Type.isBoolean(n)?n:true;if(n){this.autoHide=true;this.bindAutoHide()}else{this.autoHide=false;this.unbindAutoHide()}}},{key:"bindAutoHide",value:function e(){if(this.autoHide&&!this.isAutoHideBinded&&this.isShown()){this.isAutoHideBinded=true;if(this.isCompatibleMode()){t.Event.bind(this.getPopupContainer(),"click",this.handleContainerClick)}if(!this.hasOverlay()){t.Event.bind(this.targetContainer.ownerDocument,"click",this.handleAutoHide,!this.isCompatibleMode())}}}},{key:"unbindAutoHide",value:function e(){if(this.isAutoHideBinded){this.isAutoHideBinded=false;if(this.isCompatibleMode()){t.Event.unbind(this.getPopupContainer(),"click",this.handleContainerClick)}if(!this.hasOverlay()){t.Event.unbind(this.targetContainer.ownerDocument,"click",this.handleAutoHide,!this.isCompatibleMode())}}}},{key:"_tryCloseByEvent",value:function e(t){if(this.isCompatibleMode()){this.tryCloseByEvent(t)}else{setTimeout((()=>{this.tryCloseByEvent(t)}),0)}}},{key:"tryCloseByEvent",value:function e(t){if(t.button===0){this.close()}}},{key:"handleOverlayClick",value:function e(t){if(this.autoHide){this.tryCloseByEvent(t);t.stopPropagation()}}},{key:"setOverlay",value:function e(n){if(this.overlay===null){this.unbindAutoHide();this.overlay={element:t.Tag.render` 28 <div 29 class="popup-window-overlay" 30 id="popup-window-overlay-${this.getId()}" 31 onclick="${this.handleOverlayClick.bind(this)}"
32 aria-hidden="true" 33 ></div> 34 `};this.resizeOverlay();t.Dom.append(this.overlay.element,this.getTargetContainer());this.getZIndexComponent().setOverlay(this.overlay.element)}if(t.Type.isNumber(n?.opacity)&&n.opacity>=0&&n.opacity<=100){t.Dom.style(this.overlay.element,"opacity",parseFloat(n.opacity/100).toPrecision(3))}if(n?.backgroundColor){t.Dom.style(this.overlay.element,"background-color",n.backgroundColor)}if(n?.blur){t.Dom.style(this.overlay.element,"backdrop-filter",n.blur)}}},{key:"isModal",value:function e(){return this.hasOverlay()}},{key:"hasOverlay",value:function e(){return this.overlay!==null&&this.overlay.element!==null}},{key:"removeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){t.Dom.remove(this.overlay.element);this.getZIndexComponent().setOverlay(null)}if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay=null}},{key:"hideOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay.element.style.display="none"}}},{key:"showOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){this.overlay.element.style.display="block";let e=this.getPopupContainer().offsetHeight;this.overlayTimeout=setInterval((()=>{if(e!==this.getPopupContainer().offsetHeight){this.resizeOverlay();e=this.getPopupContainer().offsetHeight}}),1e3)}}},{key:"resizeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){let e=0;let t=0;if(this.isTargetDocumentBody()){e=document.documentElement.scrollWidth;t=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}else{e=this.getTargetContainer().scrollWidth;t=this.getTargetContainer().scrollHeight}this.overlay.element.style.width=`${e}px`;this.overlay.element.style.height=`${t}px`}}},{key:"getZindex",value:function e(){return this.getZIndexComponent().getZIndex()}},{key:"getZIndexComponent",value:function e(){return this.zIndexComponent}},{key:"setDisableScroll",value:function e(n){const i=t.Type.isBoolean(n)?n:true;if(i){this.disableScroll=true;v(T,this,k).call(this)}else{this.disableScroll=false;v(T,this,I).call(this)}}},{key:"show",value:function e(){if(this.isShown()||this.isDestroyed()){return}this.emit("onBeforeShow");this.showOverlay();this.getPopupContainer().style.display="block";t.Dom.addClass(this.getPopupContainer(),"--open");y(M,this)?.captureActiveElement();if(this.shouldFrontOnShow()){this.bringToFront()}if(!this.firstShow){this.emit("onFirstShow",new s.BaseEvent({compatData:[this]}));this.firstShow=true}this.emit("onShow",new s.BaseEvent({compatData:[this]}));if(this.disableScroll){v(T,this,k).call(this)}this.adjustPosition();this.animateOpening((()=>{if(this.isDestroyed()){return}t.Dom.removeClass(this.getPopupContainer(),this.animationShowClassName);this.emit("onAfterShow",new s.BaseEvent({compatData:[this]}));y(M,this)?.activate()}));this.bindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.bindAutoHide()}),100)}else{this.bindAutoHide()}}},{key:"close",value:function e(){if(this.isDestroyed()||!this.isShown()){return}this.emit("onClose",new s.BaseEvent({compatData:[this]}));if(this.isDestroyed()){return}if(this.disableScroll){v(T,this,I).call(this)}y(M,this)?.deactivate();this.animateClosing((()=>{if(this.isDestroyed()){return}this.hideOverlay();this.getPopupContainer().style.display="none";t.Dom.removeClass(this.getPopupContainer(),"--open");t.Dom.removeClass(this.getPopupContainer(),this.animationCloseClassName);this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.unbindAutoHide()}),0)}else{this.unbindAutoHide()}this.emit("onAfterClose",new s.BaseEvent({compatData:[this]}));if(!this.isCacheable()){this.destroy()}}))}},{key:"bringToFront",value:function e(){if(this.isShown()){a.ZIndexManager.bringToFront(this.getPopupContainer())}}},{key:"toggle",value:function e(){if(this.isShown()){this.close()}else{this.show()}}},{key:"animateOpening",value:function e(n){t.Dom.removeClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationShowClassName===null){n()}else{t.Dom.addClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseEventType===null){n()}else{const e=`${this.animationCloseEventType}end`;const i=this.animationShowClassName;this.getPopupContainer().addEventListener(e,(function s(o){if(!t.Dom.hasClass(o.target,i
34)){return}this.removeEventListener(e,s);n()}))}}}},{key:"animateClosing",value:function e(n){t.Dom.removeClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseClassName===null){n()}else{t.Dom.addClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationCloseEventType===null){n()}else{const e=`${this.animationCloseEventType}end`;const i=this.animationCloseClassName;this.getPopupContainer().addEventListener(e,(function s(o){if(!t.Dom.hasClass(o.target,i)){return}this.removeEventListener(e,s);n()}))}}}},{key:"setAnimation",value:function e(n){if(t.Type.isPlainObject(n)){this.animationShowClassName=t.Type.isStringFilled(n.showClassName)?n.showClassName:null;this.animationCloseClassName=t.Type.isStringFilled(n.closeClassName)?n.closeClassName:null;this.animationCloseEventType=n.closeAnimationType==="animation"||n.closeAnimationType==="transition"?n.closeAnimationType:null}else if(t.Type.isStringFilled(n)){const e=n;if(e==="fading"){this.animationShowClassName="popup-window-show-animation-opacity";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(e==="fading-slide"){this.animationShowClassName="popup-window-show-animation-opacity-transform";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(e==="scale"){this.animationShowClassName="popup-window-show-animation-scale";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}}else if(n===false||n===null){this.animationShowClassName=null;this.animationCloseClassName=null;this.animationCloseEventType=null}}},{key:"isShown",value:function e(){return!this.isDestroyed()&&this.getPopupContainer()?.style.display==="block"}},{key:"destroy",value:function e(){if(this.destroyed){return}if(this.disableScroll){v(T,this,I).call(this)}this.destroyed=true;this.emit("onDestroy",new s.BaseEvent({compatData:[this]}));this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.unbindAutoHide()}),0)}else{this.unbindAutoHide()}t.Event.unbindAll(this);t.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);t.Event.unbind(document,"mouseup",this.handleDocumentMouseUp);t.Event.unbind(window,"resize",this.handleResizeWindow);this.removeOverlay();a.ZIndexManager.unregister(this.popupContainer);this.zIndexComponent=null;y(M,this)?.destroy();b(M,this,null);t.Dom.remove(this.popupContainer);this.popupContainer=null;this.contentContainer=null;this.closeIcon=null;this.titleBar=null;this.buttonsContainer=null;this.angle=null;this.angleArrowElement=null;this.resizeIcon=null}},{key:"adjustPosition",value:function e(i){if(i&&t.Type.isObject(i)){this.bindOptions=i}const s=this.getBindElementPos(this.bindElement);if(!this.bindOptions.forceBindPosition&&this.bindElementPos!==null&&s.top===this.bindElementPos.top&&s.left===this.bindElementPos.left){return}const o=s.top===0&&s.left===0&&s.width===0&&s.height===0;this.bindElementPos=o&&this.bindElementPos!==null?this.bindElementPos:s;const a=s.windowSize??this.getWindowSize();const u=s.windowScroll??this.getWindowScroll();const r=s.popupWidth??this.popupContainer.offsetWidth;const h=s.popupHeight??this.popupContainer.offsetHeight;const p=n.getOption("angleTopOffset");let d=this.bindElementPos.left+this.offsetLeft-(this.isTopOrBottomAngle()?n.getOption("angleLeftOffset"):0);if(!this.bindOptions.forceLeft&&d+r+this.bordersWidth>=a.innerWidth+u.scrollLeft&&a.innerWidth+u.scrollLeft-r-this.bordersWidth>0){const e=d;d=a.innerWidth+u.scrollLeft-r-this.bordersWidth;if(this.isTopOrBottomAngle()){this.setAngle({offset:e-d+this.angle.defaultOffset})}}else if(this.isTopOrBottomAngle()){this.setAngle({offset:this.angle.defaultOffset+(d<0?d:0)})}if(d<0){d=0}let c=0;if(this.bindOptions.position&&this.bindOptions.position==="top"){c=this.bindElementPos.top-h-this.offsetTop-(this.isBottomAngle()?p:0);if(c<0||!this.bindOptions.forceTop&&c<u.scrollTop){c=this.bindElementPos.bottom+this.offsetTop;if(this.angle!==null){c+=p;this.setAngle({position:"top"})}}else if(this.isTopAngle()){c=c-p+n.getOption("positionTopXOffset");this.setAngle({position:"bottom"})}else{c+=n.getOption("positionTopXOffset")}}else{c=this.bindElementPos.bottom+this.offsetTop+this.getAngleHeight();if(!this.bindOptions.forceTop&&c+h>a.innerHeight+u.scrollTop&&this.bindElementPos.top-h-this.getAngleHeight()>=0){c=this.bindElementPos.top-h;if(this.isTopOrBottomAngle()){c-=p;this.setAngle({position:"bottom"})}c+=n.getOption("positionTopXOffset")}else if(this.isBottomAngle()){c+=p;this.setAngle({position:"top"})}}if(c<0){c=0}const f=new l;f.left=d;f.top=c;
34this.emit("onBeforeAdjustPosition",f);t.Dom.adjust(this.popupContainer,{style:{top:`${f.top}px`,left:`${f.left}px`}})}},{key:"enterFullScreen",value:function e(){if(n.fullscreenStatus){if(document.cancelFullScreen){document.cancelFullScreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}else{if(this.contentContainer.requestFullScreen){this.contentContainer.requestFullScreen();t.Event.bind(window,"fullscreenchange",this.handleFullScreen)}else if(this.contentContainer.mozRequestFullScreen){this.contentContainer.mozRequestFullScreen();t.Event.bind(window,"mozfullscreenchange",this.handleFullScreen)}else if(this.contentContainer.webkitRequestFullScreen){this.contentContainer.webkitRequestFullScreen();t.Event.bind(window,"webkitfullscreenchange",this.handleFullScreen)}else{console.log("fullscreen mode is not supported")}}}},{key:"handleFullScreen",value:function e(i){if(n.fullscreenStatus){t.Event.unbind(window,"fullscreenchange",this.handleFullScreen);t.Event.unbind(window,"webkitfullscreenchange",this.handleFullScreen);t.Event.unbind(window,"mozfullscreenchange",this.handleFullScreen);n.fullscreenStatus=false;if(!this.isDestroyed()){t.Dom.removeClass(this.contentContainer,"popup-window-fullscreen");this.emit("onFullscreenLeave");this.adjustPosition()}}else{n.fullscreenStatus=true;if(!this.isDestroyed()){t.Dom.addClass(this.contentContainer,"popup-window-fullscreen");this.emit("onFullscreenEnter");this.adjustPosition()}}}},{key:"handleCloseIconClick",value:function e(t){this.tryCloseByEvent(t);t.stopPropagation()}},{key:"handleContainerClick",value:function e(t){t.stopPropagation()}},{key:"handleResizeWindow",value:function e(){if(this.isShown()){this.adjustPosition();if(this.overlay!==null){this.resizeOverlay()}}}},{key:"handleMove",value:function e(n,i,s,o){let a=parseInt(this.popupContainer.style.left,10)+n;let l=parseInt(this.popupContainer.style.top,10)+i;if(t.Type.isObject(this.params.draggable)&&this.params.draggable.restrict){if(a<0){a=0}let e;let t;if(this.isTargetDocumentBody()){e=document.documentElement.scrollWidth;t=document.documentElement.scrollHeight}else{e=this.getTargetContainer().scrollWidth;t=this.getTargetContainer().scrollHeight}const n=this.popupContainer.offsetWidth;const i=this.popupContainer.offsetHeight;if(a>e-n){a=e-n}if(l>t-i){l=t-i}if(l<0){l=0}}this.popupContainer.style.left=`${a}px`;this.popupContainer.style.top=`${l}px`}},{key:"handleDocumentMouseMove",value:function e(t){if(this.dragPageX===t.pageX&&this.dragPageY===t.pageY){return}this.dragOptions.callback(t.pageX-this.dragPageX,t.pageY-this.dragPageY,t.pageX,t.pageY);this.dragPageX=t.pageX;this.dragPageY=t.pageY;if(!this.dragged){this.emit(`on${this.dragOptions.eventName}Start`,new s.BaseEvent({compatData:[this]}));this.dragged=true}this.emit(`on${this.dragOptions.eventName}`,new s.BaseEvent({compatData:[this]}))}},{key:"handleDocumentMouseUp",value:function e(n){if(document.body.releaseCapture){document.body.releaseCapture()}t.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);t.Event.unbind(document,"mouseup",this.handleDocumentMouseUp);document.body.ondrag=null;document.body.onselectstart=null;document.body.style.cursor="";document.body.style.MozUserSelect="";this.popupContainer.style.MozUserSelect="";this.emit(`on${this.dragOptions.eventName}End`,new s.BaseEvent({compatData:[this]}));this.dragged=false;n.preventDefault()}}],[{key:"setOptions",value:function e(n){if(!t.Type.isPlainObject(n)){return}for(let e in n){this.options[e]=n[e]}}},{key:"getOption",value:function e(n,i){if(!t.Type.isUndefined(this.options[n])){return this.options[n]}if(!t.Type.isUndefined(i)){return i}return this.defaultOptions[n]}},{key:"shouldUseFocusTrapByDefault",value:function e(){if(!o.AccessibilitySettings.useFocusTrapInDialogs()){return false}const t=o.FocusNavigator.getActiveElement();const n=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);if(t===null){return true}const i=t.tagName==="TEXTAREA"||t.tagName==="INPUT"&&!n.has(t.type)||t.isContentEditable;return!i}}])}(s.EventEmitter);h=P;function S(e){if(e===false||t.Type.isNil(e)&&!h.shouldUseFocusTrapByDefault()){return}const n={initialFocus:["[data-autofocus]","container"],isolateOutside:this.isModal()};const i=t.Type.isPlainObject(e)?e:{};b(M,this,new o.FocusTrap(this.popupContainer,{...n,...i}));if(this.isModal()){t.Dom.attr(this.overlay.element,"data-focus-trap",y(M,this).getId())}}function k(){const e=this.getTargetContainer();let n=w.get(e);if(!n){n=new Set;w.set(e,n)}n.add(this);t.Dom.addClass(e,"popup-window-disable-scroll")}function I(){const e=this.getTargetContainer();const n=w.get(e)||null;if(n){n.delete(this)}if(n===null||n.size===0){t.Dom.removeClass(e,"popup-window-disable-scroll")}}function D(e,n){n=n||{};if(t.Type.isStringFilled(n.cursor)){this.dragOptions.cursor=n.cursor}if(t.Type.isStringFilled(n.eventName)){this.dragOptions.eventName=n.eventName}if(t.Type.isFunction(n.callback)){this.dragOptions.callback=n.callback}this.dragPageX=e.pageX;this.dragPageY=e.pageY;this.dragged=false;t.Event.bind(document,"mousemove",this.handleDocumentMouseMove);t.Event.bind(document,"mouseup",this.handleDocumentMouseUp);if(document.body.setCapture){document.body.setCapture()}document.body.ondrag=()=>false;document.body.onselectstart=()=>false;document.body.style.cursor=this.dragOptions.cursor;document.body.style.MozUserSelect="none";this.popupContainer.style.MozUserSelect="none";if(this.shouldFrontOnShow()){this.bringToFront()}e.preventDefault()}babelHelpers.defineProperty(P,"options",{});babelHelpers.defineProperty(P,"defaultOptions",{angleLeftOffset:40,positionTopXOffset:-11,angleTopOffset:10,popupZindex:1e3,popupOverlayZindex:1100,angleMinLeft:10,angleMaxLeft:30,angleMinRight:10,angleMaxRight:30,angleMinBottom:23,angleMaxBottom:25,angleMinTop:23,angleMaxTop:25,offsetLeft:0,offsetTop:0});let E=-1;let x=null;function B(e,t){if(e===false){if(x&&x.length>0){for(let e=0;e<x.length;e++){x[e]()}x=null;E=-1}}else{if(x===null){x=[];E=-1;setTimeout((()=>{B(false)}),10)}if(e>E){E=e;x=[t]}else if(e===E){x.push(t)}}}const N={onSubMenuShow:{namespace:"BX.Main.Menu.Item",eventName:"SubMenu:onShow"}
34,onSubMenuClose:{namespace:"BX.Main.Menu.Item",eventName:"SubMenu:onClose"}};const O=/["'<>]/g;const W={"<":"<",">":">","'":"'",'"':"""};function F(e){if(t.Type.isString(e)){return e.replaceAll(O,(e=>W[e]))}return e}s.EventEmitter.registerAliases(N);class H extends s.EventEmitter{#n=[];#i=false;constructor(e){super();this.setEventNamespace("BX.Main.Menu.Item");const n=e||{};this.options=n;this.id=n.id||t.Text.getRandom();this.text="";this.allowHtml=false;if(t.Type.isStringFilled(n.html)||t.Type.isElementNode(n.html)){this.text=n.html;this.allowHtml=true}else if(t.Type.isStringFilled(n.text)){this.text=n.text;if(/<[^>]+>/.test(this.text)){console.warn('BX.Main.MenuItem: use "html" option for the html item content.',this.getText())}}this.title=t.Type.isStringFilled(n.title)?n.title:"";this.delimiter=n.delimiter===true;this.href=t.Type.isStringFilled(n.href)?n.href:null;this.target=t.Type.isStringFilled(n.target)?n.target:null;this.dataset=t.Type.isPlainObject(n.dataset)?n.dataset:null;this.className=t.Type.isStringFilled(n.className)?n.className:null;this.menuShowDelay=t.Type.isNumber(n.menuShowDelay)?n.menuShowDelay:300;this.subMenuOffsetX=t.Type.isNumber(n.subMenuOffsetX)?n.subMenuOffsetX:4;this.#n=t.Type.isArray(n.items)?n.items:[];this.disabled=n.disabled===true;this.cacheable=n.cacheable===true;this.focusable=this.delimiter!==true&&n.focusable!==false;this.attrs=t.Type.isPlainObject(n.attrs)?n.attrs:null;this.onclick=t.Type.isStringFilled(n.onclick)||t.Type.isFunction(n.onclick)?n.onclick:null;this.subscribeFromOptions(n.events,N);this.menuWindow=null;this.subMenuWindow=null;this.layout={item:null,text:null};this.getLayout();this.events={};this.items=[];for(const e of Object.keys(n)){if(!(e in this)){this[e]=n[e]}}}getLayout(){if(this.layout.item){return this.layout}if(this.delimiter){if(t.Type.isStringFilled(this.getText())){this.layout.item=t.Dom.create("span",{props:{className:["popup-window-delimiter-section",this.className||""].join(" ")},attrs:{"aria-hidden":"true"},children:[this.layout.text=t.Tag.render` 35 <span class="popup-window-delimiter-text">${this.allowHtml?this.getText():F(this.getText())}</span> 36 `]})}else{this.layout.item=t.Tag.render`<span class="popup-window-delimiter" aria-hidden="true"></span>`}}else{this.layout.item=t.Dom.create(this.href?"a":"span",{props:{className:["menu-popup-item",this.className||"menu-popup-no-icon",this.hasSubMenu()?"menu-popup-item-submenu":""].join(" ")},attrs:{title:this.title,onclick:t.Type.isString(this.onclick)?this.onclick:"",target:this.target||""},dataset:this.dataset,events:t.Type.isFunction(this.onclick)?{click:this.onItemClick.bind(this)}:null,children:[t.Dom.create("span",{props:{className:"menu-popup-item-icon"}}),this.layout.text=t.Tag.render` 37 <span class="menu-popup-item-text">${this.allowHtml?this.getText():F(this.getText())}</span> 38 `]});if(t.Type.isPlainObject(this.attrs)){t.Dom.attr(this.layout.item,this.attrs)}if(this.isFocusable()){t.Dom.attr(this.layout.item,"tabindex","-1");t.Dom.attr(this.layout.item,"role","menuitem")}else{t.Dom.attr(this.layout.item,"aria-hidden","true")}if(this.hasSubMenu()){t.Dom.attr(this.layout.item,"aria-haspopup","true");t.Dom.attr(this.layout.item,"aria-expanded","false")}if(this.href){this.layout.item.href=this.href}if(this.isDisabled()){this.disable()}t.Event.bind(this.layout.item,o.RESTORE_FOCUS_EVENT,this.#s.bind(this))}t.Event.bind(this.layout.item,"mouseenter",this.#o.bind(this));t.Event.bind(this.layout.item,"mouseleave",this.#a.bind(this));t.Event.bind(this.layout.item,"focusin",this.#l.bind(this));return this.layout}getContainer(){return this.getLayout().item}getTextContainer(){return this.getLayout().text}getText(){return this.text}getTextContent(){if(t.Type.isString(this.text)){return this.text}if(t.Type.isElementNode(this.text)){return this.text.textContent||""}return""}setText(e,n=false){if(t.Type.isString(e)||t.Type.isElementNode(e)){this.allowHtml=n;this.text=e;if(t.Type.isElementNode(e)){t.Dom.clean(this.getTextContainer());if(this.allowHtml){t.Dom.append(e,this.getTextContainer())}else{this.getTextContainer().innerHTML=F(e.outerHTML)}}else{this.getTextContainer().innerHTML=this.allowHtml?e:F(e)}}}hasSubMenu(){return this.subMenuWindow!==null||this.#n.length>0}showSubMenu(e=null){if(!this.getMenuWindow().isShown()){return}this.addSubMenu(this.#n);if(this.getSubMenu()!==null){this.closeSiblings(e);this.closeChildren(e);
38if(!this.getSubMenu().isShown()){this.emit("SubMenu:onShow");this.getSubMenu().setLastInputModality(e);this.getSubMenu().show()}t.Dom.attr(this.layout.item,"aria-controls",this.getSubMenu().getId());this.adjustSubMenu()}}addSubMenu(e){if(this.subMenuWindow!==null||!t.Type.isArray(e)||e.length===0){return null}const n=this.getMenuWindow().getRootMenuWindow()||this.getMenuWindow();const i={...n.params};delete i.events;const s=t.Type.isPlainObject(n.params.subMenuOptions)?n.params.subMenuOptions:{};const o={...i,...s};o.autoHide=false;o.menuShowDelay=this.menuShowDelay;o.cacheable=this.isCacheable();o.targetContainer=this.getMenuWindow().getPopupWindow().getTargetContainer();o.bindOptions={forceTop:true,forceLeft:true,forceBindPosition:true};o.focusTrap={initialFocus:false};delete o.angle;delete o.overlay;this.subMenuWindow=new J(`popup-submenu-${this.id}`,this.layout.item,e,o);this.subMenuWindow.setParentMenuWindow(this.getMenuWindow());this.subMenuWindow.setParentMenuItem(this);this.subMenuWindow.subscribe("onShow",this.#u.bind(this));this.subMenuWindow.subscribe("onClose",this.#r.bind(this));this.subMenuWindow.subscribe("onDestroy",this.#h.bind(this));t.Dom.addClass(this.layout.item,"menu-popup-item-submenu");t.Dom.attr(this.layout.item,"aria-haspopup","true");return this.subMenuWindow}closeSubMenu(e=null){this.#p();if(this.getSubMenu()!==null){this.closeChildren(e);if(this.getSubMenu().isShown()){this.emit("SubMenu:onClose")}this.getSubMenu().setLastInputModality(e);this.getSubMenu().close()}}closeSiblings(e=null){const t=this.menuWindow.getMenuItems();for(const n of t){if(n!==this){n.closeSubMenu(e)}}}closeChildren(e=null){if(this.getSubMenu()!==null){const t=this.getSubMenu().getMenuItems();for(const n of t){n.closeSubMenu(e)}}}destroySubMenu(){if(this.getSubMenu()!==null){t.Dom.removeClass(this.layout.item,"menu-popup-item-open menu-popup-item-submenu");t.Dom.attr(this.layout.item,"aria-haspopup",null);this.destroyChildren();this.getSubMenu().destroy();this.subMenuWindow=null;this.#n=[]}}destroyChildren(){if(this.getSubMenu()!==null){const e=this.getSubMenu().getMenuItems();for(const t of e){t.destroySubMenu()}}}adjustSubMenu(){if(this.getSubMenu()===null||!this.layout.item){return}const e=this.getSubMenu().getPopupWindow();const t=this.getBoundingClientRect();let n=t.width+this.subMenuOffsetX;let i=t.height+this.getPopupPadding();let s=t.height/2-this.getPopupPadding();let o="left";const a=e.getPopupContainer().offsetWidth;const l=e.getPopupContainer().offsetHeight;const u=t.top+l;const r=this.getMenuWindow().getPopupWindow().getTargetContainer();const h=this.getMenuWindow().getPopupWindow().isTargetDocumentBody();const p=h?document.documentElement.clientWidth:r.offsetWidth;const d=h?document.documentElement.clientHeight:r.offsetHeight;const c=u-d;if(c>0){let e=Math.ceil(c/t.height)*t.height;if(e>t.top){e-=Math.ceil((e-t.top)/t.height)*t.height}if(t.bottom>u-e){e-=t.bottom-(u-e)+this.getPopupPadding()}i+=e;s+=e}if(t.left+n+a>p){const e=t.left-a-this.subMenuOffsetX;if(e>0){n=-a-this.subMenuOffsetX;o="right"}}e.setBindElement(this.layout.item);e.setOffset({offsetLeft:n,offsetTop:-i});e.setAngle({position:o,offset:s});e.adjustPosition()}getBoundingClientRect(){const e=this.getMenuWindow().getPopupWindow();if(e.isTargetDocumentBody()){return this.layout.item.getBoundingClientRect()}const t=e.getPositionRelativeToTarget(this.layout.item);const n=this.getMenuWindow().getPopupWindow().getTargetContainer();return new DOMRect(t.left-n.scrollLeft,t.top-n.scrollTop,t.width,t.height)}getPopupPadding(){if(!t.Type.isNumber(this.popupPadding)){if(this.subMenuWindow){const e=this.subMenuWindow.layout.menuContainer;this.popupPadding=parseInt(t.Dom.style(e,"paddingTop"),10)}else{this.popupPadding=0}}return this.popupPadding}getSubMenu(){return this.subMenuWindow}getId(){return this.id}setMenuWindow(e){this.menuWindow=e}getMenuWindow(){return this.menuWindow}getMenuShowDelay(){return this.menuShowDelay}enable(){this.disabled=false;t.Dom.removeClass(this.getContainer(),"menu-popup-item-disabled");t.Dom.attr(this.getContainer(),"aria-disabled",null)}disable(){this.disabled=true;this.closeSubMenu();t.Dom.addClass(this.getContainer(),"menu-popup-item-disabled");t.Dom.attr(this.getContainer(),"aria-disabled","true")}isDisabled(){return this.disabled}isFocusable(){return this.focusable}setCacheable(e){this.cacheable=e!==false}isCacheable(){return this.cacheable}isDelimiter(){return this.delimiter}focus(e=false){if(this.isFocused()||this.isDelimiter()||!this.isFocusable()){return}this.focused=true;t.Dom.addClass(this.getContainer(),`--focus${e?" --focus-visible":""}`);t.Dom.attr(this.getContainer(),"tabindex","0");if(this.getMenuWindow().getFocusTrap()!==null){this.getContainer().focus({preventScroll:!e})}this.getMenuWindow().emit("Item:onFocus",{item:this})}blur(){if(!this.isFocused()||this.isDelimiter()||!this.isFocusable()){return}this.focused=false;t.Dom.removeClass(this.getContainer(),"--focus --focus-visible");t.Dom.attr(this.getContainer(),"tabindex","-1");this.getMenuWindow().emit("Item:onBlur",{item:this})}isFocused(){return this.focused}onItemClick(e){this.onclick.call(this.menuWindow,e,this)}#l(){this.#i=true;setTimeout((()=>{this.#i=false}),100)}#o(e){if(this.getMenuWindow()?.shouldIgnoreMouseEnter()||this.#i){return}const t=new s.BaseEvent({data:{mouseEvent:e}});s.EventEmitter.emit(this,"onMouseEnter",t,{thisArg:this});if(t.isDefaultPrevented()){return}this.focus();this.#p();if(this.hasSubMenu()){this.subMenuTimeout=setTimeout((()=>{this.showSubMenu("pointer")}),this.menuShowDelay)}else{this.subMenuTimeout=setTimeout((()=>{this.closeSiblings("pointer")}),this.menuShowDelay)}}#a(e){const t=new s.BaseEvent({data:{mouseEvent:e}});s.EventEmitter.emit(this,"onMouseLeave",t,{thisArg:this});if(t.isDefaultPrevented()){return}this.blur();this.#p()}#s(e){e.preventDefault();const t=this.getMenuWindow().getMenuItems().some((e=>e.isFocused()));if(!t){this.focus(o.FocusMonitor.Instance.getLastInputModality()==="keyboard")}}#p(){if(this.subMenuTimeout){clearTimeout(this.subMenuTimeout)}this.subMenuTimeout=null}#u(){t.Dom.addClass(this.layout.item,"menu-popup-item-open");t.Dom.attr(this.layout.item,"aria-expanded","true")}#r(){t.Dom.removeClass(this.layout.item,"menu-popup-item-open");
38t.Dom.attr(this.layout.item,"aria-expanded","false");t.Dom.attr(this.layout.item,"aria-controls",null)}#h(){this.#r();this.subMenuWindow=null}}const A=new Intl.Collator(undefined,{sensitivity:"base"});class z{#d=null;#c=false;#f=null;#m="";#g=null;#y=null;#b="first";constructor(e,n={}){this.#d=e;this.#d.subscribe("onShow",this.#v.bind(this));this.#d.subscribe("onDestroy",this.#C.bind(this));this.#f=this.#w.bind(this);this.#y=t.Type.isFunction(n.onTab)?n.onTab:null;this.setInitialFocusPosition(n.initialFocusPosition)}getMenu(){return this.#d}enable(){if(!this.isEnabled()){this.bindEvents()}this.#c=true}disable(){if(this.isEnabled()){this.unbindEvents()}this.#c=false}isEnabled(){return this.#c}bindEvents(){t.Event.bind(this.getMenu().getMenuContainer(),"keydown",this.#f)}unbindEvents(){t.Event.unbind(this.getMenu().getMenuContainer(),"keydown",this.#f)}setInitialFocusPosition(e){if(e==="first"||e==="last"){this.#b=e}}#v(){this.enable();if(this.#d.getParentMenuWindow()===null){if(o.FocusMonitor.Instance.getLastInputModality()==="keyboard"&&this.#d.getFocusTrap()!==null){if(this.#b==="last"){this.focusLast()}else{this.focusFirst()}}}else if(this.#d.getLastInputModal()==="keyboard"){this.focusFirst()}}#C(){this.disable();this.#d=null}#w(e){if(!this.getMenu().isShown()){return}if(e.metaKey||e.ctrlKey||e.altKey){return}const t=e.target;if(t?.tagName==="TEXTAREA"||t instanceof HTMLInputElement){return}e.preventDefault();switch(e.key){case"ArrowDown":{this.focusNext();break}case"ArrowUp":{this.focusPrevious();break}case"ArrowLeft":{const e=this.getMenu().getFocusedItem();const t=e?.getMenuWindow()?.getParentMenuItem();if(t){t.focus(true);t.closeSubMenu("keyboard")}break}case"ArrowRight":{this.#M(this.getMenu().getFocusedItem());break}case"Home":case"PageUp":{this.focusFirst();break}case"End":case"PageDown":{this.focusLast();break}case" ":case"Enter":case"Space":{const e=this.getMenu().getFocusedItem();if(e){if(e.hasSubMenu()){this.#M(e)}else{e.getContainer().click()}}break}
38case"Tab":{if(this.#y===null){const e=this.getMenu().getRootMenuWindow()||this.getMenu();e.close()}else{this.#y(e,this.#d)}break}default:{if(this.#T(e)){this.#m+=e.key;this.focusByText(this.#m);clearTimeout(this.#g);this.#g=setTimeout((()=>{this.#m=""}),200)}break}}}#M(e){if(!e||!e.hasSubMenu()){return}if(e.getSubMenu()?.isShown()){e.getSubMenu().getNavigation().focusFirst()}else{e.showSubMenu("keyboard")}e.blur()}#T(e){if(e.key===" "&&this.#m.length>0){return true}return e.key.length===1&&/^[\p{Letter}\p{Number}]$/u.test(e.key)}focusByText(e){const t=this.getItems();const n=this.getMenu().getFocusedItem();const i=e.toLowerCase();const s=t.filter((e=>{const t=e.getTextContent().trim().toLowerCase().slice(0,Math.max(0,i.length));return A.compare(i,t)===0}));if(s.length===0){return null}const o=s.indexOf(n);if(o>=0){const e=s[(o+1)%s.length];e.focus(true);return e}const a=t.indexOf(n);const l=s.find((e=>t.indexOf(e)>a))??s[0];l.focus(true);return l}focusNext(e=true){const t=this.getMenu().getFocusedItem();const n=this.getItems();if(n.length===0){return null}if(!t){n[0].focus(true);return n[0]}const i=this.getMenuItemPosition(t.id);if(i===-1){n[0].focus(true);return n[0]}if(i+1<n.length){const e=i+1;n[e].focus(true);return n[e]}if(e){n[0].focus(true);return n[0]}return null}focusPrevious(e=true){const t=this.getMenu().getFocusedItem();const n=this.getItems();if(n.length===0){return null}if(!t){n[n.length-1].focus(true);return n[n.length-1]}const i=this.getMenuItemPosition(t.id);if(i===-1){n[n.length-1].focus(true);return n[n.length-1]}if(i-1>=0){const e=i-1;n[e].focus(true);return n[e]}if(e){const e=n.length-1;n[e].focus(true);return n[e]}return null}focusFirst(){const e=this.getItems();if(e.length>0){e[0].focus(true);return e[0]}return null}focusLast(){const e=this.getItems();if(e.length>0){e[e.length-1].focus(true);return e[e.length-1]}return null}getItems(){return this.getMenu().getMenuItems().filter((e=>e.isFocusable()&&o.InteractivityChecker.isVisible(e.getContainer())))}getMenuItemPosition(e){const t=this.getItems();for(const[n,i]of t.entries()){if(i.id&&i.id===e){return n}}return-1}}function R(e,t,n){return t=babelHelpers.getPrototypeOf(t),babelHelpers.possibleConstructorReturn(e,L()?Reflect.construct(t,[],babelHelpers.getPrototypeOf(e).constructor):t.apply(e,n))}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(L=function(){return!!e})()}function X(e,t){j(e,t),t.add(e)}function $(e,t,n){j(e,t),t.set(e,n)}function j(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _(e,t){return e.get(Y(e,t))}function U(e,t,n){return e.set(Y(e,t),n),n}function Y(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var K=new WeakMap;var V=new WeakMap;var Z=new WeakMap;var q=new WeakMap;var G=new WeakSet;let J=function(e){function n(e){var i;babelHelpers.classCallCheck(this,n);i=R(this,n);X(i,G);$(i,K,null);$(i,V,null);$(i,Z,null);$(i,q,true);i.setEventNamespace("BX.Main.Menu");let[s,o,a,l]=arguments;if(t.Type.isPlainObject(e)&&!o&&!a&&!l){l=e;l.compatibleMode=false;s=e.id;o=e.bindElement;a=e.items;if(!t.Type.isStringFilled(s)){s=`menu-popup-${t.Text.getRandom()}`}}i.emit("onInit",{id:s,bindElement:o,menuItems:a,params:l});i.id=s;i.bindElement=o;i.menuItems=[];i.itemsContainer=null;i.params=l&&typeof l==="object"?l:{};i.parentMenuWindow=null;i.parentMenuItem=null;if(a&&t.Type.isArray(a)){for(const e of a){i.addMenuItemInternal(e,null)}}i.layout={menuContainer:null,itemsContainer:null};i.popupWindow=Y(G,i,Q).call(i);U(K,i,new z(i,l?.navigationOptions));i.subscribe("Item:onFocus",Y(G,i,ae).bind(i));i.subscribe("Item:onBlur",Y(G,i,le).bind(i));return i}babelHelpers.inherits(n,e);return babelHelpers.createClass(n,[{key:"getPopupWindow",value:function e(){return this.popupWindow}},{key:"show",value:function e(){this.getPopupWindow().show()}},{key:"close",value:function e(){this.getPopupWindow().close()}},{key:"destroy",value:function e(){this.getPopupWindow().destroy()}},{key:"toggle",value:function e(){if(this.getPopupWindow().isShown()){this.close()}else{this.show()}}},{key:"isShown",value:function e(){return this.getPopupWindow().isShown()}},{key:"getId",value:function e(){return this.id}},{key:"getNavigation",value:function e(){return _(K,this)}},{key:"getFocusTrap",value:function e(){return this.getPopupWindow().getFocusTrap()}},{key:"setLastInputModality",value:function e(t){U(Z,this,t)}},{key:"getLastInputModal",value:function e(){return _(Z,this)}},{key:"shouldIgnoreMouseEnter",value:function e(){return _(q,this)}},{key:"containsTarget",value:function e(t){const n=this.getPopupWindow().getPopupContainer();if(this.getPopupWindow().isShown()&&(t===n||n.contains(t))){return true}return this.getMenuItems().some((e=>e.getSubMenu()&&e.getSubMenu().containsTarget(t)))}},{key:"setParentMenuWindow",value:function e(t){if(t instanceof n){this.parentMenuWindow=t}}},{key:"getParentMenuWindow",value:function e(){return this.parentMenuWindow}},{key:"isRootMenu",value:function e(){return this.getParentMenuWindow()===null}}
38,{key:"getRootMenuWindow",value:function e(){let t=null;let n=this.getParentMenuWindow();while(n!==null){t=n;n=n.getParentMenuWindow()}return t}},{key:"setParentMenuItem",value:function e(t){if(t instanceof H){this.parentMenuItem=t}}},{key:"getParentMenuItem",value:function e(){return this.parentMenuItem}},{key:"addMenuItem",value:function e(t,n){const i=this.addMenuItemInternal(t,n);if(!i){return null}const s=i.getLayout();const o=this.getMenuItem(n);if(o===null){this.itemsContainer.appendChild(s.item)}else{const e=o.getLayout();this.itemsContainer.insertBefore(s.item,e.item)}return i}},{key:"addMenuItemInternal",value:function e(n,i){if(!n||!n.delimiter&&!t.Type.isStringFilled(n.text)&&!t.Type.isStringFilled(n.html)&&!t.Type.isElementNode(n.html)||n.id&&this.getMenuItem(n.id)!==null){return null}if(t.Type.isNumber(this.params.menuShowDelay)){n.menuShowDelay=this.params.menuShowDelay}const s=new H(n);s.setMenuWindow(this);const o=this.getMenuItemPosition(i);if(o>=0){this.menuItems.splice(o,0,s)}else{this.menuItems.push(s)}return s}},{key:"removeMenuItem",value:function e(t,n={destroyEmptyPopup:true}){const i=this.getMenuItem(t);if(!i){return}for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e]===i){i.destroySubMenu();this.menuItems.splice(e,1);break}}if(this.menuItems.length===0){const e=i.getMenuWindow();if(e){const t=e.getParentMenuItem();if(t){t.destroySubMenu()}else if(n.destroyEmptyPopup){e.destroy()}}}i.layout.item.parentNode.removeChild(i.layout.item);i.layout={item:null,text:null}}},{key:"getMenuItem",value:function e(t){for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e].id&&this.menuItems[e].id===t){return this.menuItems[e]}}return null}},{key:"getMenuItems",value:function e(){return this.menuItems}},{key:"getMenuItemPosition",value:function e(t){if(t){for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e].id&&this.menuItems[e].id===t){return e}}}return-1}},{key:"getMenuContainer",value:function e(){return this.getPopupWindow().getPopupContainer()}},{key:"getFocusedItem",value:function e(){return _(V,this)}},{key:"clearFocus",value:function e(){if(_(V,this)){_(V,this).blur();U(V,this,null)}}}])}(s.EventEmitter);function Q(){const e=[];for(let t=0;t<this.menuItems.length;t++){const n=this.menuItems[t];const i=n.getLayout();e.push(i.item)}const n={closeByEsc:true,angle:false,autoHide:true,offsetTop:1,offsetLeft:0,animation:"fading"};const i=Object.assign(n,this.params);i.noAllPaddings=true;i.darkMode=false;i.autoHideHandler=Y(G,this,oe).bind(this);i.role="menu";if(t.Type.isNil(i.focusTrap)&&P.shouldUseFocusTrapByDefault()){i.focusTrap={initialFocus:"container"}}this.layout.itemsContainer=t.Tag.render` 39 <div class="menu-popup-items" role="presentation">${e}</div> 40 `;this.layout.menuContainer=t.Tag.render` 41 <div class="menu-popup" role="presentation">${this.layout.itemsContainer}</div> 42 `;this.itemsContainer=this.layout.itemsContainer;i.content=this.layout.menuContainer;i.events={onBeforeShow:Y(G,this,ee).bind(this),onShow:Y(G,this,te).bind(this),onAfterShow:Y(G,this,ne).bind(this),onClose:Y(G,this,ie).bind(this),onDestroy:Y(G,this,se).bind(this)};const s=i.compatibleMode===false?this.getId():`menu-popup-${this.getId()}`;const o=new P(s,this.bindElement,i);if(this.params&&this.params.events){o.subscribeFromOptions(this.params.events)}return o}function ee(){this.emit("onBeforeShow");U(q,this,true)}function te(){this.emit("onShow")}function ne(){this.emit("onAfterShow");U(q,this,false)}function ie(){this.emit("onClose");for(let e=0;e<this.menuItems.length;e++){const t=this.menuItems[e];t.blur();t.closeSubMenu()}}function se(){this.emit("onDestroy");for(let e=0;e<this.menuItems.length;e++){const t=this.menuItems[e];t.blur();t.destroySubMenu()}}function oe(e){return!this.containsTarget(e.target)}function ae(e){const{item:t}=e.getData();if(_(V,this)===t){return}this.clearFocus();U(V,this,t)}function le(){this.clearFocus()}class ue{static Data={};static currentItem=null;constructor(){throw new Error("You cannot make an instance of MenuManager.")}static show(...e){if(this.currentItem!==null){this.currentItem.popupWindow.close()}this.currentItem=this.create.apply(this,e);this.currentItem.popupWindow.show()}static create(e){let n=null;const i=arguments[1];const s=arguments[2];const o=arguments[3];if(t.Type.isPlainObject(e)&&!i&&!s&&!o){n=e.id;if(!t.Type.isStringFilled(n)){throw new Error('BX.Main.Menu.create: "id" parameter is required.')}}else{n=e}if(!this.Data[n]){const t=new J(e,i,s,o);t.getPopupWindow().subscribe("onDestroy",(()=>{ue.destroy(n)}));this.Data[n]=t}return this.Data[n]}static getCurrentMenu(){return this.currentItem}static getMenuById(e){return this.Data[e]?this.Data[e]:null}static onPopupDestroy(e){this.destroy(e.id)}static destroy(e){const t=this.getMenuById(e);if(t){if(this.currentItem===t){this.currentItem=null}delete this.Data[e];t.getPopupWindow().destroy()}}}class re{static _popups=[];static _currentPopup=null;constructor(){throw new Error("You cannot make an instance of PopupManager.")}static create(e){let[n,i,s]=arguments;let o=n;let a=true;if(t.Type.isPlainObject(n)&&!i&&!s){a=false;o=n.id;if(!t.Type.isStringFilled(o)){throw new Error('BX.Main.Popup.Manager: "id" parameter is required.')}}let l=this.getPopupById(o);if(l===null){l=a?new P(n,i,s):new P(e);l.subscribe("onShow",this.handlePopupShow);l.subscribe("onClose",this.handlePopupClose)}return l}static handleOnAfterInit(e){e.getTarget().subscribeOnce("onDestroy",this.handlePopupDestroy);this._popups.forEach((t=>{if(t.getId()===e.getTarget().getId()){console.error(`Duplicate id (${t.getId()}) for the BX.Main.Popup instance.`)}}));this._popups.push(e.getTarget())}static handlePopupDestroy(e){this._popups=this._popups.filter((t=>t!==e.getTarget()))}static handlePopupShow(e){if(this._currentPopup!==null){this._currentPopup.close()}this._currentPopup=e.getTarget()}static handlePopupClose(){this._currentPopup=null}static getCurrentPopup(){return this._currentPopup}static isPopupExists(e){return this.getPopupById(e)!==null}static isAnyPopupShown(){for(let e=0,t=this._popups.length;e<t;e++){if(this._popups[e].isShown()){return true}}return false}static getPopupById(e){for(let t=0;t<this._popups.length;t++){if(this._popups[t].getId()===e){return this._popups[t]}}return null}static getMaxZIndex(){let e=0;
42this.getPopups().forEach((t=>{e=Math.max(e,t.getZindex())}));return e}static getPopups(){return this._popups}}re.handlePopupDestroy=re.handlePopupDestroy.bind(re);re.handlePopupShow=re.handlePopupShow.bind(re);re.handlePopupClose=re.handlePopupClose.bind(re);re.handleOnAfterInit=re.handleOnAfterInit.bind(re);s.EventEmitter.subscribe("BX.Main.Popup:onAfterInit",re.handleOnAfterInit);class he extends r{constructor(e){super(e);this.buttonNode=t.Dom.create("button",{props:{className:"popup-window-button popup-window-button-link"+(this.className.length>0?` ${this.className}`:""),id:this.id},attrs:{tabindex:"0",type:"button"},text:this.text,events:this.contextEvents})}}class pe extends r{constructor(e){super(e);this.buttonNode=t.Dom.create("span",{props:{className:this.className.length>0?this.className:"",id:this.id},events:this.contextEvents,text:this.text})}}class de{constructor(e){this.id=e.id||"bx-inp-popup-"+Math.round(Math.random()*1e6);this.handler=e.handler||false;this.values=e.values||false;this.pInput=e.input;this.bValues=!!this.values;this.defaultValue=e.defaultValue||"";this.openTitle=e.openTitle||"";this.className=e.className||"";this.noMRclassName=e.noMRclassName||"ec-no-rm";this.emptyClassName=e.noMRclassName||"ec-label";const t=this;this.curInd=false;if(this.bValues){this.pInput.onfocus=this.pInput.onclick=function(e){if(this.value==t.defaultValue){this.value="";this.className=t.className}t.ShowPopup();return e.preventDefault()};this.pInput.onblur=function(){if(t.bShowed){setTimeout((function(){t.ClosePopup(true)}),200)}t.OnChange()}}else{this.pInput.className=this.noMRclassName;this.pInput.onblur=this.OnChange.bind(this)}}ShowPopup(){if(this.bShowed){return}const e=this;if(!this.oPopup){const n=t.Dom.create("DIV",{props:{className:"bxecpl-loc-popup "+this.className}});for(let i=0,s=this.values.length;i<s;i++){const s=n.appendChild(t.Dom.create("DIV",{props:{id:"bxecmr_"+i},text:this.values[i].NAME,events:{mouseover:function(){t.Dom.addClass(this,"bxecplloc-over")},mouseout:function(){t.Dom.removeClass(this,"bxecplloc-over")},click:function(){const t=this.id.substr("bxecmr_".length);e.pInput.value=e.values[t].NAME;e.curInd=t;e.OnChange();e.ClosePopup(true)}}}));if(this.values[i].DESCRIPTION){s.title=this.values[i].DESCRIPTION}if(this.values[i].CLASS_NAME){t.Dom.addClass(s,this.values[i].CLASS_NAME)}if(this.values[i].URL){s.appendChild(t.Dom.create("a",{props:{href:this.values[i].URL,className:"bxecplloc-view",target:"_blank",title:this.openTitle}}))}}this.oPopup=new P(this.id,this.pInput,{autoHide:true,offsetTop:1,offsetLeft:0,lightShadow:true,closeByEsc:true,content:n,events:{onClose:this.ClosePopup.bind(this)}})}this.oPopup.show();this.pInput.select();this.bShowed=true;s.EventEmitter.emit(this,"onInputPopupShow",new s.BaseEvent({compatData:[this]}))}ClosePopup(e){this.bShowed=false;if(this.pInput.value===""){this.OnChange()}s.EventEmitter.emit(this,"onInputPopupClose",new s.BaseEvent({compatData:[this]}));if(e===true){this.oPopup.close()}}OnChange(){let e=this.pInput.value;if(this.bValues){if(this.pInput.value==""||this.pInput.value==this.defaultValue){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName;e=""}else{this.pInput.className=""}}if(isNaN(parseInt(this.curInd))||this.curInd!==false&&e!=this.values[this.curInd].NAME){this.curInd=false}else{this.curInd=parseInt(this.curInd)}s.EventEmitter.emit(this,"onInputPopupChanged",new s.BaseEvent({compatData:[this,this.curInd,e]}));if(this.handler&&typeof this.handler=="function"){this.handler({ind:this.curInd,value:e})}}Set(e,t,n){this.curInd=e;if(this.curInd!==false){this.pInput.value=this.values[this.curInd].NAME}else{this.pInput.value=t}if(n!==false){this.OnChange()}}Get(e){let t=false;if(typeof e=="undefined"){e=this.curInd}if(e!==false&&this.values[e]){t=this.values[e].ID}return t}GetIndex(e){for(let t=0,n=this.values.length;t<n;t++){if(this.values[t].ID==e){return t}}return false}Deactivate(e){if(this.pInput.value==""||this.pInput.value==this.defaultValue){if(e){this.pInput.value="";this.pInput.className=this.noMRclassName}
42else if(this.oEC.bUseMR){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName}}this.pInput.disabled=e}}class ce extends H{}class fe extends J{}class me extends P{}class ge extends r{}class ye extends he{}class be extends pe{}const ve=t.Reflection.namespace("BX");ve.PopupWindow=P;ve.PopupWindowManager=re;ve.PopupMenuWindow=J;ve.PopupMenu=ue;ve.PopupMenuItem=H;ve.PopupWindowButton=r;ve.PopupWindowButtonLink=he;ve.PopupWindowCustomButton=pe;window.BXInputPopup=de;e.CloseIconSize=u;e.Menu=J;e.MenuItem=H;e.MenuManager=ue;e.Popup=P;e.PopupManager=re;e.PopupMenu=ue;e.PopupMenuItem=ce;e.PopupMenuWindow=fe;e.PopupWindow=me;e.PopupWindowButton=ge;e.PopupWindowButtonLink=ye;e.PopupWindowCustomButton=be;e.PopupWindowManager=re})(this.BX.Main=this.BX.Main||{},BX,BX,BX,BX.Event,BX.UI.Accessibility,BX); 43//# sourceMappingURL=main.popup.bundle.map.js
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.