(()=>{var __webpack_modules__={554:(e,t,n)=>{var i,r=n.g.crypto||n.g.msCrypto;if(r&&r.getRandomValues){var s=new Uint8Array(16);i=function(){return r.getRandomValues(s),s}}if(!i){var o=new Array(16);i=function(){for(var e=0,t=void 0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}for(var a=[],c=0;c<256;++c)a[c]=(c+256).toString(16).substr(1);function u(e,t){var n=t||0,i=a;return i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]}var l=i(),d=[1|l[0],l[1],l[2],l[3],l[4],l[5]],h=16383&(l[6]<<8|l[7]),p=0,m=0;e.exports={v1:function(e,t,n){var i=t&&n||0,r=t||[],s=void 0!==(e=e||{}).clockseq?e.clockseq:h,o=void 0!==e.msecs?e.msecs:(new Date).getTime(),a=void 0!==e.nsecs?e.nsecs:m+1,c=o-p+(a-m)/1e4;if(c<0&&void 0===e.clockseq&&(s=s+1&16383),(c<0||o>p)&&void 0===e.nsecs&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=o,m=a,h=s;var l=(1e4*(268435455&(o+=122192928e5))+a)%4294967296;r[i++]=l>>>24&255,r[i++]=l>>>16&255,r[i++]=l>>>8&255,r[i++]=255&l;var g=o/4294967296*1e4&268435455;r[i++]=g>>>8&255,r[i++]=255&g,r[i++]=g>>>24&15|16,r[i++]=g>>>16&255,r[i++]=s>>>8|128,r[i++]=255&s;for(var f=e.node||d,v=0;v<6;++v)r[i+v]=f[v];return t||u(r)},v4:function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var o=0;o<16;++o)t[r+o]=s[o];return t||u(s)}}},252:(e,t,n)=>{function i(e,t){var n=e.location.pathname.split("/");for(e.document.cookie=t+"; path=/";n.length>0;)e.document.cookie=t+"; path="+n.join("/"),n.pop()}function r(e){for(var t=e.document.cookie.split("; "),n=0;n0;)i(e,r+"; domain="+s.join(".")),s.shift()}}void 0!==(e=n.nmd(e))&&(e.exports=function(e){return r.bind(e,e)})},187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&g(e,"error",t,n)}(e,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,s,o,u;if(a(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=c(e))>0&&o.length>r&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=l.bind(i);return r.listener=n,i.wrapFn=r,r}function h(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=m(c,u);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},746:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},242:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h,p:()=>o});var i=n(955),r=n(571);const s="flocktoryLogEnabled",o={ALL:0,WARN:1,ERROR:2,SILENT:3};let a=o.ALL;const c={},u=window.console||{info(){},warn(){},error(){}},l=e=>e.reason instanceof Error&&e.reason.stack&&e.reason.stack.indexOf("flocktory")>-1,d=e=>{const t=`[${e}]`,n=t=>a{r.C7&&n(o.WARN)&&u.info(t,...e)},warn:(...e)=>{r.C7&&n(o.ERROR)&&u.warn(t,...e)},error:(e,...i)=>{r.C7&&n(o.SILENT)&&u.error(e,t,...i)},setLevel:t=>{c[e]=t}}};d.setLevel=e=>{a=e},d.enable=()=>{i.Z.set(s,a)},d.disable=()=>{void 0!==i.Z.get(s)&&i.Z.remove(s)},window.addEventListener("unhandledrejection",(e=>{l(e)&&d("onunhandledrejection").error(e.reason)})),window.addEventListener("error",(e=>{l(e)&&d("onerror").error(e.message)}));const h=d},571:(e,t,n)=>{"use strict";let i;function r(){if(i)return i;let e=!0,t=window,n=0;for(;e;){try{t.opener!==t.parent&&t.parent!==t.self&&t.parent.document.body?t=t.parent:e=!1}catch(t){e=!1}n>10&&(e=!1),n++}return i=t,t}function s(){const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let t=window.screen.width;const n=window.innerWidth;return e&&n>0||(t=n),e&&n>=720&&(t=n),e&&t<=670}function o(){const e=navigator.userAgent;return e.indexOf("Mozilla/5.0")>-1&&e.indexOf("Android ")>-1&&e.indexOf("AppleWebKit")>-1&&-1===e.indexOf("Chrome")}function a(e){return"[object Object]"===Object.prototype.toString.call(e)}function c(){let e,t,n,i,r,s;const o={},a=(window.location.search||"").replace(/^\?/,"").split(/&|&/);for(i=0,r=a.length;i{t(e[n],n,e)})),e}function m(e,...t){return t.forEach((t=>{null!=t&&Object.keys(t).forEach((n=>{if(null==t)return;const i=t[n];void 0!==i&&(a(i)?a(e[n])?m(e[n],i):e[n]=m({},i):e[n]=i)}))})),e}function g(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return e[n];return null}function f(e,t,n){let i,r,s,o=null,a=0;const c=n||{leading:!0,trailing:!0},u=function(){a=!1===c.leading?0:Date.now(),o=null,s=e.apply(i,r||[]),o||(i=r=null)};return function(){const n=Date.now();a||!1!==c.leading||(a=n);const l=t-(n-a);return i=this,r=arguments,l<=0||l>t?(o&&(clearTimeout(o),o=null),a=n,s=e.apply(i,r),o||(i=r=null)):o||!1===c.trailing||(o=setTimeout(u,l)),s}}function v(e,t,n){let i;return function(){const r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(r,s)}),t),o&&e.apply(r,s)}}function w(e){return Object.keys(e).map((t=>[t,e[t]]))}function y(e,t){if(!e)throw new Error("Assert error: "+t)}function b(e,t){return e.reduce(((e,n)=>(e[t(n)?0:1].push(n),e)),[[],[]])}function _(e,t,n){const i=t.split(".");let r=0;const{length:s}=i;for(;null!=e&&re.indexOf(t)===n))}function E(e){return e.filter(Boolean)}function S(e,...t){return t.reduce(((e,t)=>e.filter((e=>t.indexOf(e)>-1))),e)}function I(e,t){return new Promise((n=>setTimeout((()=>n(t)),e)))}function A(e,t){const n=e.replace(/[[\]]/g,"\\$&"),i=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)").exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function T(e,t=[]){if("object"!=typeof e)return e;if(e&&"object"==typeof e&&e.$value)return e.$value;if(e&&"object"==typeof e&&0===t.length)return null;const{$variable:n}=e,i=t.find((e=>e.id===n));return i?i.value:null}function O(e){const t=Object.keys(e).find((e=>"$value"!==e));return t?{[t]:e[t]}:null}function C(e){let t;try{t=document.querySelector(e)}catch(e){t=null}return t}function x(e){return e.replace(/^(BEFORE|AFTER)\s+/,"")}function L(e){let t="insert";const n=x(e);return/^BEFORE\s+/.test(e)&&(t="before"),/^AFTER\s+/.test(e)&&(t="after"),[t,n]}function P(e=""){return t=>`flockapi:${e}:${t}`}function N(){return/^((?!chrome).)*safari/i.test(navigator.userAgent)}n.d(t,{$W:()=>O,BV:()=>h,C7:()=>D,Ds:()=>v,F5:()=>V,IT:()=>l,M6:()=>p,N2:()=>R,P2:()=>f,QC:()=>T,RH:()=>m,U2:()=>_,Vs:()=>I,X:()=>w,ak:()=>A,am:()=>C,b3:()=>r,dF:()=>g,eM:()=>P,fr:()=>N,hj:()=>d,hu:()=>y,jV:()=>S,jj:()=>k,kz:()=>x,mx:()=>c,oA:()=>E,s0:()=>o,tq:()=>s,uK:()=>b,vs:()=>u,wZ:()=>L});const D=void 0!==n(955).Z.get("flocktoryLogEnabled"),R=()=>!(!window.dataLayer||"function"!=typeof window.dataLayer.push),V=e=>/\/\/[^/]*api.*\.flocktory\.com\/v2\/loader\.js/.test(e)},40:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _common_utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(571),_common_log__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(242);const threshold=500,parseInterval=1500;let integrationElements=[];const flocktorySelector=".i-flocktory",toArray=e=>Array.prototype.slice.call(e),parse=function(actions,shareData,win,flocktory){(0,_common_utils__WEBPACK_IMPORTED_MODULE_0__.hu)(actions&&shareData&&win,"no enough params to parse");const{document}=win;let elements=document.querySelectorAll(flocktorySelector);elements=toArray(elements),elements.forEach((el=>{if(el.flocktoryInited)return;const data=el.dataset,actionName=(data.flAction||"").replace(/-([a-z])/g,(e=>e[1].toUpperCase())),action=actions[actionName],actionData={},actionParams={};toArray(el.attributes).forEach((attr=>{const{name}=attr;if(!/^data-fl-/.test(name))return;let value=el.getAttribute(name),parts=/^data-fl-(.*)$/.exec(name)[1].split("-"),prop;if(!parts||!parts.length)return;if("json"===parts[parts.length-1]){try{value=eval(`(${value})`)}catch(e){try{value=JSON.parse(value)}catch(e){(0,_common_log__WEBPACK_IMPORTED_MODULE_1__.Z)("parser").warn("Bad json in element.",name,value)}}parts.pop()}"params"===parts[0]?(parts=parts.slice(1),prop=actionParams):prop=actionData;let i=0;const l=parts.length;for(;i{const e=(0,_common_utils__WEBPACK_IMPORTED_MODULE_0__.RH)({},actionData,{params:actionParams});el.action=action(e)}))):shareData.addData(actionData):((0,_common_log__WEBPACK_IMPORTED_MODULE_1__.Z)("parser").warn("No actions "+actionName),shareData.addData(actionData)),el.flocktoryInited=!0,integrationElements.push(el)}));const _elements=[];let i=0;const l=integrationElements.length;for(;ie.destroy))&&e.action.destroy(),i++}integrationElements=_elements};function __WEBPACK_DEFAULT_EXPORT__(e,t,n,i){parse(e,t,n,i);const r=(0,_common_utils__WEBPACK_IMPORTED_MODULE_0__.P2)(parse.bind(null,e,t,n,i),threshold);let s;n.document.body&&n.MutationObserver&&(s=new n.MutationObserver(r),s.observe(n.document.body,{subtree:!0,attributes:!1,characterData:!1,childList:!0}));const o=setInterval(r,parseInterval);return{destroy:()=>(clearInterval(o),null!=s&&s.disconnect(),(0,_common_utils__WEBPACK_IMPORTED_MODULE_0__.Vs)(threshold))}}function __guard__(e,t){return null!=e?t(e):void 0}},955:(e,t,n)=>{"use strict";function i(e){for(var t=1;ts});var r=function e(t,n){function r(e,r,s){if("undefined"!=typeof document){"number"==typeof(s=i({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in s)s[a]&&(o+="; "+a,!0!==s[a]&&(o+="="+s[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(242);var t=__webpack_require__(571);const n=(0,e.Z)("system"),i="destroy";function r(e,...t){return{factory:e,params:t,edges:[],_edges:[],instance:null}}function s(e){return e.map((e=>e))}const o="event",a=(0,e.Z)("ga");class c{static addToDataLayer(e,n,i="flocktory"){if((0,t.N2)())try{window.dataLayer.push({event:i,eventCategory:e.category,eventAction:e.action,eventLabel:e.label,nonInteraction:e.nonInteraction?1:0})}catch(e){}else n&&a.warn("GA type dataLayer, but no window.dataLayer")}static trackClassic(e){window._gaq&&window._gaq.push?(window._gaq.push(["_trackEvent",e.category,e.action,e.label,null,e.nonInteraction?1:0]),c.addToDataLayer(e,!1)):a.warn('GA type "classic" but no GA on site')}static trackUniversal(e,t){const{gaTrackingPrefix:n,gaDynamicTracker:i,gaTrackerName:r}=t;if(!window.ga)return void a.warn("No window.ga");let s="send";n&&(s=n+"."+s);const o=["event",e.category,e.action,e.label,{nonInteraction:e.nonInteraction}];let u;if(r&&window.ga.getByName&&(u=window.ga.getByName(r)),u&&u.send instanceof Function)u.send(...o);else{if(i&&window.ga.getAll){const e=window.ga.getAll();e&&e[0]&&(s=e[0].get("name")+"."+s)}window.ga(s,...o)}c.addToDataLayer(e,!1)}static trackDdl(e){window.digitalData&&window.digitalData.events&&window.digitalData.events.push?window.digitalData.events.push({name:"Flocktory Event",category:e.category,action:e.action,label:e.label,nonInteraction:Boolean(e.nonInteraction),source:"Flocktory"}):a.warn('GA type "ddl" but no DDL on site')}static trackByType(e,t){const{type:n,gaDataLayerEvent:i}=t;switch(n){case"classic":c.trackClassic(e);break;case"universal":c.trackUniversal(e,t);break;case"data_layer":c.addToDataLayer(e,!0,i);break;case"ddl":c.trackDdl(e)}}static trackToGa4(e,n){const i={send_to:n.ga4TagId,floc_event_data:JSON.stringify({a:e.action,c:e.category,l:e.label})};if(window.gtag)window.gtag(o,"floc_event",i);else{if(!(0,t.N2)())return void a.warn("No window.gtag and window.dataLayer");c.sendThroughDataLayer(o,"floc_event",i)}c.addToDataLayer(e,!1)}static sendThroughDataLayer(){try{window.dataLayer.push(arguments)}catch(e){}}}const u=(0,e.Z)("ym");class l{static track(e,t){const{ymCounterNumber:n}=t;if(!l.checkCounter(n))return;const i={event_category:e.category,event_action:e.action,event_label:e.label,event_time:Date.now()},r={[i.event_action]:JSON.stringify(i)};window.ym(n,"params",{flock_event_data:r})}static checkCounter(e){return window.ym?!!window[`yaCounter${e}`]||(u.warn("Incorrect counter number is specified in the cabinet"),!1):(u.warn("No window.ym"),!1)}}const d=(0,e.Z)("external tracking");class h{constructor(e,t,n,i){this.trackingSettings=n,this.tracker=e,this.campaignEaEventsStorage=i,this.campaign=t,this.versionId=null!=t.widget?t.widget.versionId:"empty"}_track(e,t){const n=this.getDefaultParams(e,t);let i=this.getCampaignLevelParamsRedefinition(n);const r=function(e,t){const{trackRedefinitions:n}=t,i=t=>t.key.action===e.action;return n.find(i)}(i,this.campaign);i=function(e,t){const n=Object.assign({},e);null!=t&&null!=t.value&&(n.action=t.value.action,n.nonInteraction=1==t.value.nonInteraction);return n}(i,r),this.trackToFlocktory(n,i);const s=!r||r.enabled;null!=this.trackingSettings&&s&&(this.trackToEnabledTrackers(i,this.trackingSettings),d.info(`${this.trackingSettings.type} track`,i))}track(e,t){const{campaign:n,campaignEaEventsStorage:i}=this;(n.isGaTrackPerSession||n.isTrackEventPerSession)&&i?i.isFirstEvent(n,e).then((r=>r?(this._track(e,t),i.handleEvent(n,e)):null)).catch((e=>{throw new Error(e)})):this._track(e,t)}getDefaultParams(e,t){return{category:"flocktory-precheckout",action:e,label:this.getDefaultLabel(),nonInteraction:t}}getCampaignLevelParamsRedefinition(e){const t=Object.assign({},e);return this.campaign.trackCategory&&(t.category=this.campaign.trackCategory),this.campaign.trackLabel&&(t.label=this.campaign.trackLabel),"no-show"===t.action&&(this.campaign.noShowLabel&&(t.label=this.campaign.noShowLabel),this.campaign.noShowCategory&&(t.category=this.campaign.noShowCategory),this.campaign.noShowAction&&(t.action=this.campaign.noShowAction)),t}getDefaultLabel(){return this.campaign.groupId?String(this.campaign.groupId):this.campaign.id}trackToFlocktory(e,t){return this.tracker.trackCustomActivity(this.campaign.id,e,t||{})}trackToEnabledTrackers(e,t){const{gaTrackingEnabled:n,ymTrackingEnabled:i,ga4TrackingEnabled:r}=t;n&&c.trackByType(e,t),i&&l.track(e,t),r&&c.trackToGa4(e,t)}}const p=(0,t.eM)()("precheckoutTestId"),m=(0,e.Z)("precheckout-test"),g=(e,t,n)=>new h(e,{id:t,trackRedefinitions:[],trackCategory:"test-flocktory-precheckout",abTestEnabled:!1,type:"precheckout",widget:null,triggers:[],inactivity:{}},n);var f,v=(f=function(e,t){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},f(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});const w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return v(t,e),t}(Array);var y;!function(e){e.HANDSHAKE_REQUEST="HANDSHAKE_REQUEST",e.HANDSHAKE_RESPONSE="HANDSHAKE_RESPONSE",e.DATA_REQUEST="DATA_REQUEST",e.DATA_RESPONSE="DATA_RESPONSE"}(y||(y={}));var b,_,k,E=[y.HANDSHAKE_REQUEST,y.DATA_REQUEST],S=[y.HANDSHAKE_RESPONSE,y.DATA_RESPONSE];!function(e){e.COOKIES="COOKIES",e.LS="LS",e.LS_PER_SITE="LS_PER_SITE"}(b||(b={})),function(e){e.GET_VALUE="GET_VALUE",e.SET_VALUE="SET_VALUE",e.REMOVE_VALUE="REMOVE_VALUE",e.CLEAR="CLEAR",e.CHECK_STORAGE="CHECK_STORAGE"}(_||(_={})),function(e){e.AVAILABLE="AVAILABLE",e.UNAVAILABLE="UNAVAILABLE",e.FULL="FULL",e.UNKNOWN="UNKNOWN"}(k||(k={}));var I={VALIDATION_FIELD_NOT_FOUND:"Mandatory request field(s) not found",VALIDATION_SET_NO_VALUE:'For the "'.concat(_.SET_VALUE,' action "value" must be specified'),VALIDATION_UNSUPPORTED_ACTION:"Unsupported action requested. Must be one of: ".concat(Object.values(_).join(", ")),VALIDATION_INCORRECT_STORAGE:"Incorrect storage provided",VALIDATION_SITE_ID_NOT_FOUND:'For the per-site LS storage the "meta.siteId" field must be specified',STORAGE_NOT_AVAILABLE:"The storage is not available"},A="flocktoryLogEnabled",T="https:"===location.protocol,O="https://api.flocktory.com",C=function(){return Date.now().toString(36)+Math.random().toString(36).substr(2)},x=0;const L=function(e){this.id=C(),this.debugNumber=++x,this.messageType=e};var P=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const N=function(e){function t(t,n,i){var r=e.call(this,t)||this;return r.requestId=n,r.requestDebugNumber=i,r}return P(t,e),t}(L);var D=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const R=function(e){function t(t,n){return e.call(this,y.DATA_RESPONSE,t,n)||this}return D(t,e),t}(N);var V=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const U=function(e){function t(t){var n=this,i=t.name,r=t.value,s=t.expireAt,o=t.action,a=t.storage,c=t.meta;return(n=e.call(this,y.DATA_REQUEST)||this).name=i,n.value=r,n.expireAt=s,n.action=o,n.storage=a,n.meta=c,n}return V(t,e),t.prototype.generateResponse=function(){var e=new R(this.id,this.debugNumber);return e.name=this.name,e.action=this.action,e.storage=this.storage,e.meta=this.meta,e},t.deserialize=function(e){var n=e.id,i=e.debugNumber,r=new t(e);return r.id=n,r.debugNumber=i,r},t}(L);var j=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const F=function(e){function t(t,n){return e.call(this,y.HANDSHAKE_RESPONSE,t,n)||this}return j(t,e),t}(N);var M=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();const $=function(e){function t(){return e.call(this,y.HANDSHAKE_REQUEST)||this}return M(t,e),t.prototype.generateResponse=function(){return new F(this.id,this.debugNumber)},t.deserialize=function(e){var n=e.id,i=e.debugNumber,r=new t;return r.id=n,r.debugNumber=i,r},t}(L);var z=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;rDate.now()?i.value:void 0:i},t.prototype.setValue=function(e,n,i){var r=this.buildStorageKey(e),s=JSON.stringify({value:n,expireAt:i||Date.now()+t.DEFAULT_EXPIRE_IN,updateTs:Date.now()});window.localStorage.setItem(r,s)},t.prototype.removeValue=function(e){var t=this.buildStorageKey(e);window.localStorage.removeItem(t)},t.prototype.clear=function(){var e=this;Object.keys(window.localStorage).filter((function(t){return t.startsWith(e.fullKeyPrefix)})).forEach((function(e){return window.localStorage.removeItem(e)}))},t.STORAGE_KEY_MAIN_PREFIX="flockapi",t.DEFAULT_EXPIRE_IN=2592e6,t}(X);const ne=te;window.addEventListener("message",(function(e){var t=e.data,n=e.origin;if(E.includes(null==t?void 0:t.messageType)&&(window.location.origin===O||n===O)){var i=t.messageType===y.HANDSHAKE_REQUEST?function(e){return $.deserialize(e).generateResponse()}(t):function(e){var t=U.deserialize(e),n=t.generateResponse();try{q(t);var i=t.storage,r=t.meta;if(t.messageType===y.DATA_REQUEST){var s=void 0;switch(i){case b.COOKIES:s=new Q;break;case b.LS:s=new X;break;case b.LS_PER_SITE:s=new ne(r.siteId)}n.value=s.doRequestAction(t)}}catch(e){n.errorMessage=e.message,n.errorStack=e.stack}return n}(t);window.parent.postMessage(i,n)}}));var ie=__webpack_require__(746),re=__webpack_require__.n(ie),se="iframe_flock_data_provider",oe="https://api.flocktory.com",ae=H.Z.get(A),ce=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},ue=function(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0,'[createTimeoutPromise] parameter "timeoutMillis" must be a positive number');var n=new Promise((function(e,n){return setTimeout((function(){n(new Error("Promise timed out after ".concat(t," milliseconds")))}),t)})),i=new Promise((function(e){e(null)}));return Promise.race([e,n]).catch((function(e){return ae&&console.warn(e),i}))},me=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},ge=function(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]n.includes(e),getGlobalSessionId:()=>s.getValue(),getCookieValue:e=>r.getValue(e),updateStorage:(e,t,n,r)=>{const{expireAt:s}=r||{};switch(e){case"get":return i.getValue(t);case"set":return i.setValue(t,n,{expireAt:s});case"unset":return i.removeValue(t);case"clear":return i.clear();default:throw new Error(`Wrong method ${e}. Must be on of ${Oe}`)}}};if((0,t.IT)())return o;const a=s.init(Ae).then((()=>{n.push(Te.GET_GLOBAL_SESSION_ID),xe.info("[cors] globalSession ready",performance.now())})).catch(Ce.error),c=r.init(Ae).then((()=>r.isStorageAvailable())).then((e=>{e&&n.push(Te.GET_COOKIE_VALUE),xe.info("[cors] Cookies ready",performance.now())})).catch(Ce.error),u=i.init(Ae).then((()=>i.isStorageAvailable())).then((e=>{n=[...n,...e?[Te.SAVE_PRECHECKOUT_CAMPAIGN_CLOSED_STATE,Te.GET_PRECHECKOUT_APPROVED_CAMPAIGNS,Te.UPDATE_STORAGE]:[]],xe.info("[cors] LS ready",performance.now())})).catch(Ce.error);return(0,t.vs)()?Promise.all([a,c,u]).then((()=>o)):o}const Pe=(0,e.Z)("Storage service");function Ne(e,n){(0,t.hu)(n,"No config for Storage");const{siteId:i}=n;(0,t.hu)(i,"No siteId in Storage config");const r=(0,t.eM)(i),s=e&&e.isActionAvailable(Te.UPDATE_STORAGE),o=e=>{const t=localStorage.getItem(e);return JSON.parse(t&&"undefined"!==t?t:"null")},a=(n,i,o)=>{const a=r(n);if((0,t.hu)(null!=i,`Storage.set ${a}, null value not allowed`),s)return e.updateStorage("set",n,i,o).then((e=>{try{localStorage.setItem(a,JSON.stringify(i))}catch(e){}return e}));try{return localStorage.setItem(a,JSON.stringify(i)),Promise.resolve()}catch(e){return Promise.reject(e)}},c=t=>{const n=r(t);if(s)return e.updateStorage("get",t).then((e=>(void 0===e?localStorage.removeItem(n):localStorage.setItem(n,JSON.stringify(e)),e)));try{return Promise.resolve(o(n))}catch(e){return Promise.reject(e)}},u={},l=(e,t)=>{const n=r(e);if(s){if(u[n])return new Promise(((n,i)=>{setTimeout((()=>{l(e,t).then(n).catch(i)}),1)}));u[n]=!0;try{return c(e).then((i=>{const r=t(i);return a(e,r).then((()=>(u[n]=!1,r)))}))}catch(e){return u[n]=!1,Promise.reject(e)}}try{const e=t(o(n));return localStorage.setItem(n,JSON.stringify(e)),Promise.resolve(e)}catch(e){return Promise.reject(e)}};return{get:c,set:a,update:l,clear:()=>{Pe.warn("Use Storage.clear() only for development");for(let e=0,t=localStorage.length;ethis.onResize()),50),window.addEventListener("resize",this.externalResizeHandler),this.elements.overlay.appendChild(this.elements.wrapper),this.hasSpinner){const e=document.createElement("div");e.className=this.cssClasses.spinner,this.elements.overlay.appendChild(e)}this.canShow()&&(null!=this.rootElement&&this.rootElement.appendChild(this.elements.overlay),this.initIFrame(this.html))}show(){this.canShow()?setTimeout((()=>{this.showOverlay(),this.showWrapper()}),0):this.events.emit("noShow")}hide(){return this.hideWrapper(),this.hideOverlay()}showWrapper(){!this._wrapperShown&&this._iFrameLoaded&&(this._showEl(this.elements.wrapper),this._wrapperShown=!0)}hideWrapper(){this._hideEl(this.elements.wrapper),this._wrapperShown=!1}showOverlay(){return this._showEl(this.elements.overlay)}hideOverlay(){return this._hideEl(this.elements.overlay)}initIFrame(e){let n;if(this.disposeIframe(),!e)return;const i=e.match("]*data-width=['\"]([0-9%px]+)['\"][^>]*>");this.width=n=i&&i[1];const r=this._createIFrame(n);this.elements.iFrame&&(this.elements.prevIFrame=this.elements.iFrame),this.elements.wrapper.appendChild(r);const s=r.contentWindow.document;s.open(),s.write(e),s.close(),this.elements.iFrame=r,this._prevIFrameSize=null,this._iFrameLoaded=!1,this._whenIFrameLoad((()=>{this._iFrameLoaded=!0,this._bindIFrameEvents(),this.elements.overlay.classList.add("flockapi-loaded");let e=100;let n=0;let i;const s=r.contentDocument;if(!s)return;const o=s.body;o&&(o.classList.add("jsapi-v2"),(0,t.tq)()&&o.classList.add("is-mobile"),this._wrapperShown?(i=this.getIFrameSize(),this.onResize(i),this.elements.prevIFrame&&this.elements.prevIFrame.parentNode&&this.elements.prevIFrame.parentNode.removeChild(this.elements.prevIFrame)):(this.showWrapper(),setTimeout((()=>{this._isIframeInBody()&&(i=this.getIFrameSize(),this.onResize(i))}),1)),this.resizeInterval=window.setInterval((()=>{if(!this._isIframeInBody())return void this.clearResizeInterval();const t=this.getIFrameSize();this._equalSizes(i,t)||(this.onResize(t),i=t,n++),(0==e--||n>=2)&&this.clearResizeInterval()}),50),this.afterFrameLoaded())}))}_equalSizes(e,t){return e.width===t.width&&e.height===t.height}afterFrameLoaded(){}getIFrameSize(){const{iFrame:e}=this.elements;return{width:e?this.getIFrameWidth(e,this.width):0,height:e?this.getIFrameHeight(e):0}}getIFrameHeight(e){const t=e.contentDocument;if(!t)return 0;const{body:n}=t;if(!n)return 0;const i=n.offsetHeight||e.contentWindow.outerHeight;return i+10>window.innerHeight?window.innerHeight-10:i}getIFrameWidth(e,n){const i=e.contentDocument;if(!i)return 0;const{body:r}=i;if(!r)return 0;let s=n||r.offsetWidth;if(!s){const e=r.style,t=e.display,n=e.visibility,i=e.position;e.display="block",e.visibility="hidden",e.position="absolute",s=r.offsetWidth,e.display=t,e.visibility=n,e.position=i}if((0,t.tq)()){const n=(0,t.s0)()?e.contentWindow.innerWidth:(0,t.U2)(e,"contentWindow.screen.width",null);s=Math.max(+s||0,n||0,window.innerWidth)}return s}canShow(){return Boolean(this.rootElement&&this.html)}_showEl(e){return e.classList.add("flockapi-display_block"),setTimeout((()=>{e.classList.add("flockapi-show"),setTimeout((()=>{e.classList.add("flockapi-shown")}),Ve)}),25)}_hideEl(e){return e.classList.remove("flockapi-shown"),e.classList.remove("flockapi-show"),setTimeout((()=>e.classList.remove("flockapi-display_block")),Ve)}_createIFrame(e){const n=window.innerWidth>0?window.innerWidth:window.screen.width,i=(0,t.tq)()?n:this.paramWidth||e||"0px",r=document.createElement("iframe");return r.className="flockapi-wrapper_iframe",r.setAttribute("scrolling","no"),r.setAttribute("frameborder","0"),r.setAttribute("allowTransparency","true"),r.style.display="block",r.style.border="none",r.style.overflow="hidden",r.style.width=String(i),r.style.height="0px",r}_bindIFrameEvents(){let e,t=!1,n=!1;const{iFrame:i}=this.elements;if(null==i)return;try{e=this._iFrameEvents=i.contentWindow.sharedEvents||i.contentWindow.h.shared.events}catch(t){e=this._iFrameEvents=new De.EventEmitter}let r=i.contentDocument.querySelectorAll("[role]");if(r=[].slice.call(r),r.length&&r.forEach((i=>{const r=i.getAttribute("role");Ue.indexOf(r)>-1&&i.addEventListener("click",(()=>{e.emit?e.emit(r):null!=e.fire&&e.fire(r)})),"widgetClose"===r?t=!0:"bannerClick"===r&&(n=!0)})),t){const{closeButton:e}=this.elements;null!=e&&(e.style.display="none")}else this._addWidgetCloseButton();n||this._subscribeBannerClick(),Object.keys(this._iFrameEventHandlers).forEach((t=>{const n=this._iFrameEventHandlers[t];e.on(t,n)}))}onResize(e){return this.elements.iFrame?(e=e&&Array.isArray(e)?e:this.getIFrameSize(),this._emptySize(e)||this._prevIFrameSize&&this._equalSizes(this._prevIFrameSize,e)?null:(this.optionsWidth&&(e.width=this.optionsWidth),setTimeout((()=>this.events.emit("resize",e)),1),this._prevIFrameSize=e,e)):null}onWidgetClose(){this.noClose||(this.viewportReachedObserversData.forEach((({observer:e})=>e.disconnect())),this.events.emit("widgetClose"),this.hide())}onUserLogin(e){return e||(e={}),this.events.emit("userLogin",{data:{sb:e.sb,user_submitted:e.user_submitted,user:{email:e.email,name:e.name}}})}onBannerClick(){return this.events.emit("bannerClick")}disposeIframe(){return this.clearResizeInterval()}clearResizeInterval(){this.resizeInterval&&(clearInterval(this.resizeInterval),this.resizeInterval=0)}_emptySize(e){return!e.width||!e.height}_addWidgetCloseButton(){if(this.noClose)return;if(this.elements.closeButton)return void(this.elements.closeButton.style.display="block");const e=this.elements.closeButton=document.createElement("div");this.cssClasses.closeButton.split(" ").forEach((t=>e.classList.add(t))),this.elements.wrapper.appendChild(e),e.addEventListener("click",this.onWidgetClose.bind(this))}_subscribeBannerClick(){const{iFrame:e}=this.elements;if(null==e)return;const t=e.contentDocument,n=this._iFrameEvents;n&&n.emit&&t.addEventListener("click",(()=>n.emit("bannerClick")))}_isIframeInBody(){return(0,t.b3)().document.body.contains(this.elements.iFrame)}_whenIFrameLoad(e){let t=!1;const{iFrame:n}=this.elements;if(null==n)return;let i=0;const r=function(){clearInterval(i)},s=()=>{if(t||!this._isIframeInBody()||!n.parentNode)return void r();const{body:i}=n.contentDocument;!t&&i&&(t=!0,r(),e())};"complete"===n.contentDocument.readyState?setTimeout(s,0):n.addEventListener("load",s),i=window.setInterval(s,25)}onViewportReached(e,t){const n=new IntersectionObserver((n=>{const{intersectionRatio:i}=n[0];i>=e&&(t(i),this.offViewportReached(t))}),{threshold:e});this.viewportReachedObserversData.push({callback:t,observer:n}),n.observe(this.elements.wrapper)}offViewportReached(e){const t=this.viewportReachedObserversData.find((t=>t.callback===e));t&&t.observer.disconnect()}}class Fe extends je{constructor(e){const n=(0,t.b3)().document.body;super(e,n,(t=>{t.stdMargin=5,t.type="popup",t.noClose=!1,t.hasSpinner=!0,t.cssClasses={overlay:"flockapi-overlay flockapi-overlay_popup flockapi-overlay_widget",wrapper:"flockapi-wrapper flockapi-wrapper_popup flockapi-wrapper_widget",closeButton:"flockapi-closebutton flockapi-closebutton_popup",spinner:"flockapi-spinner flockapi-spinner_popup"};const{overlay:n}=t.elements;null!=e.background&&(n.style.background=e.background)})),this.stdMargin=5,this.type="popup",this.noClose=!1,this.hasSpinner=!0,this.cssClasses={overlay:"flockapi-overlay flockapi-overlay_popup flockapi-overlay_widget",wrapper:"flockapi-wrapper flockapi-wrapper_popup flockapi-wrapper_widget",closeButton:"flockapi-closebutton flockapi-closebutton_popup",spinner:"flockapi-spinner flockapi-spinner_popup"}}onResize(e){let n,i;if(!this.elements.iFrame)return;const r=(0,t.b3)(),s=r.innerHeight,o=r.innerWidth,{overlay:a,iFrame:c,wrapper:u}=this.elements;if(null==c)return;const l=this.getIFrameSize();let{height:d}=l;const h=e=>((0,t.tq)()&&this.stdMargin||Math.max((s-parseInt(`${e}`,10))/2-10,30))+"px";if(e){if(e=e&&Array.isArray(e)?e:l,this._emptySize(e)||this._prevIFrameSize&&this._equalSizes(this._prevIFrameSize,e))return;this.optionsWidth&&(e.width=this.optionsWidth),n=h(e.height),({width:i}=e),({height:d}=e),setTimeout((()=>this.events.emit("resize",e)),1)}else if(Number(l.width)>o){i=o;const e=c.contentDocument,t=e.querySelector("html");t&&t.classList.add("is-mobile");const n=e.querySelector("body");n&&n.classList.add("is-mobile")}else n=h((e=l).height),({width:i}=e),({height:d}=e);i=i||0,d=d||0,n=n||0;const p=Number.isNaN(i)?String(i):i+"px",m=Number.isNaN(d)?String(d):d+"px",g=Number.isNaN(n)?String(n):n+"px";c.style.width=p,c.style.height=m,u.style.width=p,u.style.height=m,u.style.marginTop=g,u.style.marginBottom=g,a.style.overflowY="auto",this._prevIFrameSize={width:i,height:d}}}class Me extends je{constructor(e){super(e,e.container,(t=>{t.type="embedded",t.rootElement=e.container,t.cssClasses={overlay:"flockapi-overlay flockapi-overlay_embedded flockapi-overlay_widget",wrapper:"flockapi-wrapper flockapi-wrapper_embedded flockapi-wrapper_widget",closeButton:"flockapi-closebutton flockapi-closebutton_embedded",spinner:"flockapi-spinner flockapi-spinner_embedded"}})),this.type="embedded"}onResize(e){const t=super.onResize(e);if(t){let{width:e,height:n}=t;Number.isNaN(e)||(e+="px"),Number.isNaN(n)||(n+="px"),this.elements.overlay.style.width=String(e),this.elements.overlay.style.height=String(n),this.elements.wrapper.style.width=String(e),this.elements.wrapper.style.height=String(n);const{iFrame:i}=this.elements;null!=i&&(i.style.width=String(e),i.style.height=String(n))}}getIFrameWidth(e,t){const n=e.contentDocument;if(!n)return 0;const{body:i}=n;if(!i)return 0;let r=t||i.offsetWidth;if(!r){const e=i.style,t=e.display,n=e.visibility,s=e.position;e.display="block",e.visibility="hidden",e.position="absolute",r=i.offsetWidth,e.display=t,e.visibility=n,e.position=s}return r}}const $e=(0,e.Z)("widget");function ze(e){const n=e.params&&e.params.el;if("popup"===n)return new Fe(e);if("inner"===n||""===n)e.container=e.rootElement;else if("[object String]"===Object.prototype.toString.call(n)){const[i,r]=(0,t.wZ)(n);let s=document.querySelector(r);if(null!=s){const e=s.parentNode;if("before"===i){const t=document.createElement("span");null!=e&&e.insertBefore(t,s),s=t}if("after"===i&&null!=e){const t=document.createElement("span");null!=s&&e.insertBefore(t,s.nextSibling),s=t}}else $e.warn("no container "+r);e.container=s}else e.container=n;return new Me(e)}var qe=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r{const n=ze({params:{el:t.selector,trigger:"auto"},html:t.html,noClose:!0,rootElement:e.params.rootElement});n.onViewportReached(We,(()=>{s.trackExchangeBanner(t.loginData)})),n.canShow()&&(n.show(),window.dataLayer&&window.dataLayer.push({event:"fl_exchange_banner",el:t.selector,html:t.html}))})).catch((()=>{}));const{params:i}=e,r=qe(e,["params"]);n.addData(r)},postcheckout:function(e){s.postcheckout(e,o.getUtmTags()).then((e=>{Be||setTimeout((()=>{ze({params:{el:e.el},html:e.html,background:e.background}).show()}),e.timeout)})).catch((e=>{He.warn(e)})),n.addData({user:e.user}),n.cart.reset()},trackItemView(t){n.addItemView(t),e.trackItemView(t)},trackCategoryView(t){n.addData(t),e.trackCategoryView(t)},fireEvent(e){i.fireEvent(e)},getData:()=>n.getData(),addData:e=>n.addData(e),trigger:e=>new r.Trigger(e),addToCart(e){n.cart.addItems(e),i.fireEvent({event:"flock_api_add_to_cart",noTrack:!0})},removeFromCart:e=>n.cart.removeItems(e),updateCart:e=>n.cart.update(e),addToFavorites:e=>n.favorites.addItems(e),removeFromFavorites:e=>n.favorites.removeItems(e),updateFavorites:e=>n.favorites.update(e),trackGoalReached:t=>e.trackGoalReached(t),attachToProfile(e,t){n.compareSnapshotMetaByPart(e.data).then((i=>{function r(){n.addMeta(e.data),t&&t()}i?r():s.attachToProfile(e.data).then(r)}))}}}var Ge=__webpack_require__(40);function Ze(t){const n={utma:{},utmb:{},utmc:{},utmz:{}};if(!t)return n;try{t.replace(/(?:^| |;)__(utm[^;$]*)/g,((e,t)=>{const i=t.slice(0,4),r=t.slice(5),s=r.split("."),o=n[i];if(o)if("utma"===i)o.domainHash=s[0],o.userId=s[1],o.initialVisitTs=s[2]&&Number(s[2]),o.previousVisitTs=s[3]&&Number(s[3]),o.currentVisitTs=s[4]&&Number(s[4]),o.pageViews=s[5]&&Number(s[5]);else if("utmb"===i)o.domainHash=s[0],o.pageViews=s[1]&&Number(s[1]),o.outboundClick=s[2]&&Number(s[2]),o.currentVisitTs=s[3]&&Number(s[3]);else if("utmc"===i)o.domainHash=s[0];else if("utmz"===i){o.domainHash=Number.isNaN(s[0])?void 0:s[0],o.lastCookiesUpdateTs=s[1]&&Number(s[1]),o.sessionCounter=s[2]&&Number(s[2]),o.resourceCounter=s[3]&&Number(s[3]);const e=r.slice(r.indexOf("utm"));e&&e.split("|").forEach((e=>{e=e.split("=");try{o[e[0]]=__webpack_require__.g.unescape(/^\(.*\)$/.test(e[1])?e[1].replace(/^\(?(.*?)\)?$/,"$1"):e[1])}catch(t){o[e[0]]=e[1]}}))}}))}catch(t){(0,e.Z)("ga-cookie-parser").error(t)}return n}const Je={PAGE:"session.page_visit",ITEM:"customer.item_visit",CATEGORY:"customer.category_visit"},Qe={ADD_ITEM:"customer.add_to_cart",REMOVE_ITEM:"customer.remove_from_cart"},Ye={ADD_ITEM:"customer.add_to_favorites",REMOVE_ITEM:"customer.remove_from_favorites"},Xe={REACHED:"goal.tracked"};class et{constructor(e,n,i){this.trackCategoryView=this.trackCategoryView.bind(this),this._clearObject=this._clearObject.bind(this),this.trackAddToCart=this.trackAddToCart.bind(this),this.trackRemoveFromCart=this.trackRemoveFromCart.bind(this),this.trackAddToFavorites=this.trackAddToFavorites.bind(this),this.trackRemoveFromFavorites=this.trackRemoveFromFavorites.bind(this),this.trackGoalReached=this.trackGoalReached.bind(this),(0,t.hu)(n&&e),this.state=e,this.backend=i,this.settings=n}getDefaults(){return{links:{site:this.settings.siteId},payload:{url:window.location.href}}}trackPageView(){const e=Ze(String.prototype.slice.call(document.cookie)),t=this.state.getUtmTags(),n=this.state.getHypotheticalUtmTags(),i={action:Je.PAGE,payload:{resolution:`${window.screen.availWidth}x${window.screen.availHeight}`,ga:{utmcsr:e.utmz.utmcsr||t.source,utmccn:e.utmz.utmccn||t.campaign,utmcmd:e.utmz.utmcmd||t.medium,utmctr:e.utmz.utmctr,utmcct:e.utmz.utmcct,h_utmcsr:n.source,h_utmccn:n.campaign,h_utmcmd:n.medium,previous_visit_ts:e.utma.previousVisitTs,current_visit_ts:e.utma.currentVisitTs,initial_visit_ts:e.utma.initialVisitTs,pageviews:e.utma.pageViews}}};this.track(i)}trackItemView(e){const{label:t}=e.item,n=this._clearObject(e.item||{}),{id:i,name:r,url:s,picture:o,price:a,available:c,category_id:u,vendor:l}=n,d="boolean"==typeof c||"true"===c||"false"===c,h={action:Je.ITEM,links:{yandex_offer:nt(e.item,(e=>e.id))},payload:Object.assign(Object.assign(Object.assign({id:i,name:r,url:s,picture:o,price:a,vendor:l},d?{available:String(c)}:{}),u?{category_id:u}:{}),t?{labels:t}:{})};this.track(h)}trackCategoryView(e){const t={action:Je.CATEGORY,links:{yandex_category:nt(e.category,(e=>e.id))}};this.track(t)}_clearObject(e){const t={};return Object.keys(e).forEach((n=>{const i=e[n];["string","number","boolean"].indexOf(typeof i)>-1&&(t[n]=i)})),t}trackAddToCart(e){const t=this._clearObject(e),n={action:Qe.ADD_ITEM,links:{yandex_offer:nt(e,(e=>e.id))||null},payload:{count:nt(e,(e=>e.count))||nt(e,(e=>e.quantity))||null,custom_data:t}};this.track(n)}trackRemoveFromCart(e){const t=this._clearObject(e),n={action:Qe.REMOVE_ITEM,links:{yandex_offer:nt(e,(e=>e.id))||null},payload:{count:nt(e,(e=>e.count))||nt(e,(e=>e.quantity))||null,custom_data:t}};this.track(n)}trackAddToFavorites(e){const t=this._clearObject(e),n={action:Ye.ADD_ITEM,links:{yandex_offer:nt(e,(e=>e.id))||null},payload:{custom_data:t}};this.track(n)}trackRemoveFromFavorites(e){const t=this._clearObject(e),n={action:Ye.REMOVE_ITEM,links:{yandex_offer:nt(e,(e=>e.id))||null},payload:{custom_data:t}};this.track(n)}trackGoalReached(e){const t=e.goal;if(!t.id)return;const n=Ze(String.prototype.slice.call(document.cookie)),i=this.state.getUtmTags(),r={action:Xe.REACHED,payload:{resolution:`${window.screen.availWidth}x${window.screen.availHeight}`,goal:`${t.id}`.substring(0,10),ga:{utmcsr:n.utmz.utmcsr||i.source,utmccn:n.utmz.utmccn||i.campaign,utmcmd:n.utmz.utmcmd||i.medium}}};this.track(r)}track(e){const n=(0,t.RH)({},e,this.getDefaults());this.backend.ultimate(n)}trackCustomActivity(e,t,n={}){const i=this.state.getUtmTags(),r=Object.assign(Object.assign({url:window.location.href},t),n);Object.keys(i).forEach((e=>{r[`utm_${e}`]=i[e]}));const s=Object.keys(r).map((e=>({key:String(e),value:String(r[e])})));this.backend.customActivity(s,e)}trackCustomEvent(e){this.backend.customEvent(e)}}function tt(e,t,n){return new et(e,t,n)}function nt(e,t){return null!=e?t(e):void 0}const it=(0,e.Z)("trigger-manager"),rt=(0,e.Z)("performance");class st{constructor(e,t,n,i,r,s){this.behaviorWatcher=t,this.setupApiDataStorage=s,this.state=r,this.storage=e,this.triggers=[],this.behaviorListeners={check:e=>{rt.info("[triggers] trigger check",performance.now()),e.behaviorWatcher=t,e.behaviorStorage=n,e.documentWatcher=i,this._checkTriggers(e)}},this.inCheckingProcess=!1,this.behaviorWatcher.events.on("check",this.behaviorListeners.check)}push(e){this.triggers.push(e)}removeTriggerByCampaignId(e){const t=this.triggers.find((t=>t.campaign.id===e));t&&(t.markExpired(),this.triggers.splice(this.triggers.indexOf(t),1))}removeAllTriggers(){this.triggers.forEach((e=>e.markExpired())),this.triggers=[]}destroy(){this.behaviorWatcher.events.removeListener("check",this.behaviorListeners.check)}_checkTriggers(e){if(this.inCheckingProcess)return void it.warn("Try to check triggers before previous check ends");this.inCheckingProcess=!0;const t=this.triggers.map((t=>t.check(e))).filter((e=>e));Promise.all(t).then((e=>this.__checkResults(e))).then((()=>{this.inCheckingProcess=!1,this.behaviorWatcher.events.emit("end_check_triggers")})).catch((e=>{this.inCheckingProcess=!1,it.error(e,"Check trigger")}))}__checkResults(e){const t=[],n=[];return e.forEach((e=>{e[0]&&(t.push(e[1]),n.push(e[1].campaign.id))})),this.state.getApprovedCampaigns(n).then((e=>{if(this.setupApiDataStorage.determineExpirationAndFireEventIfNecessary())return;let n=e;const i=this.setupApiDataStorage.getSetupApiData();if(i.campaigns){const t=i.campaigns.map((({id:e})=>e));n=e.filter((e=>t.includes(e)))}t.forEach((e=>{n.includes(e.campaign.id)&&e.execute()}))}))}}class ot{constructor(e,t,n){this.tracker=e,this.storage=t,this.config=n}logAbTest(t,n){return this.storage.get("abTests").then((i=>{i||(i={[t.id]:{index:0,isLogged:!1}}),(0,e.Z)("ab").info(`AB test for campaign ${t.id}: variation ${t.groupId} win`);return i[t.id]&&i[t.id].isLogged?Promise.resolve():this.storage.update("abTests",(e=>{const i=e||{};i[t.id]=i[t.id]||{},i[t.id].isLogged=!0;return new h(this.tracker,t,n).track("test-passed",!0),i}))}))}}const at=(0,e.Z)("precheckout-watcher"),ct=(0,e.Z)("performance");function ut(e,n,i,r,s,o,a,c,u,l,d,p,m,g,f){const v=new ot(u,e,{});let w=[],y=0;const b=new st(e,i,r,a,d,o);function _(e,t){Promise.all(e).then((e=>{t===y&&(e.forEach((e=>{e.isBackgroundExecute?E(e).execute():b.push(E(e))})),f.set(e),w=[...w,...e])}))}function k(e){y++;const t=y,n=(w||[]).map((e=>e.id)),i=e.filter((e=>!n.includes(e.id))),r=e.map((e=>e.id));w=w.reduce(((e,t)=>(r.includes(t.id)?e.push(t):b.removeTriggerByCampaignId(t.id),e)),[]),_(i,t)}function E(e){let n;return null==e.widget?n=e.noShowLabel?()=>function(e){const t=new h(u,e,d.getTrackingSettings(),s);t.track("no-show",!0)}(e):()=>function(e){const t=new h(u,e,d.getTrackingSettings(),s);t.track("error",!0)}(e):"true"===e.widget.meta["light-widget"]?n=function(e){const n={cid:e.id,vid:e.widget.versionId,motivationId:e.widget.meta.motivation_id};return function(i){var r;if("60072"===e.id&&104===function(){function e(e,t){for(let n=0,i=e.length;ne.getAttribute("src")||"")),t.F5);if(n){const e=n.match("site_id=([0-9]+)");if(e&&e[1])return parseInt(e[1],10)}return null}()){new h(u,e,d.getTrackingSettings(),s).track("before-show-widget",!0)}function o(r){if(i.state.expired)return;const{isGaTrackPerSession:o}=e,a="true"===e.widget.meta.closeOutside,{optinVersionId:c}=e.widget.meta,l=e.widget.meta.closeOutsideSeconds,p=function(e){let n=null;if(e.meta.containerSelector){const[i,r]=(0,t.wZ)(e.meta.containerSelector);if(n=document.querySelector(r),n&&("before"===i||"after"===i)){const e=document.createElement("span");if(e.classList.add("fl-embedded-wrapper"),null!=n.parentNode){const t="before"===i?n:n.nextSibling;n.parentNode.insertBefore(e,t)}n=e}if(n&&e.meta.containerWrapper){const t=document.createElement("div");t.innerHTML=e.meta.containerWrapper;t.firstElementChild.classList.add("fl-custom-wrapper");const i=t.firstChild;null!=i&&n.insertBefore(i,n.firstChild),n=i}return n}return document.body}(e.widget);if(null!=p){const t=new h(u,e,d.getTrackingSettings(),s),m=Number(l);g.create(r,{closeOutside:a,closeOutsideSeconds:m,gaTracker:t,isGaTrackPerSession:o,root:p,optinVersionId:c,motivationId:n.motivationId,trigger:i})}}if(null===(r=null==e?void 0:e.widget)||void 0===r?void 0:r.content){const t={cid:n.cid,html:e.widget.content,vid:n.vid};try{o(t)}catch(e){at.error(e,{label:"Create light widget err. (setup-api)",cid:n.cid})}}else m.widget(n).then(o).catch((e=>{at.error(e,{label:"Create light widget err. (get-widget)",cid:n.cid})}))}}(e):at.warn("Bridge widgets are not supported anymore"),new c.Trigger({campaign:e,variables:d.getVariables(),conditions:lt(e),callback:t=>{n(t),e.abTestEnabled&&v.logAbTest(e,d.getTrackingSettings())}})}return ct.info("triggerManager start",performance.now()),{update:(e,t=!1)=>d.update(e).then((()=>{t?function(e){y++;const t=y;b.removeAllTriggers(),w=[],_(e,t)}(d.getCampaigns()):k(d.getCampaigns())})),reset(){f.set(d.getCampaigns()),k(d.getCampaigns())}}}function lt(e){return function(e){if(null==e)return!0;const n=(0,t.X)(e);return 0===n.length||1===n.length&&"$or"===n[0][0]&&null==n[0][1]}(e.triggers)?{url:{$match:""}}:e.triggers}const dt="api.flocktory.com",ht={checkInterval:1e3},pt=1,mt="url-split",gt={precheckoutShown:"precheckoutShown:",viewedPagesCount:"viewedPagesCount:",pageViewsLog:"pageViewsLog",sessionId:"sessionId",globalSessionId:"__flocktory-web_session2",utmTags:"utmTags",utmTagsHypothetical:"utmTagsHypothetical",urlSplitExclusions:"urlSplitExclusions",pageViewsHolds:"pageViewsHolds:",precheckoutShownLog:"precheckoutShownLog",abTests:"abTests",cart:"cart",precheckoutClosed:"precheckoutClosed",itemsViewLog:"itemsViewLog",categoryViewLog:"categoryViewLog",pushSubscribeLog:"pushSubscribeLog",snapshotMeta:"snapshotMeta",campaignEaEvents:"campaignEaEvents",campaignHitLog:"campaignHitLog",isUserSubscribed:"isUserSubscribed"};var ft=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};const vt=(0,e.Z)("UrlSplit"),wt="flockShowPage",yt="regexp",bt="match";class _t{constructor(e,t,n,i,r){this.state=e,this.tracker=t,this.campaignEaEventsStorage=n,this.widgets=i,this.storage=r}start(){return ft(this,void 0,void 0,(function*(){vt.info("started",Math.ceil(performance.now()));const e=this.state.getUrlSplitCampaigns();if(!e.length)return void _t.disablePageHide();const t=new ot(this.tracker,this.storage,{}),n=_t.findCampaignToShow(e);if(n)return(yield this.wasCampaignExcludedByTimeout(n.groupId))?(vt.info(`campaign ${n.id} was excluded due to page load timeout`),void _t.disablePageHide()):(t.logAbTest(n,this.state.getTrackingSettings()),this.processCampaignShow(n),void _t.disablePageHide());const i=_t.findCampaignToRedirect(e);if(i){t.logAbTest(i,this.state.getTrackingSettings());const{launchRedirectUrl:e,patternUrl:n,type:r,saveQueryParams:s=!1}=i.urlSplitParams,o=_t.composeRedirectUrl(e,n,r,s);return o||vt.warn("Redirect url composition failed."),void _t.processRedirect(o)}_t.disablePageHide()}))}static disablePageHide(){vt.info("page show",Math.ceil(performance.now())),"function"==typeof window[wt]&&window[wt]()}wasCampaignExcludedByTimeout(e){var t;return ft(this,void 0,void 0,(function*(){const n=e.replace(/\D+/g,"");if(window.flockTimeoutReached)return yield this.saveTimeoutExclusion(n),!0;const i=yield this.storage.get(gt.urlSplitExclusions);return(null===(t=null==i?void 0:i[n])||void 0===t?void 0:t.sessionId)===this.state.getSessionId()}))}saveTimeoutExclusion(e){return ft(this,void 0,void 0,(function*(){const t=yield this.storage.get(gt.urlSplitExclusions),n=this.state.getSessionId();return t&&"object"==typeof t&&Object.keys(t).forEach((e=>{t[e].sessionId!==n&&delete t[e]})),this.storage.set(gt.urlSplitExclusions,Object.assign(Object.assign({},t),{[e]:{sessionId:n}}))}))}static checkLocationTrigger(e,t){const n=window.location.href.toLowerCase().trim();switch(t){case bt:return-1!==n.indexOf(String(e.trim()).toLowerCase());case yt:try{const t=new RegExp(e,"i"),i=t.test(n);return i&&vt.info("[triggers] Regex condition passed",t),i}catch(t){return vt.warn("[triggers] Regex condition failed",e),!1}}return!1}static findCampaignToShow(e){return e.find((e=>{const{launchTrackingUrl:t,type:n}=e.urlSplitParams,i=_t.checkLocationTrigger(t,n);return i&&vt.info(`[triggers] Trigger tracking_url for campaign ${e.id} passed.`),i}))}static findCampaignToRedirect(e){return e.find((e=>{const{launchRedirectUrl:t,type:n}=e.urlSplitParams,i=_t.checkLocationTrigger(t,n);return i&&vt.info(`[triggers] Trigger redirect_url for campaign ${e.id} passed.`),i}))}static composeRedirectUrl(e,t,n,i){const r=window.location.href.toLowerCase().trim();switch(n){case bt:if(i){let n=r.replace(e,t);return n=n.replace(/(.*\?.*)\?/,"$1&"),n}return r.replace(e,t).replace(window.location.search,"");case yt:try{const n=new RegExp(e,"i");return r.replace(n,t)}catch(t){return vt.warn("Redirect regex replace failed",e),!1}}}static processRedirect(e){vt.info(`processing redirect to ${e}`),window.location.replace(e)}processCampaignShow(e){var t;if(null===(t=null==e?void 0:e.widget)||void 0===t?void 0:t.content){const t={cid:e.id,html:e.widget.content,vid:e.widget.versionId},n=new h(this.tracker,e,this.state.getTrackingSettings(),this.campaignEaEventsStorage),{isGaTrackPerSession:i}=e;let r=document.body;r||"loading"!==document.readyState?this.createWidget(t,n,i,r):document.addEventListener("readystatechange",(e=>{"interactive"!==document.readyState&&"complete"!==document.readyState||(r=document.body,this.createWidget(t,n,i,r))}),{once:!0})}}createWidget(e,t,n,i){try{this.widgets.create(e,{closeOutside:!1,closeOutsideSeconds:0,gaTracker:t,isGaTrackPerSession:n,root:i,optinVersionId:void 0,motivationId:"",trigger:{state:{expired:!1}}})}catch(t){vt.error(t,{label:"Url-split widget creation error",cid:e.cid})}}}function kt(e,t,n,i,r){return new _t(e,t,n,i,r)}const Et=Number(new Date)/1e3-2678400,St=Number(new Date)-26784e5,It=e=>function(t){let n;const i=t.slice().reverse();for(n=0;nt>30||e.timeIntervals[e.timeIntervals.length-1].endt>50||e.datee.slice(-30),reduceItemsViewLog(e,t){let n=(r=e=>e.length,(null!=(i=e)?r(i):void 0)?e.slice():[]);var i,r;const s=n.length&&n[n.length-1].sessionId;if(t&&s){let e=-1;for(let i=0;i0&&(n=n.slice(e-1))}else n=s?[]:n.slice(-1);return n}};const Tt=18e5,Ot=18e5,{reduceItemsViewLog:Ct}=At,xt=e=>null==e.count?"quantity":"count",Lt=e=>{const t=Object.assign({},e),n=xt(e);null!=e.id&&(t.id=String(e.id));const i=parseFloat(e[n]);Number.isNaN(i)||(t[n]=i);const r=parseFloat(e.price);return Number.isNaN(r)||(t.price=r),t},Pt=e=>{let t=e.item||e.products||{};return Array.isArray(t)||(t=[t]),t.map(Lt)};function Nt(e,n,{siteId:i},r){class s{constructor(){this.updated=!1,this.items=[],e.get("cart").then((e=>{e&&e.items&&!this.updated&&e.expireAt>Date.now()&&(this.items=e.items)}))}save(){return e.set("cart",{items:this.items,expireAt:Date.now()+Tt})}addItem(e){const i=(0,t.RH)({},e),r=this.items.find((e=>e.id===i.id));if(r){r[xt(r)]+=i[xt(i)]}else this.items.push(i);n.trackAddToCart(i)}addItems(e){const n=(0,t.RH)({},e);Pt(n).forEach((e=>this.addItem(e))),this.save()}removeItem(e){const t=this.items.find((t=>t.id===e.id));if(t){const i=xt(t);t[i]-=e[xt(e)],t[i]=Math.max(t[i],0),n.trackRemoveFromCart(e),e=Object.assign(Object.assign({},t),e)}}removeItems(e){Pt((0,t.RH)({},e)).forEach((e=>this.removeItem(e))),this.items=this.items.filter((e=>e[xt(e)]>0)),this.save()}reset(){this.items=[],this.save()}getItemsCount(){return this.items.reduce(((e,t)=>e+Math.max(t[xt(t)],0)),0)}getTotalPrice(){return this.items.reduce(((e,t)=>e+t.price*Math.max(t[xt(t)],0)),0)}getFieldFromCardItems(e){return this.items.map((t=>t[e]))}update(e){var t;const i=(null===(t=null==e?void 0:e.cart)||void 0===t?void 0:t.items)||[];this.updated=!0;const r=this.items;this.items=i.map(Lt),this.save(),this.items.forEach((e=>{const t=r.find((t=>t.id===e.id));if(t){const i=xt(t),r=parseFloat(e[i])-parseFloat(t[i]);r>0?n.trackAddToCart({id:e.id,quantity:r}):r<0&&n.trackRemoveFromCart({id:e.id,quantity:-r})}else n.trackAddToCart(e)}));r.filter((e=>!this.items.find((t=>t.id===e.id)))).forEach((e=>n.trackRemoveFromCart(e)))}}class o{constructor(){this.updated=!1,this.items=[]}addItem(e){const i=(0,t.RH)({},e);this.items.find((e=>e.id===i.id))||this.items.push(i),n.trackAddToFavorites(i)}addItems(e){const n=(0,t.RH)({},e);Pt(n).forEach((e=>this.addItem(e)))}removeItem(e){const t=this.items.findIndex((t=>t.id===e.id));t>=0&&this.items.splice(t,1),n.trackRemoveFromFavorites(e)}removeItems(e){Pt((0,t.RH)({},e)).forEach((e=>this.removeItem(e)))}reset(){this.items=[]}update(e){var t;const i=(null===(t=null==e?void 0:e.favorites)||void 0===t?void 0:t.items)||[];this.updated=!0;const r=this.items;this.items=i.map(Lt);const s=(e,t)=>e.id===t.id,o=(e,t,n)=>e.filter((e=>!t.some((t=>n(e,t))))),a=o(r,this.items,s);o(this.items,r,s).forEach((e=>n.trackAddToFavorites(e))),a.forEach((e=>n.trackRemoveFromFavorites(e)))}}class a{constructor(){this.update=this.update.bind(this),this.isAuthorized=this.isAuthorized.bind(this),this.save=this.save.bind(this),this.location={},this.name=null,this.email=null,this.stats={}}isUserChanged(e){return this.email!==e.email}logout(){this.email=null,this.name=null}update(e){e.name&&(this.name=e.name),e.email&&(this.email=e.email),null!=e.location&&(this.location=e.location)}isAuthorized(){return/\S+@\S+\.\S+/.test(this.email)}hasName(){return!!this.name}save(){}}class c{constructor(){this.sync=this.sync.bind(this),this.mergeAndAssignTags=this.mergeAndAssignTags.bind(this),this.getReferrerToTags=this.getReferrerToTags.bind(this),this.tags={},this.hypotheticalTags={}}sync(n){const i=Ze(String.prototype.slice.call(document.cookie));return e.get(gt.utmTags).then((r=>(this.mergeAndAssignTags(i,(0,t.mx)(),r||{},this.getReferrerToTags(document.referrer)),e.set(gt.utmTagsHypothetical,this.hypotheticalTags),e.set(gt.utmTags,this.tags).then((()=>n())).catch((()=>n())))))}mergeAndAssignTags(e,t,n,i){const r={source:"utmcsr",medium:"utmcmd",campaign:"utmccn",term:"utmctr",content:"utmcct"},s=parseInt(t.utm_nooverride,10);["campaign","source","medium","term","content"].forEach((o=>{const a=e.utmz[r[o]],c=t[`utm_${o}`]||i[o];let u=a;s||(u=u||c),u=u||n[o],u&&(this.tags[o]=u),c&&!s&&(this.hypotheticalTags[o]=c)}))}getReferrerToTags(e){const t={source:null,medium:null,campaign:null};if(!e)return t;const n=e.split("/")[2],i=e=>e.split(".").slice(-2).join(".");return/google\.(com|ru)/i.test(e)?(t.source="google",t.medium="organic"):/googleadservices\.com/i.test(e)?(t.source="google",t.medium="cpc"):/yandex.ru\/clck/i.test(e)?(t.source="yandex",t.medium="organic"):i(n)!==i(window.location.host)&&(t.source=n,t.medium="referral",t.campaign="referral"),t}}class u{constructor(){e.get(gt.categoryViewLog).then((e=>{this.log=e?e.ids:{}})),this.currentCategory=void 0}getCurrent(){return this.currentCategory}getCountViews(){return Object.keys(this.log).length}reset(){this.currentCategory=void 0}add(e){this.currentCategory=e,this.log[e]=this.log[e]+1||1,this.save()}save(){e.set(gt.categoryViewLog,{ids:this.log,expireAt:Date.now()+Ot})}}class l{constructor(){e.get(gt.pushSubscribeLog).then((e=>{this.log=e||{}}))}saveLastSubscriptionTimestamp(){return e.set(gt.pushSubscribeLog,{lastSubscriptionTimestamp:+Date.now()},{expireAt:+new Date+15552e6})}getLastSubscriptionTimestamp(){return e.get(gt.pushSubscribeLog).then((e=>e?e.lastSubscriptionTimestamp:null))}}class d extends De.EventEmitter{constructor(){super(),this.sync=this.sync.bind(this),this.addData=this.addData.bind(this),this.addMeta=this.addMeta.bind(this),this.getData=this.getData.bind(this),this.getUser=this.getUser.bind(this),this.getCart=this.getCart.bind(this),this.getHypotheticalUtmTags=this.getHypotheticalUtmTags.bind(this),this.addItemView=this.addItemView.bind(this),this.getCurrentItem=this.getCurrentItem.bind(this),this.resetItem=this.resetItem.bind(this),this.resetCategory=this.resetCategory.bind(this),this.getItemsViews=this.getItemsViews.bind(this),this.user=new a,this.cart=new s,this.favorites=new o,this.assigns={},this.utmTags=new c,this.category=new u,this.push=new l,this.meta={}}sync(e){this.utmTags.sync(e)}addData(e){const n=e.user||e.customer;n&&this.user.isUserChanged(n)&&(""===n.email?this.user.logout():this.user.update(n),this.emit("add-user",n)),e.cart&&(this.cart.update(e),this.emit("add-cart",e.cart)),e.favorites&&(this.favorites.update(e),this.emit("add-favorites",e.favorites)),e.assigns&&((0,t.RH)(this.assigns,e.assigns),this.emit("add-assigns",e.assigns)),e.category&&this.category.add(String(e.category.id)),e.meta&&this.addMeta(e.meta)}addMeta(e){this.meta=Object.assign(this.meta,e),this.setSnapshotMeta(e)}getData(){return{user:this.user,cart:this.cart,favorites:this.favorites,site:{id:i},assigns:this.assigns,category:this.category,meta:(0,t.RH)({},this.meta),getSessionId:()=>r.getGlobalSessionId()}}getUser(){return this.user}getCart(){return this.cart}getUtmTags(){return this.utmTags.tags}getHypotheticalUtmTags(){return this.utmTags.hypotheticalTags}addItemView(t){const n=t&&t.item&&t.item.id;return n?(this.currentItemId=n,this.emit("add-item-view",n),e.get(gt.itemsViewLog).then((t=>{const i=r.getSessionId();return(t=Ct(t,i)).push({itemId:n,sessionId:i}),e.set(gt.itemsViewLog,t)}))):Promise.reject()}resetItem(){this.currentItemId=void 0}resetCategory(){this.category.reset()}getCurrentItem(){return new Promise((e=>this.currentItemId?e(this.currentItemId):this.on("add-item-view",(function(){return e(this.currentItemId)}))))}getItemsViews(){return e.get(gt.itemsViewLog).then((e=>{if(!e)return[];const t=e.map((e=>e.itemId)),n={};return t.forEach((e=>{n[e]=1})),Object.keys(n)}))}isProductPage(){return!!this.currentItemId}isCategoryPage(){return!!this.category.getCurrent()}getSnapshotMeta(){return this.getSnapshotMetaRaw().then((e=>(e||{}).snapshot||{}))}getSnapshotMetaRaw(){return e.get(gt.snapshotMeta)}setSnapshotMeta(t){return this.getSnapshotMetaRaw().then((n=>{(n=n||{}).snapshot=n.snapshot||{},(!n.clearAt||n.clearAt{e=e||{},t=t||{};try{if(JSON.stringify(e)===JSON.stringify(t))return!0}catch(e){}const n=Object.keys(e)||[],i=Object.keys(t)||[],r=n.filter((n=>Object.prototype.hasOwnProperty.call(t,n)&&e[n]===t[n]));return r.length===n.length&&r.length===i.length}))}compareSnapshotMetaByPart(e){return this.getSnapshotMeta().then((t=>{const n=Object.assign(Object.assign({},t),e||{});return this.compareSnapshotMeta(n)}))}}const h=new d;return new Promise((e=>h.sync((()=>e(h)))))}const{reducePageViewsLog:Dt}=At,Rt=gt.pageViewsLog,Vt=gt.categoryViewLog,Ut=gt.itemsViewLog,jt=()=>Math.round(Number(new Date)/1e3),Ft=e=>e.reduce(((e,t)=>e+t.timeIntervals.reduce(((e,t)=>e+(t.end-t.start)),0)),0);function Mt(e,n){return{cleanLog:zt,track(){const i=Math.round(ht.checkInterval/1e3);return e.get(Rt).then((r=>{let s=[];null!=r&&(s=r),s=zt(s,n.getSessionId());let o=(0,t.dF)(s,(e=>e.viewId===n.getViewId()));const a=jt();if(o){const e=(0,t.dF)(o.timeIntervals,(e=>a-e.end<=i));e?e.end=a:o.timeIntervals.push({start:a,end:a})}else o={viewId:n.getViewId(),sessionId:n.getSessionId(),pageUrl:window.location.href,timeIntervals:[{start:a,end:a}]},s.push(o);return s=Dt(s),e.set(Rt,s)}))},getSessionViewsCount:t=>e.get(Rt).then((e=>{e||(e=[]);const i=e.reduce(((e,t)=>e+(t.sessionId===n.getSessionId()?1:0)),0);return t(i)})),getSessionPageUrls:i=>e.get(Rt).then((e=>i(((e,n=[])=>((0,t.hu)(e,"no ssid"),null===n?[]:n.filter((t=>t.sessionId===e)).map((e=>e.pageUrl))))(n.getSessionId(),e)))),getSessionActivityDuration:t=>e.get(Rt).then((e=>{const i=(e||[]).filter((e=>e.sessionId===n.getSessionId()));return t(Ft(i))})),getPageActivityDuration:t=>e.get(Rt).then((e=>{const i=(e||[]).filter((e=>e.viewId===n.getViewId()));return t(Ft(i))})),getCategoriesViews:t=>e.get(Vt).then((e=>t(Date.now()<=e.expireAt?e:{}))),getCardsViews:t=>e.get(Ut).then((e=>{const i=(e||[]).filter((e=>e.sessionId===n.getSessionId()));return t(i)})),sessionIsFirst:i=>e.get(Rt).then((e=>(e||(e=[]),i(!(0,t.dF)(e,(e=>e.sessionId!==n.getSessionId())))))),sessionStartUrl:t=>e.get(Rt).then((e=>{let n;e||(e=[]);const i=$t(e[e.length-1],(e=>e.sessionId));null!=i&&(n=e.reduce(((e,t)=>(t.sessionId===i&&(!e.time||e.time>t.timeIntervals[0].start)&&(e.time=t.timeIntervals[0].start,e.url=t.pageUrl),e)),{}));const r=$t(n,(e=>e.url))||window.location.href;return t(r)})),getShownCampaignsInSession:i=>e.get(gt.precheckoutShownLog).then((e=>{const r=(e||[]).filter((e=>e.session===n.getSessionId())).map((e=>String(e.campaign)));return i((0,t.jj)(r))})),getUserSubscriptionStatus(t){const i=n.getSessionId();return e.get(gt.isUserSubscribed).then((n=>(null==n?void 0:n.sessionId)&&n.sessionId!==i?(e.set(gt.isUserSubscribed,{}),t(!1)):t(Boolean(null==n?void 0:n.isSubscribed))))}}}function $t(e,t){return null!=e?t(e):void 0}function zt(e,t){if(!e.length)return e;let n=e.slice(0);n.sort(((e,t)=>e.timeIntervals[0].start-t.timeIntervals[0].start));const i=n[0].sessionId;return n=n.filter((e=>e.sessionId===i||e.sessionId===t)),n}class qt{constructor(e,t){this.storage=e,this.sessionId=t.getSessionId()}_initNewSessionData(){return{sessionId:this.sessionId,campaignIdsToActionsMap:{}}}_cleanOldSessionData(e){return e.sessionId!==this.sessionId?this._initNewSessionData():e}_getEaEvents(){return this.storage.get(qt.STORAGE_KEY)}_setEaEvents(e){return this.storage.set(qt.STORAGE_KEY,e)}handleEvent(e,t){const n=qt.buildDataKey(e,t);return this._getEaEvents().then((e=>{const i=e?this._cleanOldSessionData(e):this._initNewSessionData();let r=i.campaignIdsToActionsMap[n];return r||(r=[],i.campaignIdsToActionsMap[n]=r),-1===r.indexOf(t)&&r.push(t),this._setEaEvents(i)}))}isFirstEvent(e,t){const n=qt.buildDataKey(e,t);return this._getEaEvents().then((e=>{if(!e)return!0;const i=this._cleanOldSessionData(e).campaignIdsToActionsMap[n];return!(i&&i.length>0)||!i.includes(t)}))}}qt.STORAGE_KEY=gt.campaignEaEvents,qt.factory=(e,t)=>new qt(e,t),qt.buildDataKey=(e,t)=>{const{id:n,noShowCategory:i,trackCategory:r}=e;let s="no-show"===t?i:r;return s||(s="DEFAULT_CATEGORY_KEY"),`${n}-${s}`};const Wt=qt;class Bt extends De.EventEmitter{constructor(){super(),this.storage={},this.isExpired=!1}determineExpirationAndFireEventIfNecessary(){const e=this.isExpired,{timestamp:t}=this.storage;return this.isExpired=t&&Date.now()-t>=216e5,this.isExpired&&!e&&this.emit(Bt.EVENTS.EXPIRED),this.isExpired}getSetupApiData(){return this.storage.setupApiData||{}}setSetupApiData(e){this.isExpired=!1,this.storage={timestamp:Date.now(),setupApiData:e}}}Bt.EVENTS={EXPIRED:"expired"},Bt.factory=()=>new Bt;const Ht=Bt,Kt=(0,e.Z)("performance");function Gt(e,n,i,r,s,o,a){const c=a&&a.checkInterval||1e3,u=a&&a.checkWithoutFocus||!1;return new class{constructor(e,t,n,i,r){this.startWatching=this.startWatching.bind(this),this.initialEventWatch=this.initialEventWatch.bind(this),this.checkConditions=this.checkConditions.bind(this),this.trackPageViews=this.trackPageViews.bind(this),this.getInactivityDuration=this.getInactivityDuration.bind(this),this.storage=e,this.behaviorStorage=t,this.documentWatcher=n,this.customEvents=i,this.shareData=r,this.lastActivity=new Date,this.viewsLog=null,this.events=new De.EventEmitter,this.events.setMaxListeners(0),this.initialEventWatch(),this.startWatching(),Kt.info("behaviorWatcher init",performance.now())}startWatching(){const e=(0,t.P2)((()=>{this.lastActivity=new Date}),1e3);document.addEventListener("click",e),document.addEventListener("keypress",e),document.addEventListener("keydown",e),document.addEventListener("contextmenu",e);const n={customEvents:this.initialEvents.events.slice(),events:[]};let i=(0,t.RH)({},n);this.check=(0,t.P2)((()=>{if(this.documentWatcher.hasFocus()||u){const e=(0,t.RH)({},i);this.trackPageViews((()=>this.events.emit("check",e))),i=(0,t.RH)({},n)}}),c/2,{leading:!0}),this.documentWatcher.events.on("locationchange",(()=>{this.events.emit("locationchange"),this.check()})),this.documentWatcher.events.on("focus",(()=>{i.events.push("document_focus"),this.check()})),this.documentWatcher.events.on("blur",(()=>{i.events.push("document_blur"),this.check()})),this.documentWatcher.events.on("leave",(e=>{this.shareData.addMeta({exitCoordinates:e}),i.events.push("document_leave"),this.check()})),this.events.on("end_check_triggers",(()=>{i.events=[]})),this.initialEvents.off(),this.customEvents.on("fireEvent",(e=>{i.customEvents.push(e.event),this.check()})),this.customEvents.on("clean",(()=>{i.customEvents=[]})),this.customEvents.on("loaderReady",(()=>{this.check()})),setInterval(this.check,c)}initialEventWatch(){const e=[],t=t=>e.push(t.event);this.customEvents.on("fireEvent",t),this.initialEvents={events:e,off:()=>this.customEvents.removeListener("fireEvent",t)}}checkConditions(){this.check()}trackPageViews(e){this.behaviorStorage.track().then((()=>e())).catch((()=>e()))}getInactivityDuration(){return Number(new Date)-Number(this.lastActivity)}}(e,n,i,r,s)}class Zt{constructor(e){this._testing=!1,this._stopWatchFocus=()=>null,null!=e&&e.testing&&(this._testing=!0),this.events=new De.EventEmitter,this.events.setMaxListeners(0),function(e){let t=!1;const n=()=>{t||(t=!0,document.removeEventListener("DOMContentLoaded",n,!1),window.removeEventListener("load",n,!1),e())};"complete"===document.readyState||"interactive"===document.readyState?n():(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1))}((()=>(this._watchFocus(),this._watchLeaving(),this._watchLocation())))}destroy(){this._stopWatchFocus()}_watchFocus(){let e;this._pageFocused=this._isPageFocused();const n=(0,t.P2)((t=>{e=this._isPageFocused(t),e!==this._pageFocused&&(this._pageFocused=e,this._emitFocusChange())}),500),i=()=>n();document.addEventListener("visibilitychange",i);const r=()=>n({focused:!0});window.addEventListener("focus",r);const s=()=>n({focused:!1});let o;window.addEventListener("blur",s),this._hasDocFocus()&&(o=setInterval(n,500));const a=(0,t.Ds)((()=>n({focused:!0})||!0),100);window.addEventListener("mousemove",a),window.addEventListener("scroll",a),this._stopWatchFocus=()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("focus",r),window.removeEventListener("blur",s),window.removeEventListener("mousemove",a),window.removeEventListener("scroll",a),o&&clearInterval(o)}}_isPageFocused(e={}){let t=null!=e.focused?e.focused:!this._hasDocFocus()||document.hasFocus();return this._hasDocVisibility()&&(t=t&&!document.hidden),t}_hasDocFocus(){return null!=document.hasFocus&&!this._isTestEnv()}_hasDocVisibility(){return!document.hidden&&!this._isTestEnv()}_isTestEnv(){return this._testing}_emitFocusChange(){return this._pageFocused?this.events.emit("focus"):this.events.emit("blur")}_watchLeaving(){return setTimeout((()=>{let e;try{e=window.top.document}catch(t){e=window.document}const{body:t}=e;return t.addEventListener("mouseout",(e=>{let t;if("SELECT"!==e.target.tagName){try{t=e.clientY{e.state&&this.events.emit("locationchange")}))}hasFocus(){return this._pageFocused}getBattery(e){return null!=window.navigator&&null!=window.navigator.getBattery?window.navigator.getBattery().then((t=>e(t.level))).catch((()=>e(1))):e(1)}}function Jt(e){return new Zt(e)}class Qt extends De.EventEmitter{constructor(e){super(),this.tracker=e}fireEvent(e){return e.noTrack||this.tracker.trackCustomEvent(e.event),this.emit("fireEvent",e)}}function Yt(e){return new Qt(e)}const Xt=(e=>/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.substr(0,4)))(navigator.userAgent||navigator.vendor),en=(0,e.Z)("triggers"),tn=function(e){if("object"!=typeof e)return e;let t=e.$value;const n=e.$unit;if("days"===n&&(t*=86400),"hours"===n&&(t*=3600),"minutes"===n&&(t*=60),"time"===n){const[e,n]=t.split(":").map((e=>parseInt(e,10)));t=(new Date).setHours(e,n)}return t};function nn(n,i,r,s,o,a){(0,t.hu)(n&&i&&r&&s&&o,"Trigger Factory args");let c=window.document.referrer||"";try{c=decodeURI(c)}catch(e){}const u=function(e){let t;return t=e.$and?new h(e.$and):e.$or?new p(e.$or):e.$not?new m(e.$not):new g(e),t},l=(n,i)=>{if(null==n&&!(e=>{if(!e||"object"==typeof e&&0===Object.keys(e).length)return!1;const t=Object.keys(e);return 1===t.length&&["$isNull","$notNull"].includes(t[0])})(i))return!1;if(!i||"object"==typeof i&&0===Object.keys(i).length)return!0;let r=!0;if("object"!=typeof i)r=n===i;else{if(null==i.$eq&&"boolean"!=typeof i.$eq||(r=r&&n===tn(i.$eq)),r&&null!=i.$match&&(r=-1!==n.toLowerCase().trim().indexOf(String(tn(i.$match).trim()).toLowerCase())),r&&null!=i.$regex)try{const e=(0,t.QC)(i.$regex,o.getVariables());r=new RegExp(e,"i").test(n)}catch(t){(0,e.Z)("triggers").warn("Regex condition failed",i.$regex),r=!1}if(r&&null!=i.$eval)try{r=new Function(i.$eval)({cart:s.cart})}catch(t){r=!1,(0,e.Z)("triggers").warn("Custom JS trigger have failed",i.$eval)}if(r&&i.$ne&&(r="object"!=typeof i.$ne||i.$ne.$unit?n!==tn(i.$ne):!l(n,i.$ne)),r&&i.$gte&&(r=n>=tn(i.$gte)),r&&i.$gt&&(r=n>tn(i.$gt)),r&&i.$lte&&(r=n<=tn(i.$lte)),r&&i.$lt&&(r=nl(n,e)))),r&&i.$includes){const e=Array.isArray(n)?n:[n];r=i.$includes.some((t=>e.includes(t)))}if(r&&i.$nincludes){const e=Array.isArray(n)?n:[n];r=i.$nincludes.every((t=>!e.includes(t)))}if(r&&i.$has&&(r=!0===n[i.$has[0]]),r&&i.$hasNot&&(r=!1===n[i.$hasNot[0]]),r&&i.$and&&(r=i.$and.every((e=>l(n,e)))),r&&i.$between){const e=tn(i.$between[0]),t=tn(i.$between[1]);r=t>e&&n>=e&&n<=t||t=e||n<=t)}r&&i.$value&&(r=n===tn(i)),r&&"boolean"==typeof i.$isNull&&(r=!n===tn(i.$isNull)),r&&"boolean"==typeof i.$notNull&&(r=!!n===tn(i.$notNull))}return r};class d{constructor(e){Array.isArray(e)?this.expressions=e.map((e=>u(e))):this.expressions=Object.keys(e).map((t=>u(e[t])))}getContext(){return this.context}setContext(e){this.context=e,this.expressions.forEach((t=>t.setContext(e)))}}class h extends d{check(){return Promise.all(this.expressions.map((e=>e.check())))}}class p extends d{check(){let e=this.expressions.length;return new Promise(((t,n)=>{this.expressions.forEach((i=>{i.check().then((()=>t())).catch((()=>{e--,e<=0&&n()}))}))}))}}class m extends d{constructor(e){super(e),this.expression=u(e)}setContext(e){return this.context=e,this.expression.setContext(e)}check(){return new Promise(((e,t)=>{this.expression.check().then(t).catch(e)}))}}class g{constructor(e){this.check=this.check.bind(this),this.expr=e}setContext(e){this.context=e}getContext(){return this.context}isBrowserSupportsPush(){return(0,t.fr)()?"safari"in window&&"pushNotification"in window.safari:"Notification"in window&&"serviceWorker"in navigator}check(){const[u,d]=(0,t.X)(this.expr)[0];return new Promise(((h,p)=>{const m=e=>{e?(en.info(`Trigger ${u} for campaign ${this.getContext().campaign.id} passed. Value: `,d),h()):setTimeout(p,1)},g=o.getUtmTags();switch(u){case"event":return m(this.context.events.some((e=>l(e,d))));case"custom_event":return m(this.context.customEvents.some((e=>l(e,d))));case"custom_js":return m(l(!0,d));case"html_element":const h=Object.keys(d)[0],p=(0,t.QC)(d[h],o.getVariables()),f=(0,t.kz)(p),v=(0,t.am)(f);return m(l(v,{[h]:!0}));case"custom_js_value":case"datalayer":const w=(e=>{const{$eval:n}=e;if(!n)return null;const{$value:i}=n;return[(0,t.QC)(i,o.getVariables()),(0,t.$W)(n)]})(d),y=w[0];return m(l((t=>{let n;try{n=new Function(t)({cart:s.cart})}catch(n){(0,e.Z)("triggers").warn("Custom JS Value trigger have failed",t)}return n})(y),(0,t.$W)(w[1])));case"views_count":return n.getSessionViewsCount((e=>m(l(e,d))));case"items_views_count":return s.getItemsViews().then((e=>m(l(e.length,d))));case"session_activity_duration":return n.getSessionActivityDuration((e=>m(l(e,d))));case"page_activity_duration":return n.getPageActivityDuration((e=>m(l(e,d))));case"inactivity_duration":return m(l(i.getInactivityDuration()/1e3,d));case"session_is_first":return n.sessionIsFirst((e=>m(l(e,d))));case"url":return m(l(window.location.href,d));case"url_in_history":return n.getSessionPageUrls((e=>{m(e.some((e=>l(e,d))))}));case"url_in_history_times":{const e=parseInt((d.$eq||d.$regex).$count,10);return n.getSessionPageUrls((t=>{m(t.filter((e=>{const{origin:t,pathname:n}=new URL(e),i=`${t}${n.replace(/\/$/,"")}`,r=`${t}${n}`;return l(e,d)||l(i,d)||l(r,d)})).length>=e)}))}case"session_start_url":return n.sessionStartUrl((e=>m(l(e,d))));case"referrer":return m(l(c,d));case"is_mobile":return m(l(Xt,d));case"cookie":const b=H.Z.get();let _=Object.keys(b).map((e=>{const t=b[e];return t&&"0"!==t&&"false"!==t?e:null}));return _=_.filter((e=>e)),m(_.some((e=>l(e,d))));case"is_shown_in_session":return n.getShownCampaignsInSession((e=>{const t=e.includes(String(this.context.campaign.id));m(l(t,d))}));case"is_campaign_shown_in_session":return n.getShownCampaignsInSession((e=>{m(l(e,d))}));case"user_is_authorized":return m(l(this.context.user.isAuthorized(),d));case"user_has_name":return m(l(this.context.user.hasName(),d));case"category_viewed_times":{const{$eq:{id:e,count:t}}=d;return n.getCategoriesViews((n=>{m((n.ids||[])[e]>=t)}))}case"card_viewed_times":return n.getCardsViews((e=>{const t=e.reduce(((e,{itemId:t})=>(e[t]=(e[t]||0)+1,e)),{});m(Object.values(t).some((e=>l(e,d))))}));case"cart_items_count":return m(l(this.context.cart.getItemsCount(),d));case"cart_total_price":return m(l(this.context.cart.getTotalPrice(),d));case"cart_add_item":const k=this.context.customEvents.some((e=>"flock_api_add_to_cart"===e));return m(l(k,d));case"cart_items_has_category":return m(this.context.cart.getFieldFromCardItems("categoryId").some((e=>l(e,d))));case"cart_items_has_brand":return m(this.context.cart.getFieldFromCardItems("brand").some((e=>l(e,d))));case"utm_source":return m(l(g.source,d));case"utm_campaign":return m(l(g.campaign,d));case"utm_medium":return m(l(g.medium,d));case"utm_content":return m(l(g.content,d));case"gclid":return n.getSessionPageUrls((e=>{m(e.some((e=>{const n=(0,t.ak)("gclid",e);return l(n,d)})))}));case"category":return m(l(s.category.getCurrent(),d));case"battery":return r.getBattery((e=>m(l(100*e,d))));case"notification_status":return m(l(String("Notification"in window&&Notification.permission),d));case"is_browser_supports_push":return m(l(this.isBrowserSupportsPush(),d));case"local_time":return m(l(new Date,d));case"spot":const E=[].slice.call(window.document.querySelectorAll("[data-fl-spot]")).map((e=>e.getAttribute("data-fl-spot")));return m(E.some((e=>l(e,d))));case"scroll":const S=document.documentElement,{body:I}=document,A=(S.scrollTop||I.scrollTop)/((S.scrollHeight||I.scrollHeight)-S.clientHeight)*100;return m(l(A,d));case"is_product_page":return m(l(s.isProductPage(),d));case"is_category_page":return m(l(s.isCategoryPage(),d));case"count_category_views":return m(l(s.category.getCountViews(),d));case a.getKey():if(!s.currentItemId)return m();const T=a.checkSku(s.currentItemId);return null===T?m():m(l(T,d));case"is_user_subscribed":return n.getUserSubscriptionStatus((e=>m(l(e,d))));case"is_incognito":return m(!0);default:return en.warn(`wrong trigger condition ${u}`,d),m()}}))}}return{Trigger:class{constructor(e){this.campaign=e.campaign,this.conditions=e.conditions,this.callback=e.callback,this.variables=e.variables,this.rootExpression=u(this.conditions),this.state={executed:!1,expired:!1}}check(e){return this.state.executed||this.state.expired?null:(null==(e=Object.assign({},e)).user&&(e.user=s.getUser()),null==e.cart&&(e.cart=s.getCart()),null==e.campaign&&(e.campaign=this.campaign),null==e.event&&(e.event=[]),null==e.customEvents&&(e.customEvents=[]),this.rootExpression.setContext(e),new Promise((e=>{this.rootExpression.check().then((()=>{e([!0,this])})).catch((()=>{e([!1,this])}))})))}reset(){this.state.executed=!1}markExpired(){this.state.expired=!0}execute(){this.state.executed=!0,this.callback(this)}},__compare:l}}const rn=(0,e.Z)("splitByExclusions"),sn=e=>(e||[]).map((e=>+e)),on=e=>(e||[]).map((e=>String(e)));function an(e,n,i,r,s){const o=function(e,n,i,r,s){const o=e.map((e=>function(e,n,i,r,s){const o=sn(e.campaigns),a=n.map((e=>1+o.indexOf(e))).filter((e=>e));let c=Math.min(...a);c=Number.isFinite(c)?c-1:0;let u=[];if(null!=e.timeConstraint&&0!==e.timeConstraint){const t=+new Date-1e3*e.timeConstraint*60*60*24,n=function(e){return e.reduce(((e,t)=>(e[t.campaign]=t.date,e)),{})}(s);Object.keys(n).forEach((e=>{n[e]>t&&o.includes(+e)&&u.push(+e)}))}else e.sessionConstraint?u=(0,t.jV)(r,o):e.pageConstraint&&(u=(0,t.jV)(i,o));return n.map((t=>{const n=function(e,t,n){const i=0===n.length,r=!e.campaigns.includes(String(t)),s=!!n.length&&t===n[0],o=e.sessionConstraint||e.timeConstraint?i||r||s:i||r;r||o||rn.warn({cid:t,campainsFromConstraintWasShown:n.join(","),isAlreadyShown:s,exclusion:e});return o}(e,t,u),i=o.indexOf(t)-c;return n?{campaign:t,approve:!0,priority:i}:{campaign:t,approve:!1,priority:0}}))}(e,n,i,r,s))),a=function(e,t){const n=[];e.forEach((e=>{null!=e&&e.forEach((e=>{e.approve||n.push(e.campaign)}))}));const i=function(e){const t={};return e.forEach((e=>{let n=-1;e.forEach(((e,i)=>{n<0&&t[e]>0&&(n=i)})),n<0&&e.forEach(((e,i)=>{n<0&&-1!==t[e]&&(n=i)})),n>=0&&(t[e[n]]=1),e.forEach(((e,i)=>{i!==n&&(t[e]=-1)}))})),t}(function(e){return e.map((e=>{const t=[];return null!=e&&e.sort(((e,t)=>e.priority-t.priority)).forEach((e=>{e.approve&&e.priority>=0&&t.push(e.campaign)})),t}))}(e));return t.map((e=>{let t;t=n.includes(e)?-1:i[e]||1;return{approve:t>0,campaign:e,priority:0}}))}(function(e){const t=(e&&e[0]||[]).reduce(((t,{campaign:n},i)=>(t[n]=e.every((e=>e[i].approve)),t)),{});return e.map((e=>e.map((({campaign:e,priority:n})=>({campaign:e,approve:t[e],priority:n})))))}(o),n),[c,u]=(0,t.uK)(a,(e=>e.approve)),l=e=>e.campaign;return[c.map(l),u.map(l)]}(e,sn(n),sn(i),sn(r),s);return[on(o[0]),on(o[1])]}const cn=(0,e.Z)("approveCampaigns");function un(e){const{ids:n,closedIds:i,shownIds:r,inactivity:s,shownLog:o,sessionId:a,exclusions:c}=e;let[u,l]=(0,t.uK)(n,(e=>(e=>i.includes(e))(e)));u.forEach((e=>{cn.info(`Campaign ${e} wants to show, but is closed.`)})),[l,u]=(0,t.uK)(l,(n=>{const i=s[String(n)];if(!i)return!0;const{count:r}=i,{period:o}=i;if(null==r||null==o||!(0,t.hj)(r)||!(0,t.hj)(o))return!0;const a=function(e,t,n){const i=(new Date).getTime()-t,r=n[String(e)]||{};return Object.keys(r).filter((e=>ie+r[t]),0)}(n,1e3*o,e.hitLog);return r>a})),u.forEach((e=>{cn.info(`Campaign ${e} wants to show, but is in inactivity state.`)}));const d=function(e,n){const i=e.filter((e=>e.session===n)).map((e=>e.campaign));return(0,t.jj)(i)}(o,a);return[l,u]=an(c,l,r,d,o),u.forEach((e=>{cn.info(`Campaign ${e} wants to show, but stopped by constraints.`)})),l}let ln;const dn=__webpack_require__.g.crypto||__webpack_require__.g.msCrypto;if(dn&&dn.getRandomValues){const e=new Uint8Array(16);ln=function(){return dn.getRandomValues(e),e}}if(!ln){const e=new Array(16);ln=function(){for(let t,n=0;n<16;n++)0==(3&n)&&(t=4294967296*Math.random()),e[n]=t>>>((3&n)<<3)&255;return e}}let hn=[];for(let e=0;e<256;++e)hn[e]=(e+256).toString(16).substr(1);function pn(e,t){let n=t||0;const i=hn;return i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+"-"+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]+i[e[n++]]}const mn=ln(),gn=[1|mn[0],mn[1],mn[2],mn[3],mn[4],mn[5]];let fn=16383&(mn[6]<<8|mn[7]),vn=0,wn=0;const yn={v1:function(e,t,n){let i=t&&n||0,r=t||[],s=void 0!==(e=e||{}).clockseq?e.clockseq:fn,o=void 0!==e.msecs?e.msecs:(new Date).getTime(),a=void 0!==e.nsecs?e.nsecs:wn+1;const c=o-vn+(a-wn)/1e4;if(c<0&&void 0===e.clockseq&&(s=s+1&16383),(c<0||o>vn)&&void 0===e.nsecs&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");vn=o,wn=a,fn=s,o+=122192928e5;const u=(1e4*(268435455&o)+a)%4294967296;r[i++]=u>>>24&255,r[i++]=u>>>16&255,r[i++]=u>>>8&255,r[i++]=255&u;const l=o/4294967296*1e4&268435455;r[i++]=l>>>8&255,r[i++]=255&l,r[i++]=l>>>24&15|16,r[i++]=l>>>16&255,r[i++]=s>>>8|128,r[i++]=255&s;const d=e.node||gn;for(let e=0;e<6;++e)r[i+e]=d[e];return t||pn(r)},v4:function(e,t,n){const i=t&&n||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);const r=(e=e||{}).random||(e.rng||ln)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(let e=0;e<16;++e)t[i+e]=r[e];return t||pn(r)}};function bn(e,t,n,i){let r={source:"",medium:"",campaign:"",term:"",content:""};null!=n&&(r=n);const s={source:"utmcsr",medium:"utmcmd",campaign:"utmccn",term:"utmctr",content:"utmcct"},o=Ze(e),a=function(e){const t={source:"",medium:"",campaign:"",term:"",content:""};if(!e)return t;const n=e.split("/")[2],i=e=>e.split(".").slice(-2).join(".");/google\.(com|ru)/i.test(e)?(t.source="google",t.medium="organic"):/googleadservices\.com/i.test(e)?(t.source="google",t.medium="cpc"):/yandex.ru\/clck/i.test(e)?(t.source="yandex",t.medium="organic"):i(n)!==i(window.location.host)&&(t.source=n,t.medium="referral",t.campaign="referral");return t}(i),c=parseInt(t.utm_nooverride,10),u={source:"",medium:"",campaign:"",term:"",content:""},l={source:"",medium:"",campaign:"",term:"",content:""};return["campaign","source","medium","term","content"].forEach((e=>{const n=o.utmz[s[e]],i=t[`utm_${e}`]||a[e];let d=n;c||(d=d||i),d=d||r[e],d&&(u[e]=d),i&&!c&&(l[e]=i)})),[u,l]}const _n=(0,e.Z)("state"),kn=18e5,{reducePrecheckoutShownLog:En}=At,Sn="2";function In(e,n,i,r){const s=i.getInitialConfig();let o="/flock_push_worker.js";s.serviceWorkerPath&&(o=String(s.serviceWorkerPath));const a={workerPath:o,campaigns:s.campaigns,tracking:s.tracking,subdomain:s.subdomain,mutualExclusions:s.exclusions,shownIds:[],ip:s.clientIp,utmTags:{source:"",medium:"",campaign:"",term:"",content:""},utmTagsHypothetical:{source:"",medium:"",campaign:"",term:"",content:""},sessionId:"",viewId:yn.v1(),precheckoutTest:s.precheckoutTest,vapidPublicKey:s.vapidPublicKey||null,enabledProducts:s["enabled-products"]||[],variables:s.variables||[],resubscribePushEnabled:s["push-subscription-version"]===Sn};function c(e){e?a.ip=e:_n.warn("Empty ip")}return Promise.all([e.get("utmTags"),An(e)]).then((([r,s])=>{a.sessionId=s;const o=bn(document.cookie,(0,t.mx)(),r,document.referrer);return a.utmTags=o[0],a.utmTagsHypothetical=o[1],e.set("utmTagsHypothetical",a.utmTagsHypothetical),e.set("utmTags",a.utmTags),{getSubdomain:()=>a.subdomain,getSessionId:()=>a.sessionId,getGlobalSessionId:()=>n&&n.isActionAvailable(Te.GET_GLOBAL_SESSION_ID)?n.getGlobalSessionId():Promise.resolve(null),getViewId:()=>a.viewId,updateViewId(){a.viewId=yn.v1()},getWorkerPath:()=>a.workerPath,resetCampaignsShownIds(){a.shownIds=[]},dump:()=>JSON.parse(JSON.stringify(a)),setIp:c,getIp:()=>a.ip,getApprovedCampaigns:n=>0===n.length?Promise.resolve([]):Promise.all([e.get(gt.precheckoutClosed),e.get(gt.campaignHitLog),e.get(gt.precheckoutShownLog)]).then((i=>{const r=Array.isArray(i[0])?i[0]:[],s=i[2]?function(e){if(!Array.isArray(e))return[];return e.map((e=>({date:new Date(e.date),campaign:e.campaign,session:e.session})))}(i[2]):[],o=un({ids:n,shownLog:s,shownIds:a.shownIds,exclusions:a.mutualExclusions,closedIds:r.map((e=>e.campaign)),inactivity:(c=a.campaigns,Object.fromEntries(c.map((e=>[e.id,e.inactivity])))),hitLog:i[1]||{},sessionId:a.sessionId});var c;return a.shownIds=(0,t.jj)(a.shownIds.concat(o)),function(e,n,i){const r="precheckoutShownLog",s=e.get(r).then((t=>{t=Array.isArray(t)?t:[];const s=+new Date;return n.forEach((e=>{t.push({date:s,campaign:e,session:i})})),t=En(t),e.set(r,t)})),o="campaignHitLog",a=e.get(o).then((i=>{const r=i||{};return e.set(o,function(e,n){const i=(0,t.RH)({},e);return n.forEach((e=>{const t=function(e){const t=new Date(e);return t.setUTCHours(0),t.setUTCMinutes(0),t.setUTCSeconds(0),t.setUTCMilliseconds(0),t.getTime()}((new Date).getTime());i[e]=i[e]||{},i[e][t]=i[e][t]||0,i[e][t]++})),i}(r,n))}));return Promise.all([s,a]).then((()=>null))}(e,o,a.sessionId).then((()=>o))})),saveClosedState(t,n){e.update(gt.precheckoutClosed,(e=>{const i=(e||[]).filter((e=>e.campaign!==t));return i.push({campaign:t,expireAt:Date.now()+n}),i}))},getUtmTags:()=>a.utmTags,getHypotheticalUtmTags:()=>a.utmTagsHypothetical,getCampaigns:()=>a.campaigns.filter((e=>!("scenario"in e)||e.scenario!==mt)),getUrlSplitCampaigns:()=>a.campaigns.filter((e=>"scenario"in e&&e.scenario===mt)),getVariables:()=>a.variables,getTrackingSettings:()=>a.tracking,getVapidPublicKey:()=>a.vapidPublicKey,getPrecheckoutTestSettings:()=>a.precheckoutTest,isProductEnabled:e=>-1!==a.enabledProducts.indexOf(e),isResubscribePushEnabled:()=>a.resubscribePushEnabled,update(e,n){let r=a.utmTags;r.source||(r=a.utmTagsHypothetical);const s=(0,t.ak)("flocktory-preview-id",window.location.href);return i.requestData(e,r,n,s).then((e=>{a.campaigns=e.campaigns,a.mutualExclusions=e.exclusions}))}}}))}function An(e){return e.get("sessionId").then((t=>{if(t&&t.sessionId&&Date.now()n))}))}var Tn,On=__webpack_require__(554),Cn=__webpack_require__.n(On),xn=function(){return xn=Object.assign||function(e){for(var t,n=1,i=arguments.length;nnull}function jn(e){const t=document.getElementById(e);null!=t&&document.getElementsByTagName("head")[0].removeChild(t)}function Fn(e,t=4e4){let n=null;return new Promise((i=>{const r="flock_jsonp_"+Vn++,s=Rn+"_"+r;window[r]=e=>{i(e),n&&clearTimeout(n),jn(s),Un(r)};const o=e+(-1===e.indexOf("?")?"?":"&"),a=document.createElement("script");a.setAttribute("data-ot-ignore",""),a.setAttribute("src",""+o+Rn+"="+r),a.setAttribute("id",s),document.getElementsByTagName("head")[0].appendChild(a),n=setTimeout((()=>{window[r]({error:new Error(`JSONP request to ${e} timed out`)}),Un(r),jn(s)}),t)}))}const Mn={getSampleData:(e,t)=>`${e} - ${t}`},$n={PUSH_SUBSCRIBE:"push-subscribe"},zn=e=>JSON.parse(JSON.stringify(e)),qn=new De.EventEmitter,Wn=(e,t)=>qn.emit(e,zn(t)),Bn={EVENTS:$n,Promise,on:(e,t)=>qn.on(e,t),off:(e,t)=>qn.removeListener(e,t),exec:(...e)=>{const[t,...n]=e;if(!t)throw Error("[flocktory.exec]: API method name not specified.");if(!Object.keys(Mn).includes(t))throw Error(`[flocktory.exec]: API method "${t}" does not exist.`);const i=(0,Mn[t])(...n);return window.Promise&&i instanceof Promise?i.then(zn,zn):zn(i)}};window.flocktory=Object.assign(window.flocktory||[],Bn);const Hn=window.flocktory,Kn=(0,e.Z)("backend"),Gn=(0,e.Z)("performance"),Zn=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?"firefox":"chrome";function Jn(e,n){const{siteId:i}=n,r=Dn();function s(e,t,n=!0){const r=`${function(e,t){try{return JSON.stringify(t)}catch(t){return Promise.reject(`Can't stringify data to ${e}`)}}(e,t)}`;return`https://${function(e){return 1632===e?"beeline.":2813===e?"vtb.":""}(i)}${dt}${e}${n?".js":""}?body=${encodeURIComponent(r)}`}function o(n){const i=e.isActionAvailable(Te.GET_GLOBAL_SESSION_ID);return(0,t.vs)()&&i?e.getGlobalSessionId().then((e=>`${n}&global-session-id=${encodeURIComponent(e)}`),(e=>(Kn.error(e),n))):Promise.resolve(n)}function a(e,t,n=!0){return o(s(e,t,n)).then((e=>n?Fn(e,1e3):function(e,t){const n=new AbortController,i=setTimeout((()=>n.abort("timed out")),t);return fetch(e,{signal:n.signal,credentials:"include"}).then((e=>(clearTimeout(i),e.json()))).catch((t=>({error:new Error(`Fetch request to ${e} error: ${t}`)})))}(e,1e3))).then(((e={})=>{if(e.error){const{error:t}=e;t.schema?Kn.error(new Error(t.message||t),t.schema):Kn.error(new Error(t.message||t))}return e}))}function c(e){document.createElement("img").setAttribute("src",e)}function u(e,t){o(`${s(e,t)}&callback=flock_jsonp_9999`).then(c)}let l,d;function h(){return a("/u_flockman/check-active-push-subscription",{"site-id":String(i)})}function p(e,t){const{keys:n}=JSON.parse(JSON.stringify(e)),s={};n&&["auth","p256dh"].forEach((e=>{n[e]&&(s[e]=n[e])})),t&&(s["vapid-public-key"]=t);const o={platform:t?"vapid":Zn,"site-id":String(i),token:e.endpoint,url:window.location.href};return 0!==Object.keys(s).length&&(o["provider-meta"]=s),r&&(o["site-session-id"]=String(r)),o}return{attachToProfile:function(e){const t={"site-id":String(i),meta:Object.keys(e).reduce(((t,n)=>(t[String(n)]=String(e[n]),t)),{})};return r&&(t["site-session-id"]=String(r)),a("/u_flockman/set-profile-custom-meta",t)},setup:function(e,t=!1){if(!t&&function(e,t){if(!e||!t)return!1;const n=e=>Object.keys(e).sort().map((t=>[t,e[t]])),i=JSON.stringify(n(e)),r=JSON.stringify(n(t));return i===r}(d,e))return Promise.resolve(l);const n={siteId:String(i),utm:e.utm,profile:e.emailProfile};return n["site-session-id"]=String(r),e.previewCampaignId&&(n["preview-campaign-id"]=String(e.previewCampaignId)),Gn.info("setup-api request start",performance.now()),(r?a("/u_shaman/setup-api",n,!1):Promise.resolve({error:"setup-api request aborted: no uuid"})).then((t=>{var n,i;t.error&&console.warn(t.error),Object.keys(t).length||Kn.warn("empty setup-api response"),Gn.info("setup-api request finished",performance.now());const r=null===(n=t.oldCampaigns)||void 0===n?void 0:n.filter((e=>e.widgets.length)).map((e=>(e.widgets=function(e){const t=e.slice(0),n=e=>parseInt(e.meta.weight||0,10);return t.sort(((e,t)=>n(e)-n(t))),t}(e.widgets),e)));return t.campaigns=(null===(i=t.campaigns)||void 0===i?void 0:i.concat(r))||[],t.campaigns.forEach((e=>{if(e.trackRedefinitions=[],null!=e.widget&&e.widget.meta.trackRedefinitions){try{e.trackRedefinitions=JSON.parse(e.widget.meta.trackRedefinitions)}catch(e){}e.trackCategory=e.widget.meta.trackCategory,e.trackLabel=e.widget.meta.trackLabel}if(null!=e.widgets){const t=e.widgets.find((e=>e.meta&&e.meta.noShowCategory));if(null!=t){const{meta:n}=t;e.noShowLabel=n.noShowLabel,e.noShowCategory=n.noShowCategory,e.noShowAction=n.noShowAction}}})),l=t,d=e,t}))},checkActivePushSubscription:function(){return h().then((e=>(0,t.U2)(e,"subscribed",null)))},getSubscriptionStatus:h,attachPushToSession:function(e,t,n){const i=p(e,n);return i["campaign-id"]=t,a("/u_flockman/attach-push-to-session",i).then((i=>(Wn($n.PUSH_SUBSCRIBE,{subscription:e,cid:t,vapidPublicKey:n,pushProfile:i}),i.id)))},resubscribePush:function(e,t,n){const i=p(e,n);return i["old-token"]=(t||{}).endpoint,a("/u_flockman/resubscribe-push",i).then((e=>e.id))},ultimate:function(e){const t={data:e};r&&(t["site-session-id"]=String(r)),u("/underworld/tracks/ultimate",t)},customActivity:function(e,t){const n={data:e,"site-id":String(i),"campaign-id":String(t),label:"precheckout-event"};r&&(n["site-session-id"]=String(r)),u("/u_shaman/custom-activity",n)},assigns:function(e,t){return t.site_id=i,a("/u_widget/get-assigns",{assigns:e,params:Object.keys(t).map((e=>({key:e,value:String(t[e])})))}).then((e=>e.assigns.reduce(((e,t)=>(e[t.key]=t.value,e)),{})))},userMeta:function(){return a("/u_flockman/get-user-metainfo",{scope:`site-custom:${i}`}).then((e=>(e.meta||[]).reduce(((e,t)=>(e[t.key]=t.value,e)),{})))},customEvent:function(e){const t={event:e,"site-id":String(i)};r&&(t["site-session-id"]=String(r)),u("/u_shaman/custom-events",t)},exchangeBanner:function(e){const t={"source-site-id":String(i)};return null!=e.spot&&(t.spot=e.spot),null!=e.name&&(t.name=e.name),null!=e.email&&(t.email=e.email),r&&(t["site-session-id"]=String(r)),a("/interchange/v1/banner",t).then((e=>{if(e.error)throw new Error(e.error);if(e.errors&&e.errors[0])throw new Error(e.errors[0]);if(e.errors)throw new Error(e.errors);return{html:e.html,loginData:e["login-data"],selector:e.selector}}))},trackExchangeBanner:function(e){o(`https://${dt}/interchange/v1/banner/track-display?data=${encodeURIComponent(e)}`).then(c)},postcheckout:function(e,n){const s=(e.order&&e.order.items||[]).reduce(((e,t,n)=>{const i=Object.assign({},t);return["id","title","image","count","price"].forEach((e=>{delete i[e]})),e[String(n)]={i:t.id,t:t.title,u:t.image,c:t.count,p:t.price,custom_data:i},e}),{}),o=Ze(String.prototype.slice.call(document.cookie)),c={site_id:i,jsapi_version:"2.0",i:e.order.id,e:e.user&&e.user.email,n:e.user&&e.user.name,p:e.order&&e.order.price,c:e.order&&e.order.custom_field,sp:e.spot,s:e.user&&e.user.sex?e.user.sex.slice(0,1):void 0,t:s,ga:{utmcsr:o.utmz.utmcsr||n.source,utmccn:o.utmz.utmccn||n.campaign,utmcmd:o.utmz.utmcmd||n.medium,utmctr:o.utmz.utmctr,pageviews:o.utma.pageViews,previous_visit_ts:o.utma.previousVisitTs,current_visit_at:o.utma.currentVisitTs}};return r&&(c["site-session-id"]=String(r)),a("/1/postcheckout/offer",c).then((e=>{if(e.error)throw new Error(e.error);if(e.errors&&e.errors[0])throw new Error(e.errors[0]);if(e.errors)throw new Error(e.errors);return{html:e.html,cid:e.campaign_id,title:e.campaign_title,timeout:e.js_options.params.timeout,el:(0,t.U2)(e,"js_options.params.widget.el","popup"),background:(0,t.U2)(e,"js_options.params.widget.background",null)}}))},widget:function({cid:e,vid:t,motivationId:n}){const r={"version-id":t,locale:"ru","site-id":String(i),"campaign-id":String(e),flags:["render"],params:[{key:"campaign_id",value:String(e)},{key:"attach_key",value:"campaign"},{key:"attach_value",value:String(e)}],"extra-params":void 0};return null!=n&&r.params.push({key:"motivation_id",value:n}),Gn.info(`widget ${e} request started`,performance.now()),a("/u_widget/get-widget",r).then((n=>(Gn.info(`widget ${e} request finished`,performance.now()),{cid:e,vid:t,html:n.response.content})))},trackCustomerActions:function(e,t,n,i,s){const o={};return o["campaign-id"]=String(e),null!=t&&(o.email=String(t)),null!=n&&(o.name=String(n)),null!=i&&(o.data=Object.keys(i).map((e=>({key:e,value:i[e]})))),null!=s&&(o["make-offer"]=s),r&&(o["site-session-id"]=String(r)),a("/u_shaman/track-customer-actions",o).then((e=>{if(e.error)throw new Error(e.error);return e}))},getMotivation:function(e){const{motivationId:t,sid:n,cid:i,cacheTime:s}=e,o={"motivation-id":String(t),options:[{key:"campaign",value:String(i)},{key:"as-link",value:"true"},{key:"page-type",value:"iframe"},{key:"away-site",value:String(n)}]};return s&&o.options.push({key:"profile-cache",value:String(s)}),r&&(o["site-session-id"]=String(r)),a("/u_shaman/make-reward",o).then((e=>{if(e){const t=e["link-to-exchange"]||e["link-to-coupon"];return{link:t.url,code:t.code}}return{}}))},getUuid:function(){return r},sendCheckpointId:function(e){c(s("/u_shaman/set-checkpoint",{"checkpoint-id":e,"site-session-id":String(r)},!1))},checkSkuInAudience:function({audienceIds:e,currentItemId:t}){return a("/u_audiencer_api/sku-exist",{"audience-ids":e.map(Number),"sku-id":t})}}}const Qn=(e,t)=>{for(const n in t){let i=String(t[n]);"zIndex"===n||isNaN(Number(i))||""===i||(i=`${i}px`),e.style[n]=i}},Yn=e=>e.split("|").map((e=>`drop-shadow(${e.trim()})`)).join(" "),Xn=e=>e.replace(/drop-shadow\((?:[^)(]+|\([^)(]*\))*\)/g,""),ei=(e,t)=>{const n=e?.contentDocument,i=n?.body;if(!n||!i)return["0","0"];const r=t.style,s=i.style,{display:o,visibility:a}=r,{position:c,display:u}=s;t.dataset.showedUp||(r.visibility="hidden"),r.display="block",s.display="block",s.position="absolute";const{offsetWidth:l,offsetHeight:d}=i;return r.display=o,t.dataset.showedUp||(r.visibility=a),s.display=u,s.position=c,i.dataset.mutation=String((Number(i.dataset.mutation)||1)+1),[`${l}px`,`${d}px`]},ti=(e,t,n)=>{if("auto"!==n)return String(n);const[i]=ei(e,t);return i},ni=(e,t,n)=>{if("auto"!==n)return String(n);const{height:i}=e.style;Qn(e,{height:"0"});const[,r]=ei(e,t);return Qn(e,{height:i}),r};class ii{constructor(e,t){this.siteId=e,this.campaignId=t,this.storageName=`flockapi:${e}:widgetStorage`,this.campaignId=t,this.clearOutdatedValues()}getSiteData(){const e=localStorage.getItem(this.storageName);try{return e?JSON.parse(e):{}}catch(e){return{}}}setSiteData(e){const t=JSON.stringify(e);localStorage.setItem(this.storageName,t)}setValueByName(e,t,n){const i=this.getSiteData();i[`${this.campaignId}:${e}`]={value:t,expired:n||Date.now()+18e5},this.setSiteData(i)}getValueByName(e){const t=this.getSiteData(),n=`${this.campaignId}:${e}`;return t[n]?t[n]:void 0}clearOutdatedValues(){const e=this.getSiteData();for(const t in e){const n=e[t]||{};n?.expired<=Date.now()&&delete e[t]}this.setSiteData(e)}}class ri{constructor(e){this.frame=e,this.frame=e,this.overlay=e.parentElement,this.set=this.set.bind(this),this.setPopupType=this.setPopupType.bind(this),this.setFixedType=this.setFixedType.bind(this),this.setEmbeddedType=this.setEmbeddedType.bind(this)}set(e){const{type:t}=e;switch(t){case"popup":this.setPopupType(e);break;case"fixed":this.setFixedType(e);break;case"embedded":this.setEmbeddedType(e)}}setPopupType(e){const{width:t="auto",height:n="auto",overlayBackground:i="rgba(0, 0, 0, 0.8)",dropShadow:r}=e,s=this.frame?.contentDocument,o=s?.body;o.dataset.mutation=o.dataset.mutation||"1",Qn(this.overlay,{position:"fixed",top:"0px",left:"0px",zIndex:"2147483647",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",background:i,transform:"none"});const[a,c]=ei(this.frame,this.overlay),{innerWidth:u,innerHeight:l}=window;if(Qn(this.frame,{width:String("auto"===t?Math.min(parseInt(a,10),u):t),height:"auto"===n?c:String(n)}),r){const{filter:e}=this.frame.style;Qn(this.frame,{filter:`${Xn(e)} ${Yn(r)}`})}parseInt(c,10)>l&&(Qn(this.overlay,{alignItems:"flex-start",overflowY:"scroll"}),Qn(this.frame,{position:"static",top:"auto",left:"auto",display:"block",margin:"0 auto",transform:"none"}))}setFixedType(e){const{position:t,top:n,right:i,bottom:r,left:s,zIndex:o="auto",width:a="auto",height:c="auto",overlayBackground:u="none",dropShadow:l}=e;if(Qn(this.overlay,{position:"fixed",zIndex:String(o),justifyContent:"initial",alignItems:"initial",width:ti(this.frame,this.overlay,a),height:ni(this.frame,this.overlay,c),background:u,transform:"translateZ(0px) scale(1, 1)",backfaceVisibility:"hidden"}),Qn(this.frame,{width:"100%",height:"100%"}),l){const{filter:e}=this.frame.style;Qn(this.frame,{filter:`${Xn(e)} ${Yn(l)}`})}if(t){const[e,o]=(e=>{if("center"===e)return["center","center"];const[t,n]=e.split("-");return[t,n]})(t);let a=this.overlay.style.transform;switch(e){case"top":Qn(this.overlay,{top:n?String(n):"0",bottom:"auto"});break;case"bottom":Qn(this.overlay,{top:"auto",bottom:r?String(r):"0"});break;case"center":Qn(this.overlay,{top:"50%",transform:`${a} translateY(-50%)`})}switch(a=this.overlay.style.transform,o){case"right":Qn(this.overlay,{right:i?String(i):"0",left:"auto"});break;case"left":Qn(this.overlay,{right:"auto",left:s?String(s):"0"});break;case"center":Qn(this.overlay,{left:"50%",transform:`${a} translateX(-50%)`})}}else Qn(this.overlay,{top:n?String(n):"auto",right:i?String(i):"auto",bottom:r?String(r):"auto",left:s?String(s):"auto"})}setEmbeddedType(e){const{zIndex:t="auto",width:n="auto",height:i="auto",overlayBackground:r="none",dropShadow:s}=e;if(Qn(this.overlay,{position:"relative",zIndex:String(t),justifyContent:"initial",alignItems:"initial",width:ti(this.frame,this.overlay,n),height:ni(this.frame,this.overlay,i),background:r}),Qn(this.frame,{width:"100%",height:"100%"}),s){const{filter:e}=this.frame.style;Qn(this.frame,{filter:`${Xn(e)} ${Yn(s)}`})}}}class si{constructor(e,t,n,i,r,s,o,a,c,u,l,d,h,p){this.frame=e,this.siteId=t,this.campaignId=n,this.tracker=i,this.pushService=r,this.pushOptinVersionId=s,this.logger=o,this.backend=a,this.motivationId=c,this.state=u,this.trigger=l,this.widgetState=d,this.readyQueue=h,this.configurations=p,this.frame=e,this.siteId=t,this.campaignId=n,this.tracker=i,this.pushService=r,this.pushOptinVersionId=s,this.logger=o,this.backend=a,this.motivationId=c,this.state=u,this.trigger=l,this.widgetState=d,this.readyQueue=h,this.configurations=p,this.overlay=e.parentElement,this.widgetStorage=new ii(this.siteId,this.campaignId),this.widgetConfig=new ri(this.frame),this.setValue=this.setValue.bind(this),this.getValue=this.getValue.bind(this),this.getData=this.getData.bind(this),this.getMeta=this.getMeta.bind(this),this.track=this.track.bind(this),this.setScreen=this.setScreen.bind(this),this.pushStatus=this.pushStatus.bind(this),this.pushSubscribe=this.pushSubscribe.bind(this),this.getMotivation=this.getMotivation.bind(this),this.sendError=this.sendError.bind(this),this.collectEmail=this.collectEmail.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.ready=this.ready.bind(this),this.configure=this.configure.bind(this)}setValue(e,t,n){this.widgetStorage.setValueByName(e,t,n)}getValue(e){return this.widgetStorage.getValueByName(e)}getData(){return{cid:this.campaignId,siteId:this.siteId}}getMeta(){const e=this.frame.contentDocument;return[].slice.call(e.querySelectorAll("meta[data-fl-param]")).reduce(((e,t)=>{const{name:n,content:i,dataset:{flParam:r}}=t;let s;switch(r){case"boolean":s="true"===i;break;case"number":s=parseFloat(i);break;default:s=i}return e[n]=s,e}),{})}track(e,t=!1){this.tracker.track(e,t)}setScreen(e){const t=this.frame.contentDocument,n=[].slice.call(t.querySelectorAll("[data-fl-screen]")),i=n.find((t=>t?.dataset?.flScreen===e));if(!i)throw new Error(`No screen ${e}`);n.forEach((e=>e.style.display="none")),i.style.display="block",this.track(`show-screen-${e}`)}pushStatus(e){return this.pushService.status?this.pushService.status({cid:this.campaignId,alwaysUseTwoStep:e?.alwaysUseTwoStep||!1}):(this.tracker.track("push-unsupported",!0),Promise.resolve({permission:"unsupported",requireInteraction:!1}))}pushSubscribe(e){return this.pushService.subscribe?this.pushService.subscribe({cid:String(this.campaignId),optinVersionId:this.pushOptinVersionId,alwaysUseTwoStep:e?.alwaysUseTwoStep||!1,isUserInteraction:e?.isUserInteraction||!1}):(this.tracker.track("push-unsupported",!0),Promise.resolve({permission:"unsupported",requireInteraction:!1}))}getMotivation(e){if(!this.motivationId)return this.logger.error(new Error(`${this.siteId}:${this.campaignId} | Missing critical assigns: motivation`)),Promise.resolve({});const t={motivationId:this.motivationId,sid:this.siteId,cid:this.campaignId,cacheTime:e||0};return this.backend.getMotivation(t)}sendError(e=""){this.logger.error(new Error(`${this.siteId}:${this.campaignId} | ${e}`))}collectEmail(e,t,n={light:"true"},i=!1){for(const e in n)if("string"!=typeof n[e])throw new Error(`Value of data[${e}] must be string type`);const r=this.state.getUtmTags(),s={};for(const e in r){s[`utm_${e}`]=r[e]}return this.backend.trackCustomerActions(this.campaignId,e,t,{...n,...s},i).then((i=>{if(e&&this.tracker.track("login",!1),window.dataLayer){const i={...n};delete i.light,window.dataLayer.push({event:"fl_collected_email",campaignLabel:this.tracker.campaign.trackLabel,email:e,name:t,additionalFields:i,...s})}return i}))}hide(e){if(this.overlay.style.display="none",0!==e){const t=1e3*(e||1800);this.state.saveClosedState(this.campaignId,t)}}show(){!this.overlay.dataset.showedUp&&this.trigger.state.expired||(this.overlay.style.display="flex",this.overlay.dataset.showedUp="true",this.tracker.track("show-widget",!0))}ready(e){return void 0!==e&&(this.widgetState.ready?e():this.readyQueue.push(e)),this.readyQueue}configure(e){const t={...this.configurations.get(this.frame)||{},...e};this.configurations.set(this.frame,t),this.widgetConfig.set(t)}}class oi{constructor(e,t,n,i,r,s,o,a,c,u){this.siteId=e,this.pushService=t,this.logger=n,this.backend=i,this.configurations=r,this.state=s,this.zIndex=o,this.apis=a,this.overlays=c,this.topWindow=u,this.siteId=e,this.pushService=t,this.logger=n,this.backend=i,this.configurations=r,this.state=s,this.zIndex=o,this.apis=a,this.overlays=c,this.topWindow=u,this.create=this.create.bind(this),this.destroy=this.destroy.bind(this),this.setupFrame=this.setupFrame.bind(this),this.initApi=this.initApi.bind(this)}create(e,t){const{cid:n,html:i}=e,{root:r,closeOutside:s,closeOutsideSeconds:o,gaTracker:a,optinVersionId:c,motivationId:u,trigger:l}=t,d={ready:!1},{overlayElement:h,frameElement:p,frameDocument:m}=this.setupFrame(n,r),g=this.initApi(p,this.siteId,n,a,this.pushService,c,this.logger,this.backend,u,this.state,l,d,[],this.configurations);this.apis.set(p,g),this.pushService&&this.pushService.emitter&&this.pushService.emitter.on("push-status",((e,t,i=!1)=>e===n&&g.track(t,i))),p.addEventListener("load",(()=>{const e=m.querySelector('meta[name="widget-config"]'),t=[].slice.call(m.querySelectorAll("[data-fl-track], [data-fl-close]")),n=e=>{const t=this.configurations.get(p),n=(e||[]).some((e=>"data-mutation"===e?.attributeName));t&&!n&&g.configure(t)};if(oi.initScreens(m,g.track),e&&oi.applyInnerConfig(e,g.configure,g.show),t.length&&oi.setupTrackableElements(t,g.hide,g.track),s){const e=t=>{t.stopPropagation(),g.hide(o),g.track("click-outside"),h.removeEventListener("click",e)};h.addEventListener("click",e)}((e,t)=>{const n=e?.contentDocument,i=n?.body;if(!n||!i)return;new MutationObserver(t).observe(i,{subtree:!0,attributes:!0,characterData:!1,childList:!1})})(p,n),this.topWindow.addEventListener("resize",(()=>n())),!l.state.expired&&g.ready().forEach((e=>e())),d.ready=!0})),oi.fillFrame(m,i,g)}destroy(){this.overlays.forEach((e=>e.remove()))}setupFrame(e,t){const n=document.createElement("div"),i=document.createElement("iframe");n.classList.add("flocktory-widget-overlay"),n.style.display="none",n.style.zIndex=String(this.zIndex++),i.id=`fl-${e}`,i.title="Flocktory widget",i.frameBorder="0",i.scrolling="no",i.classList.add("flocktory-widget"),n.append(i),t?t.append(n):document.body?document.body.append(n):this.logger.error(new Error("document.body eq null"));const r=i?.contentDocument,s=r?.documentElement;return s&&(s.style.transform="translateZ(0) scale(1, 1)"),{overlayElement:n,frameElement:i,frameDocument:r}}initApi(e,t,n,i,r,s,o,a,c,u,l,d,h,p){const{setValue:m,getValue:g,getData:f,getMeta:v,track:w,setScreen:y,pushStatus:b,pushSubscribe:_,getMotivation:k,sendError:E,collectEmail:S,hide:I,show:A,ready:T,configure:O}=new si(e,t,n,i,r,s,o,a,c,u,l,d,h,p);return{setValue:m,getValue:g,getData:f,getMeta:v,track:w,setScreen:y,pushStatus:b,pushSubscribe:_,getMotivation:k,sendError:E,collectEmail:S,hide:I,show:A,ready:T,configure:O}}static fillFrame(e,t,n){const i=`