(()=>{var t={840:function(t,e,n){var r;!function(){"use strict";function o(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function i(t,e,n,r,i,a){return o((s=o(o(e,t),o(r,a)))<<(c=i)|s>>>32-c,n);var s,c}function a(t,e,n,r,o,a,s){return i(e&n|~e&r,t,e,o,a,s)}function s(t,e,n,r,o,a,s){return i(e&r|n&~r,t,e,o,a,s)}function c(t,e,n,r,o,a,s){return i(e^n^r,t,e,o,a,s)}function u(t,e,n,r,o,a,s){return i(n^(e|~r),t,e,o,a,s)}function l(t,e){var n,r,i,l,d;t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var m=1732584193,f=-271733879,h=-1732584194,g=271733878;for(n=0;n<t.length;n+=16)r=m,i=f,l=h,d=g,m=a(m,f,h,g,t[n],7,-680876936),g=a(g,m,f,h,t[n+1],12,-389564586),h=a(h,g,m,f,t[n+2],17,606105819),f=a(f,h,g,m,t[n+3],22,-1044525330),m=a(m,f,h,g,t[n+4],7,-176418897),g=a(g,m,f,h,t[n+5],12,1200080426),h=a(h,g,m,f,t[n+6],17,-1473231341),f=a(f,h,g,m,t[n+7],22,-45705983),m=a(m,f,h,g,t[n+8],7,1770035416),g=a(g,m,f,h,t[n+9],12,-1958414417),h=a(h,g,m,f,t[n+10],17,-42063),f=a(f,h,g,m,t[n+11],22,-1990404162),m=a(m,f,h,g,t[n+12],7,1804603682),g=a(g,m,f,h,t[n+13],12,-40341101),h=a(h,g,m,f,t[n+14],17,-1502002290),m=s(m,f=a(f,h,g,m,t[n+15],22,1236535329),h,g,t[n+1],5,-165796510),g=s(g,m,f,h,t[n+6],9,-1069501632),h=s(h,g,m,f,t[n+11],14,643717713),f=s(f,h,g,m,t[n],20,-373897302),m=s(m,f,h,g,t[n+5],5,-701558691),g=s(g,m,f,h,t[n+10],9,38016083),h=s(h,g,m,f,t[n+15],14,-660478335),f=s(f,h,g,m,t[n+4],20,-405537848),m=s(m,f,h,g,t[n+9],5,568446438),g=s(g,m,f,h,t[n+14],9,-1019803690),h=s(h,g,m,f,t[n+3],14,-187363961),f=s(f,h,g,m,t[n+8],20,1163531501),m=s(m,f,h,g,t[n+13],5,-1444681467),g=s(g,m,f,h,t[n+2],9,-51403784),h=s(h,g,m,f,t[n+7],14,1735328473),m=c(m,f=s(f,h,g,m,t[n+12],20,-1926607734),h,g,t[n+5],4,-378558),g=c(g,m,f,h,t[n+8],11,-2022574463),h=c(h,g,m,f,t[n+11],16,1839030562),f=c(f,h,g,m,t[n+14],23,-35309556),m=c(m,f,h,g,t[n+1],4,-1530992060),g=c(g,m,f,h,t[n+4],11,1272893353),h=c(h,g,m,f,t[n+7],16,-155497632),f=c(f,h,g,m,t[n+10],23,-1094730640),m=c(m,f,h,g,t[n+13],4,681279174),g=c(g,m,f,h,t[n],11,-358537222),h=c(h,g,m,f,t[n+3],16,-722521979),f=c(f,h,g,m,t[n+6],23,76029189),m=c(m,f,h,g,t[n+9],4,-640364487),g=c(g,m,f,h,t[n+12],11,-421815835),h=c(h,g,m,f,t[n+15],16,530742520),m=u(m,f=c(f,h,g,m,t[n+2],23,-995338651),h,g,t[n],6,-198630844),g=u(g,m,f,h,t[n+7],10,1126891415),h=u(h,g,m,f,t[n+14],15,-1416354905),f=u(f,h,g,m,t[n+5],21,-57434055),m=u(m,f,h,g,t[n+12],6,1700485571),g=u(g,m,f,h,t[n+3],10,-1894986606),h=u(h,g,m,f,t[n+10],15,-1051523),f=u(f,h,g,m,t[n+1],21,-2054922799),m=u(m,f,h,g,t[n+8],6,1873313359),g=u(g,m,f,h,t[n+15],10,-30611744),h=u(h,g,m,f,t[n+6],15,-1560198380),f=u(f,h,g,m,t[n+13],21,1309151649),m=u(m,f,h,g,t[n+4],6,-145523070),g=u(g,m,f,h,t[n+11],10,-1120210379),h=u(h,g,m,f,t[n+2],15,718787259),f=u(f,h,g,m,t[n+9],21,-343485551),m=o(m,r),f=o(f,i),h=o(h,l),g=o(g,d);return[m,f,h,g]}function d(t){var e,n="",r=32*t.length;for(e=0;e<r;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n}function m(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e<n.length;e+=1)n[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n}function f(t){var e,n,r="0123456789abcdef",o="";for(n=0;n<t.length;n+=1)e=t.charCodeAt(n),o+=r.charAt(e>>>4&15)+r.charAt(15&e);return o}function h(t){return unescape(encodeURIComponent(t))}function g(t){return function(t){return d(l(m(t),8*t.length))}(h(t))}function p(t,e){return function(t,e){var n,r,o=m(t),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=l(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=l(i.concat(m(e)),512+8*e.length),d(l(a.concat(r),640))}(h(t),h(e))}function v(t,e,n){return e?n?p(e,t):f(p(e,t)):n?g(t):f(g(t))}void 0===(r=function(){return v}.call(e,n,e,t))||(t.exports=r)}()}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{start:()=>Nt});const t={getItem:t=>{try{return localStorage.getItem(t)}catch{return console.warn("Failed get value from Storage"),"{}"}},setItem:(t,e)=>{try{localStorage.setItem(t,e)}catch{console.warn("Failed to save to Storage")}}},e="All",o="Desktop",i="Mobile",a=767,s=a+1;const c=window,u={sendEvent:function(t,e){l().push(Object.assign(Object.assign({},e),{event:t}))},pushData:function(t){t&&l().push(t)},isInStrictMode:function(){return!(!window.Kontur||!("GoogleTagManagerStrictMode"in window.Kontur))}};function l(){const t="dataLayer";return c[t]||(c[t]=[]),c[t]}const d="events",m="web_sites",f=window;function h(t){const e=`${t}Queue`;return f[e]||(f[e]=[]),f[e]}function g(t){var e;const{metrikaProjectName:n,eventName:r,value:o,category:i}=t,a=function(t){return t.replace(/[&=?#]/g,"").replace(/(\/|-)+/g,"-").replace(/^-+|-+$/g,"")}(r);u.isInStrictMode()?u.sendEvent(a,o):(function(t){const{metrikaProjectName:e,eventName:n,category:r,value:o,name:i}=t,a=e||m,s=function(t,e,n,r){const o=["trackEvent",t,e];return r&&o.push(r),n&&o.push(n),o}(r||d,n,o,i);h(a).push(s)}({metrikaProjectName:n,eventName:a,value:o,category:i}),null===(e=window.console)||void 0===e||e.info(`event was registered: ${a}`))}function p(t,e){!function(t,e){const n=function(t){return["setEventsContext",t]}(e);h(t).push(n)}(t,e)}const v="abtest_experiments",w="abtest_active";function b(t,e){return`${t}_${e}`}function $(){return`${window.location.protocol}//${window.location.hostname}${window.location.pathname}`}function P(t){return`${t.protocol}//${t.hostname}${t.pathname}`}function S(t){const e=[];for(const n of Object.values(t))n.variantName&&e.push(b(n.experimentName,n.variantName));return e.join("+")}function y(){return window.location.search.includes("abpreview=true")}function I(e){t.setItem(v,JSON.stringify(e)),t.setItem(w,S(e))}function k(t){return{abtest:S(t)}}const U="abtest_experiments";function C(t,e,n){"undefined"!=typeof Kontur&&void 0!==Kontur.Module&&Kontur.Module(t,e,n)}class x{static setCookie(t,e,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=t+"="+e;if(void 0!==n){const t=new Date;t.setTime(t.getTime()+24*n*60*60*1e3),a=a+";expires="+t.toUTCString()}void 0===r?a+=";path=/":a=a+";path="+r,void 0!==o&&(a=a+";domain="+o),i&&(a+=";secure;samesite=none;partitioned"),document.cookie=a}static getCookie(t){const e=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}}function E(t){if(!t)return t;try{return encodeURIComponent(t)}catch(e){return t}}C("Kontur.Cookie",(function(){this.setCookie=x.setCookie,this.getCookie=x.getCookie}));const N=function(t){t.forEach((t=>{const e=Array.isArray(t.search)?t.search.join(","):t.search,n=t.rootElement||document;[].slice.call(n.querySelectorAll(e)).forEach(t.decorator)}))},R=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return t?t.substr(0,e):""};class T{static wordEndingByNumber(t,e,n,r){return(t=Math.abs(t)%100)>20&&(t%=10),1===t?e:t>1&&t<5?n:r}static separateThousandsInNumber(t,e){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,e||"&nbsp;")}static numberWithLeadingZeros(t,e){const n=Array(e+1).join("0"),r=t.toString();if(r.length>=e)return r;const o=n+r,i=o.length-e;return o.slice(i)}static trimSpaces(t){return t?t.replace(/^\s+|\s+$/g,""):t}static trimEndSpaces(t){return t?String.prototype.trimEnd?t.trimEnd():t.replace(/\s+$/,""):t}static escapeHTML(t){return"string"!=typeof t?"":t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}}C("Kontur.StringHelper",(function(){this.wordEndingByNumber=T.wordEndingByNumber,this.separateThousandsInNumber=T.separateThousandsInNumber,this.numberWithLeadingZeros=T.numberWithLeadingZeros,this.trimSpaces=T.trimSpaces}));class L{static getSiteUrl(){return this.siteUrl}static setSiteUrl(t){this.siteUrl=t}static addParameter(t,e,n){return this.#t(e,n)?this.#e(t,(t=>this.#n(t,e,n))):t}static addParameters(t,e){return e=e||{},this.#e(t,(t=>{let n=t;for(let t in e){const r=e[t];this.#t(t,r)&&(n=this.#n(n,t,r))}return n}))}static#n(t,e,n){let r="",o=t.split("?");const i=o[0],a=o[1];let s="";if(a){o=a.split("&");for(let t=0;t<o.length;t++)o[t].split("=")[0].toLowerCase()!==e.toLowerCase()&&(r+=s+o[t],s="&")}return i+"?"+r+(s+e)+"="+n}static#e(t,e){let n="";const r=t.indexOf("#");return-1!==r&&(n=t.substring(r),t=t.substring(0,r)),e(t)+n}static#t(t,e){return Boolean(t)&&Boolean(e)}static toAbsoluteUrl(t,e){const n=this.removeTrailingSlash(t)+"/"+this.trimSlashes(e);return this.removeTrailingSlash(n)}static removeTrailingSlash(t){return t.replace(/\/+$/g,"")}static trimSlashes(t){return t.replace(/^[\/]+|[\/]+$/g,"")}static removeParameters(t){return t.replace(/\?.*$/g,"")}static getQueryParams(){return this.getParameters(window.location.href)}static isRelative(t){let{hashAsRelative:e=!1,queryAsRelative:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t.trim().toLowerCase();return!(r.includes("://")||r.startsWith("//")||!e&&r.startsWith("#")||!n&&r.startsWith("?"))}static getPath(t){return t.replace(/^(?:\/\/|[^\/]+)*\//,"/")}static getParameters(t){if("string"!=typeof t||-1===t.indexOf("?"))return{};const e=t.indexOf("#");-1!==e&&(t=t.substring(0,e));const n={},r=t.slice(t.indexOf("?")+1).split("&");for(let t=0;t<r.length;t++){const e=r[t].split("=");n[e[0]]=void 0===e[1]?"":e[1]}return n}static getSafeQueryParams(t){const e=t.trim(),n=Object.create(null);if(!e||e.length<=1)return n;const r=e.substring(1).split("&"),o=new Set(["__proto__","constructor","prototype"]);for(let t of r){const e=t.split("="),r=e[0];let i="";if(void 0!==e[1])try{i=decodeURIComponent(e[1])}catch(t){console.error(t)}let a=r,s=n;const c=r.split(".");if(c.some(((t,e)=>{const n=0===e?(t||"").toLowerCase():t||"";return!n||o.has(n)})))continue;for(let t=0;t<c.length;++t)a=c[t],0===t&&(a=a.toLowerCase()),t===c.length-1||("object"==typeof s[a]&&null!==s[a]||(s[a]=Object.create(null)),s=s[a]);const u=s[a],l=T.escapeHTML(i);void 0===u?s[a]=l:Array.isArray(u)?u.push(l):s[a]=[u,l]}return n}static getUrlParts(t){const e=document.createElement("a");return e.href=t,e.href=e.href,{href:e.href,host:e.host,hostname:e.hostname,port:e.port,pathname:0==e.pathname.indexOf("/")?e.pathname:"/"+e.pathname,protocol:e.protocol,hash:e.hash,search:e.search}}static toRelativeUrl(t){const e=this.getUrlParts(t);return e.pathname+e.search+e.hash}static#r(t,e){return 0===t.lastIndexOf(e,0)}}C("Kontur.UrlHelper",(function(){const t=this;t.getSiteUrl=function(){return L.getSiteUrl()},t.setSiteUrl=function(t){L.setSiteUrl(t)},t.addParameter=function(t,e,n){return L.addParameter(t,e,n)},t.addParameters=function(t,e){return L.addParameters(t,e)},t.toAbsoluteUrl=function(t,e){return L.toAbsoluteUrl(t,e)},t.removeTrailingSlash=function(t){return L.removeTrailingSlash(t)},t.trimSlashes=function(t){return L.trimSlashes(t)},t.removeParameters=function(t){return L.removeParameters(t)},t.getQueryParams=function(){return L.getQueryParams()},t.isRelative=function(t){return L.isRelative(t)},t.getPath=function(t){return L.getPath(t)},t.getParameters=function(t){return L.getParameters(t)},t.getUrlParts=function(t){return L.getUrlParts(t)},t.toRelativeUrl=function(t){return L.toRelativeUrl(t)}}));class _{static#o=(()=>(()=>{try{return window.localStorage}catch(t){}})())();static getItem(t){if(!this.#o)return x.getCookie(t);try{const e=this.#o.getItem(t),n=this.#o.getItem(`${t}.expire`),r=new Date;return!n||r<new Date(n)?e:null}catch(t){return null}}static setItem(t,e,n){if(this.#o)try{if(this.#o.setItem(t,e),n){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),this.#o.setItem(`${t}.expire`,e.toUTCString())}}catch(t){}else x.setCookie(t,e,n||365)}static removeItem(t){this.setItem(t,"expired",-1)}}function j(t,e,n){if(document.createEvent){const r=document.createEvent("CustomEvent");r.initCustomEvent(e,!0,!1,n),t.dispatchEvent(r)}else{const r=document.createEventObject();r.detail=n,t.fireEvent("on"+e,r)}}C("Kontur.Storage",(function(){const t=this;t.getItem=t=>_.getItem(t),t.setItem=(t,e,n)=>_.setItem(t,e,n),t.removeItem=t=>_.removeItem(t)}));const O="ktr_sid",A="referer",M="start_page";function D(t){return t?L.getUrlParts(t).hostname:""}function W(t){return null==x.getCookie(O)?"":_.getItem(t)}function K(t,e,n){W(t)!==e&&(_.setItem(t,e),j(window,n,e))}const B={init:function(){if(this.isInitialized)return;const t=document.referrer,e=location.href;window.KonturTrackerInitialized=!0,D(e)!==D(t)&&(x.setCookie(O,1),K(A,t,"tracker-set-referer"),K(M,e,"tracker-set-startPage"),x.setCookie(M,encodeURIComponent(e),void 0,void 0,window.location.hostname.split(".").slice(-2).join(".")),j(window,"tracker-new-click",e))},getReferer:function(){return this.init(),W(A)},getStartPage:function(){return this.init(),W(M)},get isInitialized(){return Boolean(window.KonturTrackerInitialized)}};var H=n(840),z=n.n(H);const J="utm",Q="promocode",F="utm_referer",Z="utm_startpage",q="utm_orderpage",G="utm_from",V="ngtoken",X="hashtoken";function Y(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)return;const n=function(t,e){let{promocodeUrlParameterName:n,customPromocode:r,defaultPromocode:o,excludedParameters:i,globalNgToken:a,disableNgTokenEncode:s}=e;const c=n||"p",u=L.getParameters(t),l=L.getParameters(window.location.href),d=r||l.p||x.getCookie(Q)||u.p||o,m={...tt(a,s),...u,[c]:d,...L.getParameters("?"+x.getCookie(J)),[F]:et(B.getReferer()),[Z]:et(B.getStartPage()),[q]:et(location.href)};let f=i||[];Object.keys(u).includes(G)&&f.push(G);const h=it(window.location.href),g=it(t);return h&&g&&(f.push(V),f.push(X)),nt(m,f)}(t,e),r=rt(n,((t,e)=>t&&t.match(/^(returnurl|back)$/i)&&e),(t=>{return(e=t)?function(t){if(!t)return t;try{return decodeURIComponent(t)}catch(e){return t}}(e):null;var e})),o=new ot(e.allowedDomains,e.forbiddenDomains);let i=!0;const a={};for(const t in r){const e=r[t];e&&o.isDomainAllowed(e)&&(n[t]=a[t]=(s=t,c=e,E(L.addParameters(c,nt(n,s)))),i=!1)}var s,c;const u=e.debug;return o.isDomainAllowed(t,u)?(u&&console.info("domain allowed"),L.addParameters(t,n)):(u&&console.info("domain not allowed"),i?null:L.addParameters(t,a))}function tt(t,e){const n=x.getCookie(V)??t;return n?e?{[V]:n}:{[X]:z()(n)}:{}}function et(t){if(!t||!t.match(/^https?:/))return null;const e=L.getUrlParts(t),n="/"!==e.pathname?e.pathname:"";return R(E(e.hostname+n),100)}function nt(t,e){return rt(t,((t,n)=>!e.includes(t)&&n))}function rt(t,e,n){const r={};return n=n||(t=>t),Object.keys(t).forEach((o=>{e(o,t[o])&&(r[o]=n(t[o]))})),r}class ot{#i;#a;constructor(t,e){this.#i=t||[],this.#a=e||[]}isDomainAllowed(t,e){const n=at(t);if(e&&console.info("проверка url в методе isDomainAllowed",t,n),this.#a.length>0&&this.#a.indexOf(at(t))>=0)return e&&console.info("ссылка попала в запрещенные",at(t)),!1;if(this.#i.length<1)return!0;e&&console.info("разрешенные ссылки",this.#i);const r=this.#i.some((t=>{return r=t,!(!(e=n)||!r)&&(e===r||`.${e}`.indexOf(r)>=0);var e,r}));return e&&console.info("ссылка попала в разрешенные?",r),r}}function it(t){const e=at(t);return!!e&&("kontur.ru"===e||e.endsWith(".kontur.ru")||e.endsWith(".testkontur.ru"))}function at(t){return L.getUrlParts(t).hostname}function st(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return t=t||window.Kontur?.UtmInserterSettings||{},function(t){const{filterSelector:e,rootElement:n,urlWhitelist:r,urlBlacklist:o,forceIncludeCurrentHostInBlacklist:i}=t,a=L.getUrlParts(document.location).hostname,s=[...o||[]];i&&!s.includes(a)&&s.push(a);const c={allowedDomains:ct(r,a),forbiddenDomains:s,...t},u=lt("href",c),l=lt("action",c);N([{search:[`a[href^=http]${e||""}`],decorator:u,rootElement:n},{search:[`form[action^=http]${e||""}`],decorator:l,rootElement:n}])}(t||{})}function ct(t,e){if(!t||t.length<1)return null;const n=[];for(const r of t){if(!r)continue;const{isWildCardDomain:t,url:o}=ut(r);try{const r=new URL(o).hostname;if(r===e&&!t)continue;n.push(t?`.${r}`:r)}catch{}}return n}function ut(t){const e=t.startsWith("."),n=e?t.slice(1):t;return{isWildCardDomain:e,url:n.startsWith("https://")||n.startsWith("http://")?n:`https://${n}`}}function lt(t,e){return n=>{const r=n[t],o=Y(r,e);if(!o)return void(e.debug&&(console.groupCollapsed("UTM PromoCode Inserter debug info"),console.info(`Skipping ${t}='${r}'`,n),console.groupEnd()));e.debug&&(console.groupCollapsed("UTM PromoCode Inserter debug info"),console.info(`Replacing ${t} from '${r}' to '${o}`,n),console.groupEnd());const i=e.onProcessItemCallback;"function"==typeof i&&i(n),n[t]=o}}const dt="utm_abtest";function mt(t,e){return function(t,e){return t.then((t=>200===t.status?t.json():(console.log(`${e}: ошибка получения данных`),null))).catch((()=>(console.log(`${e}: ошибка получения данных`),null)))}(fetch(t.toString(),{method:"GET",mode:"cors",credentials:"include"}),e)}const ft="abtests/api/v1/experiments/active",ht="abtests/api/v1/experiments/active/map",gt="abtests/api/v1/variants/select",pt="getActiveExperiment",vt="getActiveExperiment",wt="getVariantToExperiment",bt="abtests/api/v1/changes",$t="abtests/api/v1/preview";function Pt(t){return y()?function(t){const e=new URLSearchParams(window.location.search).get("experiment");return mt(new URL(`${t}/${$t}/experiment/${e}`).toString(),pt)}(t):mt(new URL(`${t}/${ft}`).toString(),pt)}function St(t){if(y())return function(t){const e=new URLSearchParams(window.location.search).get("experiment");return mt(new URL(`${t}/${$t}/experiment/map/${e}`).toString(),vt)}(t);const e=new URL(`${t}/${ht}`);return e.searchParams.set("domain",window.location.hostname),mt(e.toString(),vt)}function yt(t){const{url:e,onload:n=()=>null,onerror:r=()=>null,isAsync:o=!1}=t,i=document.createElement("script");i.src=e,i.async=o,i.onload=()=>{console.info(`JS успешно загружен ${e}`),n()},i.onerror=()=>{console.error(`Не удалось загрузить JS ${e}`),r()},document.head.appendChild(i)}const It=180,kt="ab_test_change_complete",Ut="ab_test_selector_not_found";function Ct(){document.documentElement.setAttribute("style","opacity: 1")}const xt="session-store-abtest-preview";function Et(t){try{const e=new URL(t);return"https:"===e.protocol&&/^tools(-[a-zA-Z0-9-.]+)?\.(test)?kontur\.ru$/.test(e.hostname)}catch(t){return!1}}async function Nt(n,r,c){if(document.prerendering)return void document.addEventListener("prerenderingchange",(()=>Nt(n,r,c)),{once:!0});!function(){const{currentScript:t,referrer:e}=document;Et(e)&&window.opener&&(window.opener.postMessage({isOpen:!0},e),window.addEventListener("message",(e=>{if(!Et(e.origin))return;if(!e.data.isAbTestPreview)return;sessionStorage.setItem(xt,JSON.stringify(e.data));const{origin:n}=new URL(t.src),r=`${n}/abtests/api/v1/scripts/preview`;!function(t){const{url:e,onload:n=()=>null,onerror:r=()=>null}=t,o=document.createElement("link");o.href=e,o.rel="stylesheet",o.onload=()=>{console.info(`CSS загружено ${e}`),n()},o.onerror=()=>{console.error(`Не удалось загрузить СSS ${e}`),r()},document.head.appendChild(o)}({url:`${r}/css`}),yt({url:`${r}/js`})})))}();const[u,l]=await Promise.all([Pt(n).catch((()=>null)),St(n)]),d=function(e){const n=JSON.parse(t.getItem(U))||{},r={};return e?(e.forEach((t=>{const{experimentId:e}=t,o=n[e];r[e]=o||{experimentName:t.experimentName}})),r):n}(u);if(p(r,k(d)),function(t,e){const n=$(),r=window.location.search;for(const o of Object.values(t))if(o.targetUrl&&o.targetUrl.split("?")[0]===n){const t=b(o.experimentName,o.variantName);if(r.includes(t))return g({metrikaProjectName:e,eventName:`event-abtest-jump-${t}`}),!0}return!1}(d,r))return void Ct();const m=1===c,f=function(t,n){const r=function(t,e){const n=t.split("//")[1].split("/");let r=e;for(const t of n){const e=r.children[t];if(!e){const t=r.children["*"];return t?t.ids:[]}r=e}return r.isEndOfPath?r.ids:[]}($(),n);if(1!==r.length)return null;const c=r[0],u=t.find((t=>t.experimentId===c));return u&&function(t){switch(t){case e:return console.log("триггер для всех"),!0;case o:return function(){const t=window.matchMedia(`(min-width: ${s}px)`).matches;return t&&console.log("триггер для десктопов"),t}();case i:return function(){const t=window.matchMedia(`(max-width: ${a}px)`).matches;return t&&console.log("триггер для мобильных"),t}();default:return!0}}(u.triggers)?u:null}(u,l);if(!f)return I(d),void Ct();const h=f.experimentId,{experimentName:v}=f,w=d[h];if(!w.variantId||y()){const t=await function(t,e){return y()?function(t){const e=new URLSearchParams(window.location.search).get("variant");return mt(new URL(`${t}/${$t}/variant/${e}`).toString(),wt)}(t):mt(new URL(`${t}/${gt}?experimentId=${e}`).toString(),wt)}(n,h);if(!t)return I(d),console.error(`Не удалось получить вариант для эксперимента: ${f.experimentName}`),void Ct();Object.assign(w,t),d[h]=w,p(r,k(d));const e=`event-abtest-start-${b(v,t.variantName)}`;g({metrikaProjectName:r,eventName:e})}switch(I(d),f.experimentType){case"Redirect":!function(t,e,n){const r=function(t,e,n){const r=new URL(e.targetUrl),{search:o,hash:i}=window.location,a=P(r);if($()===a){const n=b(t.experimentName,e.variantName);if(o.includes(n))return null}const s=function(t,e){const n=x.getCookie(J)||"",r=L.addParameter(`?${n}`,dt,e).slice(1);return t.includes("?")?`${t}&${r}`:`${t}?${r}`}(function(t){const e=P(t);return t.search?`${e}${t.search}`:e}(r),S(n)),{hash:c}=r;return`${s}${c||i||""}`}(t,e,n);if(r){if(window.location.href===r)return void Ct();window.location.replace(r)}}(f,w,d);break;case"PageChange":!function(t,e,n,r,o){!function(t,e){const n=function(t){let e="";try{e=x.getCookie(J)||""}catch(t){console.warn("Failed to get cookie value",t)}if(e.includes(dt)){const n=`?${e}`;return L.getParameters(n)[dt]!==t?L.addParameter(n,dt,t).slice(1):e}return`${e}${e?"&":""}${dt}=${t}`}(t);try{x.setCookie(J,n,It,void 0,void 0,e)}catch(t){console.warn("Failed to set cookie value",t)}}(S(t),o),function(t){document.addEventListener(kt,st),document.addEventListener(Ut,(()=>function(t){g({metrikaProjectName:t,eventName:"event-abtest-selector-not-found"})}(t)))}(r),function(t,e){const n=function(t,e){if(y()){const e=new URLSearchParams(window.location.search).get("variant");return new URL(`${t}/${$t}/change/${e}`)}return new URL(`${t}/${bt}?variantId=${e}`).toString()}(t,e);yt({url:n,isAsync:!0,onerror:()=>{document.documentElement.setAttribute("style","opacity: 1");const t=new CustomEvent(kt,{});document.dispatchEvent(t)}})}(e,n.variantId),function(t,e){g({metrikaProjectName:t,eventName:`event-abtest-replace-${b(e.experimentName,e.variantName)}`})}(r,n)}(d,n,w,r,m)}}})();var o=abTestStarter="undefined"==typeof abTestStarter?{}:abTestStarter;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); 
abTestStarter.start('https://services.kontur.ru', 'web_sites', 0)