PageSourceSearch

https://www.unionmart.ru/bitrix/js/ui/notification/dist/notification.bundle.min.js?178829198616776

js unionmart.ru collected 2026-10-01 12:34:54 UTC 16,776 bytes, 2 lines download raw bytes

1this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(t,e){"use strict";let i=function(){function t(i,n={}){babelHelpers.classCallCheck(this,t);babelHelpers.defineProperty(this,"balloon",void 0);babelHelpers.defineProperty(this,"id",void 0);babelHelpers.defineProperty(this,"href",void 0);babelHelpers.defineProperty(this,"title",void 0);babelHelpers.defineProperty(this,"window",void 0);babelHelpers.defineProperty(this,"container",null);babelHelpers.defineProperty(this,"events",{});const s=e.Type.isPlainObject(n)?n:{};this.balloon=i;this.id=e.Type.isStringFilled(s.id)?s.id:e.Text.getRandom(8).toLowerCase();this.href=e.Type.isStringFilled(s.href)?s.href:null;this.title=e.Type.isStringFilled(s.title)?s.title:null;this.window=window;if(e.Type.isPlainObject(s.events)){for(const[t,i]of Object.entries(s.events)){if(!e.Type.isFunction(i)){continue}this.events[t]=t=>{i.call(t.target,t,this.getBalloon(),this)}}}}return babelHelpers.createClass(t,[{key:"getBalloon",value:function t(){return this.balloon}},{key:"getId",value:function t(){return this.id}},{key:"getTitle",value:function t(){return this.title}},{key:"getHref",value:function t(){return this.href}},{key:"getContainer",value:function t(){if(this.container===null){const t=this.getHref();const i=this.getTitle()??"";this.container=t===null?e.Tag.render`<span class="ui-notification-balloon-action">${i}</span>`:e.Tag.render`<a class="ui-notification-balloon-action" href="${t}">${i}</a>`;for(const[t,i]of Object.entries(this.events)){e.Event.bind(this.container,t,i)}}return this.container}},{key:"getWindow",value:function t(){return this.window}}])}();class n{#t=null;#e=null;static getFullName(t){return`UI.Notification.Balloon:${t}`}getBalloon(){return this.#t}setBalloon(t){if(e.Type.isObject(t)){this.#t=t}}getName(){return this.#e}setName(t){if(e.Type.isStringFilled(t)){this.#e=t}}getFullName(){return n.getFullName(this.#e??"")}}const s={TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right"};const o={INIT:0,OPENING:1,OPEN:2,CLOSING:3,CLOSED:4,PAUSED:5,QUEUED:6};class a{id;position;spacing=20;offsetX=25;offsetY=25;newestOnTop=false;balloonType=l;balloons=[];queueStack=[];constructor(t={}){const i=e.Type.isPlainObject(t)?t:{};this.id=e.Type.isStringFilled(i.id)?i.id:e.Text.getRandom(8).toLowerCase();this.position=a.getPositionCode(i.position)?i.position:"top-right";this.setOptions(i);e.addCustomEvent(window,n.getFullName("onClose"),(t=>this.handleBalloonClose(t)))}static getPositionCode(t){const e=Object.entries(s).find((([,e])=>e===t));return e?e[0]:null}adjustPosition(t){let i=0;this.getBalloons().forEach((n=>{if(!t||t===n){if(n.doNotAdjustPosition){return}const t=n.getContainer();const o=`${this.getOffsetX()}px`;const a=`${i+this.getOffsetY()}px`;switch(this.getPosition()){case s.TOP_LEFT:e.Dom.style(t,{left:o,top:a});break;case s.TOP_CENTER:e.Dom.style(t,{left:"50%",transform:"translateX(-50%)",top:a});break;case s.TOP_RIGHT:e.Dom.style(t,{right:o,top:a});break;case s.BOTTOM_LEFT:e.Dom.style(t,{left:o,bottom:a});break;case s.BOTTOM_CENTER:e.Dom.style(t,{left:"50%",transform:"translateX(-50%)",bottom:a});break;case s.BOTTOM_RIGHT:e.Dom.style(t,{right:o,bottom:a});break}}i+=this.getSpacing()+n.getHeight()}))}add(t){if(this.getBalloons().length>0&&(this.getQueue().length>0||!this.isBalloonFitToViewport(t))){this.queue(t)}else{this.push(t)}}clear(){const t=[...this.balloons,...this.queueStack];this.queueStack=[];this.balloons=[];t.forEach((t=>t.close()))}push(t){if(!(t instanceof l)){throw new TypeError("'balloon' must be an instance of BX.UI.Notification.Balloon.")}if(!this.balloons.includes(t)){if(this.isNewestOnTop()){this.balloons.splice(0,0,t)}else{this.balloons.push(t)}}}queue(t){if(!(t instanceof l)){throw new TypeError("'balloon' must be an instance of BX.UI.Notification.Balloon.")}if(!this.queueStack.includes(t)){t.setState(o.QUEUED);this.queueStack.push(t)}}checkQueue(){const t=[...this.queueStack];for(const e of t){if(!this.isBalloonFitToViewport(e)&&this.getBalloons().length>0){break}e.setState(o.INIT);this.queueStack.shift();this.push(e);e.show()}}getQueue(){return this.queueStack}isBalloonFitToViewport(t){const e=document.documentElement.clientHeight;const i=this.getSpacing()+t.getHeight();return this.getHeight()+i<=e}handleBalloonClose(t){const e=t.getBalloon();if(e===null||e.getStack()!==this){return}this.balloons=this.balloons.filter((t=>e!==t));this.adjustPosition();this.checkQueue()}setOptions(t){const e=t??{};this.setSpacing(e.spacing);this.setOffsetX(e.offsetX);this.setOffsetY(e.offsetY);this.setNewestOnTop(e.newestOnTop);this.setBalloonType(e.balloonType)}getId(){return this.id}getBalloons(){return this.balloons}getPosition(){return this.position}getSpacing(){return this.spacing}setSpacing(t){if(e.Type.isNumber(t)){this.spacing=t}}getOffsetX(){return this.offsetX}setOffsetX(t){if(e.Type.isNumber(t)){this.offsetX=t}}getOffsetY(){return this.offsetY}setOffsetY(t){if(e.Type.isNumber(t)){this.offsetY=t}}
1getHeight(){return this.getBalloons().reduce(((t,e)=>t+e.getHeight()+this.getSpacing()),this.getOffsetY())}getBalloonType(t){if(e.Type.isFunction(t)){return t}if(e.Type.isStringFilled(t)){const i=e.Reflection.getClass(t);if(e.Type.isFunction(i)){return i}}return this.balloonType||l}setBalloonType(t){if(e.Type.isFunction(t)){this.balloonType=t}else if(e.Type.isStringFilled(t)){const i=e.Reflection.getClass(t);if(e.Type.isFunction(i)){this.balloonType=i}}}isNewestOnTop(){return this.newestOnTop}setNewestOnTop(t){if(e.Type.isBoolean(t)){this.newestOnTop=t}}}let l=function(){function t(i={}){babelHelpers.classCallCheck(this,t);babelHelpers.defineProperty(this,"id",void 0);babelHelpers.defineProperty(this,"stack",void 0);babelHelpers.defineProperty(this,"state",o.INIT);babelHelpers.defineProperty(this,"showOnTopWindow",void 0);babelHelpers.defineProperty(this,"container",null);babelHelpers.defineProperty(this,"content",null);babelHelpers.defineProperty(this,"actions",[]);babelHelpers.defineProperty(this,"animationClassName","ui-notification-balloon-animate");babelHelpers.defineProperty(this,"customRender",null);babelHelpers.defineProperty(this,"category",null);babelHelpers.defineProperty(this,"autoHide",true);babelHelpers.defineProperty(this,"autoHideDelay",8e3);babelHelpers.defineProperty(this,"autoHideTimeout",null);babelHelpers.defineProperty(this,"useAirDesign",void 0);babelHelpers.defineProperty(this,"data",{});babelHelpers.defineProperty(this,"width",400);babelHelpers.defineProperty(this,"closeButton",null);babelHelpers.defineProperty(this,"closeButtonVisibility",true);const n=e.Type.isPlainObject(i)?i:{};if(!(n.stack instanceof a)){throw new TypeError("BX.UI.Notification.Balloon: 'stack' parameter is required.")}this.id=e.Type.isStringFilled(n.id)?n.id:e.Text.getRandom(8).toLowerCase();this.stack=n.stack;this.showOnTopWindow=n.showOnTopWindow===true;this.useAirDesign=n.useAirDesign===true;if(this.useAirDesign){this.width=339}if(e.Type.isPlainObject(n.events)){for(const[t,e]of Object.entries(n.events)){this.addEvent(t,e)}}this.setOptions(n)}return babelHelpers.createClass(t,[{key:"show",value:function t(){if(this.getState()===o.OPENING){return}if(this.getState()===o.OPEN){this.activateAutoHide();return}let i=false;if(!this.getContainer().parentNode){i=true;const t=this.showOnTopWindow?window.top.document.body:document.body;e.Dom.append(this.getContainer(),t);e.ZIndexManager.register(this.getContainer(),{alwaysOnTop:true});this.getStack().add(this);if(this.getState()===o.QUEUED){return}}const n=this.getState()===o.PAUSED;this.setState(o.OPENING);this.adjustPosition();e.ZIndexManager.bringToFront(this.getContainer());this.animateIn((()=>{if(this.getState()!==o.OPENING){return}this.setState(o.OPEN);if(i){this.fireEvent("onOpen")}if(!n){this.activateAutoHide()}}))}},{key:"setOptions",value:function t(i){if(!e.Type.isPlainObject(i)){return}const n=i;this.setContent(n.content);this.setWidth(n.width);this.setData(n.data);this.setCloseButtonVisibility(n.closeButton);this.setActions(n.actions);this.setCategory(n.category??undefined);this.setAutoHide(n.autoHide);this.setCustomRender(n.render);this.setAutoHideDelay(n.autoHideDelay)}},{key:"update",value:function t(i){this.setOptions(i);e.Dom.clean(this.getContainer());e.Dom.append(this.render(),this.getContainer());this.deactivateAutoHide();this.activateAutoHide()}},{key:"close",value:function t(){const i=this.getState();if(i===o.CLOSING||i===o.CLOSED){return}this.setState(o.CLOSING);this.deactivateAutoHide();const n=()=>
1{if(this.getState()!==o.CLOSING){return}this.setState(o.CLOSED);e.ZIndexManager.unregister(this.getContainer());e.Dom.remove(this.getContainer());this.container=null;this.fireEvent("onClose")};if(i===o.OPENING){n()}else{this.animateOut((()=>n()))}}},{key:"blink",value:function t(){this.animateOut((()=>{setTimeout((()=>{this.update(null);this.animateIn((()=>{}))}),200)}))}},{key:"adjustPosition",value:function t(){if(this.getStack().isNewestOnTop()){this.getStack().adjustPosition()}else{this.getStack().adjustPosition(this)}}},{key:"getId",value:function t(){return this.id}},{key:"getCloseButton",value:function t(){if(this.closeButton!==null){return this.closeButton}this.closeButton=e.Tag.render`<div class="ui-notification-balloon-close-btn"></div>`;e.Event.bind(this.closeButton,"click",(()=>this.handleCloseBtnClick()));return this.closeButton}},{key:"setCloseButtonVisibility",value:function t(e){this.closeButtonVisibility=e!==false}},{key:"isCloseButtonVisible",value:function t(){return this.closeButtonVisibility}},{key:"getContent",value:function t(){return this.content}},{key:"setContent",value:function t(i){if(e.Type.isString(i)||e.Type.isDomNode(i)){this.content=i}}},{key:"getWidth",value:function t(){return this.width}},{key:"setWidth",value:function t(i){if(e.Type.isNumber(i)||i==="auto"){this.width=i}}},{key:"getZIndex",value:function t(){const i=e.ZIndexManager.getComponent(this.getContainer());return i?i.getZIndex():0}},{key:"setZIndex",value:function t(e){}},{key:"getHeight",value:function t(){return this.getContainer().offsetHeight}},{key:"getCategory",value:function t(){return this.category}},{key:"setCategory",value:function t(i){if(e.Type.isStringFilled(i)||i===null){this.category=i}}},{key:"setActions",value:function t(n){if(e.Type.isArray(n)){this.actions=[];n.forEach((t=>{this.actions.push(new i(this,t))}))}else if(n===null){this.actions=[]}}},{key:"getActions",value:function t(){return this.actions}},{key:"getAction",value:function t(e){for(const t of this.actions){if(t.getId()===e){return t}}return null}},{key:"getContainer",value:function t(){if(this.container!==null){return this.container}this.container=e.Tag.render`<div class="ui-notification-balloon" data-a11y-ignore-inert="true"></div>`;e.Dom.append(this.render(),this.container);e.Event.bind(this.container,"mouseenter",(()=>this.handleMouseEnter()));e.Event.bind(this.container,"mouseleave",(()=>this.handleMouseLeave()));return this.container}},{key:"render",value:function t(){const i=this.getCustomRender();if(i!==null){return i.call(this,this)}const n=this.getContent();const s=this.getWidth();const o=e.Type.isNumber(s)?`${s}px`:s;const a=e.Type.isDomNode(n)?e.Tag.render`<div class="ui-notification-balloon-message"></div>`:e.Tag.render`<div class="ui-notification-balloon-message">${n??""}</div>`;if(e.Type.isDomNode(n)){e.Dom.append(n,a)}const l=e.Tag.render`<div class="ui-notification-balloon-actions"></div>`;this.getActions().forEach((t=>e.Dom.append(t.getContainer(),l)));const r=e.Tag.render`<div class="ui-notification-balloon-content"></div>`;e.Dom.style(r,"width",o);e.Dom.append(a,r);e.Dom.append(l,r);if(this.isCloseButtonVisible()){e.Dom.append(this.getCloseButton(),r)}return r}},{key:"setCustomRender",value:function t(i){if(e.Type.isFunction(i)){this.customRender=i}}},{key:"getCustomRender",value:function t(){return this.customRender}},{key:"getStack",value:function t(){return this.stack}},{key:"setState",value:function t(e){const i=this.getStateCode(e);if(i!==null){this.state=e}}},{key:"getState",value:function t(){return this.state}},{key:"getStateCode",value:function t(e){const i=Object.entries(o).find((([,t])=>t===e));return i?i[0]:null}},{key:"activateAutoHide",value:function t(){if(!this.getAutoHide()){return}this.deactivateAutoHide();this.autoHideTimeout=setTimeout((()=>this.close()),this.getAutoHideDelay())}},{key:"deactivateAutoHide",value:function t(){if(this.autoHideTimeout!==null){clearTimeout(this.autoHideTimeout);this.autoHideTimeout=null}}},{key:"setAutoHide",value:function t(e){this.autoHide=e!==false}},{key:"getAutoHide",value:function t(){return this.autoHide}},{key:"setAutoHideDelay",value:function t(i){if(e.Type.isNumber(i)&&i>0){this.autoHideDelay=i}}},{key:"getAutoHideDelay",value:function t(){return this.autoHideDelay}},{key:"animateIn",value:function t(i){const n=this.getContainer();if(e.Dom.hasClass(n,this.animationClassName)){i();return}const s=()=>{e.Event.unbind(n,"transitionend",s);i()};e.Event.bind(n,"transitionend",s);e.Dom.addClass(n,this.animationClassName);if(this.useAirDesign===true){e.Dom.addClass(n,["--air","\u2014ui-context-content-dark"])}}},{key:"animateOut",value:function t(i){const n=this.getContainer();if(!e.Dom.hasClass(n,this.animationClassName)){i();return}const s=()=>{e.Event.unbind(n,"transitionend",s);i()};e.Event.bind(n,"transitionend",s);e.Dom.removeClass(n,this.animationClassName)}},{key:"handleCloseBtnClick",value:function t(){this.close()}},{key:"handleMouseEnter",value:function t(){this.fireEvent("onMouseEnter");this.deactivateAutoHide();this.setState(o.PAUSED);this.show()}},{key:"handleMouseLeave",value:function t(){this.fireEvent("onMouseLeave");this.activateAutoHide()}},{key:"fireEvent",value:function t(i){const n=this.getEvent(i);e.onCustomEvent(this,n.getFullName(),[n]);return n}}
1,{key:"addEvent",value:function t(i,s){if(e.Type.isFunction(s)){e.addCustomEvent(this,n.getFullName(i),s)}}},{key:"removeEvent",value:function t(i,s){if(e.Type.isFunction(s)){e.removeCustomEvent(this,n.getFullName(i),s)}}},{key:"getEvent",value:function t(e){const i=new n;i.setBalloon(this);i.setName(e);return i}},{key:"getData",value:function t(){return this.data}},{key:"setData",value:function t(i){if(e.Type.isPlainObject(i)){this.data=i}}}])}();class r{stacks=Object.create(null);balloons=Object.create(null);balloonDefaults={};stackDefaults={};defaultPosition=s.TOP_RIGHT;constructor(){e.addCustomEvent(window,n.getFullName("onClose"),(t=>this.handleBalloonClose(t)))}notify(t){const i=e.Type.isPlainObject(t)?t:{};const n=(i.id?this.getBalloonById(i.id):null)??(i.category?this.getBalloonByCategory(i.category):null);if(n){n.setOptions(i);n.show();if(i.blinkOnUpdate===false){n.update(null)}else{n.blink()}return undefined}const s=(()=>{if(i.stack instanceof a){this.addStack(i.stack);return i.stack}const t=e.Type.isStringFilled(i.position)?this.getStackByPosition(i.position):this.getDefaultStack();i.stack=t;return t})();const o=e.Runtime.merge({},this.getBalloonDefaults(),i);const r=s.getBalloonType(i.type);const u=new r(o);if(!(u instanceof l)){throw new TypeError("Balloon type must be an instance of BX.UI.Notification.Balloon")}this.balloons[u.getId()]=u;u.show();return u}getBalloonById(t){return this.balloons[t]??null}getBalloonByCategory(t){if(e.Type.isStringFilled(t)){for(const e of Object.values(this.balloons)){if(e.getCategory()===t){return e}}}return null}removeBalloon(t){delete this.balloons[t.getId()]}handleBalloonClose(t){const e=t.getBalloon();if(e!==null){this.removeBalloon(e)}}getStack(t){return this.stacks[t]??null}getDefaultStack(){return this.getStackByPosition(this.getDefaultPosition())}getStackByPosition(t){let i=this.getStack(t);if(i===null){i=new a(e.Runtime.merge({},this.getStackDefaults(),{id:t,position:t}));this.addStack(i)}return i}addStack(t){if(t instanceof a&&this.getStack(t.getId())===null){this.stacks[t.getId()]=t}}setBalloonDefaults(t){if(e.Type.isPlainObject(t)){Object.assign(this.balloonDefaults,e.Runtime.merge(this.balloonDefaults,t))}}getBalloonDefaults(){return this.balloonDefaults}setStackDefaults(t,i){if(a.getPositionCode(t)){const e=this.getStackByPosition(t);e.setOptions(i??null)}else if(e.Type.isPlainObject(t)){const e=t;for(const t of Object.values(s)){this.setStackDefaults(t,e)}}}setDefaultPosition(t){if(a.getPositionCode(t)){this.defaultPosition=t}}getDefaultPosition(){return this.defaultPosition}getStackDefaults(){return this.stackDefaults}}const u=e.Reflection.getClass("BX.UI");const c=new r;t.Action=i;t.Balloon=l;t.Center=c;t.Event=n;t.Manager=r;t.Position=s;t.Stack=a;t.State=o;t.UI=u})(this.BX.UI.Notification=this.BX.UI.Notification||{},BX);
2//# sourceMappingURL=notification.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.