/* Built on 2023-06-20 07:45:00 /
!function(){var e=function(e,t,n){var i=document.getElementById("header-"+(t.is_desktop?"desktop-":"mobile-")+e+"-toggle");i&&(t.bIsOpened=!1,t.menu=document.getElementById(t.id),t.menu_toggler=i,t.toggle=function(i){if(void 0===i||i!==t.bIsOpened){if(i=!t.bIsOpened){window.xv.menus.closeAll(t.iAllMenuId);for(var s in n)s!==e&&n[s].bToggle&&n[s].toggle(!1);xv.dom.removeClass(t.menu,t.hide_class?t.hide_class:"mobile-hide"),xv.dom.addClass(t.menu_toggler,t.icon_cls),t.body_cls_onopen&&xv.dom.addClass(document.body,t.body_cls_onopen),t.dontScrollToTop||xv.dom.scrollToTop()}else xv.dom.addClass(t.menu,t.hide_class?t.hide_class:"mobile-hide"),t.body_cls_onopen&&xv.dom.removeClass(document.body,t.body_cls_onopen),xv.dom.removeClass(t.menu_toggler,t.icon_cls);t.bIsOpened=i,i||"function"!=typeof t.onclose_func||t.onclose_func(t),i&&"function"==typeof t.onopen_func&&t.onopen_func(t)}},t.iAllMenuId=window.xv.menus.addClose(function(){t.toggle(!1)}),window.xv.mobile.togglers.push(t),i.onclick=function(e){return e||(e=this.originalEvent),e&&("function"==typeof e.preventDefault?e.preventDefault():e.returnValue=!1),t.toggle(),!1})},t={togglers:new Array,menus_init:function(t){for(var n in t)e(n,t[n],t)}};window.xv||(window.xv={}),window.xv.mobile=t}(),function(){window.xv||(window.xv={});var e=function(e){this.sId=e.id,this.Content=document.createElement("div"),this.setContent(e.c),this.sType=e.t,this.xMsgManager=e.xmm,this.fCallback="undefined"!=typeof e.cf&&e.cf,this.bHasCallbackFunc=!1!==this.fCallback,this.bDeletable=!1,this.sReadId="string"==typeof e.ci?e.ci:"string"==typeof e.ri&&e.ri,this.sDeleteId=!1!==this.sReadId&&"del"+this.sReadId,this.sHash="string"==typeof e.h?e.h:"undefined"!=typeof e.h&&"function"==typeof e.h.toString&&e.h.toString(),this.iCookieExpires="number"==typeof e.ce&&e.ce,this.iLastTimeInView=!1,this.bInPage="boolean"==typeof e.bInPage&&e.bInPage,this.bViewed="boolean"==typeof e.r&&e.r,this.bNotif="boolean"==typeof e.n&&e.n,this.sProfileName="string"==typeof e.p&&e.p,this.bNotifCountOnly=!1,this.bAdded=!1,this.bDeleted=!1,this.bIsPreview=!1,this.tPreviewEnd=!1,this.bLoader="boolean"==typeof e.bLoader&&e.bLoader,this.sLink="string"==typeof e.l&&e.l,this.sLinkTitle="string"==typeof e.lt&&e.lt,this.sImg="string"==typeof e.i&&e.i,this.sImgAlt="string"==typeof e.ia&&e.ia;var t=this;this.isInPage()?(Elem=this.getInPageElem(),Elem?(DelBtn=Elem.getElementsByClassName("delete"DelBtn&&DelBtn[0]&&(!1!==this.sDeleteId?(t.bDeletable=!0,xv.dom.addEventListener(DelBtn[0],"click",function(){t"delete"})):DelBtn.parentNode.removeChild(DelBtn)),this.bAdded=!0):this.bNotifCountOnly=!0):document.readyState&&"complete"===document.readyState?this.bHasCallbackFunc?this.setCallbackFunc():this.setTapReduce():xv.dom.addEventListener(window,"load",function(){t.bHasCallbackFunc?t.setCallbackFunc(e.cf):t.setTapReduce()}),!1!==this.iCookieExpires&&!1!==this.sHash&&this.xMsgManager.registerHash(this.sHash,this.iCookieExpires)};e.prototype={oIconClass:{success:"check-circle",error:"close-circle",warning:"warning-circle",question:"question-circle-o",info:"info-circle"},isAdded:function(){return this.bAdded},setAdded:function(e){"boolean"!=typeof e&&(e=!0),this.bAdded=e,this.isNotif()&&(this.bAdded?(this.xMsgManager.addToAddedNotifIds(this.sId),this.isNotifCountOnly()&&(this.bNotifCountOnly=!1),this.bDeletable=!0):this.xMsgManager.removeFromAddedNotifIds(this.sId))},isNotif:function(){return this.bNotif},isNotifCountOnly:function(){return this.bNotifCountOnly},getHash:function(){return this.sHash},hasBeenWatched:function(){if(this.isViewed())return!0;if(!this.isAdded())return!1;if(!xv.dom.isElementInView(this.getRender(),!0,{scroll_marge:5}))return this.iLastTimeInView=!1,!1;if(this.iLastTimeInView>0){if(Date.now()-this.iLastTimeInView>1e3)return!0}else this.iLastTimeInView=Date.now();return!1},isViewed:function(){return this.bViewed},setViewed:function(e){"boolean"!=typeof e&&(e=!0),this.bViewed=e},isPreview:function(){return this.bIsPreview},setPreview:function(e,t){!1!==this.tPreviewEnd&&clearTimeout(this.tPreviewEnd),"boolean"!=typeof e&&(e=!0);var n=this,i=this.getRender(!1,!0);this.xMsgManager.isOpened()?this.removePreview():"function"==typeof ?e?((i).stop().hide().slideDown(50),this.bIsPreview=!0):(i).stop().slideUp("slow",function(){n.removePreview(),n.xMsgManager.hasPreview()||"boolean"==typeof t&&!1===t||n.xMsgManager.emptyPreviewContainer()}):(this.bIsPreview=e,this.bIsPreview||n.xMsgManager.hasPreview()||"boolean"==typeof t&&!1===t||n.xMsgManager.emptyPreviewContainer()),e?this.tPreviewEnd=setTimeout(function(){n.setAdded(!1),n.tPreviewEnd=!1,n.setPreview(!1)},3e3):n.xMsgManager.updateMsgContainer()},removePreview:function(){if(!this.isNotif())return!1;this.bIsPreview=!1;var e=this.getRender(!0,!0);if(!e)return!1;"function"==typeof &&(e).stop(!0,!0).show();var t=this.xMsgManager.getPreviewMsgContainer();if(e.parentNode!==t)return!1;t.removeChild(e)},isClosable:function(){return this.bDeletable},setAsRead:function(){this.sReadId=!1,this.isNotif()&&"number"==typeof this.xMsgManager.iNotifsUnviewed&&this.xMsgManager.iNotifsUnviewed>0&&(this.xMsgManager.iNotifsUnviewed--,this.xMsgManager.updateToggleBtnBadge())},getReadId:function(){return this.sReadId||!1},getDeleteId:function(){return this.sDeleteId||!1},isUnread:function(){return"string"==typeof this.sReadId},unDelete:function(){this.bDeleted=!1,this.xMsgManager.updateAllRenders()},"delete":function(e,t){var n=this;if(this.isInPage())return void n.xMsgManager.setAsDeleted([n],function(e){e.result&&(n.bDeleted=!0,Elem=n.getInPageElem(),Elem&&("function"==typeof ?(Elem).animate({right:"-10%",opacity:0},"fast",function(){(Elem).slideUp("fast",function(){(Elem).remove()})}):Elem.parentNode.removeChild(Elem)),n.xMsgManager.updateAllRenders())});this.bDeleted=!0;var i=this.getRender(!0);!1!==i&&i.parentNode&&("function"==typeof &&!0!==t?(i).animate({right:"-100%"},"fast",function(){(i).slideUp("fast",function(){"function"==typeof e&&e(),(i).remove(),n.xMsgManager.updateAllRenders()})}):(i.parentNode.removeChild(i),this.xMsgManager.updateAllRenders(),"function"==typeof e&&e())),this.setAdded(!1)},isDeleted:function(){return this.bDeleted},isLoader:function(){return!!this.bLoader},setContent:function(e){this.Content.innerHTML=e},getRender:function(e,t){if("undefined"!=typeof this.Render)return t||this.removePreview(),this.Render;if(e)returRender=document.createElement("div"),this.Render.id=this.sId,this.DivContent=document.createElemDivContent.className="content",this.Render.appendChild(this.DivContent);var n;if("string"==typeof this.sLink&&this.sLink.length>0?(n=document.createElement("a"),n.setAttribute("href",this.sLink),"string"==typeof this.sLinkTitle&&this.sLinkTitle.length>0&&n.setAttribute("title",this.sLinkTitle),this.DivContent.appendChild(n)):n=this.DivContent,"string"==typeof this.sImg&&this.sImg.length>0){var i=document.createElement("img");i.setAttribute("src",this.sImg),i.setAttribute("alt","string"==typeof this.sImgAlt&&this.sImgAlt.length>0?this.sImgAlt:""),n.appendChild(i)}n.appendChild(this.Content);var s=this.getProfileImgSrc();if("string"==typeof s){var o=document.createElement("span");o.className="bg-icon bg-img",o.style.backgroundImage='url("'+s+'")',this.Render.appendChild(o)}else{var a=this.getIconClass();if("string"==typeof a){var d=document.createElement("span");d.className="bg-icon icon-f icf-"+a,this.Render.appendChild(d)}}var r=this.isClosable(),l=document.createElement("a"),c=document.createElement("span");l.className=r?"del":"reduce",l.setAttribute("href","#"),l.setAttribute("title",xv.utils.unescape(xv.i18n.(r?"misc.delete":"misc.reduce"))),c.className="icon-f icf-"+(r?"close-thin":"angle-down"),l.appendChild(c);var g=this;return r?xv.dom.addEventListener(l,"click",function(){g.xMsgManager.delById(g.sId)}):xv.dom.addEventListener(l,"click",function(){g.xMsgManager.toggleOpening(!1)}),this.Render.appendChild(l),this.Render},getInPageRender:function(){this.Render=document.createElement("div"),this.Render.className="account−noRender.id=this.sId;var e=document.createElement("div");e.className="notification x-message-"+this.sType;var t=this.getProfileImgSrc();if("string"==typeof t){var n=document.createElement("span");n.className="bg-icon bg-img",n.style.backgroundImage='url("'+t+'")',e.appendChild(n)}else{var i=this.getIconClass();if("string"==typeof i){var s=document.createElement("span");s.className="bg-icon icon-f icf-white-fill icf-"+i,e.appendChild(s)}}var o=document.createElement("div");o.className="content",o.appendChild(this.Content),e.appendChild(o),this.Render.appendChild(e);var a=document.createElement("button");a.setAttribute("type","button"),a.className="delete";var d=document.createElement("span");d.className="icon-f icf-close-thin",a.appendChild(d),this.RenderRender},updateRender:function(){var e=this.getRender(!0,!0);e&&(this.isViewed()?xv.dom.removeClass(e,"unviewed"):xv.dom.addClass(e,"unviewed"))},getDivContent:function(e,t){return!(!this.getRender(e,t)||!this.DivContent)&&this.DivContent},getProfileImgSrc:function(){return"string"==typeof this.sProfileName&&"/profiles-picture/"+this.sProfileName},getIconClass:function(e){return void 0===e&&(e=this.sType),"undefined"!=typeof this.oIconClass[e]&&this.oIconClass[e]},setTapReduce:function(){var e=this.getRender(!1,!0);if(!1!==e){this.touch_started=!1;var t=this;return (e).on("touchstart",funct(e).on("touchend",function(e){if(!t.touch_started)return!1;0===(e.target).closest("a, button").length&&Date.now()-t.touch_started<100&&(e.preventDefault(),t.xMsgManager.toggleOpening(!1)),t.touch_started=!1}),!0}},setCallbackFunc:function(){var e=this.getDivContent();if(!1!==e){var t=this,n=this.getRender();this.bHasCallbackFunc?xv.dom.addClass(n,"has-callback"):xv.dom.removeClass(n,"has-callback"),xv.dom.addEventListener(e,"click",function(){t.execCallbackFunc()})}},execCallbackFunc:function(){var e;if("string"==typeof this.fCallback){if(aArgs=this.fCallback.split("."),0===aArgs.length)return this.fCallback=!1,void(this.bHasCallbackFunc=!1);e=window;for(var t in aArgs){var n=aArgs[t];if("object"!=typeof e[n]&&"function"!=typeof e[n])break;e=e[n]}}else e=this.fCallback=!1;this.fCallback="function"==typeof e&&e,this.bHasCallbackFunc=!1!==this.fCallback,this.bHasCallbackFunc?this.fCallback():this.xMsgManager.toggleOpening(!1)},isInPage:function(){return!!this.bInPage},getInPageElem:function(){return document.getElementById(this.sId)||!1}};var t=function(){if(this.Container=document.getElementById("page"),this.Container∣∣(this.Container=document.body),!this.Container)return!1;this.bNotificationsInPage="social_notifications"===xv.conf.data.action&&xv.conf.data.notifications.length>0,this.bNotificationSettingsInPage="social_notifications"===xv.conf.data.action,this.oMsgsById={},this.iMsgIdCount=0,this.iLastNewInPageCount=0,this.bToggleBtnAdded=!1,this.bOpened=!1,this.bPartiallyOpened=!1,this.bNotificationsEnabled=!1,this.iVisibilityCheck=!1,this.aToggleCallbacks=[],this.oCookieExpiration={},this.aAddedNotifIds=[],this.aMsgsToDelete=[],this.bMessagesLoadedFromChat=!1,this.iNotifsNotLoaded=!1,this.iNotifsUnviewed=!1,this.iAllMenuId=!1;var e=this;this.bPartiallyOpened||"undefined"==typeof window.xv.menus||"function"!=typeof window.xv.menus.addClose||(this.iAllMenuId=window.xv.menus.addClose(function(){e.bPartiallyOpened||e.toggleOpening(!1,{bUnreadNoUpdate:!0})})),this.InPageReloadBtn=!1,this.InPageDeleteAll=!1,this.isInPage()&&(this.InPageReloadBtn=document.getElementById("account-notifications-reload"),this.InPageReloadBtn&&xv.dom.addEventListener(this.InPageReloadBtn,"click",function(){e.addNotifCountsMsgs()}),this.InPageDeleteAllInPageDeleteAll&&xv.dom.addEventListener(this.InPageDeleteAll,"click",function(){e.delAllClosableNotifs()})),this.isSettingsInPage()&&this.getSettingsBtn()};t.prototype={initXMsg:function(t){if("string"==typeof t)t={c:t};else if("object"!=typeof t)return!1;var n=t.id;if(t.bInPage){var i=document.getElementById("account-notification-"+t.h.toString())||!1;i&&i.id&&(t.id=n=i.id)}"string"==typeof n&&0!==n.length||"string"==typeof n&&0!==n.length||(this.iMsgIdCount++,t.id=n="msg-mngr-"+this.iMsgIdCount),t.xmm=this;var s=new e(t);return s.isNotif()&&("number"==typeof this.iNotifsNotLoaded&&this.iNotifsNotLoaded>0&&this.iNotifsNotLoaded--,(s.isViewed()||!s.isUnread())&&"number"==typeof this.iNotifsUnviewed&&this.iNotifsUnviewed>0&&this.iNotifsUnviewed--),this.oMsgsById[n]=s,this.updateToggleBtn(),this.initUpdateViewedStatusCheck(),this.oMsgsById[n]},initXMsgs:function(e,t){var n=xv.cookies.get("hide_xmsg"),i=[],s=0;if("string"==typeof n)for(i=n.split(","),s=0;s<i.length;s++)"string"==typeof(n=i[s])&&(i[s]=n.split(":")[0]);for(s=0;s<e.length;s++){var o=e[s];"string"==typeof o.h&&-1!==i.indexOf(o.h)&&(o.r=!0),o.bInPage=!!t,this.initXMsg(o)}},addNotifCountsMsgs:function(){this.InPageReloadBtn&&(this.InPageReloadBtn.style.display="none");for(var e=this.getAllNotifCount(),t=this.getNotifMsgContainer(),n=0;n<e.length;n++){var i=e[n],s=i.getRender();t.firstElementChild?t.insertBefore(s,t.firstElementChild):t.appendChild(s),i.setAdded()}this.saveAsRead(e)},getById:function(e,t){var n=this.oMsgsById[e];return!(void 0===n||!0===n.isDeleted()&&!0!==t||!0===n.isLoader()&&!0!==t||!this.bNotificationsEnabled&&!0===n.isNotif()&&!1===n.isInPage()&&!0!==t)&&n},getAll:function(e){var t=[];for(var n in this.oMsgsById){var i=this.getById(n,e);i&&t.push(i)}return t},getAllSysMsg:function(e){var t=[];for(var n in this.oMsgsById){var i=this.getById(n,e);!i||i.isNotif()||i.isLoader()||t.push(i)}return t},getAllClosable:function(e){for(var t=this.getAll(e),n=[],i=0;i<t.length;i++){var s=t[i];s.isClosable()&&n.push(s)}return n},getAllClosableNotifs:function(e){for(var t=this.getAll(e),n=[],i=0;i<t.length;i++){var s=t[i];s.isClosable()&&s.isNotif()&&n.push(s)}return n},getAllClosableIds:function(e){for(var t=this.getAllClosable(e),n=[],i=0;i<t.length;i++){var s=t[i];n.push(s.sId)}return n},getAllClosableNotifsIds:function(e){for(var t=this.getAllClosableNotifs(e),n=[],i=0;i<t.length;i++){var s=t[i];n.push(s.sId)}return n},getAllNotif:function(e){for(var t=this.getAll(e),n=[],i=0;i<t.length;i++){var s=t[i];s.isNotif()&&n.push(s)}return n},getAllNotifCount:function(e){for(var t=this.getAll(e),n=[],i=0;i<t.length;i++){var s=t[i];s.isNotifCountOnly()&&n.push(s)}return n},hasClosableMsg:function(e){for(var t=this.getAll(e),n=0;n<t.length;n++){if(t[n].isClosable())return!0}return!1},getByHash:function(e,t){var n=this.getAll(t);e=e.toString();for(var i in n){var s=n[i];if(s.getHash()===e)return s}return!1},delByHash:function(e){var t=this.getByHash(e,!0);t&&t.sId&&this.delById(t.sId)},delById:function(e){this.delByIds([e])},delByIds:function(e,t){for(var n=[],i=0;i<e.length;i++){var s=this.getById(e[i]);s&&((s.isClosable()||s.isInPage())&&n.push(s),this.aMsgsToDelete.push(s))}var o=this;this.startDeletingMsgList(function(){o.saveAsRead(n),o.updateToggleBtn(),o.updateInPage(),"function"==typeof t&&t()})},delAllClosable:function(e){this.delByIds(this.getAllClosableIds(),e)},delAllClosableNotifs:function(e){var t=this;xv.utils.contextual_popup.confirm(xv.i18n.__("chat.delete_all_messages"),function(){t.delByIds(t.getAllClosableNotifsIds(),e)})},startDeletingMsgList:function(e){if(0===this.aMsgsToDelete.length)return void("function"==typeof e&&e());var t=this;this.aMsgsToDelete.pop()"delete",setTimeout(function(){t.startDeletingMsgList(e)},40)},updateViewedStatus:function(){if(0===this.countUnviewed(!0))return this.clearUpdateViewedStatusCheck(),!1;var e=this.getAll(),t=[];for(var n in e)!e[n].isViewed()&&e[n].hasBeenWatched()&&t.push(e[n]);t.length>0&&(this.setAllToViewed(t),this.updateAllRenders())},initUpdateViewedStatusCheck:function(){if(this.clearUpdateViewedStatusCheck(),this.isOpened()){var e=this;this.countUnviewed()>0&&(this.iVisibilityCheck=setInterval(function(){e.updateViewedStatus()},500))}},clearUpdateViewedStatusCheck:function(){!1!==this.iVisibilityCheck&&(clearInterval(this.iVisibilityCheck),this.iVisibilityCheck=!1)},setAllToViewed:function(e){"object"!=typeof e&&(e=this.getAll());var t=[];for(var n in e)e[n].isViewed()||e[n].setViewed(),e[n].isUnread()&&t.push(e[n]);this.saveAsRead(t)},saveAsRead:function(e){if(!(e.length<1)){var t="";for(var n in e)oMsg=e[n],oMsg.isUnread()&&(t+="msgid[]="+oMsg.getReadId()+"&",oMsg.setAsRead()),oMsg.setViewed(!0);if(""!==t){var i=xv.utils.createRequestObject();i.withCredentials=!0,i.open("POST","/account/message-closed",!0),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(t)}}},setAsDeleted:function(e,t){if(!(e.length<1)){var n="send_res=1";for(var i in e)oMsg=e[i],n+="&msgid[]="+oMsg.getDeleteId(),oMsg.setAsRead(),oMsg.setViewed(!0);if("send_res=1"!==n){var s=xv.utils.createRequestObject();s.withCredentials=!0,s.open("POST","/account/message-closed",!0),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){if(4===s.readyState&&200===s.status&&s.response&&"function"==typeof t)try{var e="object"==typeof s.response?s.response:"string"==typeof s.response?JSON.parse(s.response):null;t(e)}catch(n){console.error(n,s)}},s.send(n)}}},showPreview:function(e){if(this.isOpened()||this.isInPage())return!1;var t=this.getById(e),n=this.getMsgContainer(),i=this.getPreviewMsgContainer();if(!t||!t.isNotif())return!1;"function"==typeof window.navigator.vibrate&&window.navigator.vibrate(100),xv.dom.addClass(n,"preview");var s=xv.dom.getChildren(i);s.length>0?i.insertBefore(t.getRender(!1,!0),s[0]):i.appendChild(t.getRender(!1,!0)),t.setPreview(!0)},hasPreview:function(){aMsgs=this.getAll();for(var e in aMsgs)if(aMsgs[e].isPreview())return!0;return!1},emptyPreviewContainer:function(){var e=this.getMsgContainer(),t=this.getAll();xv.dom.removeClass(e,"preview");for(var n in t)t[n].isPreview()&&t[n].removePreview();this.updateMsgContainer()},getLastAddedNotifMsg:function(){return 0!==this.aAddedNotifIds.length&&this.getById(this.aAddedNotifIds[0])},addToAddedNotifIds:function(e){this.removeFromAddedNotifIds(e),this.aAddedNotifIds.unshift(e)},removeFromAddedNotifIds:function(e){for(var t=0;t<this.aAddedNotifIds.length;t++)this.aAddedNotifIds[t]===e&&this.aAddedNotifIds.splice(t,1);return!1},count:function(e,t){if(!0!==e&&!0!==t){var n=this.getAll().length;return isNaN(n)?0:n}var i=this.getAll(),s=0;for(var o in i)(!0===t?!0===i[o].isNotifCountOnly():!0===i[o].isNotif())&&s++;return s},countTotal:function(){var e=this.count();return this.bNotificationsEnabled?"number"==typeof this.iNotifsNotLoaded&&(e+=this.iNotifsNotLoaded):e-=this.count(!0),e},countUnviewed:function(e){var t=this.getAll(),n=0,i=0;for(var s in t){var o=t[s];o.isInPage()||!1!==o.isViewed()||(n++,!0===o.isNotif()&&i++)}return this.bNotificationsEnabled?e||"number"!=typeof this.iNotifsUnviewed||(n+=this.iNotifsUnviewed):n-=i,n},createChatLoader:function(){var e=this.getById("message_spinner_from_chat",!0);if(e)return void(e.isDeleted()&&e.unDelete());this.initXMsg({id:"message_spinner_from_chat",c:'',r:!0,bLoader:!0})},removeChatLoader:function(){var e=this.getById("message_spinner_from_chat",!0);e&&e"delete"},loadMessagesFromChat:function(){this.bMessagesLoadedFromChat||"function"==typeof window.xv.get_messages_from_chat&&(this.isInPage()||this.createChatLoader(),window.xv.get_messages_from_chat())},getToggleBtn:function(){return this.createToggleBtn(),this.ToggleBtn},createToggleBtn:function(){if("undefined"==typeof this.ToggleBtn){var e=document.createElement("button");e.id="x-x-messages-btn",e.setAttribute("type","button");var t=document.createElement("span");t.className="ic",e.appendChild(t);var n=document.createElement("span");n.className="icon-f icf-bell",n.setAttribute("title",xv.utils.unescape(xv.i18n.("messages.from_site",{"%site%":1===xv.utils.getSiteId()?xv.conf.dyn.is_premium?"Xvideos RED":"Xvideos.com":xv.conf.dyn.is_premium?"XNXX GOLD":"XNXX.com"}))),t.appendChild(n),this.ToggleBtnBadge=document.createElement("span"),this.ToggleBtnBadge.className=ToggleBtnBadge);var i=this;xv.dom.addEventListener(e,"click",function(){i.toggleOpening()}),this.ToggleBtn=e}},addToggleBtn:function(){if(!0===this.bToggleBtnAdded)return!1;this.Container.appendChild(this.getToggleBtn()),this.bToggleBtnAdded=!0},removeToggleBtn:function(){if(!0!==this.bToggleBtnAdded)return!1;this.bToggleBtnAdded=!1,this.toggleOpening(!1),this.Container.removeChild(this.getToggleBtn())},updateToggleBtn:function(){var e=this.countTotal();if(0===e||isNaN(e))return void this.removeToggleBtn();this.addToggleBtn(),this.updateToggleBtnBadge(),this.isOpened()?xv.dom.addClass(this.getToggleBtn(),"opened"):xv.dom.removeClass(this.getToggleBtn(),"opened")},updateToggleBtnBadge:function(){if(!0!==this.bToggleBtnAdded)return!1;var e=this.countUnviewed();this.ToggleBtnBadge.innerHTML=e,this.ToggleBtnBadge.style.display=e>0?"inline-block":"none"},setNextToChat:function(){var e=this.getToggleBtn(),t=this.getMsgContainer(),n=this.getMsgMenu();xv.dom.addClass(e,"chat-window-side"),xv.dom.addClass(t,"chat-window-side"),xv.dom.addClass(n,"chat-window-side")},addToggleCallback:function(e){"function"==typeof e&&this.aToggleCallbacks.push(e)},isOpened:function(e){return this.bOpened&&(!0===e||!this.bPartiallyOpened||0===this.count(!0))},toggleOpening:function(e,t){var n=!!t&&!!t.bPartial,i=!!t&&!!t.bUnreadOnly,s=!!t&&!!t.bUnreadNoUpdate;if(this.emptyPreviewContainer(),"boolean"!=typeof e)e=!this.isOpened();else if(e===this.bOpened&&this.bPartiallyOpened===!!n)return;if(!0==!!i){var o=!1,a=this.getAll();for(var d in a){var r=a[d];if(!(r.isViewed()||r.isNotif()&&!0!=!!n)){o=!0;break}}if(!1===o)return}var l=this.getMsgContainer();this.bOpened=e;var c=this;if(this.bOpened)this.bNotificationsInPage||this.loadMessagesFromChat(),this.initUpdateViewedStatusCheck(),this.bPartiallyOpened=!!n,this.updateMsgContainer(),this.bPartiallyOpened||"undefined"==typeof window.xv.menus||"function"!=typeof window.xv.menus.closeAll||window.xv.menus.closeAll(this.iAllMenuId),"function"==typeof ?(l).slideDown("fast",function(){(l).addClass("opened"),c.bPartiallyOpened||("body").addClass("x-messages-opened"),c.updateAllRenders()}):xv.dom.addClass(l,"opened");else{this.isSettingsInPage()||this.toggleSettings(!1),this.clearUpdateViewedStatusCheck();var g=[],h=0,u=Math.round((new Date).getTime()/1e3);for(var f in this.oCookieExpiration)g.push(f+":"+(u+parseInt(this.oCookieExpiration[f]))),h=Math.max(0,this.oCookieExpiration[f]);xv.cookies.setLocal("hide_xmsg",g.join(","),1e3h,"/"),s||(this.bPartiallyOpened?this.setAllToViewed(this.getAllSysMsg()):this.setAllToViewed()),"function"==typeof ?(l).slideUp("fast",function(){(l).removeClass("opened"),("body").removeClass("x-messages-opened"),c.updateAllRenders()}):xv.dom.removeClass(l,"opened")}for(var d in this.aToggleCallbacks)this.aToggleCallbacksd;"function"!=typeof &&this.updateAllRenders()},getMsgContainer:function(){return this.createMsgContainer(),this.MsgContainer},getPreviewMsgContainer:function(){return this.createMsgContainer(),this.PreviewMsgContainer},getSysMsgContainer:function(){return this.createMsgContainer(),this.SysMsgContainer},getNotifMsgContainer:function(){return this.createMsgContainer(),this.NotifMsgContainer},createMsgContainer:function(){if("undefined"==typeof this.MsgContainer){this.MsgContainer=document.createElement("div"),this.MsgContainer.id="x−messages",MsgContainerBack=document.createElement("div"),MsgContainerBack.id="x−messagesMsgContainer.appendChild(MsgContainerBack),this.MsgContainerScrollable=document.createElement("div"),this.MsgContainerScrollable.id="PreviewMsgContainer=document.createElement("div"),this.PreviewMsgContainer.appendChild(t),this.MsgContainerScrollable.appendChild(this.PreviewMsgContainer),this.SysMsgContainer=document.creaMsgContainerScrollable.appendChild(this.SysMsgContainer),this.isInPage()?this.NotifMsgContainer=document.getElementById("account-notifications"):(this.NotifMsgContainer=document.creaNotifTitle=document.createElement("p"),NotifTitleIcon=document.createENotifTitle.className="notif-sep",NotifTitleIcon.className="icon−NotifTitle.appendChild(NotifTitleIcon),this.NotifMsgContainer.appendChild(NotifTitle),this.MsgContainerScrollable.appendChild(this.NotifMsgContainer)),this.MsgContainer.appendChild(this.MsgConMsgContainer,n),xv.dom.addEventListener(MsgContainerBaMsgContainerScrollable,"scroll",function(){e.updateMsgContainerScroll()}),this.updateToggleBtn()}},updateMsgContainer:function(){var e=this.getSysMsgContainer(),t=this.getNotifMsgContainer();if(!this.isOpened(!0))return xv.dom.addClass(e,"hidden"),void(this.isInPage()||xv.dom.addClass(t,"hidden"));xv.dom.removeClass(e,"hidden");var n=this;setTimeout(function(){n.updateMsgContainerScroll()},200);var i=this.getPreviewMsgContainer(),s=this.getAll(),o=this.count(!0);this.isInPage()||(0!==o&&!this.bPartiallyOpened&&this.isOpened()&&this.bNotificationsEnabled?xv.dom.removeClass(t,"hidden"):xv.dom.addClass(t,"hidden")),this.bNotificationsEnabled?xv.dom.removeClass(i,"hidden"):xv.dom.addClass(i,"hidden");var a=!0,d=!1;for(var r in s){var l=s[r];if(!l.isInPage())if(l.isAdded())l.updateRender(),l.isNotif()?d=!0:a=!1;else if(l.isNotif()){if(!this.bPartiallyOpened){var c=this.getLastAddedNotifMsg(),g=l.getRender();c?t.insertBefore(g,c.getRender()):t.appendChild(g),l.setAdded(),d=!0}}else e.appendChild(l.getRender()),l.setAdded(),a=!1}var h=this.getMsgContainer();!0===a&&!0===d?xv.dom.addClass(h,"notif-only"):xv.dom.removeClass(h,"notif-only")},updateMsgContainerScroll:function(){var e=this.getMsgContainer();if(!isNaN(this.MsgContainerScrollable.scrollHeight)){if(this.MsgContainerScrollable.scrollHeight<=this.MsgContainerScrollable.scrollTop)return xv.dom.removeClass(e,"can-scroll-top"),void xv.dom.addClass(e,"can-scroll-bottom");xv.dom.addClass(e,"can-scroll-top"),this.MsgContainerScrollable.offsetHeight+MsgContainerScrollable.scrollTop>=this.MsgContainerScrollable.scrollHeight?xv.dom.removeClass(e,"can-scroll-bottom"):xv.dom.addClass(e,"can-scroll-bottom")}},updateInPage:function(){if(!this.isInPage())return!1;if(this.InPageDeleteAll){this.getAllNotif().length>0?"function"==typeof ?(this.InPageDeleteAll).is(":visible")∣∣(this.InPageDeleteAll).fadeIn():this.InPageDeleteAll.style.display="inline-block":"function"==typeof ?(this.InPageDeleteAll).is(":visible")&&(this.InPageDeleteAll).fadeOut():this.InPageDeleteAll.style.display="none"}var e=this.count(null,!0);if(e!==this.iLastNewInPageCount){if(this.iLastNewInPageCount=e,e<1)return void(this.InPageReloadBtn&&(this.InPageReloadBtn.style.display="none"));NewNotifsCNewNotifsCount,"updated"),setTimeout(function(){xv.dom.removeClass(NewNotifsCount,"updated")},1e3),NewNotifsCount.innerHTML=e,this.InPageReloadBtn&&("function"==typeof ?(this.InPageReloadBtn).is(":visible")||(this.InPageReloadBtn).fadeIn():this.InPageReloadBtn.style.display="block")}},getMsgMenu:function(){return this.createMsgMenu(),this.MsgMenu},createMsgMenu:function(){if("undefined"==typeof this.MsgMenu){this.MsgMenu=document.createElement("div"),this.SettingsBtn=this.getSettingsBtn(),this.MsgMenu.appendChild(SettingsBtn),"function"==typeof window.xv.get_messages_from_chat&&(SeeAll=document.createElement("a"),SeeAll.setAttribute("href","/account/my-notifications"),SeeAll.className="btn",SeeAll.innerHTML=xv.i18n.("misc.see_all"),this.MsgMenu.appendChild(SeeAll))),this.MsgMeMsgMenu,i),this.updateToggleBtn()}},updateMsgMenu:function(){var e=this.getMsgMenu();return this.isOpened(!0)?("function"==typeof ?(e).hasClass("opened")||(e).slideDown("fast",function(){(e).addClass("opened")}):xv.dom.addClass(e,"opened"),this.hasMsgMenuSetting()?xv.dom.addClass(e,"has-settings"):xv.dom.removeClass(e,"has-settings"),this.isOpened()?(xv.dom.removeClass(e,"partially"),void(this.hasClosableMsg()?xv.dom.addClass(e,"has-closable"):xv.dom.removeClass(e,"has-closable"))):(xv.dom.removeClass(e,"has-closable"),void xv.dom.addClass(e,"partially"))):("function"==typeof ?(e).slideUp("fast",function(){(e).removeClass("opened")}):xv.dom.removeClass(e,"opened"),void(this.isSettingsInPage()||this.toggleSettings(!1)))},toggleSettings:function(e){if(!1!==e&&"undefined"!=typeof xv&&"undefined"!=typeof xv.settings_btn&&"function"==typeof xv.settings_btn.openChatSettings&&!this.bSettingsOpened)return void xv.settings_btn.openChatSettings();if("boolean"!=typeof e)e=!this.bSettingsOpened;else if(e===this.bSettingsOpened)return;this.bSettingsOpened=e;var t=this.getSettings();this.bSettingsOpened?("function"==typeof ?(t).slideDown("fast",function(){(t).addClass("opened")}):xv.dom.addClass(t,"opened"),xv.dom.addClass(this.SettingsBtn,"opened?(t).slideUp("fast",function(){(t).removeClass("opened")}):xv.dom.removeClass(t,"opened"),xv.dom.removeClass(this.SettingsBtn,"opened"))},getSettingsBtn:function(){if("undefined"!=typeof this.SettingsBtn)return this.SettingsBtn;if(this.isSettingsInPage()&&(SettingsBtn=document.getElementById("account-notifications-settings"),SettingsBtn&&(this.SettingsBtn=SettingsBtn)),"undefined"==typeofthis.SettingsBtn){this.SettingsBtn=document.createElSettingsBtn.className="settings-btn btn btn-default",this.SettingsBtn.setAttribute("type","buSettingsBtn.setAttribute("title",xv.utils.unescape(xv.i18n._("misc.settings")));var e=document.createElement("span");e.className="icon-f icf-cog",this.SettingsBtn.appendChild(e)}var t=this;return xv.dom.addEventListener(this.SettingsBtn,"click",function(e){e=e||window.event,"function"==typeof e.preventDefault?e.preventDefault():e.returnValue=!1,t.toggleSettings()}),this.SettingsBtn},getSettings:function(){return this.updateSettings(),this.Settings},updateSettings:function(){if(this.createSettings(),"undefined"!=typeof this.aSettings&&("undefined"==typeof this.iLastSettingsUpdate||this.iLastSettingsUpdate!==this.aSettings.length)){this.iLastSettingsUpdate=this.aSettings.length;for(var e=0;e<this.aSettings.length;e++){var t=this.aSettings[e];if(!t.bAdded){t.bAdded=!0;var n=document.createElement("button");n.className="btn btn-default",
n.setAttribute("type","button"),n.innerHTML=t.sTitle,xv.dom.addEventListener(n,"click",t.fAction),this.Settings.appendChild(n)}}}},createSettings:function(){if("undefined"==typeof this.Settings){this.Settings=document.createElement("Settings.id="x-messages-menu-settings",this.isSettingsInPage()&&(this.Settings.appendChild(t);var i=document.createElement("p");i.className="title";var s=document.createElement("span");s.className="icon-f icf-cog",i.appendChild(s);var o=document.createTextNode(" "+xv.utils.unescape(xv.i18n.__("misc.settings"))+" ");i.appendChild(o),this.Settings.appendChild(i);var a=!1;if(this.isSettingsInPage()&&(ActionsContainer=document.getElementById("account-notifications-actions"),ActionsContainer&&(ActionsContainer.append(this.Settings),a=!0)),!1===a){var d=this.getToggleBtn();this.addToggleBtn(),d.parentNode.insertBefore(this.Settings,d)}this.updateToggleBtn()}},addAMsgMenuSetting:function(e,t){"undefined"==typeof this.aSettings&&(this.aSettings=[]),this.aSettings.push({sTitle:e,fAction:t,bAdded:!1})},hasMsgMenuSetting:function(){return"undefined"!=typeof this.aSettings&&!this.isSettingsInPage()&&this.aSettings.length>0},isInPage:function(){return!!this.bNotificationsInPage},isSettingsInPage:function(){return!!this.bNotificationSettingsInPage},registerHash:function(e,t){this.oCookieExpiration[e]=t||1296e3},updateAllRenders:function(){this.updateToggleBtn(),this.updateMsgContainer(),this.updateMsgMenu(),this.updateInPage()},setNotificationFeatureEnabled:function(e){this.isInPage()?this.bNotificationsEnabled=!1:this.bNotificationsEnabled=!!e,this.updateAllRenders()}};var n=new t,i={};window.xv.messages={registerOnToggle:function(e){n&&"function"==typeof n.addToggleCallback&&n.addToggleCallback(e)},xmmDelById:function(e){n&&"function"==typeof n.delById&&n.delById(e)},xmmDelByHash:function(e){n&&"function"==typeof n.delByHash&&n.delByHash(e)},updateAjaxTabMessages:function(){var e=document.getElementById("x-ajax-tab-messages");e&&new o(e)},addXMessageSetting:function(e,t){if(!n)return!1;n.addAMsgMenuSetting(e,t)},setMessageNextToChat:function(){n&&(n.setNextToChat(),n.loadMessagesFromChat())},removeChatLoader:function(){if(!n)return!1;n.removeChatLoader()},setNotificationFeatureEnabled:function(e){if(!n)return!1;n.setNotificationFeatureEnabled(e)},addMessageFromChat:function(e,t){if("object"!=typeof e||"object"!=typeof n||"function"!=typeof n.initXMsg)return!1;n.removeChatLoader(),e.n=!0,e.bInPage=n.isInPage();var i=n.initXMsg(e);n.updateAllRenders(),!n.isOpened()&&i&&(t?n.toggleOpening(!0):n.showPreview(i.sId))},setMessagesFromChat:function(e){if(!n)return!1;if(n.removeChatLoader(),"object"==typeof e)for(var t in e)"undefined"!=typeof e[t].h&&n.delByHash(e[t].h),e[t].bInPage=n.isInPage(),n.initXMsg(e[t]);n.bMessagesLoadedFromChat=!0,n.updateAllRenders()},setMessagesCountsFromChat:function(e){if(n.removeChatLoader(),"undefined"==typeof e.count||"undefined"==typeof e.count_unread||!n||void 0!==n&&n.bMessagesLoadedFromChat)return!1;isNaN(parseInt(e.count))||(n.iNotifsNotLoaded=parseInt(e.count)),isNaN(parseInt(e.count_unread))||(n.iNotifsUnviewed=parseInt(e.count_unread)),n.updateToggleBtn(),n.isOpened()&&n.loadMessagesFromChat()},setGenericMessage:function(e,t){if(!n)return!1;n.removeChatLoader(),t&&n.toggleOpening(!0,{bPartial:!0}),"object"==typeof e&&n.initXMsg(e),n.updateAllRenders()},xmmHTMLDelById:function(e){var t=i[e];if(void 0===t||"function"!=typeof t["delete"])return!1;t"delete"}},xv.conf&&("undefined"!=typeof xv.conf.dyn.xmsg&&xv.conf.dyn.xmsg.length>0&&(n.initXMsgs(xv.conf.dyn.xmsg),n.toggleOpening(!0,{bPartial:!0,bUnreadOnly:!0})),n.isInPage()&&"undefined"!=typeof xv.conf.data.notifications&&xv.conf.data.notifications.length>0&&n.initXMsgs(xv.conf.data.notifications,!0));var s=function(e){this.Msg=e;vart=xv.dom.getChildren(Msg),n=this;for(var s in t){var o=t[s];if(xv.dom.hasClass(o,"del")){var a;if(!(a=o.dataset?o.dataset.id:o.getAttribute("id")))return void o.parentNode.removeChild(o);this.sCloseId=a,i[a]=this,xv.dom.addEventListener(o,"click",function(e){e=e||window.event,"function"==typeof e.preventDefault?e.preventDefault():e.returnValue=!1,n"delete"})}}};s.prototype={"delete":function(){var e=xv.utils.createRequestObject();e.withCredentials=!0,e.open("POST","/account/message-closed",!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send("msgid[]="+this.sCloseId),this.Msg.parentNode.removeChild(this.Msg),"undefined"!=typeof i[this.sCloseId]&&delete i[this.sCloseId]}};var o=function(e){this.Container=e,this.ContainerInner=xv.dom.getFirstChild(this.Container);vart=xv.dom.getChildrenContainerInner);for(var n in t){var i=t[n];xv.dom.hasClass(i,"x-message")&&new s(i)}},a=document.getElementById("x-home-messages");a&&new o(a);var d=document.getElementById("x-red-home-messages");d&&new o(d)}(),function(){var e={};e.menu={id:"mobile-menu",icon_cls:"vertical"},e.filters={id:"mobile-filters-menu",icon_cls:"opened"};var t="xv-search-form",n="mobile-hide",i=!1;if(xv&&xv.conf&&xv.conf.data&&"main"===xv.conf.data.action){var s=document.getElementById("home-mobile-search");s&&"string"==typeof s.tagName&&(t="home-mobile-search",n="no-nothing",i=!0)}if(e.search={id:t,hide_class:n,icon_cls:"close",dontScrollToTop:!0,onclose_func:function(){if(i){("#"+t+" input[type=text]").first().focus(),("html,body").animate({scrollTop:0},400)}else window.jQuery&&("#header .white-stripe").removeClass("isForcedFixedPosition")},onopen_func:function(e){if(window.jQuery){var n=("#"+t+" input[type=text]").first(),s=("#header .white-stripe"),o=s.length&&"fixed"===s.css("position");if(n.focus(),!i&&o)return s.addClass("isForcedFixedPosition"),!1;var a=("#"+t).offset().top-(o?s.outerHeight():0);return (window).width()>(window).height()&&(window).scrollTop()<a&&("html,body").animate({scrollTop:a},400),i&&e.toggle(!1),!1}xv.dom.scrollToTop()}},xv.mobile.menus_init(e),xv.header&&(xv.header.nav=document.getElementById("navnav)){xv.header.oNavVars={menuToggle:document.getElmainGenderCatsBtn:document.getElementById("nav-main-cat-switcher-btn"),mainCatBtn:document.getElementById("main-cats-sub-list-btn")};var o,a={},d=[],r=!1,l=!1,c=0,g=-1,h=function(){for(var e in a)u(e)},u=function(e){!1===a[e].bIsInit&&(a[e].bIsInit="processing",a[e].list&&a[e].btn?xv.dom.addEventListener(a[e].btn,"click",function(){toggle_sub_menu(e)}):a[e].bDisabled=!0,a[e].bIsInit=!0)},f=function(){if(!0===r)return!1;r=!0;for(var e=0;e<d.length;e++){var t=d[e];"function"==typeof t&&t()}d=[]},v=function(e){o=!1;for(var t in a)a[t].bIsOpened=!1;xv.header.update_menu_classs()},p=function(e){f(),o=!0,xv.menus.closeAll(g);var t="string"==typeof l;for(var n in a)!0===a[n].bIsOpened&&(t=!1);!0===t&&(a[l].bIsOpened=!0),xv.header.update_menu_classs()},m=function(e){if(a[e].bIsOpened)return xv.header.update_menu_classs(),void("function"==typeof a[e].already_opened_func&&a[e].already_opened_func());for(var t in a)a[t].bIsOpened=!1;a[e].bIsOpened=!0,xv.header.update_menu_classs()};close_sub_menu=function(e){a[e].bIsOpened=!1,xv.header.update_menu_classs()},toggle_sub_menu=function(e){a[e].bIsOpened?close_sub_menu(e):m(e)},xv.header.add_sub_menu=function(e,t,n,i,s,o){if(e&&t){var d={btn:e,list:t,bIsOpened:!1,bDisabled:!1,bIsInit:!1};return c++,"string"!=typeof n&&(n="sub_menu"+c),o&&"function"==typeof o.already_opened_func&&(d.already_opened_func=o.already_opened_func),a[n]=d,(!1===l&&!1!==s||!0===s)&&(l=n),!0!==i&&h(),n}},xv.header.add_mobile_menu_init=function(e){r=!1,d.push(e),o&&f()},xv.header.is_menu_opened=function(){return window_resize_callback(!1),o},xv.header.is_sub_menu_opened=function(e){return!(!xv.header.is_menu_opened()||"undefined"==typeof a[e]||!a[e].bIsOpened)},xv.header.open_sub_menu=function(e){if(!e){if(!l)return!1;e=l}p(),m(e),"undefined"!=typeof window.xv&&"undefined"!=typeof window.xv.dom&&"function"==typeof window.xv.dom.scrollToTop&&window.xv.dom.scrollToTop()},xv.header.open_default_sub_menu=function(){xv.header.open_sub_menu()},xv.header.update_menu_classs=function(){xv.header.is_menu_opened()?(xv.dom.addClass(xv.header.nav,"opened"),xv.dom.addClass(xv.menuToggle,"opened"),xv.dom.addClass(document.body,"mobile-menu-opened")):(xv.dom.removeClass(xv.header.nav,"openedforced−opemenuToggle,"opened"),xv.dom.removeClass(document.body,"mobile-menu-opened"));for(var e in a)!0!==a[e].bDisabled&&(a[e].bIsOpened?(xv.dom.addClass(a[e].btn,"opened"),xv.dom.addClass(a[e].list,"opened")):(xv.dom.removeClass(a[e].btn,"opened"),xv.dom.removeClass(a[list,"opened")))},xv.header.update_sub_menu_btn=function(e,t){"undefined"!=typeof a[e]&&t&&(a[e].btn=t,xv.dom.addEventListener(a[e].btn,"click",function(){toggle_sub_menu(e)}))},xv.header.update_sub_menu_list=function(e,t){"undefined"!=typeof a[e]&&t&&(a[e].list=t)},xv.header.oNavVars.mainCatBtn&&xv.header.add_sub_menu(xv.header.oNavVars.mainCatBtn,mainGenderCatsBtn&&xv.header.add_sub_menu(xv.header.oNavVars.menuToggle,"click",function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,o?v():p()}),xv.dom.addClass(xv.header.oNavVars.$menuToggle,"init-ok"),g=xv.menus.addClose(function(){v()})}}();