!function(){"use strict";function n(n,t){var i="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!i){if(Array.isArray(n)||(i=function(n,t){if(!n)return;if("string"==typeof n)return e(n,t);var i=Object.prototype.toString.call(n).slice(8,-1);"Object"===i&&n.constructor&&(i=n.constructor.name);if("Map"===i||"Set"===i)return Array.from(n);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return e(n,t)}(n))||t&&n&&"number"==typeof n.length){i&&(n=i);var o=0,c=function(){};return{s:c,n:function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}},e:function(n){throw n},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){i=i.call(n)},n:function(){var n=i.next();return a=n.done,n},e:function(n){s=!0,r=n},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw r}}}}function e(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=n[t];return i}function t(){var e=jQuery(".login-menu-block")[0],r=jQuery("<div/>",{style:"display: flex; align-items: center;"}).html('<svg width="20px" height="20px" viewBox="0 0 512 512">\n        <path d="M176,256H16v-64h160v-64l96,96l-96,96V256z M496,0v416l-192,96v-96H112V288h32v96h160V96l128-64H144v128h-32V0H496z"/>\n    </svg>'),a=jQuery("<div/>",{style:"display: flex; align-items: center;"}).html('<svg width="22px" height="22px" viewBox="0 0 58 58">\n        <path d="M51,49.957c0-3.038-1.717-5.816-4.434-7.174l-9.552-4.776C35.78,37.39,35,36.128,35,34.748V31\n            c0.268-0.305,0.576-0.698,0.904-1.162c1.302-1.838,2.286-3.861,2.969-5.984C40.098,23.477,41,22.345,41,21v-4\n            c0-0.88-0.391-1.667-1-2.217V9c0,0,1.187-9-11-9C16.812,0,18,9,18,9v5.783c-0.609,0.55-1,1.337-1,2.217v4\n            c0,1.054,0.554,1.981,1.383,2.517C19.382,27.869,22,31,22,31v3.655c0,1.333-0.728,2.56-1.899,3.198L11.18,42.72\n            C8.603,44.125,7,46.826,7,49.761V52c0,0,0,0.657,0,1c0,2.761,9.85,5,22,5s22-2.239,22-5c0-0.343,0-1,0-1V49.957z"/>\n    </svg>'),s=jQuery("<div/>",{class:"notificationsIcon disabled"}).html('<svg width="22px" height="22px" viewBox="0 0 510 510">\n        <path d="M255,510c28.05,0,51-22.95,51-51H204C204,487.05,226.95,510,255,510z M420.75,357V216.75\n        c0-79.05-53.55-142.8-127.5-160.65V38.25C293.25,17.85,275.4,0,255,0c-20.4,0-38.25,17.85-38.25,38.25V56.1\n        c-73.95,17.85-127.5,81.6-127.5,160.65V357l-51,51v25.5h433.5V408L420.75,357z"/>\n    </svg>'),p=jQuery("<div/>",{style:"display: flex; align-items: center;"}).html('<svg width="22px" height="22px" viewBox="0 0 33.834 33.834">\n        <path d="M32.253,29.334v4.5H1.581v-4.501c0-2.125,1.832-4.741,4.07-5.804l4.98-2.366l3.457,7.204l1.77-4.799\n            c0.349,0.066,0.695,0.154,1.059,0.154s0.709-0.088,1.059-0.154l1.68,4.563l3.389-7.048l5.141,2.445\n            C30.421,24.591,32.253,27.207,32.253,29.334z M6.105,13.562v-3.25c0-0.551,0.287-1.034,0.72-1.312c0.581-5.058,4.883-9,10.094-9\n            s9.514,3.942,10.096,9c0.432,0.278,0.719,0.761,0.719,1.312v3.25c0,0.863-0.699,1.563-1.563,1.563s-1.563-0.7-1.563-1.563v-0.683\n            c-0.846,4.255-3.961,8.205-7.688,8.205c-3.727,0-6.842-3.95-7.688-8.205v0.683c0,0.7-0.465,1.286-1.1,1.485\n            c0.622,2.117,2.002,3.946,3.908,5.146c0.352-0.116,0.796-0.094,1.227,0.13c0.692,0.36,1.045,1.06,0.783,1.56\n            c-0.261,0.5-1.033,0.612-1.729,0.251c-0.508-0.265-0.83-0.71-0.864-1.126c-2.183-1.396-3.731-3.533-4.37-5.998\n            C6.513,14.78,6.105,14.22,6.105,13.562z M7.89,8.635c0.047,0.003,0.092,0.004,0.137,0.021C8.14,8.698,8.222,8.779,8.279,8.874\n            c0.339,0.144,0.609,0.407,0.775,0.733C9.515,5.286,12.855,3,16.917,3c4.062,0,7.402,2.286,7.863,6.607\n            c0.229-0.449,0.664-0.77,1.185-0.837c-0.676-4.393-4.47-7.771-9.048-7.771C12.386,1,8.622,4.309,7.89,8.635z"/>\n    </svg>'),l=jQuery("<div/>",{style:"display: flex; align-items: center;"}).html('<svg width="21px" height="21px" viewBox="0 0 512 512">\n        <path d="M196,90c-16.538,0-31,13.462-31,30c0,16.538,14.462,30,31,30c16.538,0,31-13.462,31-30C227,103.462,212.538,90,196,90z"/>\n        <path d="M85.605,13.184L13.184,85.605c-1.359,1.359-2.45,2.9-3.611,4.395H90V9.571C88.506,10.732,86.964,11.825,85.605,13.184z"/>\n        <path d="M196,180c-41.353,0-76,35.647-76,77v15h152v-15C272,215.647,237.353,180,196,180z"/>\n        <path d="M377,0H120v105c0,8.291-6.709,15-15,15H0v347c0,8.291,6.709,15,15,15h279.853c-11.757-17.525-19.252-38.009-21.718-60H105\n            c-8.291,0-15-6.709-15-15c0-8.291,6.709-15,15-15h168.419c1.174-10.4,3.272-20.471,6.693-30H105c-8.291,0-15-6.709-15-15\n            c0-8.291,6.709-15,15-15h190.48c21.661-31.74,56.336-53.963,96.52-58.484V15C392,6.709,385.291,0,377,0z M302,287\n            c0,8.291-6.709,15-15,15H105c-8.291,0-15-6.709-15-15v-30c0-42.017,24.976-80.089,60.72-96.858\n            C141.053,149.487,135,135.489,135,120c0-33.091,27.909-60,61-60s61,26.909,61,60c0,15.489-6.053,29.487-15.72,40.142\n            C277.024,176.911,302,214.983,302,257V287z"/>\n        <path d="M407,302c-57.99,0-105,47.01-105,105s47.01,105,105,105s105-47.01,105-105S464.99,302,407,302z M462.605,387.605l-60,60\n            c-2.93,2.93-6.768,4.395-10.605,4.395c-3.837,0-7.676-1.465-10.605-4.395l-30-30c-5.859-5.859-5.859-15.352,0-21.211\n            s15.352-5.859,21.211,0L392,415.789l49.395-49.395c5.859-5.859,15.352-5.859,21.211,0S468.465,381.746,462.605,387.605z"/>\n    </svg>');jQuery.ajax({type:"POST",url:"?option=com_uslugi&view=profile&task=getHeaderInfo",data:"",success:function(u){if(u&&(u=JSON.parse(u)))if(console.log("user",u),window.isUserTester=parseInt(u.tester),window.isUserErnValidated=!!u.ern_validated,window.currentPortalUserId=u.id,window.isUserOrganization=1==+u.isorg,u.approved&&u.approved.length&&jQuery("#profilePopup > .menuPopUpHeader > div").css("display","flex"),jQuery(e).empty(),u.loggedIn){if(jQuery("#profileHeaderName").text(u.name),+u.operator1)jQuery("<a/>",{title:"Панель оператора пользователей",class:"enterContainer",href:"/?view=upanel",style:"margin-right: 25px; margin-top: 1px;"}).appendTo(e).append(l);if(+u.operator)jQuery("<a/>",{title:"Панель оператора вопрсоов",class:"enterContainer",href:"/?view=panel",style:"margin-right: 26px"}).appendTo(e).append(p);var d=jQuery("<a/>",{title:u.notificationsCount?"Новых уведомлений: "+u.notificationsCount:"Уведомления",class:"enterContainer",href:"#",style:"margin-right: 26px"}).appendTo(e);d.on("click",(function(e){e.stopPropagation(),e.preventDefault(),jQuery("#notificationsPopup").is(":visible")?i():(c(),function(){jQuery("#notificationsPopup").show(100),jQuery("#notificationsListContainer").hide(),jQuery("#notificationsLoading").show();var e=jQuery("<div/>",{class:"notificationsListIcon"}).html('<svg width="36px" height="36px" viewBox="0 0 111.577 111.577">\n        <path d="M78.962,99.536l-1.559,6.373c-4.677,1.846-8.413,3.251-11.195,4.217c-2.785,0.969-6.021,1.451-9.708,1.451\n        c-5.662,0-10.066-1.387-13.207-4.142c-3.141-2.766-4.712-6.271-4.712-10.523c0-1.646,0.114-3.339,0.351-5.064\n        c0.239-1.727,0.619-3.672,1.139-5.846l5.845-20.688c0.52-1.981,0.962-3.858,1.316-5.633c0.359-1.764,0.532-3.387,0.532-4.848\n        c0-2.642-0.547-4.49-1.636-5.529c-1.089-1.036-3.167-1.562-6.252-1.562c-1.511,0-3.064,0.242-4.647,0.71\n        c-1.59,0.47-2.949,0.924-4.09,1.346l1.563-6.378c3.829-1.559,7.489-2.894,10.99-4.002c3.501-1.111,6.809-1.667,9.938-1.667\n        c5.623,0,9.962,1.359,13.009,4.077c3.047,2.72,4.57,6.246,4.57,10.591c0,0.899-0.1,2.483-0.315,4.747\n        c-0.21,2.269-0.601,4.348-1.171,6.239l-5.82,20.605c-0.477,1.655-0.906,3.547-1.279,5.676c-0.385,2.115-0.569,3.731-0.569,4.815\n        c0,2.736,0.61,4.604,1.833,5.597c1.232,0.993,3.354,1.487,6.368,1.487c1.415,0,3.025-0.251,4.814-0.744\n        C76.854,100.348,78.155,99.915,78.962,99.536z M80.438,13.03c0,3.59-1.353,6.656-4.072,9.177c-2.712,2.53-5.98,3.796-9.803,3.796\n        c-3.835,0-7.111-1.266-9.854-3.796c-2.738-2.522-4.11-5.587-4.11-9.177c0-3.583,1.372-6.654,4.11-9.207\n        C59.447,1.274,62.729,0,66.563,0c3.822,0,7.091,1.277,9.803,3.823C79.087,6.376,80.438,9.448,80.438,13.03z"/>\n    </svg>'),i=jQuery("<div/>",{class:"notificationsListIcon"}).html('<svg width="36px" height="36px" viewBox="0 0 31.357 31.357">\n        <path d="M15.255,0c5.424,0,10.764,2.498,10.764,8.473c0,5.51-6.314,7.629-7.67,9.62c-1.018,1.481-0.678,3.562-3.475,3.562\n            c-1.822,0-2.712-1.482-2.712-2.838c0-5.046,7.414-6.188,7.414-10.343c0-2.287-1.522-3.643-4.066-3.643\n            c-5.424,0-3.306,5.592-7.414,5.592c-1.483,0-2.756-0.89-2.756-2.584C5.339,3.683,10.084,0,15.255,0z M15.044,24.406\n            c1.904,0,3.475,1.566,3.475,3.476c0,1.91-1.568,3.476-3.475,3.476c-1.907,0-3.476-1.564-3.476-3.476\n            C11.568,25.973,13.137,24.406,15.044,24.406z"/>\n    </svg>'),o=jQuery("<div/>",{class:"notificationsListIcon"}).html('<svg width="36px" height="36px" viewBox="0 0 492 492">\n        <path d="M76.5,213h36v230h54V246h53v197h54V246h53v197h54V213h35c5.337,0,9.67-1.5,13-4.5\n        c3.333-3,5-6.833,5-11.5c0-5.335-2.333-9.669-7-13v-1h-1l-170-88V69c10,4.668,25.167,5.335,45.5,2\n        c20.333-3.333,37.833-2.333,52.5,3V17c-14-5.333-31.5-6.333-52.5-3s-36.167,2.667-45.5-2V8c0-5.333-3-8-9-8s-9,2.667-9,8v87\n        l-170,88h-1v1c-5.333,3.333-8,7.667-8,13c0,4.667,1.833,8.5,5.5,11.5C67.667,211.5,71.833,213,76.5,213z"/>\n        <polygon points="94.5,459 58.5,492 433.5,492 398.5,459"/>\n    </svg>'),c=[e,i,o];jQuery.ajax({type:"POST",url:"?option=com_uslugi&view=profile&task=getUserNotifications",data:"",success:function(e){if(e&&(e=JSON.parse(e))){console.log("data",e);var i=jQuery("#notificationsListContainer");i.empty();var o,r=n(e);try{for(r.s();!(o=r.n()).done;){var a=o.value;if(a){var s=jQuery("<div/>",{href:"#",class:"menuPopUpListOption notificationsOption"+(+a.viewed?"":" notificationOptionNew")}).appendTo(i);jQuery("<div/>",{class:"menuPopUpListOptionImg notificationsOptionImg"}).append(c[+a.type].clone()).appendTo(s),jQuery("<div/>",{class:"menuPopUpListOptionLink",html:a.message}).appendTo(s)}}}catch(n){r.e(n)}finally{r.f()}jQuery("#notificationsLoading").hide(),jQuery("#notificationsListContainer").show(),t()}}})}())})),d.append(s),console.log("data.notificationsCount",u.notificationsCount),u.notificationsCount>0&&(s.removeClass("disabled"),jQuery("<span/>",{text:+u.notificationsCount>9?"9+":u.notificationsCount,class:"notificationsCount"}).appendTo(d));var f=jQuery("<a/>",{title:"Личный кабинет",class:"enterContainer",href:"/?view=profile",style:"margin-right: 4px"}).appendTo(e);f.append(a),window.isUserTester&&f.append(jQuery("<div/>",{text:"T",style:"position: absolute; ".concat(window.isUserErnValidated?"left":"right",": -14px; bottom: -6px; font-size: 16px; font-weight: bold; border: 2px solid red; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;")})),window.isUserErnValidated&&f.append(jQuery("<div/>",{style:"position: absolute; right: -14px; bottom: -10px; width: 28px; height: 28px;"}).append(jQuery("<img />",{style:"width: 100%",src:"/source?type=image&name=ern_check.png"}))),f.on("click",(function(n){n.stopPropagation(),n.preventDefault(),jQuery("#profilePopup").is(":visible")?o():(c(),jQuery("#profilePopup").show(100))}))}else{var h=jQuery("<a/>",{title:"Личный кабинет",class:"enterContainer",href:"/?view=authorization",style:"margin-right: 4px"}).appendTo(e);h.append(jQuery('<span style="margin-right: 5px;">Авторизация / Регистрация</span>')),h.append(r)}}})}function i(){jQuery("#notificationsPopup").hide(50)}function o(){jQuery("#profilePopup").hide(50)}function c(){jQuery("#notificationsPopup").is(":visible")&&i(),jQuery("#profilePopup").is(":visible")&&o()}jQuery(document).ready((function(){jQuery("#notificationsPopup").on("click",(function(n){n.stopPropagation()})),jQuery("#profilePopup").on("click",(function(n){n.stopPropagation()})),jQuery(document).on("click",(function(n){c()})),t()})),window.startLoadingPage=function(){jQuery("#loading-page").css("display","block"),jQuery("#roma-content").css("display","none")},window.stopLoadingPage=function(){jQuery("#loading-page").css("display","none"),jQuery("#roma-content").css("display","block")}}();
