this.BX=this.BX||{};(function(e,t){"use strict";var i=function(){function e(t){babelHelpers.classCallCheck(this,e);this.sendedLabel=[];if(t===true){return}this.formSelector=".bitrix24forms";this.widgetBlockItemSelector=".landing-b24-widget-button-social-item";this.formBlocks=babelHelpers.toConsumableArray(document.querySelectorAll(this.formSelector));this.siteType=this.getSiteType();this.formsLoaded=[];this.widgetOpened=false;this.widgetBlockHover=false;this.waitForWidget();this.detectAnchor()}babelHelpers.createClass(e,[{key:"getSiteType",value:function e(){var t=document.querySelector('meta[property="Bitrix24SiteType"]');if(t){return t.getAttribute("content")}return null}},{key:"isFormsExists",value:function e(){return this.formBlocks.length>0}},{key:"detectAnchor",value:function e(){var i=this;babelHelpers.toConsumableArray(document.querySelectorAll("a")).map((function(e){var n=t.Dom.attr(e,"href");if(n){n=n.toString()}if(n&&n.indexOf(":")){var s=n.split(":")[0];if(["callto","tel","mailto"].includes(s)){t.Event.bind(e,"click",(function(){i.sendLabel("","addressClick",s)}))}}}))}},{key:"waitForWidget",value:function e(){var i=this;babelHelpers.toConsumableArray(document.querySelectorAll(this.widgetBlockItemSelector)).map((function(e){t.Event.bind(e,"mouseover",(function(){i.widgetBlockHover=true}));t.Event.bind(e,"mouseout",(function(){i.widgetBlockHover=false}));t.Event.bind(e,"click",(function(){babelHelpers.toConsumableArray(e.classList).map((function(e){if(e.indexOf("ui-icon-service-")===0){var t=e.substr("ui-icon-service-".length);i.sendLabel("","olOpenedFromWidget",t)}}))}))}));window.addEventListener("onBitrixLiveChat",(function(e){var t=e.detail,n=t.widget,s=t.widgetHost;n.subscribe({type:BX.LiveChatWidget.SubscriptionType.every,callback:function e(t){if(t.type===BX.LiveChatWidget.SubscriptionType.widgetOpen){if(i.widgetBlockHover){i.sendLabel(s,"chatOpenedFromWidget")}else{i.sendLabel(s,"chatOpened")}}}})}))}},{key:"waitForForms",value:function e(){var i=this;window.addEventListener("b24:form:show:first",(function(e){var t=e.detail.object.identification,n=t.id,s=t.sec,o=t.address;var r=e.detail.object.disabled;i.formsLoaded.push(n+"|"+s);if(r){i.sendLabel(o,"formDisabledLoad",n+"|"+s)}else{i.sendLabel(o,"formSuccessLoad",n+"|"+s)}}));setTimeout((function(){i.formBlocks.map((function(e){var n=t.Dom.attr(e,"data-b24form");if(n&&n.indexOf("|")){var s=n.split("|");if(!i.formsLoaded.includes(s[0]+"|"+s[1])){i.sendLabel(null,"formFailLoad",s[1]?s[0]+"|"+s[1]:s[0])}}}))}),5e3)}},{key:"clearSendedLabel",value:function e(){this.sendedLabel=[]}},{key:"sendLabel",value:function e(t,i,n){if(this.sendedLabel.includes(i+n)){return}if(n&&n.substr(0,1)==="#"){n=n.substr(1)}this.sendedLabel.push(i+n);BX.ajax({url:(t?t:"")+"/bitrix/images/landing/analytics/pixel.gif?action="+i+(n?"&value="+n:"")+(this.siteType?"&siteType="+this.siteType:"")+"&time="+(new Date).getTime()})}}]);return e}();e.Metrika=i})(this.BX.Landing=this.BX.Landing||{},BX); //# sourceMappingURL=metrika.bundle.map.js