1!function(){function t(t){this.caller=t.caller,this.formNode=t.formNode,this.controlNode=t.controlNode,this.inputNode=t.inputNode,this.config=t.config}t.prototype={},BX.UserConsent={msg:{title:"MAIN_USER_CONSENT_REQUEST_TITLE",btnAccept:"MAIN_USER_CONSENT_REQUEST_BTN_ACCEPT",btnReject:"MAIN_USER_CONSENT_REQUEST_BTN_REJECT",loading:"MAIN_USER_CONSENT_REQUEST_LOADING",errTextLoad:"MAIN_USER_CONSENT_REQUEST_ERR_TEXT_LOAD"},events:{save:"main-user-consent-request-save",refused:"main-user-consent-request-refused",accepted:"main-user-consent-request-accepted"},current:null,autoSave:!1,isFormSubmitted:!1,isConsentSaved:!1,attributeControl:"data-bx-user-consent",load:function(t){var e=this.find(t)[0];return e?(this.bind(e),e):null},loadAll:function(t,e){this.find(t,e).forEach(this.bind,this)},loadFromForms:function(){var t=document.getElementsByTagName("FORM");(t=BX.convert.nodeListToArray(t)).forEach(this.loadAll,this)},find:function(t){if(!t)return[];var e=t.querySelectorAll("["+this.attributeControl+"]");return(e=BX.convert.nodeListToArray(e)).map(this.createItem.bind(this,t)).filter((function(t){return!!t}))},bind:function(t){t.config.submitEventName?BX.addCustomEvent(t.config.submitEventName,this.onSubmit.bind(this,t)):t.formNode&&(t.formNode._userConsentBound||(BX.bind(t.formNode,"submit",this.onFormSubmit.bind(this)),t.formNode._userConsentBound=!0)),BX.bind(t.controlNode,"click",this.onClick.bind(this,t))},createItem:function(e,n){var i=n.querySelector('input[type="checkbox"]');if(i)try{var o=JSON.parse(n.getAttribute(this.attributeControl)),s={formNode:null,controlNode:n,inputNode:i,config:o};return"FORM"==e.tagName?s.formNode=e:s.formNode=BX.findParent(i,{tagName:"FORM"}),s.caller=this,new t(s)}catch(t){return null}},onClick:function(t,e){t.config.url||(this.requestForItem(t),e.preventDefault())},onSubmit:function(t,e){return this.isFormSubmitted=!0,!!this.check(t)||(e&&e.preventDefault(),!1)},onFormSubmit:function(t){for(var e=t.target,n=this.find(e),i=0;i<n.length;i++){var o=n[i];if(this.isRequiredConsent(o)){if(!this.check(o))return t.preventDefault(),this.isFormSubmitted=!0,!1}else o.inputNode.checked&&this.saveConsent(o)}return!0},isRequiredConsent:function(t){return"true"===t.controlNode.getAttribute("data-required")},check:function(t){return t.inputNode.checked?(this.saveConsent(t),!0):(this.requestForItem(t),!1)},requestForItem:function(t){this.setCurrent(t),this.requestConsent(t.config.id,{sec:t.config.sec,replace:t.config.replace},this.onAccepted,this.onRefused)},setCurrent:function(t){this.current=t,this.autoSave=t.config.autoSave,this.actionRequestUrl=t.config.actionUrl},onAccepted:function(){if(this.current){var t=this.current,e=this;this.saveConsent(t,(function(){BX.onCustomEvent(t,e.events.accepted,[]),BX.onCustomEvent(e,e.events.accepted,[t]),t._consentAccepted=!0,e.isFormSubmitted=!1,e.isFormSubmitted&&t.formNode&&!t.config.submitEventName&&setTimeout((function(){t.formNode.submit()}),0)})),this.current.inputNode.checked=!0,this.current=null}},onRefused:function(){BX.onCustomEvent(this.current,this.events.refused,[]),BX.onCustomEvent(this,this.events.refused,[this.current]),this.current.inputNode.checked=!1,this.current=null,this.isFormSubmitted=!1},initPopup:function(){this.popup||(this.popup={})},popup:{isInit:!1,caller:null,nodes:{container:null,shadow:null,head:null,loader:null,content:null,textarea:null,buttonAccept:null,buttonReject:null},onAccept:function(){this.hide(),BX.onCustomEvent(this,"accept",[])},onReject:function(){this.hide(),BX.onCustomEvent(this,"reject",[])},bindNodes:function(t){this.nodes.container=t,this.nodes.shadow=this.nodes.container.querySelector("[data-bx-shadow]"),this.nodes.head=this.nodes.container.querySelector("[data-bx-head]"),this.nodes.loader=this.nodes.container.querySelector("[data-bx-loader]"),this.nodes.content=this.nodes.container.querySelector("[data-bx-content]"),this.nodes.textarea=this.nodes.container.querySelector("[data-bx-textarea]"),this.nodes.link=this.nodes.container.querySelector("[data-bx-link]"),this.nodes.linkA=this.nodes.link?this.nodes.link.querySelector("a"):null,this.nodes.buttonAccept=this.nodes.container.querySelector("[data-bx-btn-accept]"),this.nodes.buttonReject=this.nodes.container.querySelector("[data-bx-btn-reject]")},bindButtons:function(t){this.nodes.buttonAccept.onclick=null,this.nodes.buttonReject.onclick=null,t&&(this.nodes.buttonAccept.textContent=BX.message(this.caller.msg.btnAccept),this.nodes.buttonReject.textContent=BX.message(this.caller.msg.btnReject)),BX.bind(this.nodes.buttonAccept,"click",this.onAccept.bind(this)),BX.bind(this.nodes.buttonReject,"click",this.onReject.bind(this))},init:function(){if(this.isInit)return!0;const t=document.querySelector("body > .ns-bitrix.main-user-consent-request.template-1");if(t)return this.isInit=!0,this.bindNodes(t),this.bindButtons(!1),!0;var e=document.querySelector("div[data-bx-template]");if(!e)return!1;var n=document.createElement("DIV");return n.innerHTML=e.innerHTML,!!(n=n.children[0])&&(document.body.insertBefore(n,document.body.children[0]),this.isInit=!0,this.bindNodes(n),this.bindButtons(!0),!0)},setTitle:function(t){this.nodes.head&&(this.nodes.head.innerHTML=t)},setContent:function(t){this.nodes.textarea&&(this.nodes.textarea.innerHTML=t,this.nodes.link.style.display="none",this.nodes.textarea.style.display="")},setUrl:function(t){this.nodes.link&&(this.nodes.linkA.textContent=t,this.nodes.linkA.href=t,this.nodes.link.style.display="",this.nodes.textarea.style.display="none")},show:function(t){"boolean"==typeof t&&(this.nodes.loader.style.display=t?"none":"",this.nodes.content.style.display=t?"":"none"),this.nodes.container.style.display="",document.body.setAttribute("data-scroll-consent","false")},hide:function(){this.nodes.container.style.display="none",document.body.removeAttribute("data-scroll-consent")}},cache:{list:[],stringifyKey:function(t){return BX.type.isString(t)?t:JSON.stringify({key:t})},set:function(t,e){var n=this.get(t);n?n.data=e:this.list.push({key:this.stringifyKey(t),data:e})},getData:function(t){var e=this.get(t);return e?e.data:null},get:function(t){t=this.stringifyKey(t);var e=this.list.filter((function(e){return e.key==t}));return e.length>0?e[0]:null},has:function(t){return!!this.get(t)}},requestConsent:function(t,e,n,i){(e=e||{}).id=t;var o=this.cache.stringifyKey(e);if(!this.popup.isInit){if(this.popup.caller=this,!this.popup.init())return;BX.addCustomEvent(this.popup,"accept",n.bind(this)),BX.addCustomEvent(this.popup,"reject",i.bind(this))}this.current&&this.current.config.text&&this.cache.set(o,this.current.config.text),this.current&&this.current.config.url?this.setTextToPopup("",this.current.config.url):this.cache.has(o)?this.setTextToPopup(this.cache.getData(o)):(this.popup.setTitle(BX.message(this.msg.loading)),this.popup.show(!1),BX.ajax.runAction("main.agreement.get",{data:e}).then((t=>{this.cache.set(o,t.data.content.html||""),this.setTextToPopup(this.cache.getData(o))})).catch((()=>{this.popup.hide(),alert(BX.message(this.msg.errTextLoad))}
1)))},setTextToPopup:function(t,e){var n="",i=t.indexOf("\n"),o=t.indexOf(".");(i=i<o?i:o)>=0&&i<=100&&(n=(n=t.substr(0,i).trim()).split(".").map(Function.prototype.call,String.prototype.trim).filter(String)[0]),this.popup.setTitle(n||BX.message(this.msg.title)),e?this.popup.setUrl(e):this.popup.setContent(t),this.popup.show(!0)},saveConsent:function(t,e){this.setCurrent(t);var n={id:t.config.id,sec:t.config.sec,url:window.location.href};if(t.config.originId){var i=t.config.originId;if(t.formNode&&i.indexOf("%")>=0){var o=t.formNode.querySelectorAll('input[type="text"], input[type="hidden"]');(o=BX.convert.nodeListToArray(o)).forEach((function(t){t.name&&(i=i.replace("%"+t.name+"%",t.value?t.value:""))}))}n.originId=i}t.config.originatorId&&(n.originatorId=t.config.originatorId),BX.onCustomEvent(t,this.events.save,[n]),BX.onCustomEvent(this,this.events.save,[t,n]),t._consentSaved||!t.config.autoSave?e&&e.apply(this,[]):(this.sendActionRequest("saveConsent",n,e,(function(){e&&e.apply(this,[])})),t._consentSaved=!0)},sendActionRequest:function(t,e,n,i){n=n||null,i=i||null,e.action=t,e.sessid=BX.bitrix_sessid(),e.action=t,BX.ajax({url:this.actionRequestUrl,method:"POST",data:e,timeout:10,dataType:"json",processData:!0,onsuccess:BX.proxy((function(t){(t=t||{}).error?i.apply(this,[t]):n&&n.apply(this,[t])}),this),onfailure:BX.proxy((function(){i&&i.apply(this,[{error:!0,text:""}])}),this)})}},BX.ready((function(){BX.UserConsent.loadFromForms()}))}(); 2//# sourceMappingURL=user_consent.min.js.map
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.