PageSourceSearch

https://mo.orange.pl/nr2Lk2I0.js

js orange.pl collected 2026-09-24 08:45:03 UTC 319,284 bytes, 1 lines download raw bytes

1((Ke,x)=>{function e(){}var g={},M={nonce:null},t=("undefined"==typeof console&&(console={log:e,debug:e,error:e,info:e}),g.setNonce=function(e){M.nonce=e},g.addEvent=function(e,t,n){return e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener(t,n,!1)},g.removeEvent=function(e,t,n){return e.detachEvent?e.detachEvent("on"+t,n):e.removeEventListener(t,n,!1)},g.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},g.onReady=function(e,t){e.document&&"complete"===e.document.readyState?t():e.document&&e.document.addEventListener?e.document.addEventListener("DOMContentLoaded",t,!1):e.attachEvent?e.attachEvent("onload",t):Ke.onload=t},g.unescapeHtml=function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":(e=t.childNodes[0]?t.childNodes[0].nodeValue:"",(e+=t.childNodes[1]?t.childNodes[1].outerHTML:"")+(t.childNodes[2]?t.childNodes[2].outerHTML:""))},g.insertAfter=function(e,t){e.parentNode&&e.parentNode.insertBefore(t,e.nextSibling)},g.insertBefore=function(e,t){e.parentNode&&e.parentNode.insertBefore(t,e)},g.moveChildren=function(e,t){if(e!==t)for(;e.hasChildNodes();)t.appendChild(e.firstChild)},g.documentFragmentInnerHtml=function(e,t){var n=document.createElement("div");n.innerHTML=t,g.moveChildren(n,e)},g.isDocumentFragment=function(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE},g.containerInnerHtml=function(e,t){g.isDocumentFragment(e)?g.documentFragmentInnerHtml(e,t):e.innerHTML=t},g.executeScriptsForScriptTags=function(e){var n,r;e.length&&(n=/^$|\/(?:java|ecma)script/i,r=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,g.each(e,function(e){f.log("_:executeScript",e);var t=e.ownerDocument;n.test(e.type||"")&&(e.src?g.globalEvalScript(e.src,t):g.globalEvalCode(e.textContent.replace(r,""),t))}))},g.executeScripts=function(e){g.executeScriptsForScriptTags(e.querySelectorAll("script"))},g.executeScriptsForNodes=function(e){g.executeScriptsForScriptTags(g.getElementsByTagNameIncludesItself(e,"script"))},g.replaceChildren=function(e,t){g.isElement(t)||g.isDocumentFragment(t)?(e.innerHTML="",e.appendChild(t)):e.innerHTML=t},g.getNodesArray=function(e){var t=[];return e.hasChildNodes()&&g.each(e.childNodes,function(e){t.push(e)}),t},g.getElementsByTagNameIncludesItself=function(e,t){t=t.toLowerCase(),Array.isArray(e)||(e=[e]);var n=[];return g.each(e,function(e){e&&e.tagName&&(e.tagName.toLowerCase()===t&&n.push(e),(e=e.getElementsByTagName(t)).length)&&g.each(e,function(e){n.push(e)})}),n},g.globalEvalCode=function(e,t){var n=(t=t||document).createElement("script");M.nonce&&(n.nonce=M.nonce),n.text=e,t.head.appendChild(n).parentNode.removeChild(n)},g.globalEvalScript=function(e,t){var n=(t=t||document).createElement("script");M.nonce&&(n.nonce=M.nonce),n.src=e,t.head.appendChild(n)},g.inArray=function(e,t,n){var r="";if(!!n){for(r in t)if(t.hasOwnProperty(r)&&t[r]===e)return!0}else for(r in t)if(t.hasOwnProperty(r)&&t[r]==e)return!0;return!1},g.isDocumentVisible=(()=>{var t,n,e={hidden:"visibilitychange",webkitHidden:"webkitvisibilitychange",mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange"};for(t in e)if(e.hasOwnProperty(t)&&t in document){n=e[t];break}return function(e){return e&&document.addEventListener(n,e),!document[t]}})(),{objects:[],_timerObject:function(e){this.label=e,this.time=(new Date).getTime(),this.getLabel=function(){return this.label},this.getElapsedTime=function(){return(new Date).getTime()-this.time},this.getElapsedTimeString=function(){return this.getElapsedTime()+" ms"},this.getTime=function(){return this.time},this.log=function(){t.log(this)}},create:function(e){var t=new this._timerObject(e);return this.objects[e]=t},get:function(e){return void 0===this.objects[e=void 0!==e&&e?e:"__main__"]&&(this.objects[e]=new this._timerObject(e)),this.objects[e]},log:function(e){f.log('Timer "'+e.getLabel()+'" took '+e.getElapsedTimeString())}}),h={_promiseHandlers:{},_persistentPromiseHandlers:{},_emptyElement:document.createDocumentFragment(),encodeString:function(e,t){return("function"==typeof encodeURIComponent?t?encodeURI:encodeURIComponent:escape)(e)},prepareTimeForDate:function(e,t){t=t?new Date(t.getTime()):new Date;e=e.split(":");return t.setHours(e[0]),t.setMinutes(e[1]),t.setSeconds(e[2]),t},DOMTokenListSupports:function(e,t){if(e&&e.supports)try{return e.supp
1orts(t)}catch(e){f.log("The DOMTokenList doesn't have a supported tokens list")}},addStyles:function(r){return new Je(function(e,t){if(f.log("Utils:addStyles"),!r)return e(null);Array.isArray(r)||(r=[r]);var n=h.DOMTokenListSupports(document.createElement("link").relList,"preload");g.each(r,function(e){n&&((t=document.createElement("link")).setAttribute("rel","preload"),t.setAttribute("as","style"),t.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(t));var t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(t)}),e(r)})},uniquePromiseHandler:function(t,n){var e;return h._promiseHandlers[t]||(e=new Je(n),(h._promiseHandlers[t]=e).then(function(){f.log("Utils:uniquePromiseHandler then",t,n),delete h._promiseHandlers[t]}).catch(function(e){f.log("Utils:uniquePromiseHandler catch",t,n,e),delete h._promiseHandlers[t]}),e)},persistentPromiseHandler:function(e,t){return h._persistentPromiseHandlers[e]||(h._persistentPromiseHandlers[e]=new Je(t)),h._persistentPromiseHandlers[e]},addClass:function(e,t){h.hasClass(e,t)||(e.className+=" "+t)},removeClass:function(e,t){h.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("\\b"+t+"\\b","g"),""))},hasClass:function(e,t){return!!e.className.match(new RegExp("\\b"+t+"\\b","g"))},attachHandlerForElements:function(e,n,r,i){f.log("Utils:attachHandlerForElements",e.length,e),0<e.length&&g.each(e,function(t,e){h.addEvent(t,n,function(e){f.log("Utils:attachHandlerForElements on event ",n,e,this,t),!1!==i&&g.preventDefault(e),r(e)})})},attachHandlerByClassName:function(e,t,n,r,i){e=e.getElementsByClassName(t);h.attachHandlerForElements(e,n,r,i)},attachHandlerByQuerySelectorAll:function(e,t,n,r,i){e=e.querySelectorAll(t);h.attachHandlerForElements(e,n,r,i)},timer:t,hashString:function(e){var t=0;if(0!==e.length)for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n);t&=t}return t},getBoundingClientRect:function(e){if(e.getBoundingClientRect)return e.getBoundingClientRect();if(document.createRange&&e.nodeType===Node.TEXT_NODE){var t=document.createRange();if(t.selectNodeContents(e),t.getBoundingClientRect)return t.getBoundingClientRect()}return null},isVisibleOnScreen:function(e){var t=h.getWindowHeight();return h.isVisibleOnScreenForViewHeight(e,t)},isVisibleOnScreenForViewHeight:function(e,t){e=h.getBoundingClientRect(e);return!(!e||0===e.top&&0===e.left&&0===e.width&&0===e.height||e.left<0&&e.right<0||e.bottom<0||0<=e.top-t)},isVisibleAtLeastOneElementOnScreen:function(e){if(e){Array.isArray(e)||(e=[e]);var t,n=h.getWindowHeight();for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(r&&h.isVisibleOnScreenForViewHeight(r,n))return f.info("Utils:isVisibleAtLeastOneElementOnScreen element is visible on screen",r),!0}}return!1},getWindowHeight:function(){return Math.max(Ke.innerHeight,document.documentElement.clientHeight,0)},getWindowYScroll:function(){return Ke.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0},getDocumentHeight:function(){return Math.max(document.body.scrollHeight||0,document.documentElement.scrollHeight||0,document.body.offsetHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0,document.documentElement.clientHeight||0)},getScrollPercentage:function(){return(h.getWindowYScroll()+h.getWindowHeight())/h.getDocumentHeight()*100},debounce:function(r,i,o){var s;return function(){var e=this,t=arguments,n=o&&!s;clearTimeout(s),s=setTimeout(function(){s=null,o||r.apply(e,t)},i),n&&r.apply(e,t)}},escapeHTML:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,function(e){return t[e]})},generateUUID:function(){var i=(new Date).getTime();return Ke.performance&&"function"==typeof Ke.performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){t=i;var t,n,r=(r=Ke.crypto||Ke.msCrypto)&&"function"==typeof r.getRandomValues?(n=new Uint32Array(1),r.getRandomValues(n),(t+n[0])%16|0):(t+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==e?r:3&r|8).toString(16)})},validateUUID:function(e){return RegExp(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).test(e)},validateSelector:function(e){try{h._emptyElement.querySelector(e)}catch(e){return!1}return!0},addEvent:function(t,e,n){return"click"===e?g.addEvent(t,e,function(e){return p.handleClick(t),n(e)}):g.addEvent(t,e,n)},removeEvent:function(e,t,n){return g.removeEvent(e,t,n)},uint8ArrayToBase64Url:function(e,t,n){return t=t||0,n=n||e.byteLength,Ke.btoa(String.fromCharCode.apply(null,e.subarray(t,n))).replace(/\=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},atou:function(e){return decodeURIComponent(escape(Ke.atob(e)))},utoa:function(e){return Ke.btoa(unescape(encodeURIComponent(e)))}},p={_enabled:!1,_events:[],_startTime:null,_groupUuid:null,_intervalId:null,_delayTimeoutId:null,_maxEventCount:25,_logingConditions:[],LEVEL:{fatal:"fatal",error:"error",info:"info",debug:"debug"},TYPE:{general:"general",request:"request",log:"log",click:"click",lost:"lost"},SCOPE:{inner:"inner",outer:"outer"},init:function(e){p._startTime=(e=e||{}).startTime||(new Date).getTime(),p._groupUuid=h.generateUUID(),p._attachWindowErrorListener(),p._logingConditions=[{level:p.LEVEL.fatal,scope:p.SCOPE.inner},{level:p.LEVEL.error,type:p.TYPE.request,scope:p.SCOPE.inner}],o.init()},setEnabled:function(e){p._enabled=e}
1,callFunctionAndLogError:function(e,t,n){var r,i,o;for(o in e.apply(this,t),t)if(t[o]instanceof Error){r=t[o];break}"string"==typeof t[0]&&(i=t[0]),r?(e=p._prepareEventFromError(r,p.TYPE.general,n),i&&(e.msg=i+" "+e.msg),p.handleEvent(e)):p.handleError(new Error(i||"Unknown error dump message"),p.TYPE.general,n)},handleError:function(e,t,n,r){p.handleEvent(p._prepareEventFromError(e,t,n,r))},handleClick:function(e){p.handleEvent(p._prepareEventFromElement(e,p.TYPE.click,p.LEVEL.info,p.SCOPE.inner))},handleEvent:function(e){p._checkAndRichEvent(e),p._pushEvent(e)},handleFetch:function(t,e){var n,r=(new Date).getTime();return e.then(function(e){return n=200===e.status||201===e.status||0===e.status?g.extend(p._prepareEventDataFromRequest(t),{level:p.LEVEL.info,type:p.TYPE.request,msg:"Fetch request succeeded",statusCode:e.status}):g.extend(p._prepareEventDataFromRequest(t),{level:p.LEVEL.error,type:p.TYPE.request,name:"Fetch request fail",msg:e.statusText,stack:(new Error).stack,statusCode:e.status}),e}).catch(function(e){return n=g.extend(p._prepareEventDataFromRequest(t),p._prepareEventFromError(e,p.TYPE.request)),Je.reject(e)}).finally(function(){n.requestDuration=(new Date).getTime()-r,p.handleEvent(n)})},sendEvents:function(){p._sendEventsToSender(),p._attachDelayAndSendFewEventsAfterTriggered()},_sendEventsToSender:function(){var e=[].concat(p._events);p._enabled&&o.sendEvents(e),p._events=[]},_attachDelayAndSendFewEventsAfterTriggered:function(){p._delayTimeoutId&&(clearTimeout(p._delayTimeoutId),p._delayTimeoutId=null),p._delayTimeoutId=setTimeout(function(){p._sendEventsToSender()},15)},_prepareEventFromElement:function(e,t,n,r){var i=e.nodeName||null,e=e.className||null;return{level:n||p.LEVEL.error,type:t||p.TYPE.general,scope:r||p.SCOPE.inner,name:"NodeEvent",msg:'Action on "'+(i||"unknown")+'" node with class name "'+(e||"")+'"',nodeName:"string"==typeof i?i.toLowerCase():null,className:e}},_prepareEventFromError:function(e,t,n,r){var i=e.stack,o=e.toString();return{level:n||p.LEVEL.error,type:t||p.TYPE.general,scope:r||p.SCOPE.inner,name:e.name,msg:o,stack:i}},_prepareEventDataFromRequest:function(e){return{method:e.method,url:e.url,bodyUsed:e.bodyUsed,cache:e.cache,keepalive:e.keepalive}},_pushEvent:function(e){p._applyEventsLimit(),p._events.push(e),p._checkConditionsAndSend(e)},_checkConditionsAndSend:function(e){p._checkConditions(e)&&p.sendEvents()},_checkConditions:function(e){if(e.level!==p.LEVEL.error||e.type!==p.TYPE.request||-1===(e.url||"").indexOf("web-push/get-public-config"))for(var t in p._logingConditions)if(p._logingConditions.hasOwnProperty(t)){t=p._logingConditions[t];if(p._checkCondition(e,t))return!0}return!1},_checkCondition:function(e,t){for(var n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0},_applyEventsLimit:function(){var e;p._events.length>=p._maxEventCount&&((e=p._events.shift()).type===p.TYPE.lost?(p._events.shift(),e.lostCount++,p._events.unshift(e)):(e=p._checkAndRichEvent({level:p.LEVEL.info,type:p.TYPE.lost,name:"LostEventsLimitAchieved",msg:"First lost event message: "+e.msg,lostCount:1}),p._events.splice(0,1,e)))},_attachWindowErrorListener:function(){h.addEvent(Ke,"error",function(e){e.error&&p.handleError(e.error,p.TYPE.general,p.LEVEL.error,p.SCOPE.outer)})},_checkAndRichEvent:function(e){var t;if(e&&e.level&&e.type)return e.clientUuid||(t=d.getClientFromStore())&&(e.clientUuid=t.uuid,e.clientPermUuid=t.permUuid),void 0===e.scrollPercentage&&(e.scrollPercentage=h.getScrollPercentage()),e.time||(t=(new Date).getTime(),e.startTime=p._startTime,e.time=t,e.elapsedTime=t-p._startTime),e.groupUuid||(e.groupUuid=p._groupUuid),e.eventUuid||(e.eventUuid=h.generateUUID()),e.scope||(e.scope=p.SCOPE.inner),e.href||(e.href=Ke.location.href),e.source="sdk-js",e.sdkVersion=m.getVersion(),e.sdkModule=m.getModuleName(),e.sdkBuildTime=m.getBuildTime(),e;throw new Error("Invalid event to handle by error handler")}},o={_logsToSend:[],_eventLost:null,_intervalId:null,_intervalMs:2e3,_timeout:4e3,_localStorageLogsKey:"_snrs_error_logs",_maxLogsCount:100,LEVEL:{fatal:"fatal",error:"error",info:"info",debug:"debug"},TYPE:{general:"general",request:"request",log:"log",click:"click",lost:"lost"},init:function(e){n.init(),o._restoreLogs(),o._attachHandlers(),o._startLogging()},sendEvents:function(e){e=o._applyLogsLimit(e);o._logsToSend=o._logsToSend.concat(e)},_attachHandlers:function(){Ke.onbeforeunload=function(){o._storeLogs()},o._attachLoggingOnMouseExit()},_attachLoggingOnMouseExit:function(){h.addEvent(document,"mouseout",function(e){e.clientY
1<=0&&setTimeout(function(){o.flush()},10)})},_applyLogsLimit:function(e){var t,n,r,i=e;return e.length>o._maxLogsCount?(i=e.slice(e.length-o._maxLogsCount+1),t=e.slice(0,e.length-o._maxLogsCount+1),n=o._logsToSend[0]||t[0],n=p._checkAndRichEvent({level:p.LEVEL.info,type:p.TYPE.lost,name:"LostLogsToSendLimitAchieved",msg:"First lost event message: "+n.msg,lostCount:t.length+o._logsToSend.length}),o._logsToSend=[n]):o._logsToSend.length+e.length>o._maxLogsCount&&((t=o._logsToSend[0]).type===p.TYPE.lost&&"LostLogsToSendLimitAchieved"===t.name?(i=e.slice(e.length-o._maxLogsCount+1),r=o._logsToSend.length+i.length-o._maxLogsCount,o._logsToSend=o._logsToSend.slice(r+1),o._logsToSend.unshift(t),t.lostCount+=r):(n=p._checkAndRichEvent({level:p.LEVEL.info,type:p.TYPE.lost,name:"LostLogsToSendLimitAchieved",msg:"First lost event message: "+t.msg,lostCount:r}),r=o._logsToSend.length+e.length-o._maxLogsCount,o._logsToSend=o._logsToSend.slice(r+1),o._logsToSend.unshift(n))),i},flush:function(){o._logsToSend.length&&l.checkAuth()&&o._requestLogs(function(){})},_requestLogs:function(e){var t=[].concat(o._logsToSend);o._logsToSend=[],o._requestWithLimits(t,e)},_request:function(e,t){var n=T.trackingDomain+T.trackerLogsUrl,r=new XMLHttpRequest;r.open("POST",n,!0),r.withCredentials=!1,r.timeout=o._timeout,r.setRequestHeader(l.getHeaderAuth("key"),l.getHeaderAuth("value")),r.setRequestHeader("Content-type","application/json"),r.ontimeout=function(e){},r.onabort=function(e){},r.onerror=function(e){},r.onreadystatechange=function(){4===r.readyState&&t(r)},r.send(JSON.stringify(e))},_requestWithLimits:function(e,t){n.request(function(){o._request(e,function(e){t(e)})})},_startLogging:function(){o._intervalId=setInterval(function(){o.flush()},o._intervalMs)},_setToLocalStore:function(e){k.setString(o._localStorageLogsKey,JSON.stringify(e))},_getFromLocalStore:function(){var e=k.getString(o._localStorageLogsKey);return e?JSON.parse(e):null},_getAndRemoveFromLocalStore:function(){var e=k.getString(o._localStorageLogsKey);return e?(k.remove(o._localStorageLogsKey),JSON.parse(e)):null},_storeLogs:function(){var e,t=[].concat(o._logsToSend);o._logsToSend=[],t.length&&((e=o._getFromLocalStore())&&e.length,o._setToLocalStore(t))},_restoreLogs:function(){var e=o._getAndRemoveFromLocalStore();e&&e.length&&o.sendEvents(e)}},n={_locked:!1,_lockedTimeEnd:null,_count:0,_countAll:0,_maxCount:10,_maxCountAll:100,_timeMs:1e4,_localStorageLimitAchievedKey:"_snrs_logs_limit_achieved",_lockForTimeMs:18e4,init:function(e){n._startThrottling()},request:function(e){n._checkAndLock()||(n._count++,n._countAll++,e())},_startThrottling:function(){var e=n._checkAndRemoveLockTimeFromStoreIfExpired();e&&n._lock(e),setInterval(function(){n._count=0},n._timeMs)},_checkAndLock:function(){return!!n._locked||(n._maxCount<n._count||n._countAll>n._maxCountAll)&&(n._lockAndStore(),!0)},_lock:function(e){e=e||(new Date).getTime()+n._lockForTimeMs,n._locked=!0,n._lockedTimeEnd=e,n._setUnlockTimer(n._lockedTimeEnd)},_lockAndStore:function(){n._lock(),n._setTimeToLocalStore(n._lockedTimeEnd)},_unlockAndStore:function(){n._locked=!1,n._lockedTimeEnd=null,n._count=0,n._countAll=0,n._checkAndRemoveLockTimeFromStoreIfExpired()},_checkAndRemoveLockTimeFromStoreIfExpired:function(){var e=n._getTimeFromLocalStore();return e&&e-(new Date).getTime()<=0?(k.remove(k._localStorageLimitAchievedKey),null):e},_setUnlockTimer:function(e){e-=(new Date).getTime();0<e?setTimeout(function(){n._unlockAndStore()},e):setTimeout(function(){n._unlockAndStore()},10)},_setTimeToLocalStore:function(e){k.setString(k._localStorageLimitAchievedKey,e+"")},_getTimeFromLocalStore:function(){var e=k.getString(k._localStorageLimitAchievedKey);return!e||(e=parseInt(e,10),isNaN(e))?null:e}},L=h.timer.get(),F={},U=(function(){var O=x,D=x,e=x;function h(){for(var e=0,t={};e<arguments.length;e++){var n,r=arguments[e];for(n in r)t[n]=r[n]}return t}c=this,i=function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function s(e,t,n){t&&o(e.prototype,t),n&&o(e,n)}
1function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){if(!t||"object"!=typeof t&&"function"!=typeof t){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}return t}function l(e){var t=C.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function t(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault)&&e.event.preventDefault():"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function d(e,t){C.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});for(var n,r=Object.keys(t),i=0;i<r.length;++i)(n=r[i])in this||Object.defineProperty(this,n,h(n))}function h(t){return{get:function(){return l(this).event[t]},set:function(e){l(this).event[t]=e},configurable:!0,enumerable:!0}}function p(n,e){function t(e,t){n.call(this,e,t)}var r=Object.keys(e);if(0===r.length)return n;t.prototype=Object.create(n.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(var i,o,s=0;s<r.length;++s)(o=r[s])in n.prototype||(i="function"==typeof Object.getOwnPropertyDescriptor(e,o).value,Object.defineProperty(t.prototype,o,
1(i?t=>({value:function(){var e=l(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}):h)(o)));return t}function f(e,t){return new(function e(t){var n;return null==t||t===Object.prototype?d:(null==(n=S.get(t))&&(n=p(e(Object.getPrototypeOf(t)),t),S.set(t,n)),n)}(Object.getPrototypeOf(t)))(e,t)}function g(e,t){l(e).passiveListener=t}function m(e){return null!==e&&"object"===r(e)}function y(e){e=w.get(e);if(null==e)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}function v(e,t){var i;Object.defineProperty(e,"on".concat(t),(i=t,{get:function(){for(var e=y(this).get(i);null!=e;){if(3===e.listenerType)return e.listener;e=e.next}return null},set:function(e){"function"==typeof e||m(e)||(e=null);for(var t=y(this),n=null,r=t.get(i);null!=r;)3===r.listenerType?null===n?null===r.next?t.delete(i):t.set(i,r.next):n.next=r.next:n=r,r=r.next;null!==e&&(e={listener:e,listenerType:3,passive:!1,once:!1,next:null},null===n?t.set(i,e):n.next=e)},configurable:!0,enumerable:!0}))}function n(e){function t(){b.call(this)}t.prototype=Object.create(b.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(var n=0;n<e.length;++n)v(t.prototype,e[n]);return t}function b(){if(!(this instanceof b)){if(1===arguments.length&&Array.isArray(arguments[0]))return n(arguments[0]);if(0<arguments.length){for(var e=Array(arguments.length),t=0;t<arguments.length;++t)e[t]=arguments[t];return n(e)}throw new TypeError("Cannot call a class as a function")}w.set(this,new Map)}function _(e){var t=k.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got ".concat(null===e?"null":r(e)));return t}var C=new WeakMap,S=new WeakMap,w=(d.prototype={get type(){return l(this).event.type},get target(){return l(this).eventTarget},get currentTarget(){return l(this).currentTarget},composedPath:function(){var e=l(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return l(this).eventPhase},stopPropagation:function(){var e=l(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation:function(){var e=l(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return!!l(this).event.bubbles},get cancelable(){return!!l(this).event.cancelable},preventDefault:function(){t(l(this))},get defaultPrevented(){return l(this).canceled},get composed(){return!!l(this).event.composed},get timeStamp(){return l(this).timeStamp},get srcElement(){return l(this).eventTarget},get cancelBubble(){return l(this).stopped},set cancelBubble(e){e&&((e=l(this)).stopped=!0,"boolean"==typeof e.event.cancelBubble)&&(e.event.cancelBubble=!0)},get returnValue(){return!l(this).canceled},set returnValue(e){e||t(l(this))},initEvent:function(){}},Object.defineProperty(d.prototype,"constructor",{value:d,configurable:!0,writable:!0}),void 0!==Ke&&void 0!==Ke.Event&&(Object.setPrototypeOf(d.prototype,Ke.Event.prototype),S.set(Ke.Event.prototype,d)),new WeakMap),T=(b.prototype={addEventListener:function(e,t,n){if(null!=t){if("function"!=typeof t&&!m(t))throw new TypeError("'listener' should be a function or an object.");var r=y(this),i=m(n),o=(i?!!n.capture:!!n)?1:2,i={listener:t,listenerType:o,passive:i&&!!n.passive,once:i&&!!n.once,next:null},s=r.get(e);if(void 0===s)r.set(e,i);else{for(var a=null;null!=s;){if(s.listener===t&&s.listenerType===o)return;s=(a=s).next}a.next=i}}},removeEventListener:function(e,t,n){if(null!=t)for(var r=y(this),i=(m(n)?!!n.capture:!!n)?1:2,o=null,s=r.get(e);null!=s;){if(s.listener===t&&s.listenerType===i)return void(null===o?null===s.next?r.delete(e):r.set(e,s.next):o.next=s.next);s=(o=s).next}},dispatchEvent:function(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');var t=y(this),n=e.type,r=t.get(n);if(null==r)return!0;for(var i,o=f(this,e),s=null;null!=r;
1){if(r.once?null===s?null===r.next?t.delete(n):t.set(n,r.next):s.next=r.next:s=r,g(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else 3!==r.listenerType&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(l(o).immediateStopped)break;r=r.next}return g(o,null),i=0,l(o).eventPhase=i,i=null,l(o).currentTarget=i,!o.defaultPrevented}},Object.defineProperty(b.prototype,"constructor",{value:b,configurable:!0,writable:!0}),void 0!==Ke&&void 0!==Ke.EventTarget&&Object.setPrototypeOf(b.prototype,Ke.EventTarget.prototype),(()=>{function e(){throw i(this,e),u(this,a(e).call(this)),new TypeError("AbortSignal cannot be constructed directly")}var t=e,n=b;if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");return t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&c(t,n),s(e,[{key:"aborted",get:function(){var e=E.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got ".concat(null===this?"null":r(this)));return e}}]),e})()),E=(v(T.prototype,"abort"),new WeakMap),P=(Object.defineProperties(T.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===r(Symbol.toStringTag)&&Object.defineProperty(T.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"}),s(I,[{key:"abort",value:function(){var e;e=_(this),!1===E.get(e)&&(E.set(e,!0),e.dispatchEvent({type:"abort"}))}},{key:"signal",get:function(){return _(this)}}]),I),k=new WeakMap;function I(){var e;i(this,I),k.set(this,(e=Object.create(T.prototype),b.call(e),E.set(e,!1),e))}Object.defineProperties(P.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===r(Symbol.toStringTag)&&Object.defineProperty(P.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),e.AbortController=P,e.AbortSignal=T,e.default=P,Object.defineProperty(e,"__esModule",{value:!0}),void 0===D&&void 0===O&&void 0===(e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==Ke?Ke:"undefined"!=typeof global?global:x).AbortController&&(e.AbortController=P,e.AbortSignal=T)},"object"==typeof e&&void 0!==D?i(e):"function"==typeof O&&O.amd?O(["exports"],i):i((c=c||self).AbortControllerShim={}),i=this,c=function(){function r(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function i(e){return e="string"!=typeof e?String(e):e}function s(t){this.map={},t instanceof s?t.forEach(function(e,t){this.append(t,e)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function n(e){if(e.bodyUsed)return Je.reject(new TypeError("Already read"));e.bodyUsed=!0}function o(n){return new Je(function(e,t){n.onload=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function e(e){var t=new FileReader;return t.readAsArrayBuffer(e),o(t)}s.prototype.append=function(e,t){e=r(e),t=i(t);var n=this.map[e];n||(this.map[e]=n=[]),n.push(t)},s.prototype.delete=function(e){delete this.map[r(e)]},s.prototype.get=function(e){e=this.map[r(e)];return e?e[0]:null},s.prototype.getAll=function(e){return this.map[r(e)]||[]},s.prototype.has=function(e){return this.map.hasOwnProperty(r(e))},s.prototype.set=function(e,t){this.map[r(e)]=[i(t)]},s.prototype.forEach=function(n,r){Object.getOwnPropertyNames(this.map).forEach(function(t){this.map[t].forEach(function(e){n.call(r,e,t,this)},this)},this)};var a={blob:"FileReader"in self&&"Blob"in self&&(()=>{try{return new Blob,!0}catch(e){return!1}})(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};function t(){return this.bodyUsed=!1,this._initBody=function(e){if("string"==typeof(this._bodyInit=e))this._bodyText=e;else if(a.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(a.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!a.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText=""},a.blob?(this.blob=function(){var e=n(this);if(e)return e;if(this._bodyBlob)return Je.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Je.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(e)},this.text=function(){var e,t=n(this);if(t)return t;if(this._bodyBlob)return t=this._bodyBlob,(e=new FileReader).readAsText(t),o(e);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Je.resolve(this._bodyText)}):this.text=function(){var e=n(this);return e||Je.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(l)}),this.json=function(){return this.text().then(JSON.parse)},this}
1var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function u(e,t){var n,r=(t=t||{}).body;if(u.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new s(e.headers)),this.method=e.method,this.mode=e.mode,r||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new s(t.headers)),this.method=(e=t.method||this.method||"GET",n=e.toUpperCase(),-1<c.indexOf(n)?n:e),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function l(e){var n=new FormData;return e.trim().split("&").forEach(function(e){var t;e&&(t=(e=e.split("=")).shift().replace(/\+/g," "),e=e.join("=").replace(/\+/g," "),n.append(decodeURIComponent(t),decodeURIComponent(e)))}),n}function d(e,t){t=t||{},this._initBody(e),this.type="default",this.status=t.status,this.ok=200<=this.status&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof s?t.headers:new s(t.headers),this.url=t.url||""}u.prototype.clone=function(){return new u(this)},t.call(u.prototype),t.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},d.error=function(){var e=new d(null,{status:0,statusText:""});return e.type="error",e};var h=[301,302,303,307,308];return d.redirect=function(e,t){if(-1===h.indexOf(t))throw new RangeError("Invalid status code");return new d(null,{status:t,headers:{location:e}})},{fetch:Xe=function(t,n){return new Je(function(r,i){var e=u.prototype.isPrototypeOf(t)&&!n?t:new u(t,n),o=new XMLHttpRequest;o.onload=function(){var n,e,t=1223===o.status?204:o.status;t<100||599<t?i(new TypeError("Network request failed")):(t={status:t,statusText:o.statusText,headers:(t=o,n=new s,t.getAllResponseHeaders().trim().split("\n").forEach(function(e){var e=e.trim().split(":"),t=e.shift().trim(),e=e.join(":").trim();n.append(t,e)}),n),url:"responseURL"in o?o.responseURL:/^X-Request-URL:/m.test(o.getAllResponseHeaders())?o.getResponseHeader("X-Request-URL"):void 0},e="response"in o?o.response:o.responseText,r(new d(e,t)))},o.onerror=function(){i(new TypeError("Network request failed"))},o.open(e.method,e.url,!0),"include"===e.credentials&&(o.withCredentials=!0),"responseType"in o&&a.blob&&(o.responseType="blob"),e.headers.forEach(function(e,t){o.setRequestHeader(t,e)}),o.send(void 0===e._bodyInit?null:e._bodyInit)})},Request:u,Headers:s}},"object"==typeof e&&void 0!==D?D.exports=c():"function"==typeof O&&O.amd?O(c):i.ES6Fetch=c(),i=this,c=function(){var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)},i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function e(r,i){var o,s,a,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,s&&(a=2&t[0]?s.return:t[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,t[1])).done)return a;switch(s=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,s=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3]))c.label=t[1];else if(6===t[0]&&c.label<a[1])c.label=a[1],a=t;else{if(!(a&&c.label<a[2])){a[2]&&c.ops.pop(),c.trys.pop();continue}c.label=a[2],c.ops.push(t)}}t=i.call(r,c)}catch(e){t=[6,e],s=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function p(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}}}function f(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=f(e[n],t[n]));return e}t.prototype.wrapCallback=function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}};var o=t;function t(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Je(function(e,t){n.resolve=e,n.reject=t})}s=Error,n(r=c,I=s),r.prototype=null===I?Object.create(I):(a.prototype=I.prototype,new a);var r,s,l=c;function a(){this.constructor=r}
1function c(e,t){t=s.call(this,t)||this;return t.code=e,t.name="FirebaseError",Object.setPrototypeOf(t,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,g.prototype.create),t}u.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r,i=t[0]||{},o=this.service+"/"+e,e=this.errors[e],e=e?(r=i,e.replace(d,function(e,t){var n=r[t];return null!=n?n.toString():"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+o+").",s=new l(o,e),a=0,c=Object.keys(i);a<c.length;a++){var u=c[a];"_"!==u.slice(-1)&&(u in s&&console.warn('Overwriting FirebaseError base field "'+u+'" can cause unexpected behavior.'),s[u]=i[u])}return s};var g=u;function u(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var d=/\{\$([^}]+)}/g;function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function y(e,t){e=new h(e,t);return e.subscribe.bind(e)}v.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},v.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},v.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},v.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=(e=>{if("object"==typeof e&&null!==e)for(var t=0,n=["next","error","complete"];t<n.length;t++){var r=n[t];if(r in e&&"function"==typeof e[r])return 1}})(e)?e:{next:e,error:t,complete:n}).next&&(r.next=b),void 0===r.error&&(r.error=b),void 0===r.complete&&(r.complete=b);e=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),e},v.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount)&&void 0!==this.onNoObservers&&this.onNoObservers(this)},v.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},v.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},v.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))};var h=v;function v(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Je.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}function b(){}C.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},C.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},C.prototype.setServiceProps=function(e){return this.serviceProps=e,this};var _=C;function C(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var S="[DEFAULT]",w=(T.prototype.get=function(e){var t=this.normalizeInstanceIdentifier(e=void 0===e?S:e);if(!this.instancesDeferred.has(t)){var n=new o;this.instancesDeferred.set(t,n);try{var r=this.getOrInitializeService(t);r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise},T.prototype.getImmediate=function(e){var t=i({identifier:S,optional:!1},e),n=t.identifier,t=t.optional,n=this.normalizeInstanceIdentifier(n);try{var r=this.getOrInitializeService(n);if(r)return r;if(t)return null;throw Error("Service "+this.name+" is not available")}catch(e){if(t)return null;throw e}},T.prototype.setComponent=function(e){var t,n;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if("EAGER"===(this.component=e).instantiationMode)try{this.getOrInitializeService(S)}catch(e){}try{for(var r=p(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=((e,t)=>{var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;
1(void 0===t||0<t--)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s})(i.value,2),s=o[0],a=o[1],c=this.normalizeInstanceIdentifier(s);try{var u=this.getOrInitializeService(c);a.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},T.prototype.clearInstance=function(e){this.instancesDeferred.delete(e=void 0===e?S:e),this.instances.delete(e)},T.prototype.delete=function(){return o=this,s=void 0,a=function(){var t;return e(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Je.all(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))];case 1:return e.sent(),[2]}})},new(s=Je)(function(e,t){function n(e){try{i(a.next(e))}catch(e){t(e)}}function r(e){try{i(a.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}i((a=a.apply(o,[])).next())});var o,s,a},T.prototype.isComponentSet=function(){return null!=this.component},T.prototype.getOrInitializeService=function(e){var t=this.instances.get(e);return!t&&this.component&&(t=this.component.instanceFactory(this.container,e===S?void 0:e),this.instances.set(e,t)),t||null},T.prototype.normalizeInstanceIdentifier=function(e){return!this.component||this.component.multipleInstances?e:S},T);function T(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}P.prototype.addComponent=function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component "+e.name+" has already been registered with "+this.name);t.setComponent(e)},P.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},P.prototype.getProvider=function(e){var t;return this.providers.has(e)?this.providers.get(e):(t=new w(e,this),this.providers.set(e,t),t)},P.prototype.getProviders=function(){return Array.from(this.providers.values())};var E,F=P;function P(e){this.name=e,this.providers=new Map}function k(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function U(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString();switch(t){case E.DEBUG:case E.VERBOSE:console.log.apply(console,k(["["+i+"]  "+e.name+":"],n));break;case E.INFO:console.info.apply(console,k(["["+i+"]  "+e.name+":"],n));break;case E.WARN:console.warn.apply(console,k(["["+i+"]  "+e.name+":"],n));break;case E.ERROR:console.error.apply(console,k(["["+i+"]  "+e.name+":"],n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+t+")")}}}(I=E=E||{})[I.DEBUG=0]="DEBUG",I[I.VERBOSE=1]="VERBOSE",I[I.INFO=2]="INFO",I[I.WARN=3]="WARN",I[I.ERROR=4]="ERROR",I[I.SILENT=5]="SILENT";var W=E.INFO,I=(Object.defineProperty(O.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in E))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!0,configurable:!0}),O.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,k([this,E.DEBUG],e))},O.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,k([this,E.VERBOSE],e))},O.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,k([this,E.INFO],e))},O.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,k([this,E.WARN],e))},O.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,k([this,E.ERROR],e))},O);function O(e){this.name=e,this._logLevel=W,this._logHandler=U}var D=new g("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists","app-deleted":"Firebase App named '{$appName}
1' already deleted","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."}),A="[DEFAULT]",N=new I("@firebase/app"),R=(Object.defineProperty(M.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),M.prototype.delete=function(){var t=this;return new Je(function(e){t.checkDestroyed_(),e()}).then(function(){return t.firebase_.INTERNAL.removeApp(t.name_),Je.all(t.container.getProviders().map(function(e){return e.delete()}))}).then(function(){t.isDeleted_=!0})},M.prototype._getService=function(e,t){return void 0===t&&(t=A),this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})},M.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=A),this.container.getProvider(e).clearInstance(t)},M.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){N.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},M.prototype._addOrOverwriteComponent=function(e){this.container.addOrOverwriteComponent(e)},M.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw D.create("app-deleted",{appName:this.name_})},M);function M(e,t,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=f(void 0,e),this.container=new F(t.name),this._addComponent(new _("app",function(){return o},"PUBLIC"));try{for(var s=p(this.firebase_.INTERNAL.components.values()),a=s.next();!a.done;a=s.next()){var c=a.value;this._addComponent(c)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}R.prototype.name&&R.prototype.options||R.prototype.delete||console.log("dc");var x="7.5.2";var L,I=function e(){c=R,u={},l=new Map,(d={__esModule:!0,initializeApp:function(e,t){var t=t="object"==typeof(t=void 0===t?{}:t)&&null!==t?t:{name:t},n=(void 0===t.name&&(t.name=A),t.name);if("string"!=typeof n||!n)throw D.create("bad-app-name",{appName:String(n)});if(m(u,n))throw D.create("duplicate-app",{appName:n});e=new c(e,t,d);return u[n]=e},app:h,apps:null,SDK_VERSION:x,INTERNAL:{registerComponent:function(n){var e,t,r,i=n.name;if(l.has(i))N.debug("There were multiple attempts to register component "+i+".");else{l.set(i,n),"PUBLIC"===n.type&&(r=function(e){if("function"!=typeof(e=void 0===e?h():e)[i])throw D.create("invalid-app-argument",{appName:i});return e[i]()},void 0!==n.serviceProps&&f(r,n.serviceProps),d[i]=r,c.prototype[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,i).apply(this,n.multipleInstances?e:[])});try{for(var o=p(Object.keys(u)),s=o.next();!s.done;s=o.next()){var a=s.value;u[a]._addComponent(n)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}return"PUBLIC"===n.type?d[i]:null},removeApp:function(e){delete u[e]},components:l,useAsService:function(e,t){return"serverAuth"!==t?t:null}}}).default=d,Object.defineProperty(d,"apps",{get:function(){return Object.keys(u).map(function(e){return u[e]})}}),h.App=c;var c,u,l,d,t=d;function h(e){if(m(u,e=e||A))return u[e];throw D.create("no-app",{appName:e})}return t.INTERNAL=i(i({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){f(t,e)},createSubscribe:y,ErrorFactory:g,deepExtend:f}),t}(),B=("object"==typeof self&&self.self===self&&void 0!==self.firebase&&(N.warn("\n    Warning: Firebase is already defined in the global scope. Please make sure\n    Firebase library is only loaded once.\n  "),L=self.firebase.SDK_VERSION)&&0<=L.indexOf("LITE")&&N.warn("\n    Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n    You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n    "),I.initializeApp);return I.initializeApp=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(()=>{try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){}})()&&N.warn('\n      Warning: This is a browser-targeted Firebase bundle but it appears it is being\n      run in a Node environment.  If running in a Node environment, make sure you\n      are using the bundle specified by the "main" field in package.json.\n      \n      If you are using Webpack, you can specify "main" as the first item in\n      "resolve.mainFields":\n      https://webpack.js.org/configuration/resolve/#resolvemainfields\n      \n      If using Rollup, use the rollup-plugin-node-resolve plugin and specify "main"\n      as the first item in "mainFields", e.g. [\'main\', \'module\'].\n      https://github.com/rollup/rollup-plugin-node-resolve\n      '),B.apply(void 0,e)},I},"object"==typeof e&&void 0!==D?D.exports=c():"function"==typeof O&&O.amd?O(c):(i=i||self).firebase=c(),i=this,c=function(Ye){try{!function(){Ye=Ye&&Ye.hasOwnProperty("default")?Ye.default:Ye;
1var 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)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)};function e(e,t){function n(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function u(o,s,a,c){return new(a=a||Je)(function(e,t){function n(e){try{i(c.next(e))}catch(e){t(e)}}function r(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,r)}i((c=c.apply(o,s||[])).next())})}function l(r,i){var o,s,a,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,s&&(a=2&t[0]?s.return:t[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,t[1])).done)return a;switch(s=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,s=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3]))c.label=t[1];else if(6===t[0]&&c.label<a[1])c.label=a[1],a=t;else{if(!(a&&c.label<a[2])){a[2]&&c.ops.pop(),c.trys.pop();continue}c.label=a[2],c.ops.push(t)}}t=i.call(r,c)}catch(e){t=[6,e],s=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function U(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(((e,t)=>{var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;
1(void 0===t||0<t--)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s})(arguments[t]));return e}e(n,W=Error);var W,x=n;function n(e,t){t=W.call(this,t)||this;return t.code=e,t.name="FirebaseError",Object.setPrototypeOf(t,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,r.prototype.create),t}B.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r,i=t[0]||{},o=this.service+"/"+e,e=this.errors[e],e=e?(r=i,e.replace(H,function(e,t){var n=r[t];return null!=n?n.toString():"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+o+").",s=new x(o,e),a=0,c=Object.keys(i);a<c.length;a++){var u=c[a];"_"!==u.slice(-1)&&(u in s&&console.warn('Overwriting FirebaseError base field "'+u+'" can cause unexpected behavior.'),s[u]=i[u])}return s};var r=B;function B(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var H=/\{\$([^}]+)}/g;function j(e,t){e=new V(e,t);return e.subscribe.bind(e)}t.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},t.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},t.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},t.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=(e=>{if("object"==typeof e&&null!==e)for(var t=0,n=["next","error","complete"];t<n.length;t++){var r=n[t];if(r in e&&"function"==typeof e[r])return 1}})(e)?e:{next:e,error:t,complete:n}).next&&(r.next=o),void 0===r.error&&(r.error=o),void 0===r.complete&&(r.complete=o);e=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),e},t.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount)&&void 0!==this.onNoObservers&&this.onNoObservers(this)},t.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},t.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},t.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))};var V=t;function t(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Je.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}function o(){}function q(n){return new Je(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function i(n,r,i){var o,e=new Je(function(e,t){q(o=n[r].apply(n,i)).then(e,t)});return e.request=o,e}function s(e,n,t){t.forEach(function(t){Object.defineProperty(e.prototype,t,{get:function(){return this[n][t]},set:function(e){this[n][t]=e}})})}function c(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return i(this[n],e,arguments)})})}function d(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return this[n][e].apply(this[n],arguments)})})}function G(e,r,t,n){n.forEach(function(n){n in t.prototype&&(e.prototype[n]=function(){return e=this[r],(t=i(e,n,arguments)).then(function(e){if(e)return new p(e,t.request)});var e,t})})}function h(e){this._index=e}function p(e,t){this._cursor=e,this._request=t}function f(e){this._store=e}function g(n){this._tx=n,this.complete=new Je(function(e,t){n.oncomplete=function(){e()},n.onerror=function(){t(n.error)},n.onabort=function(){t(n.error)}})}function m(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new g(n)}function y(e){this._db=e}s(h,"_index",["name","keyPath","multiEntry","unique"]),c(h,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),G(h,"_index",IDBIndex,["openCursor","o
1penKeyCursor"]),s(p,"_cursor",["direction","key","primaryKey","value"]),c(p,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(p.prototype[n]=function(){var t=this,e=arguments;return Je.resolve().then(function(){return t._cursor[n].apply(t._cursor,e),q(t._request).then(function(e){if(e)return new p(e,t._request)})})})}),f.prototype.createIndex=function(){return new h(this._store.createIndex.apply(this._store,arguments))},f.prototype.index=function(){return new h(this._store.index.apply(this._store,arguments))},s(f,"_store",["name","keyPath","indexNames","autoIncrement"]),c(f,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),G(f,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),d(f,"_store",IDBObjectStore,["deleteIndex"]),g.prototype.objectStore=function(){return new f(this._tx.objectStore.apply(this._tx,arguments))},s(g,"_tx",["objectStoreNames","mode"]),d(g,"_tx",IDBTransaction,["abort"]),m.prototype.createObjectStore=function(){return new f(this._db.createObjectStore.apply(this._db,arguments))},s(m,"_db",["name","version","objectStoreNames"]),d(m,"_db",IDBDatabase,["deleteObjectStore","close"]),y.prototype.transaction=function(){return new g(this._db.transaction.apply(this._db,arguments))},s(y,"_db",["name","version","objectStoreNames"]),d(y,"_db",IDBDatabase,["close"]),["openCursor","o
1penKeyCursor"].forEach(function(i){[f,h].forEach(function(e){i in e.prototype&&(e.prototype[i.replace("open","iterate")]=function(){e=arguments;var e=Array.prototype.slice.call(e),t=e[e.length-1],n=this._store||this._index,r=n[i].apply(n,e.slice(0,-1));r.onsuccess=function(){t(r.result)}})})}),[h,f].forEach(function(e){e.prototype.getAll||(e.prototype.getAll=function(e,n){var r=this,i=[];return new Je(function(t){r.iterateCursor(e,function(e){e&&(i.push(e.value),void 0===n||i.length!=n)?e.continue():t(i)})})})});v.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},v.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},v.prototype.setServiceProps=function(e){return this.serviceProps=e,this};var Y=v;function v(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var K=1e4,J="w:0.3.7",z="FIS_v2",X="https://firebaseinstallations.googleapis.com/v1",$=36e5,b={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},_=new r("installations","Installations",b);function Q(e){return e instanceof x&&e.code.includes("request-failed")}function C(e){var t,n,r,i,o;if(!e||!e.options)throw Z("App Configuration");if(!e.name)throw Z("App Name");try{r=["projectId","apiKey","appId"],i="function"==typeof Symbol&&r[Symbol.iterator],o=0;for(var s=i?i.call(r):{next:function(){return{value:(r=r&&o>=r.length?void 0:r)&&r[o++],done:!r}}},a=s.next();!a.done;a=s.next()){var c=a.value;if(!e.options[c])throw Z(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}function Z(e){return _.create("missing-app-config-values",{valueName:e})}function ee(e){e=e.projectId;return X+"/projects/"+e+"/installations"}function te(e){return{token:e.token,requestStatus:2,expiresIn:Number(e.expiresIn.replace("s","000")),creationTime:Date.now()}}function ne(n,r){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,r.json()];case 1:return t=e.sent(),t=t.error,[2,_.create("request-failed",{requestName:n,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function re(e){e=e.apiKey;return new ze({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function ie(e,t){t=t.refreshToken,e=re(e);return e.append("Authorization",z+" "+t),e}function oe(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function se(t){return new Je(function(e){setTimeout(e,t)})}var ae=/^[cdef][\w-]{21}$/,ce="";var S,ue="firebase-installations-database",le=1,w="firebase-installations-store",de=null;function he(){return de=de||(t=function(e){0===e.oldVersion&&e.createObjectStore(w)},e=i(indexedDB,"open",[ue,le]),(n=e.request)&&(n.onupgradeneeded=function(e){t(new m(n.result,e.oldVersion,n.transaction))}),e.then(function(e){return new y(e)}));var t,e,n}function T(r,i){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return t=fe(r),[4,he()];case 1:return n=e.sent(),[4,(n=n.transaction(w,"readwrite")).objectStore(w).put(i,t)];case 2:return e.sent(),[4,n.complete];case 3:return e.sent(),[2,i]}})})}function pe(r){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return t=fe(r),[4,he()];case 1:return n=e.sent(),[4,(n=n.transaction(w,"readwrite")).objectStore(w).delete(t)];case 2:return e.sent(),[4,n.complete];case 3:return e.sent(),[2]}})})}function E(o,s){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return t=fe(o),[4,he()];case 1:return n=e.sent(),n=n.transaction(w,"readwrite"),[4,(r=n.objectStore(w)).get(t)];case 2:return i=e.sent(),void 0!==(i=s(i))?[3,4]:[4,r.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,r.put(i,t)];case 5:e.sent(),e.label=6;case 6:return[4,n.complete];case 7:return e.sent(),[2,i]}})})}function fe(e){return e.appName+"!"+e.appId}function ge(i){return u(this,void 0,void 0,function(){var r,t,n;return l(this,function(e){switch(e.label){case 0:return[4,E(i,function(e){var t,e=ye(e||{fid:(()=>{try{var e=new Uint8Array(17),t=((self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16,n=e,btoa(String.fromCharCode.apply(String,U(n))).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22));return ae.test(t)?t:ce}catch(e){return ce}var n})(),registrationStatus:0}),n=(n=i,0!==(e=e).registrationStatus?1===e.registrationStatus?{installationEntry:e,registrationPromise:function(i){return u(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return[4,me(i)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,se(100)];case 3:return e.sent(),[4,me(i)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,ge(i)];case 6:return r=e.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,t]}})})}(n)}:{installationEntry:e}:navigator.onLine?{installationEntry:t={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},registrationPromise:function(r,i){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(s){var a=i.fid;return u(this,void 0,void 0,function(){var t,n,r,i,o;return l(this,function(e){switch(e.label){case 0:return t=ee(s),o=re(s),n={fid:a,authVersion:z,appId:s.appId,sdkVersion:J},r={method:"POST",headers:o,body:JSON.stringify(n)},[4,oe(function(){return Xe(t,r)})];case 1:return(i=e.sent()).ok?[4,i.json()]:[3,3];case 2:return[2,{fid:(o=e.sent()).fid||a,registrationStatus:2,refreshToken:o.refreshToken,authToken:te(o.authToken)}];case 3:return[4,ne("Create Installation",i)];case 4:throw e.sent()}})})}(r)];case 1:return t=e.sent(),[2,T(r,t)];case 2:return Q(n=e.sent())&&409===n.serverCode?[4,pe(r)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,T(r,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(n,t)}:{installationEntry:e,registrationPromise:Je.reject(_.create("app-offline"))});return r=n.registrationPromise,n.installationEntry})];case 1:return(t=e.sent()).fid!==ce?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function me(e){return E(e,function(e){if(e)return ye(e);throw _.create("installation-not-found")})}function ye(e){return 1===e.registrationStatus&&e.registrationTime+K<Date.now()?{fid:e.fid,registrationStatus:0}:e}function ve(a,c){return u(this,void 0,void 0,function(){var n,r,i,o,s;return l(this,function(e){switch(e.label){case 0:return t=c.fid,n=ee(a)+"/"+t+"/authTokens:generate",r=ie(a,c),i={installation:{sdkVersion:J}},o={method:"POST",headers:r,body:JSON.stringify(i)},[4,oe(function(){return Xe(n,o)})];case 1:return(s=e.sent()).ok?[4,s.json()]:[3,3];case 2:return[2,te(e.sent())];case 3:return[4,ne("Generate Auth Token",s)];case 4:throw e.sent()}var t})})}function be(o,s){return void 0===s&&(s=!1),u(this,void 0,void 0,function(){var i,t,n;return l(this,function(e){switch(e.label){case 0:return[4,E(o,function(e){if(!Ce(e))throw _.create("not-registered");var t,n,r=e.authToken;if(!(s||2!==r.requestStatus||(t=r,(n=Date.now())<t.creationTime)||t.creationTime+t.expires
1In<n+$))return e;if(1===r.requestStatus)return i=function(r,i){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,_e(r)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,se(100)];case 3:return e.sent(),[4,_e(r)];case 4:return t=e.sent(),[3,2];case 5:return 0===(n=t.authToken).requestStatus?[2,be(r,i)]:[2,n]}})})}(o,s),e;if(navigator.onLine)return t=e,n={requestStatus:1,requestTime:Date.now()},r=a(a({},t),{authToken:n}),i=function(i,o){return u(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,ve(i,o)];case 1:return t=e.sent(),r=a(a({},o),{authToken:t}),[4,T(i,r)];case 2:return e.sent(),[2,t];case 3:return!Q(n=e.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,pe(i)];case 4:return e.sent(),[3,7];case 5:return r=a(a({},o),{authToken:{requestStatus:0}}),[4,T(i,r)];case 6:e.sent(),e.label=7;case 7:throw n;case 8:return[2]}})})}(o,r),r;throw _.create("app-offline")})];case 1:return t=e.sent(),i?[4,i]:[3,3];case 2:return n=e.sent(),[3,4];case 3:n=t.authToken,e.label=4;case 4:return[2,n]}})})}function _e(e){return E(e,function(e){if(Ce(e))return 1===(t=e.authToken).requestStatus&&t.requestTime+K<Date.now()?a(a({},e),{authToken:{requestStatus:0}}):e;throw _.create("not-registered");var t})}function Ce(e){return void 0!==e&&2===e.registrationStatus}function Se(o,s){return u(this,void 0,void 0,function(){var n,r,i;return l(this,function(e){switch(e.label){case 0:return t=s.fid,n=ee(o)+"/"+t,i=ie(o,s),r={method:"DELETE",headers:i},[4,oe(function(){return Xe(n,r)})];case 1:return(i=e.sent()).ok?[3,3]:[4,ne("Delete Installation",i)];case 2:throw e.sent();case 3:return[2]}var t})})}Ye.INTERNAL.registerComponent(new Y("installations",function(e){var t=e.getProvider("app").getImmediate();return C(t),{app:t,getId:function(){return function(i){return u(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return[4,ge(t=C(i))];case 1:return n=e.sent(),r=n.installationEntry,(n.registrationPromise||be(t)).catch(console.error),[2,r.fid]}})})}(t)},getToken:function(e){return function(n,r){return void 0===r&&(r=!1),u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,ge(n)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t=C(n))];case 1:return e.sent(),[4,be(t,r)];case 2:return[2,e.sent().token]}})})}(t,e)},delete:function(){return function(r){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,E(t=C(r),function(e){if(!e||0!==e.registrationStatus)return e})];case 1:if(!(n=e.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw _.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw _.create("app-offline");case 3:return[4,Se(t,n)];case 4:return e.sent(),[4,pe(t)];case 5:e.sent(),e.label=6;case 6:return[2]}})})}(t)}}},"PUBLIC"));var P=new r("messaging","Messaging",{"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","should-be-overriden":"This method should be overriden by extended classes.","bad-sender-id":"Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().","permission-default":"The required permissions were not granted and dismissed instead.","permission-blocked":"The required permissions were not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the firebase SDK.","notifications-blocked":"Notifications have been blocked.","failed-serviceworker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","sw-registration-expected":"A service worker registration was the expected input.","get-sub
1scription-failed":"There was an error when trying to get any existing Push Subscriptions.","invalid-saved-token":"Unable to access details of the saved token.","sw-reg-redundant":"The service worker being used for push was made redundant.","token-subscribe-failed":"A problem occured while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occured while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occured while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-before-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-delete-token":"You must pass a valid token into deleteToken(), i.e. the token from getToken().","delete-token-not-found":"The deletion attempt for token could not be performed as the token was not found.","delete-scope-not-found":"The deletion attempt for service worker scope could not be performed as the scope was not found.","bg-handler-function-expected":"The input to setBackgroundMessageHandler() must be a function.","no-window-client-to-msg":"An attempt was made to message a non-existant window client.","unable-to-resubscribe":"There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$errorInfo}","no-fcm-token-for-resubscribe":"Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.","failed-to-delete-token":"Unable to delete the currently saved token.","no-sw-in-reg":"Even though the service worker registration was successful, there was a problem accessing the service worker itself.","bad-scope":"The service worker scope must be a string with at least one character.","bad-vapid-key":"The public VAPID key is not a Uint8Array with 65 bytes.","bad-subscription":"The subscription must be a valid PushSubscription.","bad-token":"The FCM Token used for storage / lookup was not a valid token string.","failed-delete-vapid-key":"The VAPID key could not be deleted.","invalid-public-vapid-key":"The public VAPID key must be a string.","use-public-key-before-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.","public-vapid-key-decryption-failed":"The public VAPID key did not equal 65 bytes when decrypted."}),we=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),Te="google.c.a.c_id";function k(e,t){if(null==e||null==t)return!1;if(e!==t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e),r=new DataView(t),i=0;i<e.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1}return!0}function Ee(e){return e=new Uint8Array(e),btoa(String.fromCharCode.apply(String,U(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}S={PUSH_MSG_RECEIVED:"push-msg-received",NOTIFICATION_CLICKED:"notification-clicked"};I.prototype.getToken=function(o,s,a){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return[4,Ie(o)];case 1:t=e.sent(),r=Oe(s,a),t={method:"POST",headers:t,body:JSON.stringify(r)},e.label=2;case 2:return e.trys.push([2,5,,6]),[4,Xe(ke(o.app),t)];case 3:return[4,e.sent().json()];case 4:return n=e.sent(),[3,6];case 5:throw r=e.sent(),P.create("token-subscribe-failed",{errorInfo:r});case 6:if(n.error)throw i=n.error.message,P.create("token-subscribe-failed",{errorInfo:i});if(n.token)return[2,n.token];throw P.create("token-subscribe-no-token")}})})},I.prototype.updateToken=function(o,s,a,c){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return[4,Ie(s)];case 1:t=e.sent(),r=Oe(a,c),t={method:"PATCH",headers:t,body:JSON.stringify(r)},e.label=2;case 2:return e.trys.push([2,5,,6]),[4,Xe(ke(s.app)+"/"+o.fcmToken,t)];case 3:return[4,e.sent().json()];case 4:return n=e.sent(),[3,6];case 5:throw r=e.sent(),P.create("token-update-failed",{errorInfo:r});case 6:if(n.error)throw i=n.error.message,P.create("token-update-failed",{errorInfo:i});if(n.token)return[2,n.token];throw P.create("token-update-no-token")}})})},I.prototype.deleteToken=function(r,i){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,Ie(r)];case 1:t=e.sent(),t={method:"DELETE",headers:t},e.label=2;case 2:return e.trys.push([2,5,,6]),[4,Xe(ke(r.app)+"/"+i.fcmToken,t)];case 3:return[4,e.sent().json()];case 4:if((n=e.sent()).error)throw n=n.error.message,P.create("token-unsubscribe-failed",{errorInfo:n});return[3,6];case 5:throw n=e.sent(),P.create("token-unsubscribe-failed",{errorInfo:n});case 6:return[2]}})})};var Pe=I;function I(){}function ke(e){return"https://fcmregistrations.googleapis.com/v1/projects/"+e.options.projectId+"/registrations"}function Ie(e){var n=e.app,r=e.installations;return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,r.getToken()];case 1:return t=e.sent(),[2,new ze({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.options.apiKey,"x-goog-firebase-installations-auth":"FIS "+t})]}})})}function Oe(e,t){var n=Ee(e.getKey("p256dh")),r=Ee(e.getKey("auth")),e={web:{endpoint:e.endpoint,p256dh:n,auth:r}};return k(t.buffer,we.buffer)||(e.web.applicationPubKey=Ee(t)),e}function O(e){for(var e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t=atob(e),n=new Uint8Array(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}var De="undefined",Ae="fcm_token_object_Store";function Ne(s){var a=indexedDB.open(De);a.onerror=function(e){},a.onsuccess=function(e){var n,r,t,i,o;n=a.result,r=s,n.objectStoreNames.contains(Ae)&&(t=n.transaction(Ae).objectStore(Ae),i=new Pe,(o=t.openCursor()).onerror=function(e){console.warn("Unable to cleanup old IDB.",e)},o.onsuccess=function(){var e,t=o.result;t?(e=t.value,i.deleteToken(r,e),t.continue()):(n.close(),indexedDB.deleteDatabase(De))})}}D.prototype.get=function(t){return this.createTransaction(function(e){return e.get(t)})},D.prototype.getIndex=function(t,n){return this.createTransaction(function(e){return e.index(t).get(n)})},D.prototype.put=function(t){return this.createTransaction(function(e){return e.put(t)},"readwrite")},D.prototype.delete=function(t){return this.createTransaction(function(e){return e.delete(t)},"readwrite")},D.prototype.closeDatabase=function(){return u(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:e.sent().close(),this.dbPromise=null,e.label=2;case 2:return[2]}})})},D.prototype.createTransaction=function(o,s){return void 0===s&&(s="readonly"),u(this,void 0,void 0,function(){var r,t,i;return l(this,function(e){switch(e.label){case 0:return[4,this.getDb()];case 1:return t=e.sent(),r=t.transaction(this.objectStoreName,s),t=r.objectStore(this.objectStoreName),[4,(n=o(t),new Je(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}}))];case 2:return i=e.sent(),[2,new Je(function(e,t){r.oncomplete=function(){e(i)},r.onerror=function(){t(r.error)}})]}var n})})},D.prototype.getDb=function(){var r=this;return this.dbPromise||(this.dbPromise=new Je(function(e,t){var n=indexedDB.open(r.dbName,r.dbVersion);n.onsuccess=function(){e(n.result)},n.onerror=function(){r.dbPromise=null,t(n.error)},n.onupgradeneeded=function(e){return r.onDbUpgrade(n,e)}})),this.dbPromise};b=D;function D(){this.dbPromise=null}e(A,Re=b),A.prototype.onDbUpgrade=function(e,t){var n=e.result;switch(t.oldVersion){case 0:(i=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1}),i.createIndex("fcmToken","fcmToken",{unique:!0});case 1:Ne(this.services);case 2:var r=(i=e.transaction.objectStore(this.objectStoreName)).openCursor();r.onsuccess=function(){var e,t,n=r.result;n&&(e=n.value,t=a({},e),e.createTime||(t.createTime=Date.now()),"string"==typeof e.vapidKey&&(t.vapidKey=O(e.vapidKey)),"string"==typeof e.auth&&(t.auth=O(e.auth).buffer),"string"==typeof e.auth&&(t.p256dh=O(e.p256dh).buffer),"string"==typeof e.fcmPushSet&&delete t.fcmPushSet,n.update(t),n.continue())};break;case 3:var i,o=(i=e.transaction.objectStore(this.objectStoreName)).openCursor();o.onsuccess=function(){var e,t,n=o.result;n&&(e=n.value,t=a({},e),"string"==typeof e.fcmPushSet&&delete t.fcmPushSet,n.update(t),n.continue())}}},A.prototype.getTokenDetailsFromToken=function(t){return u(this,void 0,void 0,function(){return l(this,function(e){if(t)return Le({fcmToken:t}),[2,this.getIndex("fcmToken",t)];throw P.create("bad-token")})})},A.prototype.getTokenDetailsFromSWScope=function(t){return u(this,void 0,void 0,function(){return l(this,function(e){if(t)return Le({swScope:t}),[2,this.get(t)];throw P.create("bad-scope")})})},A.prototype.saveTokenDetails=function(t){return u(this,void 0,void 0,function(){return l(this,function(e){if(!t.swScope)throw P.create("bad-scope");
1if(!t.vapidKey)throw P.create("bad-vapid-key");if(!t.endpoint||!t.auth||!t.p256dh)throw P.create("bad-subscription");if(!t.fcmSenderId)throw P.create("bad-sender-id");if(t.fcmToken)return Le(t),[2,this.put(t)];throw P.create("bad-token")})})},A.prototype.deleteToken=function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return"string"!=typeof n||0===n.length?[2,Je.reject(P.create("invalid-delete-token"))]:[4,this.getTokenDetailsFromToken(n)];case 1:if(t=e.sent())return[4,this.delete(t.swScope)];throw P.create("delete-token-not-found");case 2:return e.sent(),[2,t]}})})};var Re,Me=A;function A(e){var t=Re.call(this)||this;return t.services=e,t.dbName="fcm_token_details_db",t.dbVersion=4,t.objectStoreName="fcm_token_object_Store",t}function Le(e){if(e.fcmToken&&("string"!=typeof e.fcmToken||0===e.fcmToken.length))throw P.create("bad-token");if(e.swScope&&("string"!=typeof e.swScope||0===e.swScope.length))throw P.create("bad-scope");if(e.vapidKey&&(!(e.vapidKey instanceof Uint8Array)||65!==e.vapidKey.length))throw P.create("bad-vapid-key");if(e.endpoint&&("string"!=typeof e.endpoint||0===e.endpoint.length))throw P.create("bad-subscription");if(e.auth&&!(e.auth instanceof ArrayBuffer))throw P.create("bad-subscription");if(e.p256dh&&!(e.p256dh instanceof ArrayBuffer))throw P.create("bad-subscription");if(e.fcmSenderId&&("string"!=typeof e.fcmSenderId||0===e.fcmSenderId.length))throw P.create("bad-sender-id")}e(N,Fe=b),N.prototype.onDbUpgrade=function(e){e.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},N.prototype.getVapidFromSWScope=function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:if("string"!=typeof n||0===n.length)throw P.create("bad-scope");return[4,this.get(n)];case 1:return[2,(t=e.sent())?t.vapidKey:void 0]}})})},N.prototype.saveVapidDetails=function(n,r){return u(this,void 0,void 0,function(){var t;return l(this,function(e){if("string"!=typeof n||0===n.length)throw P.create("bad-scope");if(null===r||65!==r.length)throw P.create("bad-vapid-key");return t={swScope:n,vapidKey:r},[2,this.put(t)]})})},N.prototype.deleteVapidDetails=function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.getVapidFromSWScope(n)];case 1:if(t=e.sent())return[4,this.delete(n)];throw P.create("delete-scope-not-found");case 2:return e.sent(),[2,t]}})})};var Fe,Ue=N;function N(){var e=null!==Fe&&Fe.apply(this,arguments)||this;return e.dbName="fcm_vapid_details_db",e.dbVersion=1,e.objectStoreName="fcm_vapid_object_Store",e}R.prototype.getToken=function(){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:if("denied"===(i=this.getNotificationPermission_()))throw P.create("notifications-blocked");return"granted"!==i?[2,null]:[4,this.getSWRegistration_()];case 1:return t=e.sent(),[4,this.getPublicVapidKey_()];case 2:return n=e.sent(),[4,this.getPushSubscription(t,n)];case 3:return r=e.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(t.scope)];case 4:return(i=e.sent())?[2,this.manageExistingToken(t,r,n,i)]:[2,this.getNewToken(t,r,n)]}})})},R.prototype.manageExistingToken=function(t,n,i,r){return u(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return((e,t)=>{var n,r;if(t.vapidKey&&k(i.buffer,t.vapidKey.buffer))return n=e.endpoint===t.endpoint,r=k(e.getKey("auth"),t.auth),e=k(e.getKey("p256dh"),t.p256dh),n&&r&&e})(n,r)?Date.now()<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(t,n,i,r)]:[3,1];case 1:return[4,this.deleteTokenFromDB(r.fcmToken)];case 2:return e.sent(),[2,this.getNewToken(t,n,i)];case 3:return[2]}})})},R.prototype.updateToken=function(i,o,s,a){return u(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,6]),[4,this.subscriptionManager.updateToken(a,this.services,o,s)];case 1:return t=e.sent(),n={swScope:i.scope,vapidKey:s,fcmSenderId:this.services.app.options.messagingSenderId,fcmToken:t,createTime:Date.now(),endpoint:o.endpoint,auth:o.getKey("auth"),p256dh:o.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(n)];case 2:return e.sent(),[4,this.vapidDetailsModel.saveVapidDetails(i.scope,s)];case 3:return e.sent(),[2,t];case 4:return r=e.sent(),[4,this.deleteToken(a.fcmToken)];case 5:throw e.sent(),r;case 6:return[2]}})})},R.prototype.getNewToken=function(r,i,o){return u(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,this.subscriptionManager.getToken(this.services,i,o)];case 1:return t=e.sent(),n={swScope:r.scope,vapidKey:o,fcmSenderId:this.app.options.messagingSenderId,fcmToken:t,createTime:Date.now(),endpoint:i.endpoint,auth:i.getKey("auth"),p256dh:i.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(n)];case 2:return e.sent(),[4,this.vapidDetailsModel.saveVapidDetails(r.
1scope,o)];case 3:return e.sent(),[2,t]}})})},R.prototype.deleteToken=function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.deleteTokenFromDB(n)];case 1:return e.sent(),[4,this.getSWRegistration_()];case 2:return(t=e.sent())?[4,t.pushManager.getSubscription()]:[3,4];case 3:if(t=e.sent())return[2,t.unsubscribe()];e.label=4;case 4:return[2,!0]}})})},R.prototype.deleteTokenFromDB=function(n){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.tokenDetailsModel.deleteToken(n)];case 1:return t=e.sent(),[4,this.subscriptionManager.deleteToken(this.services,t)];case 2:return e.sent(),[2]}})})},R.prototype.getPushSubscription=function(n,r){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,n.pushManager.getSubscription()];case 1:return(t=e.sent())?[2,t]:[2,n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r})]}})})},R.prototype.requestPermission=function(){throw P.create("only-available-in-window")},R.prototype.useServiceWorker=function(e){throw P.create("only-available-in-window")},R.prototype.usePublicVapidKey=function(e){throw P.create("only-available-in-window")},R.prototype.onMessage=function(e,t,n){throw P.create("only-available-in-window")},R.prototype.onTokenRefresh=function(e,t,n){throw P.create("only-available-in-window")},R.prototype.setBackgroundMessageHandler=function(e){throw P.create("only-available-in-sw")},R.prototype.delete=function(){return u(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,Je.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return e.sent(),[2]}})})},R.prototype.getNotificationPermission_=function(){return Notification.permission},R.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},R.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},R.prototype.getSubscriptionManager=function(){return this.subscriptionManager};b=R;function R(e){var t=this,n=(this.services=e,this.vapidDetailsModel=new Ue,this.subscriptionManager=new Pe,e.app);if(!(this.app=n).options.messagingSenderId||"string"!=typeof n.options.messagingSenderId)throw P.create("bad-sender-id");this.INTERNAL={delete:function(){return t.delete()}},this.tokenDetailsModel=new Me(e)}var We,xe="FCM_MSG",Be=(e(M,We=b),M.prototype.onPush=function(e){e.waitUntil(this.onPush_(e))},M.prototype.onSubChange=function(e){e.waitUntil(this.onSubChange_(e))},M.prototype.onNotificationClick=function(e){e.waitUntil(this.onNotificationClick_(e))},M.prototype.onPush_=function(a){return u(this,void 0,void 0,function(){var t,n,r,i,o,s;return l(this,function(e){switch(e.label){case 0:if(!a.data)return[2];try{t=a.data.json()}catch(e){return[2]}return[4,this.hasVisibleClients_()];case 1:return e.sent()?[2,this.sendMessageToWindowClients_(t)]:(n=this.getNotificationData_(t))?(r=n.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return i=e.sent(),o=n.actions,s=Notification.maxActions,o&&s&&o.length>s&&console.warn("This browser only supports "+s+" actions.The remaining actions will not be displayed."),[2,i.showNotification(r,n)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(t)]:[3,5];case 4:return e.sent(),[2];case 5:return[2]}})})},M.prototype.onSubChange_=function(e){return u(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return t=e.sent(),[3,3];case 2:throw r=e.sent(),P.create("unable-to-resubscribe",{errorInfo:r});case 3:return e.trys.push([3,5,,8]),[4,t.pushManager.getSubscription()];case 4:return e.sent(),[3,8];case 5:return n=e.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(t.scope)];case 6:if(r=e.sent())return[4,this.deleteToken(r.fcmToken)];throw n;case 7:throw e.sent(),n;case 8:return[2]}})})},M.prototype.onNotificationClick_=function(o){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:if(!(o.notification&&o.notification.data&&o.notification.data[xe]))return[2];if(o.action)return[2];if(o.stopImmediatePropagation(),o.notification.close(),!(t=o.notification.data[xe]).notification)return[2];if(!(n=t.fcmOptions&&t.fcmOptions.link||t.notification.click_action)){if
1(!(t.data&&Te in t.data))return[2];n=self.location.origin}return[4,this.getWindowClient_(n)];case 1:return(r=e.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return r=e.sent(),[4,new Je(function(e){setTimeout(e,3e3)})];case 3:return e.sent(),[3,6];case 4:return[4,r.focus()];case 5:r=e.sent(),e.label=6;case 6:return r?(delete t.notification,delete t.fcmOptions,i=je(S.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(r,i)]):[2]}})})},M.prototype.getNotificationData_=function(e){var t,n;if(e&&"object"==typeof e.notification)return(n=a({},e.notification)).data=a(a({},e.notification.data),((t={})[xe]=e,t)),n},M.prototype.setBackgroundMessageHandler=function(e){if(!e||"function"!=typeof e)throw P.create("bg-handler-function-expected");this.bgMessageHandler=e},M.prototype.getWindowClient_=function(o){return u(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return t=new URL(o,self.location.href).href,[4,He()];case 1:for(n=e.sent(),r=null,i=0;i<n.length;i++)if(new URL(n[i].url,self.location.href).href===t){r=n[i];break}return[2,r]}})})},M.prototype.attemptToMessageClient_=function(t,n){return u(this,void 0,void 0,function(){return l(this,function(e){if(t)return t.postMessage(n),[2];throw P.create("no-window-client-to-msg")})})},M.prototype.hasVisibleClients_=function(){return u(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,He()];case 1:return[2,e.sent().some(function(e){return"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")})]}})})},M.prototype.sendMessageToWindowClients_=function(i){return u(this,void 0,void 0,function(){var t,n,r=this;return l(this,function(e){switch(e.label){case 0:return[4,He()];case 1:return t=e.sent(),n=je(S.PUSH_MSG_RECEIVED,i),[4,Je.all(t.map(function(e){return r.attemptToMessageClient_(e,n)}))];case 2:return e.sent(),[2]}})})},M.prototype.getSWRegistration_=function(){return u(this,void 0,void 0,function(){return l(this,function(e){return[2,self.registration]})})},M.prototype.getPublicVapidKey_=function(){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.getSWRegistration_()];case 1:if(t=e.sent())return[4,this.getVapidDetailsModel().getVapidFromSWScope(t.scope)];throw P.create("sw-registration-expected");case 2:return null==(t=e.sent())?[2,we]:[2,t]}})})},M);function M(e){var t=We.call(this,e)||this;return t.bgMessageHandler=null,self.addEventListener("push",function(e){t.onPush(e)}),self.addEventListener("pushsubscriptionchange",function(e){t.onSubChange(e)}),self.addEventListener("notificationclick",function(e){t.onNotificationClick(e)}),t}function He(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function je(e,t){return{firebaseMessagingType:e,firebaseMessagingData:t}}e(L,Ve=b),L.prototype.requestPermission=function(){return u(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?P.create("permission-blocked"):P.create("permission-default")}})})},L.prototype.useServiceWorker=function(e){if(!(e instanceof ServiceWorkerRegistration))throw P.create("sw-registration-expected");if(null!=this.registrationToUse)throw P.create("use-sw-before-get-token");this.registrationToUse=e},L.prototype.usePublicVapidKey=function(e){if("string"!=typeof e)throw P.create("invalid-public-vapid-key");if(null!=this.publicVapidKeyToUse)throw P.create("use-public-key-before-get-token");e=O(e);if(65!==e.length)throw P.create("public-vapid-key-decryption-failed");this.publicVapidKeyToUse=e},L.prototype.onMessage=function(e,t,n){return"function"==typeof e?this.onMessageInternal(e,t,n):this.onMessageInternal(e)},L.prototype.onTokenRefresh=function(e,t,n){return"function"==typeof e?this.onTokenRefreshInternal(e,t,n):this.onTokenRefreshInternal(e)},L.prototype.waitForRegistrationToActivate_=function(r){var i=r.installing||r.waiting||r.active;return new Je(function(e,t){var n;i?"activated"!==i.state?"redundant"!==i.state?(n=function(){if("activated"===i.state)e(r);else{if("redundant"!==i.state)return;t(P.create("sw-reg-redundant"))}i.removeEventListener("statechange",n)},i.addEventListener("statechange",n)):t(P.create("sw-reg-redundant")):e(r):t(P.create("no-sw-in-reg"))})},L.prototype.getSWRegistration_=function(){var t=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(e){throw P.create("failed-serviceworker-registration",{browserErrorMessage:e.message})}).then(function(e){return t.waitForRegistrationToActivate_(e).then(function(){return(t.registrationToUse=e).update(),e})}))},L.prototype.getPublicVapidKey_=function(){return u(this,void 0,void 0,function(){return l(this,function(e){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,we]})})},L.prototype.setupSWMessageListener_=function(){var e=this;navigator.serviceWorker.addEventListener("message",function(i){return u(e,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return i.data&&i.data.firebaseMessagingType&&i.data.firebaseMessagingData?(n=i.data,t=n.firebaseMessagingType,n=n.firebaseMessagingData,this.messageOb
1server&&this.messageObserver.next(n),(n=n.data)&&Te in n&&"1"===n["google.c.a.e"]?(r=(()=>{switch(t){case S.NOTIFICATION_CLICKED:return"notification_open";case S.PUSH_MSG_RECEIVED:return"notification_foreground";default:throw new Error}})(),[4,this.services.analyticsProvider.get()]):[3,2]):[2];case 1:e.sent().logEvent(r,{message_name:n["google.c.a.c_l"],message_id:n[Te],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),e.label=2;case 2:return[2]}})})},!1)};var Ve,qe=L;function L(e){var t=Ve.call(this,e)||this;return t.registrationToUse=null,t.publicVapidKeyToUse=null,t.messageObserver=null,t.tokenRefreshObserver=null,t.onMessageInternal=j(function(e){t.messageObserver=e}),t.onTokenRefreshInternal=j(function(e){t.tokenRefreshObserver=e}),t.setupSWMessageListener_(),t}function Ge(){return self&&"ServiceWorkerGlobalScope"in self?"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in Ke&&"Notification"in Ke&&"fetch"in Ke&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}b={isSupported:Ge},Ye.INTERNAL.registerComponent(new Y("messaging",function(e){e={app:e.getProvider("app").getImmediate(),installations:e.getProvider("installations").getImmediate(),analyticsProvider:e.getProvider("analytics-internal")};if(Ge())return new(self&&"ServiceWorkerGlobalScope"in self?Be:qe)(e);throw P.create("unsupported-browser")},"PUBLIC").setServiceProps(b))}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-messaging - be sure to load firebase-app.js first.")}},"object"==typeof e&&void 0!==D?c(require("@firebase/app")):"function"==typeof O&&O.amd?O(["@firebase/app"],c):c((i||self).firebase),g.cookie=function e(l){function d(e,t,n){var r,i;if(!(1<arguments.length)){e||(r={});for(var o=document.cookie?document.cookie.split("; "):[],s=/(%[0-9A-Z]{2})+/g,a=0;a<o.length;a++){var c=o[a].split("="),u=c[0].replace(s,decodeURIComponent),c=c.slice(1).join("=");'"'===c.charAt(0)&&(c=c.slice(1,-1));try{if(c=l.read?l.read(c,u):l(c,u)||c.replace(s,decodeURIComponent),this.json)try{c=JSON.parse(c)}catch(e){}if(e===u){r=c;break}e||(r[u]=c)}catch(e){}}return r}"number"==typeof(n=h({path:"/"},d.defaults,n)).expires&&((i=new Date).setMilliseconds(i.getMilliseconds()+864e5*n.expires),n.expires=i);try{r=JSON.stringify(t),/^[\{\[]/.test(r)&&(t=r)}catch(e){}t=l.write?l.write(t,e):encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[e,"=",t,n.expires&&"; expires="+n.expires.toUTCString(),n.path&&"; path="+n.path,n.domain&&"; domain="+n.domain,n.sameSite?"; SameSite="+n.sameSite:"; SameSite=None","; Secure"].join("")}d.get=d.set=d;d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))};d.defaults={};d.remove=function(e,t){d(e,"",h(t,{expires:-1}))};d.withConverter=e;return d}(function(){}),c=this,i=function(){function c(e){return"function"==typeof e}function t(){var e=setTimeout;return function(){return e(n,1)}}function n(){for(var e=0;e<_;e+=2)(0,k[e])(k[e+1]),k[e]=void 0,k[e+1]=void 0;_=0}function u(e,t){var n,r=this,i=new this.constructor(d),o=(void 0===i[I]&&y(i),r._state);return o?(n=arguments[o-1],w(function(){return m(o,i,n,r._result)})):s(r,i,e,t),i}function l(e){var t;return e&&"object"==typeof e&&e.constructor===this?e:(p(t=new this(d),e),t)}function d(){}function o(e,r,i){w(function(t){var n=!1,e=((e,t,n,r)=>{try{e.call(t,n,r)}catch(e){return e}})(i,r,function(e){n||(n=!0,(r!==e?p:f)(t,e))},function(e){n||(n=!0,g(t,e))},t._label);!n&&e&&(n=!0,g(t,e))},e)}function h(e,t,n){var r,i;t.constructor===e.constructor&&n===u&&t.constructor.resolve===l?(r=e,(i=t)._state===D?f(r,i._result):i._state===A?g(r,i._result):s(i,void 0,function(e){return p(r,e)},function(e){return g(r,e)})):void 0!==n&&c(n)?o(e,t,n):f(e,t)}function p(t,e){if(t===e)g(t,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof e,null===e||"object"!=n&&"function"!=n)f(t,e);else{n=void 0;try{n=e.then}catch(e){return void g(t,e)}h(t,e,n)}var n}
1function r(e){e._onerror&&e._onerror(e._result),a(e)}function f(e,t){e._state===O&&(e._result=t,e._state=D,0!==e._subscribers.length)&&w(a,e)}function g(e,t){e._state===O&&(e._state=A,e._result=t,w(r,e))}function s(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+D]=n,i[o+A]=r,0===o&&e._state&&w(a,e)}function a(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i=void 0,o=e._result,s=0;s<t.length;s+=3)r=t[s],i=t[s+n],r?m(n,r,i,o):i(o);e._subscribers.length=0}}function m(e,t,n,r){var i=c(n),o=void 0,s=void 0,a=!0;if(i){try{o=n(r)}catch(e){a=!1,s=e}if(t===o)return void g(t,new TypeError("A promises callback cannot return that same promise."))}else o=r;t._state===O&&(i&&a?p(t,o):!1===a?g(t,s):e===D?f(t,o):e===A&&g(t,o))}function y(e){e[I]=N++,e._state=void 0,e._result=void 0,e._subscribers=[]}var e,i,v,b=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},_=0,C=void 0,S=void 0,w=function(e,t){k[_]=e,k[_+1]=t,2===(_+=2)&&(S?S(n):U())},T=void 0!==Ke?Ke:void 0,E=T||{},E=E.MutationObserver||E.WebKitMutationObserver,P="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),F="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,k=new Array(1e3),U=void 0,U=P?function(){return process.nextTick(n)}:E?(i=0,P=new E(n),v=document.createTextNode(""),P.observe(v,{characterData:!0}),function(){v.data=i=++i%2}):F?((e=new MessageChannel).port1.onmessage=n,function(){return e.port2.postMessage(0)}):(void 0===T&&"function"==typeof require?()=>{try{var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==Ke?Ke:"undefined"!=typeof global?global:{}).require("vertx");return void 0!==(C=e.runOnLoop||e.runOnContext)?function(){C(n)}:t()}catch(e){return t()}}:t)(),I=Math.random().toString(36).substring(2),O=void 0,D=1,A=2,N=0,W=(L.prototype._enumerate=function(e){for(var t=0;this._state===O&&t<e.length;t++)this._eachEntry(e[t],t)},L.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===l){var i,o=void 0,s=void 0,a=!1;try{o=t.then}catch(e){a=!0,s=e}o===u&&t._state!==O?this._settledAt(t._state,e,t._result):"function"!=typeof o?(this._remaining--,this._result[e]=t):n===R?(i=new n(d),a?g(i,s):h(i,t,o),this._willSettleAt(i,e)):this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},L.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===O&&(this._remaining--,e===A?g(r,n):this._result[t]=n),0===this._remaining&&f(r,this._result)},L.prototype._willSettleAt=function(e,t){var n=this;s(e,void 0,function(e){return n._settledAt(D,t,e)},function(e){return n._settledAt(A,t,e)})},L),R=(M.prototype.catch=function(e){return this.then(null,e)},M.prototype.finally=function(t){var n=this.constructor;return c(t)?this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}):this.then(t,t)},M);function M(e){if(this[I]=N++,this._result=this._state=void 0,this._subscribers=[],d!==e){if("function"!=typeof e)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof M))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object c
1onstructor cannot be called as a function.");var t=this;try{e(function(e){p(t,e)},function(e){g(t,e)})}catch(e){g(t,e)}}}function L(e,t){this._instanceConstructor=e,this.promise=new e(d),this.promise[I]||y(this.promise),b(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0!==this.length&&(this.length=this.length||0,this._enumerate(t),0!==this._remaining)||f(this.promise,this._result)):g(this.promise,new Error("Array Methods must be provided an Array"))}return R.prototype.then=u,R.all=function(e){return new W(this,e).promise},R.race=function(i){var o=this;return new o(b(i)?function(e,t){for(var n=i.length,r=0;r<n;r++)o.resolve(i[r]).then(e,t)}:function(e,t){return t(new TypeError("You must pass an array to race."))})},R.resolve=l,R.reject=function(e){var t=new this(d);return g(t,e),t},R._setScheduler=function(e){S=e},R._setAsap=function(e){w=e},R._asap=w,R.polyfill=function(){var e=void 0;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==Ke?Ke:"undefined"!=typeof global?global:x}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=R},(R.Promise=R).polyfill(),R},"object"==typeof e&&void 0!==D?D.exports=i():"function"==typeof O&&O.amd?O(i):c.ES6Promise=i(),e=this,c=function(){return function(n,e){var r=this,i=(e===x&&(e=999),r.getOffset=function(e){for(var t=Ke.getComputedStyle(e,null),n=["paddingTop","paddingBottom"],r=0,i=0;i<n.length;i++)r+=parseInt(t[n[i]]);return r},r.autogrowFn=function(){var e=0,t=!1;return n.scrollHeight-i>r.maxAllowedHeight?(n.style.overflowY="scroll",e=r.maxAllowedHeight):(n.style.overflowY="hidden",n.style.height="auto",e=n.scrollHeight-i,t=!0),n.style.height=e+"px",t},r.getOffset(n));r.rows=n.rows||1,r.lineHeight=n.scrollHeight/r.rows-i/r.rows,r.maxAllowedHeight=r.lineHeight*e-i,n.addEventListener("input",r.autogrowFn)}},"function"==typeof O&&O.amd?O([],c):"object"==typeof D&&D.exports?D.exports=c():e.Autogrow=c();function s(e){return"number"==typeof(e=d(e))&&0<=e&&e<=l}function r(e,t){var n=f.length,r=e.constructor,i=g.isFunction(r)&&r.prototype||a,o="constructor";for(g.has(e,o)&&!g.contains(t,o)&&t.push(o);n--;)(o=f[n])in e&&e[o]!==i[o]&&!g.contains(t,o)&&t.push(o)}function t(c,u){return function(e){var t=arguments.length;if(u&&(e=Object(e)),!(t<2||null==e))for(var n=1;n<t;n++)for(var r=arguments[n],i=c(r),o=i.length,s=0;s<o;s++){var a=i[s];u&&void 0!==e[a]||(e[a]=r[a])}return e}}var n,i=Array.prototype,a=Object.prototype,e=Function.prototype,o=(i.push,a.toString),c=Array.isArray,u=Object.keys,l=(e.bind,Math.pow(2,53)-1),d=(n="length",function(e){return null==e?void 0:e[n]}),p=(g.isEmpty=function(e){return null==e||(s(e)&&(g.isArray(e)||g.isString(e)||g.isArguments(e))?0===e.length:0===g.keys(e).length)},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=c||function(e){return"[object Array]"===o.call(e)},g.isObject=function(e){var t=typeof e;return"function"==t||"object"==t&&!!e},g.each=g.forEach=function(e,t,n){if(t=((i,o,e)=>{if(void 0===o)return i;switch(null==e?3:e){case 1:return function(e){return i.call(o,e)};case 3:return function(e,t,n){return i.call(o,e,t,n)};case 4:return function(e,t,n,r){return i.call(o,e,t,n,r)}}return function(){return i.apply(o,arguments)}})(t,n),s(e))for(i=0,o=e.length;i<o;i++)t(e[i],i,e);else for(var r=g.keys(e),i=0,o=r.length;i<o;i++)t(e[r[i]],r[i],e);return e},g.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol"],function(t){g["is"+t]=function(e){return o.call(e)==="[object "+t+"]"}}),!{toString:null}.propertyIsEnumerable("toString")),f=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];g.allKeys=function(e){if(!g.isObject(e))return[];var t,n=[];for(t in e)n.push(t);return p&&r(e,n),n},g.keys=function(e){if(!g.isObject(e))return[];if(u)return u(e);var t,n=[];for(t in e)g.has(e,t)&&n.push(t);return p&&r(e,n),n};g.extend=t(g.allKeys),g.extendOwn=g.assign=t(g.keys),void 0!==U&&(this.firebase=U),void 0!==g&&(this._=g)}.call(F),F.ES6Promise&&F.ES6Promise.Promise||console.error("Main:init Promise library is required"),F.firebase),g=F._,Je=F.ES6Promise.Promise,Xe=F.ES6Fetch.fetch,ze=F.ES6Fetch.Headers,W=F.ES6Fetch.Request,f=g.cookie.get("_snrs_sdk_d")?{debug:console.debug.bind(console),log:console.log.bind(console),info:console.info.bind(console),error:function(){p.callFunctionAndLogError(console.error,arguments)},fatal:function(){p.callFunctionAndLogError(console.error,arguments,p.LEVEL.fatal)}}:{debug:e,log:e,info:e,error:function(){p.callFunctionAndLogError(e,arguments)},fatal:function(){p.callFunctionAndLogError(e,arguments,p.LEVEL.fatal)}},l=(f.log("Main:init SyneriseLibraryScope",F),{_apiKey:null,_trackerKey:null,apiKey:function(e){return f.error("Api key is no longer supported"),null},trackerKey:function(e){return void 0!==e?"YOUR_TRACKER_KEY"!=e?l._trackerKey=e:null:l._trackerKey},getHeaderAuth:function(e){if(l.checkAuth())return"key"==e?"Tracker":"value"==e?this.trackerKey():void 0;throw new TypeError("TrackerKey is not set")},checkAuth:function(){return!!this.trackerKey()||(f.error("TrackerKey is not set"),!1)},parseToken:function(t){try{var e=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n)}catch(e){return f.error("Auth:parseToken ERROR: could not parse token",t,e),null}}});function B(e){this.uuid=(e=e||{}).uuid||null,this.permUuid=e.permUuid||null,this.customIdentify=e.customIdentify||null,this.accessToken=e.accessToken||null,this.isNewClient=e.isNewClient||null,this.tags=null,this.segments=null,this.params=e.params||null,void 0!==this.params&&null!=this.params&&void 0!==this.params.customIdentify&&(this.customIdentify=this.params.customIdentify,delete this.params.customIdentify)}B.prototype.getTags=function(){f.log("Client:getTag");var e=this;return new Je(function(t,n){e.tags?t(e.tags):H(e).then(function(e){f.log("Client:getTag RequestManager.getClientTags then",e),t(e.tags||[])}).catch(function(e){n(e)})})},B.prototype.getSegments=function(){f.log("Client:getSegments");var e=this;return new Je(function(t,n){e.segments?t(e.segments):H(e).then(function(e){f.log("Client:getTag RequestManager.getSegments then",e),t(e.segments||[])}).catch(function(e){n(e)})})};var H=function(r){return f.log("Client:getData"),new Je(function(t,n){r.segments&&r.tags?t({tags:r.tags,segments:r.segments}):T.getClientData(r).then(function(e){f.log("Client:getData RequestManager.getClientData then",e),r.segments=e.segments||[],r.tags=e.tags||[],t(e)}).catch(function(e){n(e)})})},d=(B.prototype.getDynamicContents=function(){f.log("Client:getDynamicContents",this);var n=this;return new Je(function(e,t){c.getDynamicContentsForClient(n).then(e).catch(function(e){f.error(e,n),t(ne
1w Error("Can not get dynamic contents"))})})},B.prototype.renderDynamicContents=function(){f.log("Client:renderDynamicContents");var r=this;return new Je(function(t,n){r.getDynamicContents().then(c.renderBatchDynamicContents).then(function(e){g.each(e,function(e){r.renderDynamicContent(e)}),t(e)}).catch(function(e){f.error(e,r),n(new Error("Can not render dynamic contents"))})})},B.prototype.renderDynamicContent=function(e){return c.renderDynamicContentForClient(e,this)},B.prototype.reRenderDynamicContent=function(e){return c.reRenderDynamicContentForClient(e,this)},B.prototype.getDynamicContentByUuids=function(n){f.log("Client:getDynamicContentByUuids",this);var r=this;return new Je(function(e,t){c.getDynamicContentByUuidsForClient(r,n).then(e).catch(function(e){f.error(e,r),t(new Error("Can not get dynamic content"))})})},B.prototype.renderDynamicContentByUuidFromCache=function(n){f.log("Client:renderDynamicContentByUuidFromCache",this);var r=this;return new Je(function(e,t){c.findDynamicContenByUuid(n).then(function(e){r.renderDynamicContentByUuids(e)}).catch(function(e){f.error(e,r),t(new Error("Can not find dynamic content"))})})},B.prototype.renderDynamicContentByUuids=function(e){f.log("Client:renderDynamicContentByUuids");var r=this;return new Je(function(t,n){r.getDynamicContentByUuids(e).then(function(e){g.each(e,function(e){r.reRenderDynamicContent(e)}),t(e)}).catch(function(e){f.error(e,r),n(new Error("Can not render dynamic content"))})})},B.prototype.getNotifications=function(){f.log("Client:getNotifications");var n=this;return new Je(function(t,e){f.log("Client:getNotifications",n),w.getNotificationsForClient(n).then(function(e){f.log("Client:getNotifications NotificationManager.getNotificationsForClient() then check capping",e);var r=[];g.each(e,function(e){var t,n;e.capping&&g.isObject(e.capping)&&e.id?"count"===(t=e.capping).type&&(f.log("Client.getNotifications capping count limit",t.count),t.count&&0<t.count&&(n=I.getNotificationCapping(e),f.log("Client.getNotifications check capping",e.id,t.count,n,t.count>n),!(t.count>n))||r.push(e)):r.push(e)}),t(r)}).catch(function(e){f.error(e),t([])})})},B.prototype.renderNotifications=function(){f.log("Client:renderNotifications");var n=this;return new Je(function(t,e){n.getNotifications().then(function(e){return g.each(e,function(e){n.renderNotification(e)}),Je.resolve(e)}).then(function(){t()}).catch(function(e){f.error(e),t()})})},{currentClient:null,notify:function(t){t=new S(t),d.getCurrentClient().then(function(e){e.renderNotification(t,!0)})},getAndRenderDynamicContentsForClient:function(t){d.getCurrentClient().then(function(e){void 0!==t?e.renderDynamicContentByUuidFromCache(t):e.renderDynamicContents()})},getCurrentClient:function(){return new Je(function(t,n){var e,r,i;f.log("ClientManager:getCurrentClient",d.currentClient),d.currentClient&&d.currentClient.uuid&&d.currentClient.permUuid?t(d.currentClient):(e=d.getClientFromStore())&&"null"!==e.uuid?(d.currentClient?(d.currentClient.uuid=e.uuid,d.currentClient.permUuid=e.permUuid):d.setCurrentClient(e),f.log("ClientManager:getCurrentClient return:",d.currentClient),t(d.currentClient)):(r=0,i=setInterval(function(){f.log("ClientManager:getCurrentClient try get client again",r,25);var e=d.getClientFromStore();e?(clearInterval(i),i=null,d.currentClient?(d.currentClient.uuid=e.uuid,d.currentClient.permUuid=e.permUuid):d.setCurrentClient(e),f.log("ClientManager:getCurrentClient return:",d.currentClient),t(d.currentClient)):25<=r&&(clearInterval(i),i=null,n(new TypeError("Client has not found"))),r++},250))})},updateClientParams:function(e,t){void 0===t&&(t=!0),e instanceof B?d.currentClient=e:d.currentClient.params=e,t&&b.clientCreateOrUpdate("Update client data",d.currentClient.params)},setCurrentClient:function(e){d.currentClient=e},setClientNew:function(e){d.currentClient?d.currentClient.isNewClient=e:f.log("ClientManager: setClientNew failed to set isNewClient")},isNewClient:function(){return d.currentClient?d.currentClient.isNewClient:null},getClientFromStore:function(){f.log("ClientManager:getClientFromStore");var e=I.getClientUuid(),t=I.getClientPermUuid(),n=I.getClientToken();return e?t?(e=new B({uuid:e,permUuid:t,accessToken:n}),f.log("ClientManager:getClientFromStore return:",e),e):(f.log("ClientManager:getClientFromStore PermUuid not found"),f.log("ClientManager:getClientFromStore return:",null),null):(f.log("ClientManager:getClientFromStore return:",null),null)},getAccessToken:function(){return d.currentClient&&d.currentClient.accessToken?d.currentClient.accessToken:null},setAccessToken:function(t){I.setClientToken(t)?d.getCurrentClient().then(function(e){d.currentClient.accessToken=t,f.log("ClientManager:setToken Token stored and set")}).catch(function(e){f.log("ClientManager:setToken Token stored but not set",e)}):f.log("ClientManager:setToken Failed to store token")},clearAccessToken:function(){d.currentClient&&d.currentClient.accessToken&&(d.currentClient.accessToken=null),I.removeClientToken()},checkGlobalControlGroupForClient:function(){return I.getGlobalControlGroupForClient()},getIdentityHash:function(){return SyneriseTC.identityHash},hashIdentity:function(e){return h.hashString(e)},setUuidAndIdentityHash:function(e,t){return SyneriseTC.setNewUUIDAndIdentityHash(e,t)},setUuid:function(n){return f.log("ClientManager:setUuid",n),new Je(function(e,t){if(!h.validateUUID(n))return t(new TypeError("Uuid is invali
1d"));SyneriseTC.setNewUUIDAndIdentityHash("",n),SyneriseTC.pageVisit({}).then(function(){e(!0)}).catch(function(){t(new TypeError("Can't set new uuid"))})})}}),m={_options:{notificationNewsletterHandlers:!0,disableNotification:!(B.prototype.renderNotification=function(s,a){var c=this;return new Je(function(e,t){a=a||!1;var n=s.conditions&&s.conditions.delay?parseInt(s.conditions.delay,10):0;if(f.log("Client:renderNotification",s,"delay:",n,"forceRender:",a),!a){if(s.additionalParams&&s.additionalParams.popupAtLeave)return f.log("Client:renderNotification atach click handlers for leave popup"),w.attachHandlerForLeavePopup(c,s),void e();s.additionalParams&&s.additionalParams.popupTransparentBackground?w.turnOnPopupTransparentBackground():w.turnOffPopupTransparentBackground();var r=new Date;if(n){var i,o=E.get("_snrs_notify_delay_"+s.id);if(o?i=new Date(parseInt(o,10)):(i=new Date(r.getTime()+1e3*n),E.set("_snrs_notify_delay_"+s.id,i.getTime(),300)),f.log("Client:renderNotification check end date",i),0<(o=i.getTime()-r.getTime()))return f.log("Client:renderNotification set render timeout",o),setTimeout(function(){c.renderNotification(s,!0)},o),void e(s)}}s.render().then(function(){return E.remove("_snrs_notify_delay_"+s.id),Je.resolve(s)}).then(function(e){return f.log("Client:renderNotification then",e,e.isRendered()),e.isRendered()&&I.setNotificationCapping(e),Je.resolve(e)}).then(function(t){var e=!(!t.conditions||!t.conditions.trackEventShow);return f.log("Client:renderNotification track",t,e,t.isRendered()),t.isRendered()&&e&&T.track("","dynamicContent.show","",{id:t.id,title:t.name}).then(function(e){f.log("Notification:render show tracked",t)}),Je.resolve(t)}).catch(function(e){f.error(e)}),e(s)})}),disableWebPush:!1,webpush:{},dynamicContent:{},lang:x,acceptLangList:x,localStorageMode:!1,doNotTrack:!1,allowGoogleBot:!1,disablePageHistoryTracking:!1},_isReady:!1,_readyCallbacks:[],_readyResolve:null,_profileConfig:null,PROFILE_CONFIG_TYPE_NOTIFICATIONS:"notifications",PROFILE_CONFIG_TYPE_DATA_MARKER:"dataMarker",PROFILE_CONFIG_TYPE_PROVIDERS:"providers",PROFILE_CONFIG_TYPE_PROFILE:"profile",PROFILE_CONFIG_TYPE_WEBPUSH:"webPush",PROFILE_CONFIG_TYPE_COOKIE_MATCHERS:"cookieMatchers",getVersion:function(){return"3.29.6"},getModuleName:function(){return"default"},getBuildTime:function(){return"2026-09-23"},getFullVersion:function(){return m.getModuleName()+":"+m.getVersion()},getBuildHash:function(){return h.hashString(m.getFullVersion()+m.getBuildTime())+""},getTrackerHost:function(){return T.trackingDomain},getOption:function(e){return void 0!==e?m._options[e]:m._options},setOption:function(e,t){m._options[e]=t},isReady:function(){return m._isReady},ready:function(e){"function"==typeof e&&(m._isReady?e():m._readyCallbacks.push(e))},_executeReadyCallbacks:function(){for(var e=0;e<m._readyCallbacks.length;e++)try{m._readyCallbacks[e]()}catch(e){f.error("Core:readyCallback error",e)}m._readyCallbacks=[],m._readyResolve&&m._readyResolve()},getDoNotTrackStatus:function(){var e=m.getOption("dntCookieName"),e=e?E.get(e):x,t=E.get("_snrs_dnt"),e=e||t;return"true"===e||"1"===e},init:function(r,e){return new Je(function(e,t){m._options=g.extend(m._options,r),"faststore"===m._options.plugin&&(m.setOption("dynamicContent",{virtualPage:!0}),m.setOption("customPageVisit",!0)),m.getOption("allowGoogleBot")&&u.isGoogleCrawler()&&m.setOption("doNotTrack",!0),m.getDoNotTrackStatus()&&m.setOption("doNotTrack",!0),m.getOption("doNotTrack")&&((n=E.get("_snrs_p"))&&"null"!==n&&SyneriseTC.clearCookieList(),k.setVariableStorage(),m.setOption("localStorageMode",!0)),u.init(),m._options.lang?m._options.acceptLangList=[m._options.lang]:m._options.lang=u.getLanguage(),m._options.acceptLangList||(m._options.acceptLangList=u.getAcceptLanguageList()),f.log('Core:init module name: "'+m.getModuleName()+'", version: "'+m.getVersion()+'", build time: "'+m.getBuildTime()+'"'),f.log("Core:init with options",m._options);var i,n=E.get("_snrs_token");return n&&k.isAvailable()&&I.setClientToken(n),m._options.trackerKey&&l.trackerKey(m._options.trackerKey),!0===m._options.localStorageMode&&
1k.clearExpiredKeysStartingWithSnrs(),m._options.apiKey&&l.apiKey(m._options.apiKey),m._options.trackingDomain&&T.utils.setTrackingDomain(m._options.trackingDomain),u.isCrawler()?t(new TypeError("Cannot initialize SDK - crawler detected")):(m._options.nonce&&g.setNonce(m._options.nonce),l.trackerKey()?(i=[["setTracker",l.trackerKey()]],m._options.customPageVisit&&i.push(["setCustomPageVisit",m._options.customPageVisit]),m._options.customizeMetadata&&i.push(["setCustomizeMetadata",m._options.customizeMetadata]),m._options.cookieExpiration&&i.push(["setCookieExpiration",m._options.cookieExpiration]),m._options.domain&&i.push(["setDomain",m._options.domain]),m._options.path&&i.push(["setPath",m._options.path]),void 0!==m._options.clientUuid&&m._options.clientUuid&&h.validateUUID(m._options.clientUuid)&&i.push(["setUuid",[m._options.clientUuid,!0]]),void 0!==m._options.triggerPageVisitOnHashChange&&i.push(["setTriggerPageVisitOnHashChange",m._options.triggerPageVisitOnHashChange]),void m.getProfileConfig().then(function(n){return new Je(function(e,t){b.init().then(function(){e(n)}).catch(function(e){f.error(e),t(new TypeError("Event list is not defined"))})})}).then(function(r){return new Je(function(e,t){f.log("Core:init init tracker",i);var n="email",n=n=r&&r.resetUUID&&r.resetUUID.fieldName?r.resetUUID.fieldName:n;i.push(["setIdentity",n]),SyneriseTC.init(i),SyneriseTC.ready(function(){e()})})}).then(function(){return new Je(function(t,n){m.initModulesForClient().then(function(e){f.log("Core:init done for client",e),t()}).catch(function(e){f.error(e),n(new TypeError("Client is not identified"))})})}).then(function(){return m._isReady=!0,m._executeReadyCallbacks(),e(!0)}).catch(function(e){return t(e)})):t(new TypeError("TrackerKey is not set")))})},initModulesForClient:function(){return new Je(function(t,n){d.getCurrentClient().then(function(n){return new Je(function(e,t){if("null"===n.uuid)return e(n);m.getProfileContext(n.uuid).finally(function(){e(n)})})}).then(function(n){return new Je(function(e,t){if(f.log("Core:init dynamicContents"),m._options.disableDynamicContent||void 0===c)return e(n);c.init(m._options.dynamicContent).then(function(){C.init(),location.href.match("snr_preview")?c.renderDynamicContentPreview():m._options.dynamicContent.virtualPage||n.renderDynamicContents()}).catch(function(e){f.error(e)}),e(n)})}).then(function(r){return new Je(function(e,t){var n;f.log("Core:init basic data"),"object"==typeof clientData&&(f.log("Core:init with client data",clientData),d.updateClientParams(clientData)),m._options.disableFormMarker||void 0===_||m._options.doNotTrack||(_.init().catch(function(e){f.error(e)}),J.init().catch(function(e){f.error(e)})),"object"!=typeof m._options.dataLayer||void 0===j||m._options.doNotTrack||(n=m._options.gaVersion,j.init(m._options.dataLayer,n)),e(r)})}).then(function(n){return new Je(function(e,t){f.log("Core:init plugin"),"faststore"===m._options.plugin&&z.init(),e(n)})}).then(function(n){return new Je(function(t,e){if(f.log("Core:init webpush"),m._options.disableWebPush||void 0===D||m._options.doNotTrack)return t(n);D.init(m._options.webpush).then(function(){t(n)}).catch(function(e){t(n)})})}).then(function(n){return new Je(function(e,t){if(f.log("Core:init notifications"),m._options.disableNotification||void 0===w||m._options.doNotTrack)return e(n);w.init().then(function(){C.init(),n.renderNotifications()}).catch(function(e){f.error(e)}),e(n)})}).then(function(e){t(e)}).catch(function(e){n(e)})})},_setResetUUIDMode:function(e){"undefined"!=typeof SyneriseTC&&e&&e.resetUUID&&e.resetUUID.mode&&(SyneriseTC.resetUUIDMode=e.resetUUID.mode)},getProfileContext:function(e){return new Je(function(i,t){T.getProfileContext(e).then(function(e){var t,n,r;f.log("Core:getProfileContext RequestManager.getProfileContext then",e),e&&e.profile&&(t=e.profile.newClient,n=e.profile.identityHash,r=e.profile.belongsToGlobalControlGroup,"boolean"==typeof t&&d.setClientNew(t),n&&!SyneriseTC.checkIdentityHashExists()&&SyneriseTC.resetUUIDByIdentityHash(n),"boolean"==typeof r)&&SyneriseTC.setGlobalControlGroup(r),i(e)}).catch(function(e){t(e)})})},getProfileConfig:function(){return h.uniquePromiseHandler("Core:getProfileConfig",function(t,n){var e;return I.getProfileConfig()?(e=I.getProfileConfig(),f.log("Core:getProfileConfig RequestManager.getProfileConfig from localStorage",e),m._profileConfig=e,m._setResetUUIDMode(e),t(e)):m._profileConfig?(f.log("Core:getProfileConfig RequestManager.getProfileConfig from cache",m._profileConfig),m._setResetUUIDMode(m._profileConfig),t(m._profileConfig)):void T.getProfileConfig().then(function(e){f.log("Core:getProfileConfig RequestManager.getProfileConfig then",e),I.setProfileConfig(e),m._profileConfig=e,m._setResetUUIDMode(e),t(m._profileConfig)}).catch(function(e){n(e)})})},getProfileConfigByType:function(r){return new Je(function(t,n){m.getProfileConfig().then(function(e){if(f.log("Core:getProfileConfigByType for type",r),!e)return t(null);t(e[r]||null)}
1).catch(function(e){n(e)})})},getWebPushProfileConfig:function(){return new Je(function(r,t){var i=m.getOption("acceptLangList")?m.getOption("acceptLangList").join(","):x;m.getProfileConfig().then(function(e){return new Je(function(t,n){if(f.log("Core:getWebPushProfileConfig get webpush config",e),m._profileConfig&&m._profileConfig[m.PROFILE_CONFIG_TYPE_WEBPUSH]!==x)return f.log("Core:getWebPushProfileConfig get from cache",m._profileConfig[m.PROFILE_CONFIG_TYPE_WEBPUSH]),t(m._profileConfig);T.getWebPushProfileConfig(i).then(function(e){f.log("Core:getWebPushProfileConfig RequestManager.getWebPushProfileConfig then",e),m._profileConfig[m.PROFILE_CONFIG_TYPE_WEBPUSH]=e,t(m._profileConfig)}).catch(function(e){n(e)})})}).then(function(e){var t,n;return f.log("Core:getWebPushProfileConfig",e),e&&e[m.PROFILE_CONFIG_TYPE_PROVIDERS]&&e[m.PROFILE_CONFIG_TYPE_PROFILE]&&e[m.PROFILE_CONFIG_TYPE_WEBPUSH]?(n=e[m.PROFILE_CONFIG_TYPE_PROFILE],(t=e[m.PROFILE_CONFIG_TYPE_PROVIDERS])&&t.fcm?(n={api_key:t.fcm.api_key,project_id:t.fcm.project_id,app_id:t.fcm.app_id,sender_id:t.fcm.sender_id,public_vapid:t.fcm.public_vapid||null,agreement_page_domain:"https://"+n.subdomain+".snrpush.com"},f.log("Core:getWebPushProfileConfig webpushData",e[m.PROFILE_CONFIG_TYPE_WEBPUSH]),f.log("Core:getWebPushProfileConfig extendData",n),n=g.extend({},e[m.PROFILE_CONFIG_TYPE_WEBPUSH],n),void r(n||null)):(f.log("Core:getWebPushProfileConfig Fcm settings are not configured.",t),r(null))):(f.log("Core:getWebPushProfileConfig configs required for webpush are not defined.",e),f.log("Core:getWebPushProfileConfig configs isProvidersConfig: "+!!e[m.PROFILE_CONFIG_TYPE_PROVIDERS]+" isProfileConfig: "+!!e[m.PROFILE_CONFIG_TYPE_PROFILE]+" isWebPushConfig: "+!!e[m.PROFILE_CONFIG_TYPE_WEBPUSH]),r(null))}).catch(function(e){t(e)})})}},j={_allowDataLayerAction:["add","remove","purchase","refund"],_events:{add_to_cart:"add",remove_from_cart:"remove",purchase:"purchase",refund:"refund"},_initObserverPush:!1,_localOrders:[],_gaVersion:null,init:function(t,e){this.getLocalOrders(),e&&(this._gaVersion=e);try{f.log("DataLayer:init",t,e),this.validData(t)&&(this.observerPush(t,this.eventData),this.eventsData(t))}catch(e){f.error("DataLayer:init",t,e)}},validData:function(e){return!!Array.isArray&&Array.isArray(e)},eventsData:function(e){var t=this;e.forEach(function(e){t.eventData(t,e)})},ga4Parser:function(e,n){f.log("DataLayer:ga4 event",e,n);var r,t=this._events[e];return(e={ecommerce:{}}).ecommerce[t]={products:[]},n.currency&&(e.ecommerce.currencyCode=n.currency),[].forEach.call(n.items,function(n){var r={};[].forEach.call(g.keys(n),function(e){var t=e.replace(/^item_/,"");r[t]=n[e]}),e.ecommerce[t].products.push(r)}),t!==this._events.purchase&&t!==this._events.refund||(r={},[].forEach.call(g.keys(n),function(e){var t;"items"!==e&&(t=e.replace(/^transaction_id$/,"id").replace(/^value$/,"revenue"),r[t]=n[e])}),e.ecommerce[t].actionField=r),e.ecommerce},containsItemWithItemId:function(e){return e.some(function(e){return e.hasOwnProperty("item_id")})},isGa4GtagValid:function(e){return"string"==typeof e[0]&&"event"===e[0]&&"string"==typeof e[1]&&this._events[e[1]]&&"object"==typeof e[2]&&e[2].items!==x&&this.containsItemWithItemId(e[2].items)},eventData:function(t,e){var e=JSON.parse(JSON.stringify(e)),n=(f.log("DataLayer:eventData - search ecommerce",e),null);return"object"==typeof e.ecommerce&&null!==e.ecommerce?(f.log("DataLayer:eventData - found ecommerce",e),"UA"!==t._gaVersion&&null!==t._gaVersion||(n=e.ecommerce),(["GA4","GA_4"].includes(t._gaVersion)||null===t._gaVersion)&&"object"==typeof e.ecommerce.items&&"string"==typeof e.event&&t._events[e.event]&&(n=t.ga4Parser(e.event,e.ecommerce))):["GA4_gtag","GA_4_TAG"].includes(t._gaVersion)&&t.isGa4GtagValid(e)&&(e={event:e[1],ecommerce:e[2]},n=t.ga4Parser(e.event,e.ecommerce)),n&&t._allowDataLayerAction.forEach(function(e){"object"==typeof n[e]&&"object"==typeof n[e].products&&("purchase"==e?t.trackPurchase(n,e):t.track(n,e))}),!0},getParamsCookie:function(e){var t={};try{var n=E.getJson(e);if(n)for(var r in n)n.hasOwnProperty(r)&&r.match("(snrs?|utm)_.*")&&(t[r]=n[r])}catch(e){f.log("DataLayer:eventData - parse snrs_params",item)}return t},observerPush:function(e,t){var n,r;
1this._initObserverPush||("function"!=typeof e.push?f.log("DataLayer:observerPush - dataLayer.push is not a function",item):(n=e.push,r=this,e.push=function(){try{f.log("DataLayer:observerPush - callback push",arguments[0]),t(r,arguments[0])}catch(e){try{f.error("DataLayer:observerPush - callback push error E: ",e)}catch(e){}}return n.apply(this,arguments)},this._initObserverPush=!0))},buildRequest:function(e,t){return{label:"datalayer.ecommerce",object:"datalayer."+t,params:{data:e,snrs_params:this.getParamsCookie("_snrs_params"),url:Ke.location.href}}},track:function(e,t){e=this.buildRequest(e,t);return T.trackProxy(e)},trackPurchase:function(e,t){if(e[t].actionField&&e[t].actionField.id){var n=e[t].actionField.id;if(!(-1<this._localOrders.indexOf(n)))return this.setLocalOrders(n),e=this.buildRequest(e,t),T.trackProxy(e);f.log("DataLayer:trackPurchase - duplicate transaction",n,this._localOrders)}},setLocalOrders:function(e){this._localOrders.push(e);var t=Math.floor(((new Date).getTime()+18e5)/1e3);k.setStringWithTtl("_snrs_orders",this._localOrders,t),f.log("DataLayer:setLocalOrders - set orders",e,this._localOrders)},getLocalOrders:function(){var e=k.getStringWithTtl("_snrs_orders");e&&(this._localOrders=e),f.log("DataLayer:getLocalOrders - get orders",this._localOrders)}},u={DEVICE_TYPE_DESKTOP:"desktop",DEVICE_TYPE_MOBILE:"mobile",_screen:null,_isCrawler:null,_isGoogleCrawler:null,_canSaveCookies:x,_crawlerExclusionList:null,_googleCrawlerList:["Googlebot","Mediapartners-Google","Google Web Preview","Web Preview","Feedfetcher","google\\.com/bot\\.html"],_crawlerList:["Googlebot","Mediapartners-Google","Web Preview","bot","Applebot","spider","crawler","Feedfetcher","Slurp","Twiceler","Nutch","BecomeBot","bingbot","BingPreview","Google Web Preview","WordPress.com mShots","Seznam","facebookexternalhit","Yandex","Teoma","ThumbSniper","Phantom","Nuhk","DuckDuckBot","sogou","Exabot","facebook","ia_archiver","slack","msnbot","adidxbot","Ask Jeeves","RuxitSynthetic"],init:function(){f.log("DeviceManager:init"),u._screen=u.getScreenInfo()},getScreenInfo:function(){var e,t=null,n=null,r=null,i=[],o=null,s=(screen?(t=screen.width+"x"+screen.height,n=screen.colorDepth+"-bit"):java&&(t=(s=java.awt.Toolkit.getDefaultToolkit().getScreenSize()).width+"x"+s.height),navigator.language?r=navigator.language.toLowerCase():navigator.browserLanguage?r=navigator.browserLanguage.toLowerCase():navigator.languages&&navigator.languages.length&&(r=navigator.languages[0].toLowerCase()),navigator.languages&&navigator.languages.length?i=navigator.languages:r&&i.push(r),document.characterSet?o=h.encodeString(document.characterSet):document.charset&&(o=h.encodeString(document.charset)),u.DEVICE_TYPE_DESKTOP);return t&&(e=t.split("x"),e=parseInt(e[0],10),s=u.DEVICE_TYPE_MOBILE,1024<e)&&(s=u.DEVICE_TYPE_DESKTOP),{encoding:o,resolution:t,color:n,language:r,deviceType:s=/Mobi|Android/i.test(navigator.userAgent)?u.DEVICE_TYPE_MOBILE:s,acceptLanguageList:i,isCrawler:u.isCrawler()}},getProtocol:function(){var e=void 0!==document.location.protocol?document.location.protocol:"https";return e=(e=e.replace(":","")).match("https?")?e:"https"},isCrawler:function(){var e,t;return!(m.getOption("allowGoogleBot")&&u.isGoogleCrawler()||(null===u._isCrawler&&(u._isCrawler=!1,e=navigator.userAgent||"",(e=u._crawlerExclusionList?e.replace(new RegExp(u._crawlerExclusionList.join("|"),"g"),"").trim():e)&&(t=new RegExp(u._crawlerList.join("|"),"g").exec(e),f.log("DeviceManager:isCrawler matches",e,t),t)&&t.length&&(u._isCrawler=!0),f.log("DeviceManager:isCrawler",u._isCrawler)),!u._isCrawler))},isGoogleCrawler:function(){var e;return null===u._isGoogleCrawler&&(e=navigator.userAgent||"",u._isGoogleCrawler=new RegExp(u._googleCrawlerList.join("|")).test(e),f.log("DeviceManager:isGoogleCrawler",u._isGoogleCrawler)),!!u._isGoogleCrawler},checkDeviceType:function(e){return f.log("DeviceManager:checkDeviceType",e),g.isString(e)&&(e=[e]),g.inArray(u._screen.deviceType,e)},getAcceptLanguageList:function(){return f.log("DeviceManager:getAcceptLanguageList",u._screen.acceptLanguageList),u._screen.acceptLanguageList},getLanguage:function(){return f.log("DeviceManager:getLanguage",u._screen.language),u._screen.language},getOsInfo:function(){var e,t=navigator.appVersion,n=navigator.userAgent,r=navigator.appName,i=""+parseFloat(navigator.appVersion),o=(parseInt(navigator.appVersion,10),-1!==(s=n.indexOf("Opera"))?(r="Opera",i=n.substring(s+6),-1!==(s=n.indexOf("Version"))&&(i=n.substring(s+8))):-1!==(s=n.indexOf("OPR/"))?(r="Opera",i=n.substring(s+4)):-1!==(s=n.indexOf("Edge"))?(r="Microsoft Edge",i=n.substring(s+5)):-1!==(s=n.indexOf("MSIE"))?(r="Microsoft Internet Explorer",i=n.substring(s+5)):-1!==(s=n.indexOf("Chrome"))?(r="Chrome",i=n.substring(s+7)):-1!==(s=n.indexOf("Safari"))?(r="Safari",i=n.substring(s+7),-1!==(s=n.indexOf("Version"))&&(i=n.substring(s+8))):-1!==(s=n.indexOf("Firefox"))?(r="Firefox",i=n.substring(s+8)):-1!==n.indexOf("Trident/")?(r="Microsoft Internet Explorer",i=n.substring(n.indexOf("rv:")+3)):(o=n.lastIndexOf(" ")+1)<(s=n.lastIndexOf("/"))&&(r=n.substring(o,s),i=n.substring(s+1),r.toLowerCase()==r.toUpperCase())&&(r=navigator.appName),-1!==(o=(i=-1!==(o=(i=-1!==(o=i.indexOf(";"))?i.substring(0,o):i).indexOf(" "))?i.substring(0,o):i).indexOf(")"))&&(i=i.substring(0,o)),s=parseInt(""+i,10),isNaN(s)&&(i=""+parseFloat(navigator.appVersion),parseInt(navigator.appVersion,10)),/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(t)),s=!!navigator.cookieEnabled,a=(void 0===navigator.cookieEnabled&&(s=s||this.canSaveCookies()),"-"),c=[{s:"BOT",r:/(Googlebot|Mediapartners-Google|Web Preview|bot|Applebot|spider|crawler|Feedfetcher|Slurp|Twiceler|Nutch|BecomeBot|bingbot|BingPreview|Google Web Preview|WordPress.com mShots|Seznam|facebookexternalhit|Yandex|Teoma|ThumbSniper|Phantom|Nuhk|DuckDuckBot|sogou|Exabot|facebook|ia_archiver|slack|msnbot|adidxbot|Ask Jeeves|RuxitSynthetic)/},{s:"Windows 3.11",r:/Win16/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/}
1,{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows ME",r:/Windows ME/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/}];for(e in c)if(c.hasOwnProperty(e)){var u=c[e];if(u.r.test(n)){a=u.s;break}}var l="-";switch(/Windows/.test(a)&&(l=/Windows (.*)/.exec(a)[1],a="Windows"),a){case"Mac OS X":var d=/Mac OS X (10[\.\_\d]+)/.exec(n);null!==d&&(l=d[1]);break;case"Android":l=/Android ([\.\_\d]+)/.exec(n)[1];break;case"iOS":l=(l=/OS (\d+)_(\d+)_?(\d+)?/.exec(n))[1]+"."+l[2]+"."+(0|l[3])}return{browser:r,browserVersion:i,mobile:o,os:a,osVersion:l,cookies:s}},canSaveCookies:function(){return this._canSaveCookies===x&&(document.cookie="testcookie=1",this._canSaveCookies=-1!==document.cookie.indexOf("testcookie"),document.cookie="testcookie=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),this._canSaveCookies},isBrowseIE:function(){f.log("DeviceManager:isBrowseIE");var e=u.getOsInfo();return!(!e||"Microsoft Internet Explorer"!=e.browser)}};function i(e,t){if(t=t||!0,(e=e||{}).options=e.options||{},this._container=null,this._nodes=[],this._status=i.STATUS_NEW,this.id=e.id||null,this.rawParams=e,this.subject=e.subject||null,this.displayType=e.dis
1playType||null,this.toReRender=e.containsJinjava||e.isSegment||null,this.isAbx=e.isABX||null,this.checkAbxVariantId=!1,this.isGlobalControlGroupEnabled=e.isGlobalControlGroupEnabled||null,this.isControlGroupEnabled=e.isControlGroup||null,this.controlGroupValue=e.options.controlGroup||0,this.isIncludeAudience=e.options.includeAudience||null,this.targetRestriction=new G(e.targetRestriction,!1),this.variants=[],Array.isArray(e.variants))for(var n in e.variants)e.variants.hasOwnProperty(n)&&(this.variants[n]=new v(e.variants[n],!1));this.createControlGroupVariant(),this.viewsPage=new K({include:e.viewsPageUrl,exclude:e.viewsExcludePageUrl},!1),this.utm=new Y(e.options.utm,!1),this.frequency=new s(e.frequency,!1),this.stopDisplay=new a(e.stopDisplay,!1),this.trigger=new y(e.trigger,!1),this.capping=new q(e.capping,!1),t&&this.validate()}i.prototype.createControlGroupVariant=function(){var e=this.isGlobalControlGroup();if(0!==this.controlGroupValue||e){var t=null,n=this.rawParams.variants[0];if(!n&&c._dynamicContents){for(var r,i=c._dynamicContents,o=0;o<i.length;o++)if(i[o].id===self.id){r=i[o];break}n=r&&r.variants?r.variants[0].options:{}}t=new v(n,!1),e?(t.getControlGroupVariant(this.id,100),this.variants=[t]):(t.getControlGroupVariant(this.id,this.controlGroupValue),this.variants.push(t))}},i.DISPLAY_TYPE_OPTIONS_LIST=[i.DISPLAY_TYPE_OBJECT="OBJECT",i.DISPLAY_TYPE_LAYER="LAYER"],i.STATUS_RENDERED="RENDERED",i.STATUS_TRIGGERED="TRIGGERED",i.STATUS_WAITING_TO_TRIGGER="WAITING_TO_TRIGGER",i.STATUS_NEW="NEW",i.prototype.validate=function(){if(!this.id)throw new Error("Invalid id");if(!this.displayType||-1===i.DISPLAY_TYPE_OPTIONS_LIST.indexOf(this.displayType))throw new Error('Display type ("'+self.displayType+'") is incorrect, only '+i.DISPLAY_TYPE_OPTIONS_LIST.join(",")+" is allowed");if(!Array.isArray(this.variants)||!this.variants.length)throw new Error("Invalid variants");for(var e=0;e<this.variants.length;e++){var t,n=this.variants[e];n.validate(),n.getTargetSelector();switch(this.displayType){case i.DISPLAY_TYPE_OBJECT:if(!(t=n.getTargetSelector()))throw new Error("Target selector not defined");
1if(!h.validateSelector(t))throw new Error("Target selector is invalid",this);if(n.getTargetSelectorPrefix())break;throw new Error("Target selector prefix not defined")}}return this.targetRestriction.validate(),this.viewsPage.validate(),this.utm.validate(),this.frequency.validate(),this.stopDisplay.validate(),this.trigger.validate(),this.capping.validate(),!0},i.prototype.hasNodes=function(){return!!this._nodes.length},i.prototype.getNodes=function(){return this._nodes},i.prototype.getObservableNodes=function(){var t=[],e=this._nodes;return g.each(e,function(e){1===e.nodeType&&e.nodeName&&!e.nodeName.toLowerCase().match(/style|script|meta|title|link|base|noscript/)&&t.push(e)}),t},i.prototype.getStatus=function(){return this._status},i.prototype.isToReRender=function(){return this.toReRender},i.prototype.isAbx=function(){return this.abx},i.prototype.getId=function(){return this.id},i.prototype.getSubject=function(){return this.subject},i.prototype.getRawParams=function(){return this.rawParams},i.prototype.getVariant=function(){return this.variant||(this.variant=this.pickVariant()),this.variant},i.prototype.pickVariant=function(){var e=null;if(1===this.variants.length)e=this.variants[0];
1else{for(var t,n=P.getCachedDynamicContentVariant(this.id),r=n?n.id:null,i=!1,o=0;o<this.variants.length;o++)n&&this.variants[o].getId()===n.id&&!n.checkId&&(i=!0),n&&n.checkId&&(this.checkAbxVariantId=!0);i||(t=this.drawVariant(),r=this.isAbx?(this.checkAbxVariantId=!0,this.toReRender=!0,P.cacheDynamicContentVariantId(this.id,t.getId(),!0)):P.cacheDynamicContentVariantId(this.id,t.getId()));for(o=0;o<this.variants.length;o++)if(this.variants[o].getId()==r){e=this.variants[o];break}}return e},i.prototype.drawVariant=function(){for(var e=0,t=0;t<this.variants.length;t++)e+=this.variants[t].getPercentage();for(var n=Math.ceil(Math.random()*e),t=0;t<this.variants.length;t++)if((n-=this.variants[t].getPercentage())<=0)return this.variants[t]},i.prototype.getVariantId=function(){return this.getVariant().getId()},i.prototype.getVariantName=function(){return this.getVariant().getName()},i.prototype.getContent=function(){return this.getVariant().getContent()},i.prototype.getTargetContainer=function(){var e=this.getVariant().getTargetSelector();return e?document.querySelector(e):null},i.prototype.getContentToRender=function(){return this.getVariant().getContentToRender()},i.prototype.isContentHtml=function(){return this.getVariant().isContentHtml()},i.prototype.isContentCss=function(){return this.getVariant().isContentCss()},i.prototype.isContentJs=function(){return this.getVariant().isContentJs()},i.prototype.isTriggerInstant=function(){return this.trigger.isInstant()},i.prototype.isRendered=function(){return this._status===i.STATUS_RENDERED},i.prototype.isDisplayTypeObject=function(){return this.displayType===i.DISPLAY_TYPE_OBJECT},i.prototype.setStatusRendered=function(){return this._status=i.STATUS_RENDERED,f.log("DynamicContent:setStatusRendered",this),this},i.prototype.setStatusWaitingToTrigger=function(){return this._status=i.STATUS_WAITING_TO_TRIGGER,f.log("DynamicContent:setStatusWaitingToTrigger",this),this},i.prototype.setStatusTriggered=function(){return this._status=i.STATUS_TRIGGERED,f.log("DynamicContent:setStatusTriggered",this),this},i.prototype.isStatusReadyToRender=function(){return g.inArray(this.getStatus(),[i.STATUS_NEW,i.STATUS_TRIGGERED])},i.prototype.isStatusNew=function(){return this.getStatus()===i.STATUS_NEW},i.prototype.isVisibleOnScreen=function(){return!!this.isRendered()&&h.isVisibleAtLeastOneElementOnScreen(this.getNodes())},i.prototype.checkIfNewClientIncluded=function(){return this.isIncludeAudience&&d.isNewClient()},i.prototype.isGlobalControlGroup=function(){var e=this.isGlobalControlGroupEnabled;return(!e||!this.checkIfNewClientIncluded())&&e&&d.checkGlobalControlGroupForClient()},i.prototype.isControlGroup=function(){return 0===this.getVariantId()||this.isGlobalControlGroup()},i.prototype.getControlGroupType=function(){return this.isGlobalControlGroup()?"global":"campaign"},i.prototype.getUtmWithParametersFlatMap=function(){return this.utm.getUtmWithParametersFlatMap()},i.prototype.render=function(){var r=this;return new Je(function(e,t){f.log("DynamicContent:render",r);var n=document.createDocumentFragment();(r.displayType===i.DISPLAY_TYPE_LAYER?r.renderLayer(n):r.renderObject(n)).then(e).catch(t)})},i.prototype.renderLayer=function(n){var r=this;return new Je(function(t,e){if(C.isShown())return e(new Error("Other layer shown"));g.containerInnerHtml(n,r.getContentToRender()),r._nodes=g.getNodesArray(n),c.attachHandlers(r).then(function(){var e;if(C.setContent(n),r._container=C._contentCtr,r.isContentJs()&&g.executeScriptsForNodes(r.getNodes()),r.setStatusRendered(),r.isControlGroup())return e={id:r.getId(),campaignName:r.getSubject(),type:r.getControlGroupType()},r.isGlobalControlGroup()&&d.isNewClient()&&(e.firstTimeVisitor=!0),b.trackClientEvent("","dynamicContent.controlGroup",e),t();C.show(),t()}).catch(e)})},i.prototype.renderObject=function(r){var i=this;return new Je(function(e,t){var n=i.getTargetContainer();g.containerInnerHtml(r,i.getContentToRender()),i._nodes=g.getNodesArray(r),c.attachHandlers(i).then(function(){i.renderObjectForContainerByPrefix(n,r,i.getVariant().getTargetSelectorPrefix()),i._container=n,i.isContentJs()&&g.executeScriptsForNodes(i.getNodes()),i.setStatusRendered(),e()}).catch(t)})},i.prototype.renderObjectForContainerByPrefix=function(e,t,n){switch(n){case v.TARGET_SELECTOR_PREFIX_BEFORE:this.renderObjectForContainerBefore(e,t);break;case v.TARGET_SELECTOR_PREFIX_AFTER:this.renderObjectForContainerAfter(e,t);break;case v.TARGET_SELECTOR_PREFIX_INNER:this.renderObjectForContainerInner(e,t)}},i.prototype.renderObjectForContainerBefore=function(e,t){if(!e.parentNode||e.parentNode.nodeType!==Node.ELEMENT_NODE||"html"===e.parentNode.nodeName.toLowerCase())throw f.error("DynamicContent:renderObjectForContainerBefore Invalid node to insert before",e,e.parentNode,this),new Error("Invalid node to insert before");g.insertBefore(e,t)},i.prototype.renderObjectForContainerAfter=function(e,t){if(!e.parentNode||e.parentNode.nodeType!==Node.ELEMENT_NODE||"html"===e.parentNode.nodeName.toLowerCase())throw f.error("DynamicContent:renderObjectForContainerBefore Invalid node to insert after",e,e.parentNode,this),new Error("Invalid node to insert after");g.insertAfter(e,t)};var c={_virtualPage:!(i.prototype.renderObjectForContainerInner=function(e,t){if("html"===e.nodeName.toLowerCase())throw f.error("DynamicContent:renderObjectForContainerBefore Invalid node to insert inner",e,this),new Error("Invalid node to insert inner");g.replaceChildren(e,t)}),_dynamicContents:null,_stylesUrl:[],_callbackStack:{customVariablesFunction:function(){return{}}},_selectorObservers:{},renderedDynamicContents:[],setCustomVariablesFunction:function(e){c._callbackStack.customVariablesFunction=e},prepareStyles:function(){var e=T.utils.getStyleUrl();return c._stylesUrl.push(e),$.loadStyles(c._stylesUrl)},init:function(n){return new Je(function(e,t){c.prepareStyles(),P.clearExpiredKeysFromStore(),!0===n.virtualPage&&(c._virtualPage=!0),e()})},mergeDynamicContent:function(r,t){return new Je(function(e){var n=[];t.forEach(function(i){var e=r.filter(function(e){return e.id===i.id})[0];if(e){var t,o=JSON.parse(JSON.stringify(e.getRawParams()));for(t in i.options.utm)i.options.utm.hasOwnProperty(t)&&(o.options.utm[t]=i.options.utm[t]);
1Array.isArray(i.variants)&&i.variants.forEach(function(t){var e=o.variants.filter(function(e){return e.id===t.id})[0],n=P.getCachedDynamicContentVariant(i.id);if(n&&n.checkId&&P.cacheDynamicContentVariantId(i.id,e.id),e)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}),n.push(o)}}),e(n)})},getDynamicContentByUuids:function(n,r){return new Je(function(e,t){T.getDynamicContentByUuids(n,r).then(T.utils.getDataKey).then(function(e){return c.mergeDynamicContent(r,e)}).then(c.parseDataToObjects).then(c.filterUnsupportedDynamicContents).then(function(e){return c.filterDynamicContentsForClient(n,e)}).then(e).catch(function(e){t(e)})})},getDynamicContentsFiltered:function(n){return new Je(function(e,t){T.getDynamicContentsFiltered(n).then(T.utils.getDataKey).then(c.parseDataToObjects).then(c.setDynamicContentsCache).then(c.filterUnsupportedDynamicContents).then(e).catch(function(e){t(e)})})},setDynamicContentsCache:function(n){return new Je(function(e,t){e(c._dynamicContents=n)})},findDynamicContenByUuid:function(i){return f.log("DynamicContentManager:findDynamicContenByUuid",i),new Je(function(e,t){var n,r=c._dynamicContents;return!r||(n=[],g.each(r,function(e){e.getId()==i&&n.push(e)}),0===n.length)?t(new Error("Can not find dynamic content")):e(n)})},getDynamicContentsForClient:function(n){return f.log("DynamicContentManager:getDynamicContentsForClient",n),new Je(function(e,t){c.getDynamicContentsFiltered(n).then(function(e){return f.log("DynamicContentManager:getDynamicContentsFiltered result",n),c.filterDynamicContentsForClient(n,e)}).then(e).catch(t)})},getDynamicContentByUuidsForClient:function(e,r){return f.log("DynamicContentManager:getgetDynamicContentByUuidsForClient",e),new Je(function(t,n){c.getDynamicContentByUuids(e,r).then(function(e){t(e)}).catch(function(e){n(e)})})},parseDataToObjects:function(r){return new Je(function(e,t){f.log("DynamicContentManager:parseToObjects");var n=[];if(!g.isEmpty(r)){I.primeGlobalControlGroupCache();try{g.each(r,function(t){try{var e=new i(t);n.push(e)}catch(e){f.error("DynamicContentManager:parseToObjects error",e,t)}})}finally{I.clearGlobalControlGroupCache()}}f.log("DynamicContentManager:parseToObjects after parse",n),e(n)})},filterDynamicContentsForClient:function(r,i){return f.log("DynamicContentManager:filterDynamicContentsForClient",r,i),new Je(function(e,t){var n=[];if(g.isEmpty(i))return e(n);g.each(i,function(e){c.checkStopDisplay(e,r)&&c.checkFrequency(e,r)&&n.push(e)}),e(n)})},checkFrequency:function(e){var t,n;return!e.frequency.isLimited()||(e.frequency.isSessionExpiration()&&(f.log("DynamicContentManager:checkFrequency renew session frequency expiration",e),c.renewFrequencyExpiration(e),t=setInterval(function(){f.log("DynamicContentManager:checkFrequency renew session frequency expiration after interval",e),c.renewFrequencyExpiration(e)},1e3*s.EXPIRATION_SESSION/10),setTimeout(function(){t&&(f.log("DynamicContentManager:checkFrequency stop renewing session frequency - timeout",e),clearInterval(t))},1e3*s.EXPIRATION_ON_PAGE_FOR_SESSION)),n=c.getFrequencyValue(e),f.log("DynamicContentManager:checkFrequency frequencyValueStored",n),!e.frequency.checkFrequencyLimit(n))||(f.info("DynamicContentManager:checkFrequency - invalid",n),!1)},renewFrequencyExpiration:function(e){return e.frequency.isLimited()?(e=P.renewFrequencyExpiration(e))?e.value:null:0},incrementFrequencyValue:function(e){return e.frequency.isLimited()?P.incrementFrequency(e).value:0},getFrequencyValue:function(e){return e.frequency.isLimited()?(e=P.getFrequencyWithCheckExpiration(e))?e.value:null:0},filterUnsupportedDynamicContents:function(r){return new Je(function(e,t){f.log("DynamicContentManager:filterUnsupportedDynamicContents",r);var n=[];if(g.isEmpty(r))return e(n);g.each(r,function(e){c.checkDevices(e)&&c.checkViewsPage(e)&&n.push(e)}),e(n)})},renderBatchDynamicContents:function(i){return new Je(function(e,t){f.log("DynamicContentManager:renderBatchDynamicContents",i);var n=[],r=[];if(g.isEmpty(i))return e(n);g.each(i,function(e){(!e.isStatusReadyToRender()||!c.checkViewsPage(e)||e.isStatusNew()&&!e.isTriggerInstant()||e.isDisplayTypeObject()&&!e.getTargetContainer()||!e.isToReRender()?n:r).push(e)}),f.log("DynamicContentManager:renderBatchDynamicContents::batched",r),0<r.length&&c.reRen
1derDynamicContents(r),e(n)})},checkDevices:function(e){var t,n,r,i=e.targetRestriction.getDevices();return!(i.length&&!u.checkDeviceType((t=i,(n={})[G.TARGET_RESTRICTION_DESKTOP]=u.DEVICE_TYPE_DESKTOP,n[G.TARGET_RESTRICTION_MOBILE]=u.DEVICE_TYPE_MOBILE,r=[],g.each(t,function(e){r.push(n[e]||e)}),r))&&(f.info("DynamicContentManager:validDevices - invalid",i,e),1))},checkViewsPage:function(e){return!!e.viewsPage.isMatchPageUrl(location.href)||(f.info("DynamicContentManager:checkViewsPage - invalid",location.href,e),!1)},attachTrigger:function(e){if(f.info("DynamicContentManager:attachTrigger",e,e.getStatus()),!e.isStatusNew()||e.isTriggerInstant())return Je.resolve();switch(e.setStatusWaitingToTrigger(),e.trigger.getType()){case y.TYPE_ON_LANDING:return c.attachTriggerOnLanding(e);case y.TYPE_ON_EXIT:return c.attachTriggerOnExit(e);case y.TYPE_ON_DEMAND:return c.attachTriggerOnDemand(e);case y.TYPE_AFTER_SCROLL:return c.attachTriggerAfterScroll(e)}},attachTriggerOnLanding:function(e){var t,n,r;return f.info("DynamicContentManager:attachTriggerOnLanding",e,e.trigger.isDelay()),e.trigger.isDelay()&&(t=function(){P.removeTimeForDelay(e),c.renderDynamicContentForClientAfterTriggered(e)},n=new Date,r=P.getTimeForDelay(e),f.info("DynamicContentManager:attachTriggerOnLanding stored date time",r,e),null===r?r=P.setTimeForDelay(e,n):P.renewTimeForDelay(e),0<(r=r.getTime()-n.getTime())?(f.log("DynamicContentManager:attachTriggerOnLanding set timeout",r,e),setTimeout(function(){t()},r)):t()),Je.resolve()},attachTriggerOnExit:function(n){return f.info("DynamicContentManager:attachTriggerOnExit",n),h.addEvent(document,"mouseout",function e(t){t.clientY<=0&&(h.removeEvent(document,"mouseout",e),g.preventDefault(t),f.info("DynamicContentManager:attachTriggerOnExit mouseOut",t.clientY,n),c.checkFrequency(n))&&c.renderDynamicContentForClientAfterTriggered(n)}),Je.resolve()},attachTriggerOnDemand:function(e){return f.info("DynamicContentManager:attachTriggerOnDemand",e),Je.resolve()},attachTriggerAfterScroll:function(n){var r;function e(e){var t=h.getScrollPercentage();return!!n.trigger.checkScrollingAchieved(t)&&(r&&clearInterval(r),f.info("DynamicContentManager:attachTriggerAfterScroll scrollPercentage achieved",t,n),c.renderDynamicContentForClientAfterTriggered(n),!0)}return f.info("DynamicContentManager:attachTriggerAfterScroll",n,n.trigger.isDelay()),e()||(r=setInterval(e,250)),Je.resolve()},attachHandlerForTrackEventShow:function(n){var t,r,e;function i(e){return!!n.isVisibleOnScreen()&&(t&&clearInterval(t),f.info("DynamicContentManager:attachHandlerForTrackEventShow dc is visible on screen",n),b.trackDynamicContentEventShow(n),!0)}return f.info("DynamicContentManager:attachHandlerForTrackEventShow",n),"IntersectionObserver"in Ke&&"IntersectionObserverEntry"in Ke&&"intersectionRatio"in Ke.IntersectionObserverEntry.prototype?0<(e=n.getObservableNodes()).length&&(r=new IntersectionObserver(function(e,t){e[0].isIntersecting&&(f.info("DynamicContentManager:attachHandlerForTrackEventShow dc is visible on screen",n),b.trackDynamicContentEventShow(n),t.disconnect())},{}),g.each(e,function(e){r.observe(e)})):i()||(t=setInterval(i,200)),Je.resolve()},attachTargetSelectorObserver:function(t){if(f.log("DynamicContentManager:attachTargetSelectorObserver",t),!c._selectorObservers[t.getId()]&&!1===c._virtualPage)try{var e=document.body||document,n=MutationObserver||WebKitMutationObserver||null,r="function"==typeof n,i=h.debounce(function(){t.getTargetContainer()&&(f.log("DynamicContentManager:attachTargetSelectorObserver::findTargetSelector",t),f.log("DynamicContentManager:attachTargetSelectorObserver::stopObserve",t),c._selectorObservers[t.getId()]&&(r?c._selectorObservers[t.getId()].disconnect():clearInterval(c._selectorObservers[t.getId()]),c._selectorObservers[t.getId()]=null),c.renderDynamicContentForClientAfterTriggered(t))},300,!1);r?(c._selectorObservers[t.getId()]=new n(i),c._selectorObservers[t.getId()].observe(e,{childList:!0,subtree:!0,attributes:!0})):c._selectorObservers[t.getId()]=setInterval(i,200)}catch(e){f.error("DynamicContentManager:attachTargetSelectorObserver::catch",e,t)}return Je.resolve()}
1,reRenderDynamicContents:function(t){return d.getCurrentClient().then(function(e){e.renderDynamicContentByUuids(t)}),Je.resolve()},renderDynamicContentForClientAfterTriggered:function(e){f.info("DynamicContentManager:renderDynamicContentAfterTriggered",e),e.setStatusTriggered(),c.renderDynamicContentForCurrentClient(e)},renderDynamicContentForCurrentClient:function(n){return f.info("DynamicContentManager:renderDynamicContentForCurrentClient",n),new Je(function(e,t){d.getCurrentClient().then(function(e){return e.renderDynamicContent(n)}).then(e).catch(t)})},attachHandlers:function(e){return f.info("DynamicContentManager:attachHandlers",e,e.hasNodes()),e.hasNodes()?Je.all([c.attachHandlersForStopDisplaySettings(e)]):(f.info("DynamicContentManager:attachHandlers Nodes list empty",e),Je.resolve())},attachHandlersForStopDisplaySettings:function(t){if(f.info("DynamicContentManager:attachHandlersForStopDisplaySettings",t,t.stopDisplay.isStopAfterAction()),!t.stopDisplay.isStopAfterAction())return Je.resolve();function e(e){f.info("DynamicContentManager:attachHandlersForStopDisplaySettings handler",e,t),c.stopDisplayAnymore(t)}h.attachHandlerForElements(g.getElementsByTagNameIncludesItself(t.getNodes(),"a"),"click",e,!1),h.attachHandlerForElements(g.getElementsByTagNameIncludesItself(t.getNodes(),"button"),"click",e,!1)},stopDisplayAnymore:function(e){return P.stopDisplay(e)},checkStopDisplay:function(e){return f.info("DynamicContentManager:checkStopDisplay",e,e.stopDisplay.isStopDefined()),!e.stopDisplay.isStopDefined()||!P.checkStopDisplay(e)||(f.info("DynamicContentManager:checkStopDisplay - stopped",e),!1)},incrementViewsForStopDisplay:function(e){var t,n;return e.stopDisplay.isStopAfterShow()?(t=P.incrementViewsForStopDisplay(e),n=c.getViewsForStopDisplay(e),f.log("DynamicContentManager:incrementViewsForStopDisplay viewsValueStored",n),e.stopDisplay.checkShowTimesLimit(n)&&(f.info("DynamicContentManager:incrementViewsForStopDisplay - views limit achieved",n),c.stopDisplayAnymore(e),P.removeViewsForStopDisplay(e)),t):0},getViewsForStopDisplay:function(e){return e.stopDisplay.isStopAfterShow()?P.getViewsForStopDisplay(e):0},onAfterDynamicContentRender:function(n,e){return new Je(function(e,t){new Je(function(e,t){if(f.log("Client:renderDynamicContent increment views",n.isRendered(),n.capping.isLimited(),n),!n.isRendered()||!n.capping.isLimited())return e();T.incrementDynamicContentViews(n),e()}).then(function(){return new Je(function(e,t){if(f.log("Client:renderDynamicContent incrementFrequency",n.frequency.isLimited(),n),!n.isRendered()||!n.frequency.isLimited())return e();c.incrementFrequencyValue(n),e()})}).then(function(){return new Je(function(e,t){if(f.log("Client:renderDynamicContent incrementFrequency",n.frequency.isLimited(),n),!n.isRendered()||!n.stopDisplay.isStopAfterShow())return e();c.incrementViewsForStopDisplay(n),e()})}).then(function(){return new Je(function(e,t){return f.log("Client:renderDynamicContent track show",n.isRendered(),n),n.isRendered()?c.attachHandlerForTrackEventShow(n):e()})}).then(e).catch(t)})},renderDynamicContentForClient:function(n,r){return new Je(function(e,t){f.log("DynamicContentManager:renderDynamicContentForClient",r,n.isStatusReadyToRender(),n.getStatus(),n),(n.isStatusReadyToRender()&&c.checkViewsPage(n)?n.isStatusNew()&&!n.isTriggerInstant()?c.attachTrigger(n):n.isDisplayTypeObject()&&!n.getTargetContainer()?c.attachTargetSelectorObserver(n):n.isToReRender()?c.reRenderDynamicContents([n]):n.render().then(function(){return c.renderedDynamicContents.push(n),c.onAfterDynamicContentRender(n,r)}):Je.resolve(!1)).then(function(){e(n.isRendered())}).catch(function(e){f.error(e,self,n),t(new Error("Can not render dynamic content"))})})},reRenderDynamicContentForClient:function(n,r){return new Je(function(e,t){f.log("DynamicContentManager:reRenderDynamicContentForClient",r,n.isStatusReadyToRender(),n.getStatus(),n),(n.isStatusReadyToRender()?n.render().then(function(){return c.renderedDynamicContents.push(n),c.onAfterDynamicContentRender(n,r)}):Je.resolve(!1)).then(function(){e(n.isRendered())}
1).catch(function(e){f.error(e,self,n),t(new Error("Can not reRender dynamic content"))})})},getRenderedDynamicContent:function(){return c.renderedDynamicContents},getVariables:function(){try{var t=this._callbackStack.customVariablesFunction()}catch(e){f.error("DynamicContentManager:getVariables -> customVariablesFunction error",e),t={}}try{var n=SyneriseTC.getOgTag()}catch(e){f.error("DynamicContentManager:getVariables -> SyneriseTC.getOgTag error",e),n={}}var e,r=g.extend({},n="object"!=typeof n?{}:n,t="object"!=typeof t?{}:t);for(e in r)"string"!=typeof r[e]&&delete r[e];return r},getDynamicContentPreview:function(n,r){return new Je(function(e,t){T.getDynamicContentPreview(n,r).then(e).catch(function(e){V.showPreviewAlert(),t(e)})})},renderDynamicContentPreview:function(){var e=Ke.location.search,e=new URLSearchParams(e).get("snr_preview"),t=JSON.parse(h.atou(e));d.getCurrentClient().then(function(e){e=t.customerUuid||e.uuid;c.getDynamicContentPreview(t.id,e).then(function(e){new r(g.extend(e,t),!0).render()})})}};function r(e,t){this._nodes=[],this._container=null,this.options=g.extend({templateId:null,html:"",css:"",js:"",selector:null,selectorPrefix:null},e),t&&this.validate()}r.TARGET_SELECTOR_PREFIX_OPTIONS_LIST=[r.TARGET_SELECTOR_PREFIX_BEFORE="BEFORE",r.TARGET_SELECTOR_PREFIX_AFTER="AFTER",r.TARGET_SELECTOR_PREFIX_INNER="INNER"],r.prototype.getNodes=function(){return this._nodes},r.prototype.getTargetSelectorPrefix=function(){return this.options.selectorPrefix},r.prototype.getContent=function(){return this.options},r.prototype.isContent=function(){return this.isContentHtml()||this.isContentCss()||this.isContentJs()},r.prototype.isContentHtml=function(){return!!this.getContent().html},r.prototype.isContentCss=function(){return!!this.getContent().css},r.prototype.isContentJs=function(){return!!this.getContent().js},r.prototype.getTargetSelector=function(){return this.options.selector},r.prototype.getContentHtml=function(){return this.getContent().html},r.prototype.getContentCss=function(){return this.getContent().css},r.prototype.getContentJs=function(){return this.getContent().js},r.prototype.getContentHtmlToRender=function(){return this.getContentHtml()},r.prototype.getContentCssToRender=function(){return'<style type="text/css">'+this.getContentCss()+"</style>"},r.prototype.getContentJsToRender=function(){return'<script type="application/javascript">'+this.getContentJs()+"<\/script>"},r.prototype.getTargetContainer=function(){var e=this.getTargetSelector();return e?document.querySelector(e):null},r.prototype.getContentToRender=function(){var e="";return this.isContentCss()&&(e+=this.getContentCssToRender()),this.isContentHtml()&&(e+=this.getContentHtmlToRender()),this.isContentJs()&&(e+=this.getContentJsToRender()),e},r.prototype.validate=function(){var e=this.getTargetSelector(),t=this.getTargetSelectorPrefix(),n=this.isContent();if(t&&!g.inArray(t,r.TARGET_SELECTOR_PREFIX_OPTIONS_LIST))throw new Error('Target selector prefix ("'+t+'") is incorrect, only ['+r.TARGET_SELECTOR_PREFIX_OPTIONS_LIST.join(",")+"] is allowed");if(e&&!h.validateSelector(e))throw new Error("Target selector is invalid",this);if(n)return!0;throw V.showJinjavaAlert(),new Error("Empty preview response",this)},r.prototype.render=function(){var r=this;return new Je(function(e,t){f.log("DynamicContentPreview:render",r);var n=document.createDocumentFragment();(r.getTargetSelector()&&r.getTargetSelectorPrefix()?r.renderObject(n):r.renderLayer(n)).then(e).catch(t)})},r.prototype.renderLayer=function(n){var r=this;return new Je(function(e,t){if(C.isShown())return t(new Error("Other layer shown"));g.containerInnerHtml(n,r.getContentToRender()),r._nodes=g.getNodesArray(n),C.setContent(n),r._container=C._contentCtr,r.isContentJs()&&g.executeScriptsForNodes(r.getNodes()),C.show(),e()})},r.prototype.renderObject=function(r){var i=this;return new Je(function(e,t){var n=i.getTargetContainer();n||V.showSelectorAlert(),g.containerInnerHtml(r,i.getContentToRender()),i._nodes=g.getNodesArray(r),i.renderObjectForContainerByPrefix(n,r,i.getTargetSelectorPrefix()),i._container=n,i.isContentJs()&&g.executeScriptsForNodes(i.getNodes()),e()})},r.prototype.renderObjectForContainerByPrefix=function(e,t,n){switch(n){case r.TARGET_SELECTOR_PREFIX_BEFORE:this.renderObjectForContainerBefore(e,t);break;case r.TARGET_SELECTOR_PREFIX_AFTER:this.renderObjectForContainerAfter(e,t);break;case r.TARGET_SELECTOR_PREFIX_INNER:this.renderObjectForContainerInner(e,t)}},r.prototype.renderObjectForContainerBefore=function(e,t){if(!e.parentNode||e.parentNode.nodeType!==Node.ELEMENT_NODE||"html"===e.parentNode.nodeName.toLowerCase())throw f.error("DynamicContentPreview:renderObjectForContainerBefore Invalid node to insert before",e,e.parentNode,this),new Error("Invalid node to insert before");g.insertBefore(e,t)},r.prototype.renderObjectForContainerAfter=function(e,t){if(!e.parentNode||e.parentNode.nodeType!==Node.ELEMENT_NODE||"html"===e.parentNode.nodeName.toLowerCase())throw f.error("DynamicContentPreview:renderObjectForContainerBefore Invalid node to insert after",e,e.parentNode,this),new Error("Invalid node to insert after");g.insertAfter(e,t)},r.prototype.renderObjectForContainerInner=function(e,t){if("html"===e.nodeName.toLowerCase())throw f.error("DynamicContentPreview:renderObjectForContainerBefore Invalid node to insert inner",e,this),new Error("Invalid node to insert inner");g.replaceChildren(e,t)};var V={_icon:'<svg viewBox="0 0 48 48"><path d="M20.591 10.124c1.442-2.499 5.047-2.499 6.49 0l13.833 23.961c1.443 2.497-.36 5.62-3.243 5.62H10c-2.884 0-4.687-3.122-3.245-5.62zm5.19.75c-.865-1.498-3.026-1.498-3.89 0L8.054 34.836c-.864 1.497.217 3.37 1.947 3.37H37.67c1.728 0 2.81-1.873 1.944-3.37zM23.75 30.85a.75.75 0 01.743.649l.007.101v1.16a.75.75 0 01-1.493.101L23 32.76v-1.159a.75.75 0 01.75-.75zm0-11.351a.75.75 0 01.743.648l.007.102v7.763a.75.75 0 01-1.493.101L23 28.013V20.25a.75.75 0 01.75-.75z"></path></svg>',_language:"EN",_i18n:{EN:{title:"Invalid preview of the Dynamic Content",preview:"The preview of the dynamic content has expired or may not exist. It has been 3 days since the link was generated, or the link may have been incorrect",selector:"The entered CSS selector does not exist on the target page",jinjava:"The JinJava used in the template cannot be rendered correctly"},PL:{title:"Podgląd kampanii Dynamic Content niedostępny",preview:"Podgląd kampanii Dynamic Content wygasł lub nie istnieje. Po trzech dniach od wygenerowania podglądu, zostaje on automatycznie usunięty. Sprawdź czy link jest poprawny lub wygeneruj nowy",selector:"Selektor 
1CSS nie istnieje na stronie, na której uruchomiony jest podgląd",jinjava:"Kod JinJavy użyty w szablonie nie może zostać wyrenderowany dla wybranego profilu"}},prepareContent:function(e){var t=document.createElement("div"),n=(h.addClass(t,"snrs-preview-wrapper"),document.createElement("div")),r=(h.addClass(n,"snrs-preview-content"),document.createElement("p")),i=(h.addClass(r,"snrs-preview-title"),document.createElement("p")),o=(h.addClass(i,"snrs-preview-description"),u.getLanguage());return o&&o.toLowerCase().match("pl")&&(this._language="PL"),r.textContent=this._i18n[this._language].title,i.textContent=this._i18n[this._language][e],n.innerHTML=this._icon,n.appendChild(r),n.appendChild(i),t.appendChild(n),t},showAlertModal:function(e){C.addClassName("snrs-live-preview"),C.setContent(e),C.show()},showJinjavaAlert:function(){var e=this.prepareContent("jinjava");this.showAlertModal(e)},showPreviewAlert:function(){var e=this.prepareContent("preview");this.showAlertModal(e)},showSelectorAlert:function(){var e=this.prepareContent("selector");this.showAlertModal(e)}};function q(e,t){t=t||!0,e=e||{},this.viewsLimit=null,e.viewsLimit&&(this.viewsLimit=parseInt(e.viewsLimit,10)),t&&this.validate()}function s(e,t){t=t||!0,e=e||{},this._count=null,this._expiration=null,this.type=e.type,this.options=g.extend({count:null,times:null,timesType:null},e.options),this.options.count=this.options.count?parseInt(this.options.count,10):null,this.options.times=this.options.times?parseInt(this.options.times,10):null,this.calculateCountAndExpiration(),t&&this.validate()}function a(e,t){t=t||!0,e=e||{},this._count=null,this._expiration=null,this.type=e.type,this.options=g.extend({times:null},e.options),this.options.times=this.options.times?parseInt(this.options.times,10):null,t&&this.validate()}function G(e,t){t=t||!0,this.options=e||[],t&&this.validate()}function y(e,t){switch(t=t||!0,e=e||{},this._delayInSeconds=null,this.type=e.type,this.options={},this.type){case y.TYPE_ON_LANDING:this.options=g.extend({delayType:null,delayValue:null},e.options),this.options.delayValue=this.options.delayValue?parseInt(this.options.delayValue,10):null,this.calculateDelayInSeconds();break;case y.TYPE_AFTER_SCROLL:this.options=g.extend({scrollingPercentage:null},e.options),this.options.scrollingPercentage=this.options.scrollingPercentage?parseInt(this.options.scrollingPercentage,10):null}t&&this.validate()}function Y(e,t){t=t||!0,this.utm={utmCampaign:(e=e||{}).utmCampaign,utmMedium:e.utmMedium,utmSource:e.utmSource},this.parameters=g.extend({},e.parameters),t&&this.validate()}function v(e,t){t=t||!0,this.options=g.extend({id:null,name:null,percentage:null,content:{css:"",html:"",js:"",raw:""},selector:null,selectorPrefix:null},e),t&&this.validate()}function K(e,t){t=t||!0,this.options=g.extend({},{include:[],exclude:[]},e),t&&this.validate()}q.prototype.validate=function(){if(null!==this.viewsLimit&&isNaN(this.viewsLimit))throw new Error("Invalid views limit");return!0},q.prototype.isLimited=function(){return null!==this.viewsLimit},q.prototype.getViewsLimit=function(){return this.viewsLimit},s.TYPE_OPTIONS_LIST=[s.TYPE_ALWAYS="ALWAYS",s.TYPE_ONCE="ONCE",s.TYPE_ONCE_PER_VISIT="ONCE_PER_VISIT",s.TYPE_ONCE_PER_DAY="ONCE_PER_DAY",s.TYPE_MAXIMUM="MAXIMUM"],s.TIME_TYPE_OPTIONS_LIST=[s.TIME_TYPE_HOURS="HOURS",s.TIME_TYPE_DAYS="DAYS",s.TIME_TYPE_WEEKS="WEEKS"],s.EXPIRATION_SESSION=300,s.EXPIRATION_ON_PAGE_FOR_SESSION=1800,s.EXPIRATION_HOUR=3600,s.EXPIRATION_DAY=86400,s.EXPIRATION_WEEK=604800,s.EXPIRATION_MAX_VALUE=2592e3,s.prototype.validate=function(){var e=this.getType();if(!g.inArray(e,s.TYPE_OPTIONS_LIST))throw new Error('Frequency type ("'+e+'") is incorrect, only ['+s.TYPE_OPTIONS_LIST.join(",")+"] is allowed");if(e===s.TYPE_MAXIMUM){if(!g.inArray(this.options.timesType,s.TIME_TYPE_OPTIONS_LIST))throw new Error('Frequency time type ("'+this.options.timesType+'") is incorrect, only ['+s.TIME_TYPE_OPTIONS_LIST.join(",")+"] is allowed");if(null===this.options.count||isNaN(this.options.count))throw new Error("Invalid count limit");if(null===this.options.times||isNaN(this.options.times))throw new Error("Invalid times limit")}return!0},s.prototype.isLimited=function(){return this.getType()!==s.TYPE_ALWAYS},s.prototype.getType=function(){return this.type},s.prototype.getExpiration=function(){return this._expiration},s.prototype.isExpiration=function(){return null!==this._expiration},s.prototype.isSessionExpiration=function(){return this.isExpiration()&&this.getType()===s.TYPE_ONCE_PER_VISIT},s.prototype.getCount=function(){return this._count},s.prototype.isCount=function(){return null!==this._count},s.prototype.calculateCountAndExpiration=function(){switch(this.type){case s.TYPE_ALWAYS:this._count=null,this._expiration=null;break;case s.TYPE_ONCE:this._count=1,this._expiration=s.EXPIRATION_MAX_VALUE;break;case s.TYPE_ONCE_PER_VISIT:this._count=1,this._expiration=s.EXPIRATION_SESSION;break;case s.TYPE_ONCE_PER_DAY:this._count=1,this._expiration=s.EXPIRATION_DAY;break;case s.TYPE_MAXIMUM:if(this._count=isNaN(this.options.count)?null:this.options.count,(this._expiration=null)!==this._count&&!isNaN(this.options.times))switch(this.options.timesType){case s.TIME_TYPE_HOURS:this._expiration=this.options.times*s.EXPIRATION_HOUR;break;case s.TIME_TYPE_DAYS:this._expiration=this.options.times*s.EXPIRATION_DAY;break;case s.TIME_TYPE_WEEKS:this._expiration=this.options.times*s.EXPIRATION_WEEK}}},s.prototype.checkFrequencyLimit=function(e){return f.log("DynamicContentFrequency:checkFrequencyLimit",e,this._count,this),this.isCount()&&this.getCount()<=e},a.TYPE_OPTIONS_LIST=[a.TYPE_NEVER="NEVER",a.TYPE_AFTER_ACTION="AFTER_ACTION",a.TYPE_AFTER_SHOW="AFTER_SHOW"],a.STOP_DISPLAY_EXPIRATION_MAX_VALUE=2592e3,a.prototype.validate=function(){var e=this.getType();if(!g.inArray(e,a.TYPE_OPTIONS_LIST))throw new Error('Stop display type ("'+e+'") is incorrect, only ['+a.TYPE_OPTIONS_LIST.join(",")+"] is allowed");if(e!==a.TYPE_AFTER_SHOW||null!==this.options.times&&!isNaN(this.options.times))return!0;throw new Error("Invalid times limit")},a.prototype.isStopDefined=function(){return this.getType()!==a.TYPE_
1NEVER},a.prototype.getType=function(){return this.type},a.prototype.getShowTimes=function(){return this.options.times},a.prototype.isShowTimes=function(){return this.isStopAfterShow()},a.prototype.isStopAfterShow=function(){return this.getType()===a.TYPE_AFTER_SHOW},a.prototype.isStopAfterAction=function(){return this.getType()===a.TYPE_AFTER_ACTION},a.prototype.checkShowTimesLimit=function(e){return f.log("DynamicContentStopDisplay:checkShowTimesLimit",e,this.getShowTimes(),this),this.isShowTimes()&&this.getShowTimes()<=e},G.TARGET_RESTRICTION_OPTIONS_LIST=[G.TARGET_RESTRICTION_MOBILE="MOBILE",G.TARGET_RESTRICTION_DESKTOP="DESKTOP"],G.prototype.validate=function(){var e;if(Array.isArray(this.options))return(e=this.getDevices()).length&&g.each(e,function(e){if(!g.inArray(e,G.TARGET_RESTRICTION_OPTIONS_LIST))throw new Error('Target selector prefix ("'+e+'") is incorrect, only ['+G.TARGET_RESTRICTION_OPTIONS_LIST.join(",")+"] is allowed")}),!0;throw new Error("Invalid target restriction options")},G.prototype.getDevices=function(){return this.options},y.TYPE_OPTIONS_LIST=[y.TYPE_ON_LANDING="ON_LANDING",y.TYPE_ON_EXIT="ON_EXIT",y.TYPE_AFTER_SCROLL="AFTER_SCROLL",y.TYPE_ON_DEMAND="ON_DEMAND"],y.DELAY_TYPE_OPTIONS_LIST=[y.DELAY_TYPE_SECONDS="SECONDS",y.DELAY_TYPE_MINUTES="MINUTES"],y.TRIGGER_DELAY_EXPIRATION_VALUE=300,y.prototype.validate=function(){var e=this.getType();if(!g.inArray(e,y.TYPE_OPTIONS_LIST))throw new Error('Trigger type ("'+e+'") is incorrect, only ['+y.TYPE_OPTIONS_LIST.join(",")+"] is allowed");switch(e){case y.TYPE_ON_LANDING:if(null!==this.options.delayValue){if(isNaN(this.options.delayValue))throw new Error("Invalid delay value");if(!g.inArray(this.options.delayType,y.DELAY_TYPE_OPTIONS_LIST))throw new Error('Delay type ("'+this.options.delayType+'") is incorrect, only ['+y.DELAY_TYPE_OPTIONS_LIST.join(",")+"] is allowed")}break;case y.TYPE_AFTER_SCROLL:if(null===this.options.scrollingPercentage||isNaN(this.options.scrollingPercentage))throw new Error("Invalid scrolling percentage")}return!0},y.prototype.isInstant=function(){return this.getType()===y.TYPE_ON_LANDING&&!this.isDelay()},y.prototype.getType=function(){return this.type},y.prototype.isDelay=function(){return null!==this.options.delayValue},y.prototype.getDelay=function(){return this.options.delayValue},y.prototype.getDelayType=function(){return this.options.delayType},y.prototype.getScrollingPercentage=function(){return this.options.scrollingPercentage},y.prototype.isTypeOnLanging=function(){return this.getType()===y.TYPE_ON_LANDING},y.prototype.isTypeOnDemand=function(){return this.getType()===y.TYPE_ON_DEMAND},y.prototype.isTypeOnExit=function(){return this.getType()===y.TYPE_ON_EXIT},y.prototype.isTypeAfterScroll=function(){return this.getType()===y.TYPE_AFTER_SCROLL},y.prototype.getDelayInSeconds=function(){return this._delayInSeconds},y.prototype.isDelayInSeconds=function(){return null!==this._delayInSeconds},y.prototype.calculateDelayInSeconds=function(){if(null!==this.options.delayValue&&!isNaN(this.options.delayValue))switch(this.options.delayType){case y.DELAY_TYPE_SECONDS:this._delayInSeconds=this.options.delayValue;break;case y.DELAY_TYPE_MINUTES:this._delayInSeconds=60*this.options.delayValue}},y.prototype.checkScrollingAchieved=function(e){return this.isTypeAfterScroll()&&this.getScrollingPercentage()<=e},Y.prototype.validate=function(){return!0},Y.prototype.getUtm=function(){return this.utm},Y.prototype.getUtmCampaign=function(){return this.utm.utmCampaign},Y.prototype.getUtmMedium=function(){return this.utm.utmMedium},Y.prototype.getUtmSource=function(){return this.utm.utmSource},Y.prototype.getParameters=function(){return this.parameters},Y.prototype.getUtmWithParametersFlatMap=function(){return g.extend({},this.getParameters(),this.getUtm())},v.TARGET_SELECTOR_PREFIX_OPTIONS_LIST=[v.TARGET_SELECTOR_PREFIX_BEFORE="BEFORE",v.TARGET_SELECTOR_PREFIX_AFTER="AFTER",v.TARGET_SELECTOR_PREFIX_INNER="INNER"],v.prototype.validate=function(){if(!this.getName())throw new Error("Name not defined");var e=this.getTargetSelectorPrefix();if(e&&!g.inArray(e,v.TARGET_SELECTOR_PREFIX_OPTIONS_LIST))throw new Error('Target selector prefix ("'+e+'") is incorrect, only ['+v.TARGET_SELECTOR_PREFIX_OPTIONS_LIST.join(",")+"] is allowed");return!0},v.prototype.getId=function(){return this.options.id},v.prototype.getName=function(){return this.options.name},v.prototype.getPercentage=function(){return this.options.percentage},v.prototype.getControlGroupVariant=function(e,t){this.options.id=0,this.options.name="Control group",this.options.percentage=t,this.options.selectorPrefix="BEFORE",this.options.content={css:"",html:'<html><head></head><body><div id="snrs-campaign-'+e+'" class="snrs-control-group"></div></body></html>',js:""}},v.prototype.getContent=function(){return this.options.content},v.prototype.getTargetSelector=function(){return this.options.selector},v.prototype.getTargetSelectorPrefix=function(){return this.options.selectorPrefix},v.prototype.isContent=function(){return this.isContentHtml()||this.isContentCss()||this.isContentJs()},v.prototype.isContentHtml=function(){return!!this.getContent().html},v.prototype.isContentCss=function(){return!!this.getContent().css},v.prototype.isContentJs=function(){return!!this.getContent().js},v.prototype.getContentHtml=function(){return this.getContent().html},v.prototype.getContentCss=function(){return this.getContent().css},v.prototype.getContentJs=function(){return this.getContent().js},v.prototype.getContentToRender=function(){var e="";return this.isContentCss()&&(e+=this.getContentCssToRender()),this.isContentHtml()&&(e+=this.getContentHtmlToRender()),this.isContentJs()&&(e+=this.getContentJsToRender()),e},v.prototype.getContentHtmlToRender=function(){return this.getContentHtml()},v.prototype.getContentCssToRender=function(){return'<style type="text/css">'+this.getContentCss()+"</style>"},v.prototype.getContentJsToRender=function(){return'<script type="application/javascript">'+this.getContentJs()+"<\/script>"},K.VIEWS_PAGE_URL_TYPE_OPTIONS_LIST=[K.VIEWS_PAGE_URL_TYPE_EQUALS="EQUALS",K.VIEWS_PAGE_URL_TYPE_CONTAIN="CONTAIN",K.VIEWS_PAGE_URL_TYPE_REGEXP="REGEXP"],K.prototype.validate=function(){if(Array.isArray(this.options.include)&&Array.isArray(this.options.exclude))return g.each(this.options,function(e,t){Array.isArray(e)&&g.each(e,function(e){if(!g.inArray(e.type,K.VIEWS_PAGE_URL_TYPE_OPTIONS_LIST))throw new Error('Type of views page url ("'+e.type+'") is incorrect, only ['+K.
1VIEWS_PAGE_URL_TYPE_OPTIONS_LIST.join(",")+'] is allowed (in "'+t+'" mode)')})}),!0;throw new Error("Invalid views page url options")},K.prototype.getIncludePages=function(){return this.options.include},K.prototype.getExcludePages=function(){return this.options.exclude},K.prototype.isIncludePages=function(){return this.options.include&&this.options.include.length},K.prototype.isExcludePages=function(){return this.options.exclude&&this.options.exclude.length};var b={EVENT_LIST_SIGNED_IDENTIFIED:"signedIdentifiedActions",jwtRequired:!0,eventList:{},objectToActionMapping:{"event.track":"event.log","product.add":"product.addToCart","product.remove":"product.removeFromCart","client.data":"client.createOrUpdate","client.logIn":"client.login","client.logOut":"client.logout","custom.event":"customEvent.log"},init:function(){return new Je(function(t,n){b.getEventListByType(b.EVENT_LIST_SIGNED_IDENTIFIED).then(function(e){b.jwtRequired=Array.isArray(e)&&0<e.length,t()}).catch(function(e){f.error("EventManager:init EventManager.getEventListByType Error",e),n(e)})})},track:function(e,t){return f.log("EventManager:track",e,t),t=g.extend({url:Ke.location.href},t||{}),T.trackProxy({label:e,object:"event.track",params:t})},clientCreateOrUpdate:function(e,t){f.log("EventManager:clientCreateOrUpdate",e,t);var e={label:e,object:"client.data",params:t=g.extend({url:Ke.location.href},t||{})},t=(String.prototype.hashCode=function(){var e,t,n=0;if(0!==this.length)for(e=0,t=this.length;e<t;e++)n=(n<<5)-n+this.charCodeAt(e),n|=0;return n},JSON.stringify(e).hashCode()),n=k.getString("snrsClientHashCode");if(f.log("EventManager:clientCreateOrUpdate: currentHashCode & lcHashCode",t,n),typeof n===x||n!=t)return f.log("EventManager:clientCreateOrUpdate: SEND REQUEST:",e),k.setString("snrsClientHashCode",t),T.trackProxy(e)},sendFormData:function(n,r,i,o,s){return new Je(function(e,t){SyneriseTC.sendFormData(n,r,i,o,s).then(e).catch(t)})},pageVisit:function(n){return new Je(function(e,t){SyneriseTC.pageVisit(n).then(e).catch(t)})},trackCustomEvent:function(r,i={},o){return f.log("EventManager:trackCustomEvent",r,i,o),new Je(function(t,n){d.getCurrentClient().then(function(e){return e?e.uuid?r?void T.track("",r,o,i).then(function(e){f.log("EventManager:trackCustomEvent fetch then",e),t(e)}).catch(function(e){f.error("EventManager:trackCustomEvent fetch error",e),n(e)}):n(new Error("Action is required")):n(new Error("Client is not identified")):n(new Error("Client not exists"))}).catch(function(e){f.error("Can not get current client",e),n(new Error("Client not exists"))})})},dynamicContentShow:function(e,t){return this.trackCustomEvent("dynamicContent.show",e,t)},dynamicContentClick:function(e,t){return this.trackCustomEvent("dynamicContent.click",e,t)},recommendationView:function(e,t){return this.trackCustomEvent("recommendation.view",e,t)},recommendationClick:function(e,t){return this.trackCustomEvent("recommendation.click",e,t)},itemSearchClick:function(e,t){return this.trackCustomEvent("item.search.click",e,t)},trackClientEvent:function(r,i,o){return f.log("EventManager:trackClientEvent",r,i,o),new Je(function(t,n){d.getCurrentClient().then(function(e){return e?e.uuid?i?(o=o||{},void T.track(r,i,e.uuid,o).then(function(e){f.log("EventManager:trackClientEvent fetch then",e),t(e)}).catch(function(e){f.error("EventManager:trackClientEvent fetch error",e),n(e)})):n(new Error("Action is required")):n(new Error("Client is not identified")):n(new Error("Client not exists"))}).catch(function(e){f.error("Can not get current client",e),n(new Error("Client not exists"))})})},trackDynamicContentEventShow:function(e){f.log("EventManager:trackDynamicContentEventShow",e);var t={id:e.getId(),campaignName:e.getSubject()},n=(e.frequency.isLimited()&&(t.frequencyCounter=c.getFrequencyValue(e),t.frequencyLimitAchieved=!c.checkFrequency(e)),e.getUtmWithParametersFlatMap()),t=g.extend({},n||{},t);return e.isControlGroup()?(t.type=e.getControlGroupType(),d.isNewClient()&&e.isGlobalControlGroup()&&(t.firstTimeVisitor=!0),b.trackClientEvent("","dynamicContent.controlGroup",t)):(e.checkIfNewClientIncluded()&&(t.firstTimeVisitor=!0),t.title=e.getSubject(),t.variantId=e.getVariantId(),t.variantName=e.getVariantName(),b.trackClientEvent("","dynamicContent.show",t))},getEventListByType:function(n){return new Je(function(t,e){if(b.eventList[n]!==x)return t(b.eventList[n]);m.getProfileConfigByType(n).then(function(e){if(f.log("EventManager:getEventListByType for type",n),e)return b.eventList[n]=e,t(b.eventList[n]);throw new Error("EventManager:getEventListByType Failed to fetch config.")}).catch(function(e){return t(e)})})},requiresAuthorization:function(n){return new Je(function(t,e){n||t(!1),b.getEventListByType(b.EVENT_LIST_SIGNED_IDENTIFIED).then(function(e){t(null===e||e.includes(n))}).catch(function(e){f.error("EventManager:isSignedIdentified EventManager.getEventListByType Error",e),t(!0)})})},mapObjectToAction:function(e){return this.objectToActionMapping[e]||e}},_={_dataMarker:null,_blockReloadInitForm:!(K.prototype.isMatchPageUrl=function(e){f.log("DynamicContentViewsPage:isMatchPageUrl",e,this.options,this);var t,r=this;function n(e,t){for(var n in t)if(t.hasOwnProperty(n)){n=t[n];if(((e,t,n)=>{switch(n){case K.VIEWS_PAGE_URL_TYPE_EQUALS:return e===t;case K.VIEWS_PAGE_URL_TYPE_CONTAIN:return-1!==e.indexOf(t);case K.VIEWS_PAGE_URL_TYPE_REGEXP:try{return new RegExp(t,"m").test(e)}catch(e){f.error("DynamicContentViewsPage:isMatchPageUrl RegExp invalid",t,n,e,r)}}})(e,n.requirement,n.type))return n}return!1}if(this.isIncludePages()){if(!1===(t=n(e,this.getIncludePages())))return f.log("DynamicContentViewsPage:isMatchPageUrl included - not allowed",this.getIncludePages(),this),!1;f.log("DynamicContentViewsPage:isMatchPageUrl included - allowed",t,this)}if(this.isExcludePages()){if(!1!==(t=n(e,this.getExcludePages())))return f.log("DynamicContentViewsPage:isMatchPageUrl excluded - not allowed",t,this.getExcludePages(),this),!1;f.log("DynamicContentViewsPage:isMatchPageUrl excluded - allowed",this)}return!0}
1),_isInitObserveMarker:!1,init:function(){try{return new Je(function(e,t){_.getDataMarker().then(function(e){f.log("FormMarker:init  FormMarker.getDataMarker() then",e),_.marker(e)}).then(function(){_.bindLiveFormMarker()}).catch(function(e){f.error(e),t(e)})})}catch(e){f.error("FormMarker::init",e)}},reloadInitForm:function(){0==_._blockReloadInitForm&&(_._blockReloadInitForm=!0,setTimeout(function(){_._blockReloadInitForm=!1,_.init()},1e3))},getDataMarker:function(){return new Je(function(t,n){_._dataMarker?(f.log("FormMarker:getFormMarker RequestManager.getFormMarker from cache",_._dataMarker),t(_._dataMarker)):m.getProfileConfigByType(m.PROFILE_CONFIG_TYPE_DATA_MARKER).then(function(e){return f.log("FormMarker:getFormMarker RequestManager.getFormMarker then",e),Je.resolve(e)}).catch(function(e){n(e)}).then(function(e){f.log("FormMarker:getFormMarker RequestManager.getFormMarker then filtered",e),_._dataMarker=e,t(_._dataMarker)}).catch(function(e){n(e)})})},marker:function(t){try{f.log("FormMarker:marker",t),this.validData(t)&&this.markerForm(t)}catch(e){f.error("FormMarker:marker",t,e)}},validData:function(e){return!!Array.isArray&&Array.isArray(e)},addAttribute:function(e,t){f.log("FormMarker:addAttribute",e,t),e.setAttribute("data-synerise",t)},addDataValue:function(e,t){f.log("FormMarker:addDataValue",e,t),e.setAttribute("data-synerise-value",t)},checkCondition:function(e){return!(e.conditions_include_page&&-1==document.URL.indexOf(e.conditions_include_page)||e.conditions_exclude_page&&-1!==document.URL.indexOf(e.conditions_exclude_page))},markerForm:function(e){var n=this,r=[];e.forEach(function(t){var e;t.selector&&n.checkCondition(t)&&(e=document.querySelectorAll(t.selector),f.log("FormMarker:markerForm search selector: ["+t.selector+"] found: "+e.length),e.forEach(function(e){t.attribute&&!e.hasAttribute("data-synerise")&&(n.addAttribute(e,t.attribute),"form"==e.tagName.toLowerCase())&&r.push(e),""==t.data_value||e.hasAttribute("data-value")||n.addDataValue(e,t.data_value)}))}),n.tcSyneriseForm(r)},bindLiveFormMarker:function(){var e;0==_._isInitObserveMarker&&(f.log("bindLiveFormMarker init!"),_._isInitObserveMarker=!0,"MutationObserver"in Ke?(e=document.querySelector("body"),new MutationObserver(function(e){var r=new RegExp("<s*form","i");e.forEach(function(e){for(var t=0;t<e.addedNodes.length;++t){var n=e.addedNodes[t].nodeValue||e.addedNodes[t].outerHTML;r.test(n)&&(f.log("bindLiveFormMarker call reloadInitForm:",e.addedNodes[t]),_.reloadInitForm())}})}).observe(e,{attributes:!1,childList:!0,characterData:!1})):(f.log("[FormMarker] bindLiveFormMarker MutationObserver is not supported by your browser."),setTimeout(_.reloadInitForm(),3e3)))},tcSyneriseForm:function(e){f.log("FormMarker:tcSyneriseForm"),e.forEach(function(e){f.log("FormMarker:initFormCatch element: ",e),SyneriseTC.initFormCatch(e)})}},J={init:function(){var n=this;return new Je(function(e,t){"#_snrs_tool_marker"==Ke.location.hash&&(E.set("_snrs_tool_marker",1),n.removeHashFromUrl()),1==E.get("_snrs_tool_marker")&&n.appendToolMarker()})},appendToolMarker:function(){var e=document.createElement("script");e.type="text/javascript",e.src="https://www.snrcdn.net/tracker-marker/2.0/syneriseToolMarker.min.js",document.body.appendChild(e)},removeHashFromUrl:function(){history.pushState("",document.title,Ke.location.pathname+Ke.location.search)}},C={_initialized:!1,_html:'<div class="snrs-modal-wrapper"><div class="snrs-modal"><div class="snrs-modal-btn-close"></div><div class="snrs-modal-content"></div><div class="popup-backdrop"></div></div></div>',_container:null,_containerModal:null,_contentCtr:null,_closeBtn:null,_modalShowClass:"snrs-modal-show",_hideClass:"snrs-hide",_transparentModalClass:"snrs-transparent-modal",_cancelBtnClass:"snrs-notify--cancel",_closeBtnClass:"snrs-notify--close",_saveBtnClass:"snrs-notify--allow",_callbackStack:{onCancel:function(){},onClose:function(){},onSave:function(){},onShow:function(){},onHide:function(){}},_attachGeneralActions:function(){f.log("Modal:_attachGeneralActions"),C._closeBtn&&h.addEvent(C._closeBtn,"click",function(e){C.close()})},_modalCloseBtnVisibility:function(e){if(f.log("Modal:_modalCloseBtnVisibility",e),!C._closeBtn)return!1;e?h.removeClass(C._closeBtn,C._hideClass):h.addClass(C._closeBtn,C._hideClass)},_triggerCallback:function(e){if(f.log("Modal:_triggerCallback",e),C._callbackStack[e]){for(var t=new Array(arguments.length-1),n=0;n<t.length;++n)t[n]=arguments[n+1];e=C._callbackStack[e];
1if(g.isFunction(e))if(!1===e.apply(C,t))return!1}},_attachContentActions:function(){f.log("Modal:_attachContentActions");var e=C._contentCtr.getElementsByClassName(C._cancelBtnClass),e=(f.log("Modal:_attachContentActions attach cancel items",e.length,e),0<e.length&&g.each(e,function(e,t){h.addEvent(e,"click",function(e){f.log("Modal:_attachGeneralActions action - on cancel ",e,this),C.cancel()})}),C._contentCtr.getElementsByClassName(C._closeBtnClass)),e=(f.log("Modal:_attachContentActions attach close items",e.length,e),0<e.length?(C._modalCloseBtnVisibility(!1),g.each(e,function(e,t){h.addEvent(e,"click",function(e){f.log("Modal:_attachGeneralActions action - on close ",e,this),C.close()})})):C._modalCloseBtnVisibility(!0),C._contentCtr.getElementsByClassName(C._saveBtnClass));f.log("Modal:_attachContentActions attach save items",e.length,e),0<e.length&&g.each(e,function(e,t){h.addEvent(e,"click",function(e){f.log("Modal:_attachGeneralActions action - on save ",e,this),C.save()})})},onCancel:function(e){C._callbackStack.onCancel=e},onClose:function(e){C._callbackStack.onClose=e},onSave:function(e){C._callbackStack.onSave=e},onShow:function(e){C._callbackStack.onShow=e},onHide:function(e){C._callbackStack.onHide=e},init:function(){var e;f.log("Modal:init - initialized:",C._initialized),C._initialized||((e=document.createElement("div")).innerHTML=C._html,C._container=e.childNodes[0],C._contentCtr=C._container.querySelector(".snrs-modal-content"),C._closeBtn=C._container.querySelector(".snrs-modal-btn-close"),C._containerModal=C._container.querySelector(".snrs-modal"),document.body&&(document.body.appendChild(C._container),C._attachGeneralActions()),C._initialized=!0)},setContent:function(e){f.log("Modal:setContent",!!e),g.replaceChildren(C._contentCtr,e),C._attachContentActions()},addClassName:function(e){f.log("Modal:addClassName",e),h.addClass(C._container,e)},show:function(){var e=C.isShown();f.log("Modal:show - hasShow",!!e),e||(h.addClass(C._container,C._modalShowClass),C._triggerCallback("onShow"))},hide:function(){var e=C.isShown();f.log("Modal:hide - hasShow",!!e),e&&(h.removeClass(C._container,C._modalShowClass),C._triggerCallback("onHide"))},isShown:function(){return h.hasClass(C._container,C._modalShowClass)},isTransparentModal:function(){return h.hasClass(C._containerModal,C._transparentModalClass)},turnOnTransparentModal:function(){C.isTransparentModal()||h.addClass(C._containerModal,C._transparentModalClass)},turnOffTransparentModal:function(){C.isTransparentModal()&&h.removeClass(C._containerModal,C._transparentModalClass)},isHidden:function(){return!C.isShown()},cancel:function(){C.isShown()&&!1!==C._triggerCallback("onCancel")&&C.hide()},close:function(){C.isShown()&&!1!==C._triggerCallback("onClose")&&C.hide()},save:function(){C.isShown()&&!1!==C._triggerCallback("onSave")&&C.hide()}};function S(e){e=e||{},this._container=null,this._contentCtr=null,this._nativeObject=null,this._status=S.STATUS_NEW,this.id=e.id||null,this.name=e.name||null,this.content=e.content||null,this.conditions=e.conditions||{},this.conditions.includeType=this.conditions.includeType||S.PAGE_URL_MATCH_TYPE_CONTAINS,this.conditions.excludeType=this.conditions.excludeType||S.PAGE_URL_MATCH_TYPE_CONTAINS,this.capping=e.capping||{type:"count",expiration:null,count:null},this.additionalParams=e.additionalParams||{},this.type=e.type||"content",this.template=e.template||"default",this.contentSent=e.contentSent||null,this.contentAlreadyExists=e.contentAlreadyExists||null,this.contentProducts=e.contentProducts||null,this.targetSelector=e.targetSelector||null,this.leavePopupNotOpened=!0,this.isNative="native"===this.type}S.STATUS_RENDERED="RENDERED",S.STATUS_NEW="NEW",S.PAGE_URL_MATCH_TYPE_CONTAINS="contains",S.PAGE_URL_MATCH_TYPE_ALLOWED_LIST=[S.PAGE_URL_MATCH_TYPE_EQUALS="equals",S.PAGE_URL_MATCH_TYPE_CONTAINS],S.prototype.getStatus=function(){return this._status},S.prototype.isPageUrlAllowed=function(c){function e(e){if(-1!==S.PAGE_URL_MATCH_TYPE_ALLOWED_LIST.indexOf(e))return 1;f.error("ContentNotification:isMatchPageUrl invalid type",e,this)}function t(e,t,n){var r,i,o,s=t.split("|");for(r in s)if(s.hasOwnProperty(r)){var a=s[r];if(i=c,a=a,(o=n)===S.PAGE_URL_MATCH_TYPE_EQUALS?i===a:o===S.PAGE_URL_MATCH_TYPE_CONTAINS&&-1!==i.indexOf(a))return!0}return!1}if(f.log("ContentNotification:isMatchPageUrl",c,this.conditions,this),this.conditions.pageUrl){if(!e(this.conditions.includeType))return!1;if(!(n=t(0,this.conditions.pageUrl,this.conditions.includeType)))return f.log("ContentNotification:isMatchPageUrl included - not allowed",this.conditions.pageUrl,this.conditions.includeType,n,this),!1;f.log("ContentNotification:isMatchPageUrl included",n,this)}if(this.conditions.excludePageUrl){if(!e(this.conditions.excludeType))return!1;var n;if(!(n=!t(0,this.conditions.excludePageUrl,this.conditions.excludeType)))return f.log("ContentNotification:isMatchPageUrl excluded - not allowed",this.conditions.excludePageUrl,this.conditions.excludeType,n,this),!1;f.log("ContentNotification:isMatchPageUrl excluded",!n,this)}return!0},S.prototype.isRendered=function(){return this._status===S.STATUS_RENDERED},S.prototype.setStatusRendered=function(){return this._status=S.STATUS_RENDERED,f.log("ContentNotification:setStatusRendered",this),this},S.prototype.render=function(){var o=this;return new Je(function(t,n){var e;if(f.log("ContentNotification:render isNative",o,o.isNative),o.isNative)return"web_push_agreement"!==o.template?n(new Error('Template type ("'+o.template+'") is incorrect for notification, only "web_push_agreement" is allowed for native notification')):D.getMode()!==D.CONFIG_WEBPUSH_MODE_NATIVE?n(new Error('Web push service mode ("'+D.getMode()+'") does not support auto triggering web push agreement')):(e=D.getBrowserPermissionState(),f.log("ContentNotification:render check permission",e),e!==N.BROWSER_PERMISSION_DEFAULT?n(new Error('Auto triggering native web push agreement is disabled if browser permission is "'+e+'"')):(f.log("ContentNotification:render subscribe",o),void D.subscribe().then(function(e){return f.log("ContentNotification:render subscribe then Notification permission",o,e),void 0!==e&&!e||o.setStatusRendered(),t()}).catch(function(e){f.error("ContentNotification:render subscribe error occurred",e),n(e)})));var r=document.createElement("div");switch(r.className+=" snrs-notify",r.className+=" snrs-notify-type-"+o.type,r.className+=" snrs-notify-template-"+o.template,r.className+=" snrs-notify-rendered",o.type){case"popup":document.querySelector("snrs-notify-type-popup")?n():(r.innerHTML=g.unescapeHtml(o.content),C.setContent(r),o._container=C._contentCtr,o._contentCtr=r);break;case"content":var i=o.targetSelector?document.querySelector(o.targetSelector):null;if(f.log("ContentNotification:render container",i),!i)return n(new Error("Can not found container("+o.targetSelector+") for notification"));r.innerHTML=g.unescapeHtml(o.content),o._container=i,o._contentCtr=r;break;default:return n(new Error('Notification type ("'+o.type+'") is incorrect, only "popup", "content" is allowed'))}if(!o._container)return n(new Error("ContentNotification container is not defined"));o._contentCtr&&g.executeScripts(o._contentCtr),w.attachHandlers(o).then(function(e){return f.log("ContentNotification:render attachHandlers then",o,e),void 0!==e&&!e||("popup"===o.type?C.show():"content"===o.type&&g.replaceChildren(o._container,o._contentCtr),o.setStatusRendered()),t()}).catch(function(e){f.error("ContentNotification:render attachHandlers error occurred",e),n(e)})})};var w={_notifications:null,_stylesUrl:[],init:function(e){return new Je(function(t,n){w.getNotifications().then(function(e){f.log("NotificationManager:init  NotificationManager.getNotifications() then",e),t(e)}).catch(function(e){f.error(e),n(e)})})},getConnectedSocket:function(){return"undefined"==typeof SocketManager?Je.reject(new Error("Socket module not defined")):SocketManager.getConnectedSocket()},initSocketNotification:function(){return new Je(function(t,n){f.log("NotificationManager:initSocketNotification"),w.getConnectedSocket().then(function(e){e.on("dynamicContentMessage",function(t){w.renderNotificationForCurrentClient(t).catch(function(e){f.error("Can not render notification for message",t),f.error(e)})}),f.log('NotificationManager:initSocketNotification listening "dynamicContentMessage"',e),t()}).catch(function(e){f.error(e),n(e)})})},renderNotificationForCurrentClient:function(e){return new Je(function(n,r){f.log("NotificationManager:renderNotificationForCurrentClient",e),d.getCurrentClient().then(function(t){w.filterUnsupportedNotifications([new S(e)]).then(function(e){e.length&&t.renderNotification(e[0],!0).then(function(e){f.log("NotificationManager:renderNotificationForCurrentClient rendered",e),n()}).catch(r)}).catch(r)}).catch(r)})},prepareStyles:function(){var e=T.utils.getStyleUrl();return w._stylesUrl.push(e),$.loadStyles(w._stylesUrl)},attachHandlers:function(s){return new Je(function(e,t){if(!s._contentCtr)return e(!1);switch(s.template){case"newsletter":var n;return m.getOption("notificationNewsletterHandlers")?(n=s._contentCtr.getElementsByTagName("form"),g.each(n,function(i){var o=i.onsubmit;i.onsubmit=function(e){f.log("Notification:render form submit then",i,s),(e=e||Ke.event).preventDefault?e.preventDefault():e.returnValue=!1;function t(e){e&&"undefined"!=typeof SyneriseTC&&SyneriseTC.sendFormData(e.type,e.fields,e.fieldsMapping),"function"===(typeof o).toLowerCase()&&o.call(r),s.c
1ontentSent&&setTimeout(function(){f.log("Notification:render form submit then saved",i,s),s._contentCtr.innerHTML=g.unescapeHtml(s.contentSent)},1e3),"popup"==s.type&&setTimeout(function(){f.log("Notification:render form submit - close modal",i,s),C.hide()},5e3)}var n,r=this;return"undefined"!=typeof SyneriseTC?((n=SyneriseTC.getFormData(i)).type=i.getAttribute("data-synerise"),e=void 0!==n.fieldsMapping.email?n.fields[n.fieldsMapping.email]:x,f.log("Notification:render form submit then - check email exists:",!!s.contentAlreadyExists,e),s.contentAlreadyExists?T.checkNewsletterSubscription(e).then(function(e){f.log("RequestManager.checkNewsletterSubscription then",e),0==e?t(n):"subscribed"===e||"waiting_for_confirmation"===e?(s._contentCtr.innerHTML=g.unescapeHtml(s.contentAlreadyExists),"popup"==s.type&&setTimeout(function(){f.log("Notification:render form submit - close modal",i,s),C.hide()},4e3)):(f.error("Invalid response. Can not check newsletter subscription"),t(n))}).catch(function(e){f.error("Can not check newsletter subscription",e),t(n)}):t(n)):(f.error("Synerise tracking codes is not defined."),t()),!1}})):"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(s._contentCtr),e(!0);case"products":return"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(s._contentCtr),s._container.style.display="none",s.contentProducts&&T.getProductSku(s.contentProducts,I.getClientUuid()).then(function(e){s._container.style.display="block";var t=s._contentCtr.getElementsByClassName("snrs-products");return 0<t.length?(t[0].innerHTML=e,new X({sliderSelector:"ul.snrs-products"}),"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(t[0])):(s._contentCtr.innerHTML=e,"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(s._contentCtr)),Je.resolve(e)}),e(!0);case"web_push_agreement":if(void 0===D)return f.info("NotificationManager:attachHandlers Web push module not defined",s),e(!1);if(!D.checkSubscribeRequestNeed())return f.log("NotificationManager:attachHandlers Web push agreement is not needed",s),e(!1);D.isWebPushAppReady().then(function(){"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(s._contentCtr),D.attachHandlers(s._contentCtr),e(!0)}).catch(function(){e(!1)});break;default:return"undefined"!=typeof SyneriseTC&&SyneriseTC.initFormCatch(s._contentCtr),void 0!==D&&D.attachHandlers(s._contentCtr),e(!0)}})},getNotifications:function(){return new Je(function(t,n){w._notifications?(f.log("NotificationManager:getNotifications RequestManager.getNotifications from cache",w._notifications),t(w._notifications)):m.getProfileConfigByType(m.PROFILE_CONFIG_TYPE_NOTIFICATIONS).then(w.parseDataToObjects).then(w.filterUnsupportedNotifications).then(function(e){f.log("NotificationManager:getNotifications RequestManager.getNotifications then filtered",e),w._notifications=e,w.prepareStyles(),t(w._notifications)}).catch(function(e){n(e)})})},getNotificationsForClient:function(e){return new Je(function(t,n){f.log("NotificationManager:getNotificationsForClient",e),e.getTags().then(function(s){e.getSegments().then(function(e){var o={};o.tags=s,o.segments=e,w.getNotifications().then(function(e){f.log("NotificationManager:getNotificationsForClient NotificationManager.getNotifications() then",e,o);var i=[];g.each(e,function(t){if(t.conditions)if(t.conditions.include){var e=t.conditions.include;switch(e.type){case"segments":e.items&&g.each(e.items,function(e){g.inArray(e,o.segments)&&i.push(t)});break;case"tag":e.items&&g.each(e.items,function(e){g.inArray(e,o.tags)&&i.push(t)});break;case"all":i.push(t)}}else{var n,r;t.conditions.exclude&&"tag"===(n=t.conditions.exclude).type&&n.items&&(r=!0,g.each(n.items,function(e){g.inArray(e,s)&&(r=!1)}),r)&&i.push(t)}}),t(i)}).catch(n)})})})},parseDataToObjects:function(r){return new Je(function(e,t){f.log("NotificationManager:parseToObjects");var n=[];g.isEmpty(r)||g.each(r,function(e,t){n.push(new S(e))}),e(n)})},getUnsupportedModules:function(){return new Je(function(e,t){f.log("NotificationManager:getUnsupportedModules");var n={};Je.all([new Je(function(e,t){if(void 0===D)return f.info("NotificationManager:getUnsupportedModules Web push module not defined"),n.webPush=!0,e();D.isWebPushSupported().then(function(){e()}).catch(function(){n.webPush=!0,e()})})]).then(function(){e(n)}).catch(function(e){t(e)})})},filterUnsupportedNotifications:function(n){return new Je(function(e,t){f.log("NotificationManager:filterUnsupportedNotifications",n),w.getUnsupportedModules().then(function(s){f.log("NotificationManager:filterUnsupportedNotifications getUnsupportedModules than",n,s);var a,c=[];return g.isEmpty(n)||(a={},g.each(n,function(e){if("web_push_agreement"===e.template){if(s.webPush)return void f.log("NotificationManager:filterUnsupportedNotifications filtered (unsuported webpush module)",e);if(!D.checkSubscribeRequestNeed())return void f.log("NotificationManager:filterUnsupportedNotifications filtered (Web push agreement is not needed)",e)}if(e.conditions){if(!e.isPageUrlAllowed(location.href))return void f.log("NotificationManager:filterUnsupportedNotifications filtered (wrong current page url)",e);if(e.conditions.deviceType&&!u.checkDeviceType(e.conditions.deviceType))return void f.log("NotificationManager:filterUnsupportedNotifications filtered (wrong current device type)",e);if(e.conditions.timeFrom||e.conditions.timeTo){f.log("NotificationManager:filterUnsupportedNotifications filter for time showing",e.conditions.timeFrom,e.conditions.timeTo,e);var t,n=e.conditions.timeFrom,r=e.conditions.timeTo,i=new Date,o=function(e){return e.toISOString().replace(/t/i," ").replace(/\.\d+./,"")};if(null==n&&((t=new Date).setDate(i.getDate()-7),n=o(t)),null==r&&((t=new Date).setDate(i.getDate()+7),r=o(t)),o=n.length<19?h.prepareTimeForDate(n||"00:00:00",i):new Date(n),(t=r.length<19?h.prepareTimeForDate(r||"23:59:59",i):new Date(r)).setTime(t.getTime()-60*t.getTimezoneOffset()*1e3),o.setTime(o.getTime()-60*o.getTimezoneOffset()*1e3),"Invalid Date"===o.toString()||"Invalid Date"===t.toString())return void f.error("NotificationManager:filterUnsupportedNotifications filtered (invalid showing time)",o,t,e);if(i<o||t<i)return void f.log("NotificationManager:filterUnsupportedNotifications filtered (wrong showing time)",i,o,t)}}if("content"===e.type){if(!e.targetSelector)return void f.log("NotificationManager:filterUnsupportedNotifications filtered (empty target selector)",e);if(a[e.targetSelector])return void f.log("NotificationManager:filterUnsupportedNotifications filtered (with same target selector)",e);a[e.targetSelector]=!0}c.push(e)})),e(c)}).catch(function(e){t(e)})})},leavePopupOpenEventHandler:function(e,t,n){t.leavePopupNotOpened&&n.clientY<=0&&(n.preventDefault(),e.renderNotification(t,!0),t.leavePopupNotOpened=!1)},attachHandlerForLeavePopup:function(e,t){document.addEventListener("mouseout",w.leavePopupOpenEventHandler.bind(this,e,t))}
1,turnOffPopupTransparentBackground:function(){C.turnOffTransparentModal()},turnOnPopupTransparentBackground:function(){C.turnOnTransparentModal()}},z={allowList:[],syneriseLayer:[],init:function(e=[]){j.init(this.syneriseLayer),this.allowList=e,this.checkSessionData(),Ke.addEventListener("message",function(e){"AnalyticsEvent"===e.data.name&&z.handleMessage(e)})},getDataFromIndexedDB:function(t,r,i){return new Je(n=>{try{var e=indexedDB.open(t);e.onerror=function(){n(null)},e.onsuccess=function(e){try{var t=e.target.result.transaction([r],"readonly").objectStore(r).get(i);t.onerror=function(){n(null)},t.onsuccess=function(){t.result?n(t.result):n(null)}}catch(e){n(null)}}}catch(e){n(null)}})},debounce:function(r,i,o){var s;return function(){var e=this,t=arguments,n=o&&!s;clearTimeout(s),s=setTimeout(function(){s=null,o||r.apply(e,t)},i),n&&r.apply(e,t)}},checkUserData:function(e){e&&e.person&&e.person.email&&SR.client.getIdentityHash()!=SR.client.hashIdentity(e.person.email)&&SR.event.sendFormData("userIdentification",{email:e.person.email})},updateCartStatus:function(){z.getDataFromIndexedDB("keyval-store","keyval","fs::cart").then(e=>{var t,n,r;e&&e.items&&(t=e.items.map(e=>({sku:e.itemOffered?.isVariantOf?.productGroupID||e.itemOffered?.sku||e.sku,quantity:e.quantity,brand:e.itemOffered?.brand?.name||e.brand?.name,category:e.breadcrumbList?.itemListElement?.[1]?.name})),n=e.items.reduce((e,t)=>e+t.listPrice*t.quantity,0),e=e.items.reduce((e,t)=>e+t.quantity,0),r=t.map(e=>e.sku),SR.event.trackCustomEvent("cart.status",{products:t,totalAmount:n,totalQuantity:e,itemIds:r},"CartStatus"))})},checkSessionData:async function(){this.getDataFromIndexedDB("keyval-store","keyval","fs::session").then(e=>{this.checkUserData(e)})},handleMessage:function(e){var t=e.data.params.name;0<this.allowList.length&&!this.allowList.includes(t)||this.events[t]&&(z.checkSessionData(),this.events[t](e.data.params.params))},events:{"store:add_to_cart":function(e){z.syneriseLayer.push({event:"add_to_cart",ecommerce:{currency:e.currency,value:e.value,items:e.items}}),z.updateCartStatus()},"store:view_item":function(e){var t=SyneriseTC.getOgTag();t["product:retailer_part_no"]=e.items[0].item_id,SR.event.pageVisit({ogTags:JSON.stringify(t)}).then(function(){SR.dynamicContent.get()})},"store:page_view":function(e){e.page_location.match(/\/p$/)||SR.event.pageVisit().then(function(){SR.dynamicContent.get()})},"store:recommendation_view":function(e){e&&e.campaignId&&e.correlationId&&e.items&&SR.event.recommendationView(e)},"store:recommendation_click":function(e){e&&e.campaignId&&e.correlationId&&e.item&&SR.event.recommendationClick(e)},"store:remove_from_cart":function(e){z.syneriseLayer.push({event:"remove_from_cart",ecommerce:{currency:e.currency,value:e.value,items:e.items}}),z.updateCartStatus()}}},X=function(e){for(var t in this.properties={sliderSelector:"ul.snrs-products",slidesTagName:"LI",displayedItemCount:5,slideIntervalMiliseconds:3e3,isResponsive:!0,navigateLeftSelector:".snrs-left-arrow",navigateRightSelector:".snrs-right-arrow",breakingPoints:{small:650,medium:1280}},e)e.hasOwnProperty(t)&&(this.properties[t]=e[t]);this.slider=document.querySelector(this.properties.sliderSelector),null!==this.slider&&(this.slidesCollection=this.slider.getElementsByTagName(this.properties.slidesTagName),this.slideCount=this.slidesCollection.length,this.roundedSlideCount=Math.ceil(this.slideCount/this.properties.displayedItemCount)*this.properties.displayedItemCount,this.sliderPercentWidth=100*Math.ceil(this.roundedSlideCount/this.properties.displayedItemCount),this.position=0,this.init())},T=(X.prototype.init=function(){this.setResponsivity(),this.slider.style.width=this.sliderPercentWidth+"%",this.createNavigation(),this.setSlidesWidth(),this.setInterval=setInterval(this.slideRTL.bind(this),this.properties.slideIntervalMiliseconds),this.attachSlideEvents()},X.prototype.setResponsivity=function(){var e=Ke.innerWidth;e>this.properties.breakingPoints.small&&e<this.properties.breakingPoints.medium?this.properties.displayedItemCount=3:e<this.properties.breakingPoints.small&&(this.properties.displayedItemCount=1),this.roundedSlideCount=Math.ceil(this.slideCount/this.properties.displayedItemCount)*this.properties.displayedItemCount,this.sliderPercentWidth=100*Math.ceil(this.roundedSlideCount/this.properties.displayedItemCount)},X.prototype.setSlidesWidth=function(){for(var e=1/this.roundedSlideCount*100+"%",t=0,n=this.slidesCollection.length;t<n;t+=1)this.slidesCollection[t].style.width=e},X.prototype.getSlideDistance=function(){return 100*this.position/Math.ceil(this.slideCount/this.properties.displayedItemCount)},X.prototype.slideRTL=function(){this.position=++this.position<Math.ceil(this.slideCount/this.properties.displayedItemCount)?this.position:0,this.slider.style.transform="translateX(-"+this.getSlideDistance()+"%)"},X.prototype.slideLTR=function(){this.position=0<=--this.position?this.position:Math.ceil(this.slideCount/this.properties.displayedItemCount)-1,this.slider.style.transform="translateX(-"+this.getSlideDistance()+"%)"},X.prototype.createNavigation=function(){var e=document.createElement("DIV"),t=document.createElement("DIV");
1e.className="snrs-arrow snrs-left-arrow",t.className="snrs-arrow snrs-right-arrow",document.querySelector(".snrs-products-slider").appendChild(e),document.querySelector(".snrs-products-slider").appendChild(t)},X.prototype.attachSlideEvents=function(){var e=this;document.querySelector(this.properties.navigateLeftSelector).addEventListener("click",function(){clearInterval(e.setInterval),e.slideLTR(),e.setInterval=setInterval(e.slideRTL.bind(e),e.properties.slideIntervalMiliseconds)}),document.querySelector(this.properties.navigateRightSelector).addEventListener("click",function(){clearInterval(e.setInterval),e.slideRTL(),e.setInterval=setInterval(e.slideRTL.bind(e),e.properties.slideIntervalMiliseconds)})},X.prototype.off=function(){for(var e=0,t=this.properties.slidesCollection.length;e<t;e+=1)this.properties.slidesCollection[e].style.width="";clearInterval(this.setInterval),this.properties.slider.style.width="",this.properties.slider.style.transform="",document.querySelector(this.properties.navigateRight).remove(),document.querySelector(this.properties.navigateLeft).remove()},{trackingDomain:"https://web.snrbox.com",trackIGifUrl:"/_i.gif",trackSdkProxyUrl:"/tck/sdk-proxy",rtomUrl:"/rtom",rtomProxyUrl:"/rtom-proxy/rtom",dynamicContentV4Url:"/dc/v4",dynamicContentV5Url:"/dc/v5",trackerLogsUrl:"/tck/logs",productsRenderBySkuUrl:location.protocol+"//"+location.hostname+"/dynamicblock/products",utils:{getSsuid:function(){var e=E.get("_snrs_sa"),t="";return t=e&&e.ssuid?e.ssuid:t},setTrackingDomain:function(e){f.log("RequestManager:utils:setTrackingDomain",e),T.trackingDomain=e},processStatus:function(e){var t;return f.log("RequestManager:utils:processStatus",e),200===e.status||201===e.status||0===e.status?Je.resolve(e):((t=new Error(e.statusText)).status=e.status,Je.reject(t))},getStyleUrl:function(){return m.getOption("trackingDomain")?m.getOption("trackingDomain")+"/sdk/3.0/synerise-javascript-sdk.min.css":"https://www.snrcdn.net/sdk/3.0/synerise-javascript-sdk.min.css"},getDataKey:function(e){return void 0!==e.data?Je.resolve(e.data):Je.reject(new Error("Can no get data from response"))},getDataFromKeyName:function(e,t){return void 0!==e[t]?Je.resolve(e[t]):Je.reject(new Error("Can no get data from response"))},parseJson:function(e){return e.json()},fetchWithTimeout:function(e,t){void 0!==t&&null!=t||(t=4e3);var n=new AbortController,r=n.signal,i=setTimeout(function(){n.abort()},t);return Xe(e,{signal:r}).then(function(e){return clearTimeout(i),i=x,Je.resolve(e)}).then(T.utils.processStatus).catch(function(e){return clearTimeout(i),i=x,"AbortError"===e.name?Je.reject(new Error("Request Timeout")):Je.reject(e)})},fetchWithTimeoutAndLog:function(e,t){return p.handleFetch(e,T.utils.fetchWithTimeout(e,t))},trackEventWithCheckPossibility:function(e){return u.isCrawler()?new Error("Can not track event - crawler detected"):T.utils.fetchWithTimeoutAndLog(e,4e3)},checkMethodLimiter:function(){return u.isBrowseIE()?2e3:1e4}},getProductSku:function(o,e){f.log("RequestManager:getProductSku");var t={"no-buy":"stats/transaction/no-buy-products","last-view":"products/last-view","top-vew":"products/top-vew",recommend:"products/recommend",similar:"products/recommend"},i=null,s=(void 0!==t[o]&&(i=t[o]),"");if("similar"==o){sku="";try{sku=document.head.querySelector('meta[property="product:retailer_part_no"]').content}catch(e){}s="sku="+sku}else s="clientUUID="+encodeURIComponent(e);return"function"==typeof srRenderProducts&&(s+="&onlySku=1"),new Je(function(n,t){var e={"Content-Type":"application/json"},r=(e[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),T.trackingDomain+T.rtomProxyUrl+"/"+i+"?"+s),r=new W(r,{method:"GET",mode:"cors",redirect:"follow",headers:new ze(e)});T.utils.fetchWithTimeoutAndLog(r).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){if(f.log("RequestManager:getProductSku fetch then",e),g.isEmpty(e)||g.isEmpty(e.items))throw new TypeError("Empty list product to render");var t,i="";"function"==typeof srRenderProducts?(t=[],e.items.forEach(function(e){t.push(e.sku)}),srRenderProducts(t,o,function(e){n(e)}
1)):(e.items.forEach(function(e){var t=e.category!==x?'<p class="snrs-product-category">'+e.category+"</p>":"",n=e.sku!==x?'<p class="snrs-product-sku">'+e.sku+"</p>":"",r=e.name!==x?'<p class="snrs-product-title">'+e.name+"</p>":"";i+='<li class="snrs-product" ><a  class="snrs-product-href" href="'+e.url+"?snr_medium=synerise_products&snr_source=synerise&snr_campaign="+o+'" ><img  class="snrs-product-image" alt="'+e.name+'" src="'+e.image+'"/></a>'+t+n+r+"</li>"}),n('<div class="snrs-products-slider"><ul class="snrs-products">'+i+"</ul></div>"))}).catch(function(e){f.error("RequestManager:getProductSku fetch error",e),t(e)})})},checkNewsletterSubscription:function(r){f.log("RequestManager:checkNewsletterSubscription");var i={"Content-Type":"application/json"};return i[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),new Je(function(t,n){var e=T.trackingDomain+T.rtomUrl+"/newsletter/check-subscription?email="+encodeURIComponent(r),e=new W(e,{method:"GET",mode:"cors",redirect:"follow",headers:new ze(i)});T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){return void 0!==e.status?Je.resolve(e.status):Je.reject(new Error("Can no get status from response"))}).then(function(e){f.log("RequestManager:checkNewsletterSubscription fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:checkNewsletterSubscription fetch error",e),n(e)})})},getNotifications:function(){return f.log("RequestManager:getNotifications"),new Je(function(t,n){var e={"Content-Type":"application/json"},r=(e[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),T.trackingDomain+T.rtomProxyUrl+"/clients/notificationTemplates"),r=new W(r,{method:"GET",mode:"cors",redirect:"follow",headers:new ze(e)});T.utils.fetchWithTimeoutAndLog(r).then(T.utils.processStatus).then(T.utils.parseJson).then(T.utils.getDataKey).then(function(e){f.log("RequestManager:getNotifications fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getNotifications fetch error",e),n(e)})})},getDynamicContentsFiltered:function(e){return f.log("RequestManager:getDynamicContentsFiltered"),new Je(function(t,n){var e=T.trackingDomain+T.dynamicContentV5Url+"/dynamic-content/definitions?code="+l.trackerKey(),r=new ze({"Content-Type":"text/plain"}),r=(m.getOption("doNotTrack")&&r.append("x-do-not-track","true"),new W(e,{method:"GET",mode:"cors",redirect:"follow",headers:r}));f.log("RequestManager:getDynamicContentsFiltered fetch",e),T.utils.fetchWithTimeoutAndLog(r).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getDynamicContentsFiltered fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getDynamicContentsFiltered fetch error",e),n(e)})})},getDynamicContentByUuids:function(s,a){return f.log("RequestManager:getDynamicContentByUuids",a),new Je(function(t,n){var e=T.trackingDomain+T.dynamicContentV5Url+"/dynamic-content/byUuids?code="+l.trackerKey()+"&uuid="+encodeURIComponent(s.uuid),r=c.getVariables(),i={},r=(g.each(a,function(e){i[e.getId()]=e.checkAbxVariantId?null:e.getVariantId()||0}),{variantFilters:i,variables:r,referer:location.href}),o=e+"&query="+encodeURIComponent(h.utoa(JSON.stringify(r)));o.length<T.utils.checkMethodLimiter()?T.getDynamicContentByGet(e,o,r).then(function(e){t(e)}).catch(function(e){n(e)}):T.getDynamicContentByPost(e,r).then(function(e){t(e)}).catch(function(e){n(e)})})},getDynamicContentPreview:function(i,o){return new Je(function(t,n){var e=T.trackingDomain+T.dynamicContentV4Url
1+"/dynamicContent/preview?code="+l.trackerKey()+"&uuid="+o,r={variables:c.getVariables(),templateId:i},e=new W(e,{method:"POST",headers:new ze({"Content-Type":"application/json"}),body:JSON.stringify(r)});T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getDynamicContentPreview fetch",e),t(e)}).catch(function(e){f.log("RequestManager:getDynamicContentPreview error",e),n(e)})})},getDynamicContentByGet:function(r,i,o){return f.log("RequestManager:getDynamicContentByGet",o),new Je(function(t,n){var e=new W(i,{method:"GET",headers:new ze({})});T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getDynamicContentByGet fetch",e),t(e)}).catch(function(e){f.log("RequestManager:getDynamicContentByGet error",e),e.status&&400===e.status?(f.log("RequestManager:getDynamicContentByPost::fallback",o),T.getDynamicContentByPost(r,o).then(function(e){t(e)}).catch(function(e){n(e)})):n(e)})})},getDynamicContentByPost:function(r,i){return f.log("RequestManager:getDynamicContentByPost"),new Je(function(t,n){var e=new W(r,{method:"POST",headers:new ze({"Content-Type":"text/plain"}),body:JSON.stringify(i)});T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getDynamicContentByPost fetch",e),t(e)}).catch(function(e){f.log("RequestManager:getDynamicContentByPost error",e),n(e)})})},getProfileContext:function(r){return f.log("RequestManager:getProfileContext"),new Je(function(t,n){var e=T.trackingDomain+T.dynamicContentV5Url+"/context",e=(e+="?code="+l.getHeaderAuth("value"),new W(e+="&uuid="+r,{method:"GET",mode:"cors",redirect:"follow",headers:new ze({"Content-Type":"application/json"})}));T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getProfileContext fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getProfileContext fetch error",e),n(e)})})},getProfileConfig:function(){return f.log("RequestManager:getProfileConfig"),new Je(function(t,n){var e=T.trackingDomain+T.rtomProxyUrl+"/configs/getPublicConfigForContext",e=(e+="?tracker="+l.getHeaderAuth("value"),new W(e,{method:"GET",mode:"cors",redirect:"follow",headers:new ze({"Content-Type":"application/json"})}));T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getProfileConfig fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getProfileConfig fetch error",e),n(e)})})},getWebPushProfileConfig:function(r){return f.log("RequestManager:getWebPushProfileConfig"),new Je(function(t,n){var e=T.trackingDomain+T.rtomProxyUrl+"/web-push/get-public-config",e=(e+="?tracker="+l.getHeaderAuth("value"),r&&(e+="&acceptLanguage="+encodeURIComponent(r)),new W(e,{method:"GET",mode:"cors",redirect:"follow",headers:new ze({"Content-Type":"application/json"})}));T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){f.log("RequestManager:getWebPushProfileConfig fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getWebPushProfileConfig fetch error",e),n(e)})})},getClientTags:function(r){f.log("RequestManager:getClientTags",r);var i={"Content-Type":"application/json"};return i[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),new Je(function(t,n){var e=T.trackingDomain+T.rtomProxyUrl+"/clients/tagsHash?uuid="+encodeURIComponent(r.uuid),e=new W(e,{method:"GET",mode:"cors",redirect:"follow",headers:new ze(i)});T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(T.utils.getDataKey).then(function(e){f.log("RequestManager:getClientTags fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:getClientTags fetch error",e),n(e)})})},getClientData:function(e){f.log("RequestManager:getClientData",e);return{"Content-Type":"application/json"}[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),new Je(function(e,t){e({segments:[],tags:[]})})},track:function(s,a,c,u){return f.log("RequestManager:track",s,a,
1c,u),new Je(function(t,n){if(m.getOption("doNotTrack"))return t();var e,r,i,o=d.getClientFromStore();o?(c=c||"",u=u||{},e={uuid:o.uuid,ssuid:T.utils.getSsuid(),url:Ke.location.href,host:Ke.location.hostname},u=g.extend(e,u),r={action:a,label:c,params:JSON.stringify(u),uuid:o.uuid,tracker:l.getHeaderAuth("value"),hash:Math.random().toString(36).substring(2,8)},s&&(r.category=s),i={method:"GET",mode:"cors",redirect:"follow"},b.requiresAuthorization(a).then(function(e){e&&(e=o.accessToken)&&(i.headers=new ze({Authorization:"Bearer "+e}));e=T.trackingDomain+"/"+l.trackerKey()+T.trackIGifUrl+"?"+(e=>{var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.join("&")})(r),e=new W(e,i);T.utils.trackEventWithCheckPossibility(e).then(function(e){f.log("RequestManager:track fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:track fetch error",e),n(e)})}).catch(function(e){f.error("RequestManager:track EventManager.requiresAuthorization error",e),n(e)})):n(new Error("Can not track event if client not exists"))})},trackProxy:function(s){return f.log("RequestManager:trackProxy",s),new Je(function(t,n){var r,i,o,e;return m.getOption("doNotTrack")?t():(r=d.getClientFromStore())?(s=g.extend({uuid:r.uuid,ssuid:T.utils.getSsuid()},s)).label?s.object?(i={"Content-Type":"text/plain"},o=T.trackingDomain+T.trackSdkProxyUrl+"?code="+l.trackerKey(),e=b.mapObjectToAction(s.object),void b.requiresAuthorization(e).then(function(e){e&&(e=r.accessToken)&&(i.Authorization="Bearer "+e);e=new W(o,{method:"POST",mode:"cors",redirect:"follow",headers:new ze(i),body:JSON.stringify(s)});T.utils.trackEventWithCheckPossibility(e).then(function(e){f.log("RequestManager:trackProxy fetch then",e),t(e)}).catch(function(e){f.error("RequestManager:trackProxy fetch error",e),n(e)})})):n(new Error('Can not track event - "object" is required')):n(new Error("Can not track unknown event")):n(new Error("Can not track event if client not exists"))})},subscribeWebPushForClient:function(){return f.log("RequestManager:subscribeWebPushForClient"),new Je(function(r,i){d.getCurrentClient().then(function(e){var t,n;return e?e.uuid?((t={"Content-Type":"application/json"})[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),n=T.trackingDomain+T.rtomUrl+"/web-push/subscribe",n=new W(n,{method:"POST",mode:"cors",redirect:"follow",headers:new ze(t),body:JSON.stringify({uuid:e.uuid,ssuid:T.utils.getSsuid(),url:location.href})}),void T.utils.fetchWithTimeoutAndLog(n).then(T.utils.processStatus).then(function(e){f.log("RequestManager:subscribeWebPushForClient fetch then",e),r(e)}).catch(function(e){f.error("RequestManager:subscribeWebPushForClient fetch error",e),i(e)})):i(new Error("Client is not identified")):i(new Error("Can not subscribe if client not exists"))}).catch(function(){i(new Error("Client is not exists"))})})},unsubscribeWebPushForClient:function(){return f.log("RequestManager:unsubscribeWebPushForClient"),new Je(function(r,i){d.getCurrentClient().then(function(e){var t,n;return e?e.uuid?((t={"Content-Type":"application/json"})[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),n=T.trackingDomain+T.rtomUrl+"/web-push/unsubscribe",n=new W(n,{method:"POST",mode:"cors",redirect:"follow",headers:new ze(t),body:JSON.stringify({uuid:e.uuid,ssuid:T.utils.getSsuid(),url:location.href})}),void T.utils.fetchWithTimeoutAndLog(n).then(T.utils.processStatus).then(function(e){f.log("RequestManager:unsubscribeWebPushForClient fetch then",e),r(e)}).catch(function(e){f.error("RequestManager:unsubscribeWebPushForClient fetch error",e),i(e)})):i(new Error("Client is not identified")):i(new Error("Can not unsubscribe if client not exists"))}).catch(function(){i(new Error("Client is not exists"))})})},addBrowserPermissionWebPushForClient:function(o,s,a,c){return f.log("RequestManager:addBrowserPermissionWebPushForClient",o),new Je(function(r,i){d.getCurrentClient().then(function(e){var t,n;return e?e.uuid?o?((t={"Content-Type":"application/json"})[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),e={uuid:e.uuid,ssuid:T.utils.getSsuid(),token:o,domain:s,url:location.href},c&&(e.version=c),a&&(e.subscription=a),n=T.trackingDomain+T.rtomUrl+"/web-push/add-browser-permission",
1n=new W(n,{method:"POST",mode:"cors",redirect:"follow",headers:new ze(t),body:JSON.stringify(e)}),void T.utils.fetchWithTimeoutAndLog(n).then(T.utils.processStatus).then(function(e){f.log("RequestManager:addBrowserPermissionWebPushForClient fetch then",e),r(e)}).catch(function(e){f.error("RequestManager:addBrowserPermissionWebPushForClient fetch error",e),i(e)})):i(new Error("Token is required")):i(new Error("Client is not identified")):i(new Error("Can not subscribe if client not exists"))}).catch(function(){i(new Error("Client is not exists"))})})},checkWebPushSubscriptionForClient:function(i){return f.log("RequestManager:checkWebPushSubscriptionForClient"),new Je(function(n,r){d.getCurrentClient().then(function(e){var t;return e?e.uuid?(t=T.trackingDomain+T.rtomUrl+"/web-push/check-subscription",t=(t=(t+="?tracker="+l.getHeaderAuth("value"))+"&uuid="+encodeURIComponent(e.uuid))+"&domain="+encodeURIComponent(i||""),e=new W(t,{method:"GET",mode:"cors",redirect:"follow",headers:new ze({"Content-Type":"application/json"})}),void T.utils.fetchWithTimeoutAndLog(e).then(T.utils.processStatus).then(T.utils.parseJson).then(function(e){return T.utils.getDataFromKeyName(e,"subscription")}).then(function(e){f.log("RequestManager:addBrowserPermissionWebPushForClient fetch then",e),n(e)}).catch(function(e){f.error("RequestManager:addBrowserPermissionWebPushForClient fetch error",e),r(e)})):r(new Error("Client is not identified")):r(new Error("Can not subscribe if client not exists"))}).catch(function(e){f.error("RequestManager:checkWebPushSubscriptionForClient error occurred",e),r(new Error("Client is not exists"))})})},incrementDynamicContentViews:function(o){return f.log("RequestManager:incrementDynamicContentViews",o),new Je(function(r,i){d.getCurrentClient().then(function(e){var t={"Content-Type":"application/json"},n=(t[l.getHeaderAuth("key")]=l.getHeaderAuth("value"),T.trackingDomain+T.dynamicContentV4Url
1+"/dynamicContent/incrementView"),n=new W(n,{method:"POST",mode:"cors",redirect:"follow",headers:new ze(t),body:JSON.stringify({uuid:e.uuid,ssuid:T.utils.getSsuid(),campaignId:o.getId()})});T.utils.fetchWithTimeoutAndLog(n).then(T.utils.processStatus).then(function(e){f.log("RequestManager:incrementDynamicContentViews fetch then",e),r(e)}).catch(function(e){f.error("RequestManager:incrementDynamicContentViews fetch error",e),i(e)})}).catch(function(e){f.error("RequestManager:incrementDynamicContentViews error",e),i(new Error("Client not exists"))})})}}),$={_sourcesMap:{},loadStyles:function(n){return new Je(function(e,t){if(!(n=$.deduplicateSources(n)).length)return e();h.addStyles(n).then(function(){e()}).catch(function(e){f.error(e),t(e)})})},deduplicateSources:function(e){var t;return e?(t=[],g.each(e,function(e){$._sourcesMap[e]||(t.push(e),$._sourcesMap[e]=!0)}),t):[]}},E={set:function(e,t,n,r,i){g.isObject(t)&&(t=I.prepareObjectToString(t));var o=new Date,s=0,s=void 0!==n?1e3*n:62208e6;o.setTime(o.getTime()+s),E.setForDateExpires(e,t,o,r,i)},setForDateExpires:function(e,t,n,r,i){g.isObject(t)&&(t=I.prepareObjectToString(t)),n||(n=new Date).setTime(n.getTime()+62208e6);i={path:i||m.getOption("path")||"/"};i.expires=n,void 0!==(r=void 0===r?m.getOption("domain"):r)&&(i.domain=r),m.getOption("localStorageMode")?(n=new Date(i.expires),r=Math.round(n.getTime()/1e3),k.setStringWithTtl(e,t,r)):g.cookie.set(e,t,i)},get:function(e){var t=m.getOption("localStorageMode")?k.getStringWithTtl(e):g.cookie.get(e);return f.log("CookieStore:get",e,t),/:/.test(t)&&(t=I.prepareStringToObject(t)),f.log("CookieStore:get return",t),t},getJson:function(e){var t=m.getOption("localStorageMode")?k.getStringWithTtl(e):g.cookie.get(e);f.log("CookieStore:getJson",e,t);try{return t?JSON.parse(t):{}}catch(e){f.error("CookieStore:getJson ERROR: parse json",t)}return null},remove:function(e){var t;m.getOption("localStorageMode")?k.remove(e):(t={path:m.getOption("path")||"/"},m.getOption("domain")&&(t.domain=m.getOption("domain")),g.cookie.remove(e,t))}},P={FREQUENCY_PREFIX:"_snrs_dc_frq_",STOP_DISPLAY_PREFIX:"_snrs_dc_sd_",VIEWS_FOR_STOP_DISPLAY_PREFIX:"_snrs_dc_views_sd_",DELAY_PREFIX:"_snrs_dc_delay_",CAMPAIGNS:"_snrs_dc_campaigns",EXPIRE:"_snrs_dc_expire",TESTS:"_snrs_dc_tests",getKeyList:function(){return[P.FREQUENCY_PREFIX,P.STOP_DISPLAY_PREFIX,P.VIEWS_FOR_STOP_DISPLAY_PREFIX,P.DELAY_PREFIX,P.CAMPAIGNS,P.EXPIRE,P.TESTS]},clearExpiredKeysFromStore:function(){var e;return f.log("DynamicContentStore:clearExpiredKeysFromStore"),k.isAvailable()&&(e=P.getKeyList(),g.each(e,function(e){e===P.TESTS?P.clearExpiredTests():k.clearExpiredKeysFromContainer(e)})),!0},clearExpiredTests:function(){var t=new Date,n=k.getJson(P.TESTS);g.each(Object.keys(n),function(e){"number"==typeof n[e].exp&&t.getTime()>n[e].exp?k.removeFromContainer(P.TESTS,e):"number"==typeof n[e]&&P.cacheDynamicContentVariantId(e,n[e])})},incrementFrequency:function(e){var t=e.frequency.getExpiration(),n=(null===t&&(t=s.EXPIRATION_MAX_VALUE),P.getFrequencyWithCheckExpiration(e));return(n=n||{value:0,expires:new Date((new Date).getTime()+1e3*t).getTime()}).value++,k.isAvailable()?k.setToContainer(P.FREQUENCY_PREFIX,e.id,n):(t=P.FREQUENCY_PREFIX+e.id,E.setForDateExpires(t,n,new Date(n.expires))),n},renewFrequencyExpiration:function(e){var t,n=e.frequency.getExpiration(),r=P.getFrequencyWithCheckExpiration(e);return f.log("Store:renewFrequencyExpiration",r,e),r&&(t=new Date((new Date).getTime()+1e3*n),r.expires=t.getTime(),f.log("Store:renewFrequencyExpiration set",r,n,t,e),k.isAvailable()?k.setToContainer(P.FREQUENCY_PREFIX,e.id,r):(n=P.FREQUENCY_PREFIX+e.id,E.setForDateExpires(n,r,new Date(r.expires)))),r},getFrequency:function(e){e=k.isAvailable()?k.getFromContainer(P.FREQUENCY_PREFIX,e.id):E.get(P.FREQUENCY_PREFIX+e.id);return!e||(e.value=parseInt(e.value,10),e.expires=parseInt(e.expires,10),isNaN(e.value))||isNaN(e.expires)?null:e},getFrequencyWithCheckExpiration:function(e){var t=P.getFrequency(e);return P.checkExpirationFrequencyForData(e,t)},checkExpirationFrequencyForData:function(e,t){if(t){var n=new Date;if(t.expires<n.getTime())return P.removeFrequency(e),null}return t},removeFrequency:function(e){k.isAvailable()?k.removeFromContainer(P.FREQUENCY_PREFIX,e.id):E.remove(P.FREQUENCY_PREFIX+e.id)},stopDisplay:function(e){var t=new Date,n=a.STOP_DISPLAY_EXPIRATION_MAX_VALUE,n=(t.setSeconds(t.getSeconds()+n),{value:1,expires:t.getTime()});k.setToContainer(P.STOP_DISPLAY_PREFIX,e.id,n)},checkStopDisplay:function(e){return f.log("Store:checkStopDisplay value",k.getFromContainer(P.STOP_DISPLAY_PREFIX,e.id)),!!k.getFromContainer(P.STOP_DISPLAY_PREFIX,e.id)},incrementViewsForStopDisplay:function(e){var t=new Date,n=a.STOP_DISPLAY_EXPIRATION_MAX_VALUE,n=(t.setSeconds(t.getSeconds()+n),P.getViewsForStopDisplay(e)),n=++n,t={value:n,expires:t.getTime()};return k.setToContainer(P.VIEWS_FOR_STOP_DISPLAY_PREFIX,e.id,t),n},getViewsForStopDisplay:function(e){e=k.getFromContainer(P.VIEWS_FOR_STOP_DISPLAY_PREFIX,e.id);return e?e.value:0},removeViewsForStopDisplay:function(e){return k.removeFromContainer(P.VIEWS_FOR_STOP_DISPLAY_PREFIX,e.id)},setTimeForDelay:function(e,t){t=t||new Date;var n=e.trigger.getDelayInSeconds(),t=new Date(t.getTime()+1e3*n);return P.storeTimeForDelay(e,t),t},renewTimeForDelay:function(e){var t=P.getTimeForDelay(e);return null!==t&&P.storeTimeForDelay(e,t),t},storeTimeForDelay:function(e,t){var n,r=y.TRIGGER_DELAY_EXPIRATION_VALUE;k.isAvailable()?(n=new Date((new Date).getTime()+1e3*r),n={value:t.getTime(),expires:n.getTime()},k.setToContainer(P.DELAY_PREFIX,e.id,n)):E.set(P.DELAY_PREFIX+e.id,t.getTime(),r)},getTimeForDelay:function(e){t=k.isAvailable()?(t=k.getFromContainer(P.DELAY_PREFIX,e.id))?t.value:null:E.get(P.DELAY_PREFIX+e.id);var t,e=parseInt(t,10);return isNaN(e)?null:new Date(e)},removeTimeForDelay:function(e){k.isAvailable()?k.removeFromContainer(P.DELAY_PREFIX,e.id):E.remove(P.DELAY_PREFIX+e.id)},cacheDynamicContentVariantId:function(e,t,n){var r;return k.isAvailable()?(r={id:t,exp:new Date(Date.now()+2592e6).getTime()},n&&(r.checkId=!0),k.setToContainer(P.TESTS,e,r)):f.error("DynamicContentStore:setDynamicContentVariant error"),t},getCachedDynamicContentVariant:function(e){var t;return k.isAvailable()&&((t=k.getFromContainer(P.TESTS,e))&&"number"==typeof t.id&&this.cacheDynamicContentVariantId(e,t.id,t.checkId),t)?{id:t.id,checkId:t.checkId}:null}},k={_is_available:null,_tool:Ke.localStorage,setVariableStorage:function(){var n;k._tool=(n={},{setItem:function(e,t){n[e]=String(t)},getItem:function(e){return n.hasOwnProperty(e)?n[e]:null},removeItem:function(e){delete n[e]},clear:function(){n={}},key:function(e){return Object.keys(n)[e]||null},get length(){return Object.keys(n).length}})},setJson:function(e,t){return!!k.isAvailable()&&(t=I.prepareObjectToJsonString(t),f.log("LocalStore:set",e,t),k._tool.setItem(e,t),!0)},getJson:function(e){var t;return!!k.isAvailable()&&(t=k._tool.getItem(e)||x,t=I.prepareJsonStringToObject(t),f.log("LocalStore:get",e,t),t)},saveContainer:function(e,t){return!!k.isAvailable()&&(Object.keys(t).length?k.setJson(e,t):k.removeContainer(e),!0)},getContainer:function(e,t){return!!k.isAvailable()&&(k.getJson(e)||{})},removeContainer:function(e){return!!k.isAvailable()&&(k.remove(e),!0)}
1,getFromContainer:function(e,t){return!!k.isAvailable()&&((e=k.getContainer(e))[t]!==x?e[t]:null)},setToContainer:function(e,t,n){var r;return!!k.isAvailable()&&((r=(r=k.getContainer(e))||{})[t]=n,k.saveContainer(e,r),!0)},removeFromContainer:function(e,t){var n;return!!k.isAvailable()&&(delete(n=k.getContainer(e))[t],k.saveContainer(e,n),!0)},clearExpiredKeysFromContainer:function(r,i,o){if(!k.isAvailable())return!1;i=i||new Date,o=o||"expires";var e=k.getContainer(r),s={},a=!1;return g.each(e,function(e,t){var n=parseInt(e[o],10);!isNaN(n)&&(n=new Date(n))<i.getTime()?(f.log("LocalStore:clearExpiredKeysFromContainer key expired",t,n,r,e),k.removeFromContainer(r,t),a=!0):s[t]=e}),a&&k.saveContainer(r,s),!0},set:function(e,t){return!!k.isAvailable()&&(g.isObject(t)&&(t=I.prepareObjectToString(t)),f.log("LocalStore:set",e,t),k._tool.setItem(e,t),!0)},get:function(e){var t;return!!k.isAvailable()&&(t=k._tool.getItem(e)||x,f.log("LocalStore:get",e,t),t!==x&&/:/.test(t)&&(t=I.prepareStringToObject(t)),f.log("LocalStore:get return",t),t)},setString:function(e,t){return!!k.isAvailable()&&(f.log("LocalStore:setString",e,t),k._tool.setItem(e,t),!0)},getString:function(e){var t;return!!k.isAvailable()&&(t=k._tool.getItem(e)||x,f.log("LocalStore:getString",e,t),t)},setStringWithTtl:function(e,t,n){return!!k.isAvailable()&&(n=n||Math.round((new Date).getTime()/1e3)+43200,f.log("LocalStore:setStringWithTtl",e,t,n),this.setJson(e,{value:t,expires:n}))},getStringWithTtl:function(e){var t=this.getJson(e);return this.isExpired(t.expires)?(f.log("LocalStore:getStringWithTtl key expired",e,t),this.remove(e),null):t.value},remove:function(e){return!!k.isAvailable()&&(f.log("LocalStore:remove",e),k._tool.removeItem(e),!0)},isAvailable:function(e){if(null===k._is_available)if("undefined"!=typeof Storage&&"undefined"!=typeof localStorage)try{localStorage.setItem("lsCheck",1),localStorage.removeItem("lsCheck"),k._is_available=!0}catch(e){f.log("[LocalStore]:isAvailable Local storage isn't available"),k._is_available=!1}else f.log("[LocalStore]:isAvailable Local storage isn't available"),k._is_available=!1;return k._is_available},isExpired:function(e){e=parseInt(e,10);return!!(isNaN(e)||e<Math.round((new Date).getTime()/1e3))},clearExpiredKeysStartingWithSnrs:function(){for(var e=0;e<k._tool.length;e++){var t,n=k._tool.key(e);n.startsWith("_snrs")&&(t=k.getJson(n)).expires&&k.isExpired(t.expires)&&k.remove(n)}}},I={prepareObjectToJsonString:function(e){return JSON.stringify(e)},prepareJsonStringToObject:function(t){var e={};if("string"===(typeof t).toLowerCase())try{e=JSON.parse(t)}catch(e){f.error("Store:parseJson - Wrong JSON format",t)}return e},prepareObjectToString:function(e){var n="";return g.isObject(e)&&(g.each(e,function(e,t){""!==e&&(n+=t+":"+e+"&")}),n=n.substring(0,n.length-1)),n},prepareStringToObject:function(e){var t={};return g.isString(e)&&(e=e.split("&"),g.each(e,function(e){e=e.split(":");1<e.length&&(t[e[0]]=e[1])})),t},getClientUuid:function(){f.log("Store:getClientUuid");var e=E.get("_snrs_p"),t=null;return e&&e.uuid&&(t=e.uuid),f.log("Store:getClientUuid value:",t),t},_globalControlGroupCache:null,primeGlobalControlGroupCache:function(){I._globalControlGroupCache=I._readGlobalControlGroupFromStore()},clearGlobalControlGroupCache:function(){I._globalControlGroupCache=null},_readGlobalControlGroupFromStore:function(){var e=!0,t=E.get("_snrs_p");return e=t&&"globalControlGroup"in t?"true"===t.globalControlGroup:e},getGlobalControlGroupForClient:function(){return null!==I._globalControlGroupCache?I._globalControlGroupCache:I._readGlobalControlGroupFromStore()},getClientPermUuid:function(){f.log("Store:getClientPermUuid");var e=E.get("_snrs_p"),t=null;return e&&e.permUuid&&(t=e.permUuid),f.log("Store:getClientPermUuid value:",t),t},getClientToken:function(){return f.log("Store:getClientToken"),k.getStringWithTtl("snr-token")||E.get("_snrs_token")},setClientToken:function(e){var t=l.parseToken(e);return null===t||t.exp==x?(f.error("Store:setClientToken ERROR: invalid token",e),!1):k.isExpired(t.exp)?(f.error("Store:setClientToken ERROR: token expired",e),!1):(t=t.exp,k.isAvailable()?k.setStringWithTtl("snr-token",e,t)?(E.remove("_snrs_token"),!0):void 0:(f.log("Store:setClientToken ERROR: Localstorage unavailable. Setting cookie"),t=new Date(1e3*t),E.setForDateExpires("_snrs_token",e,t),!0))},removeClientToken:function(){k.remove("snr-token"),E.remove("_snrs_token")},setNotificationCapping:function(e){var t,n;f.log("Store:setNotificationCapping",e),e.capping&&g.isObject(e.capping)&&e.id&&"count"===(t=e.capping).type&&t.count&&0<t.count&&(t.expiration?(n=(n=E.get("_snrs_notify_capping_"+e.id))||0,E.set("_snrs_notify_capping_"+e.id,++n,t.expiration),f.log("Store:setNotificationCapping done",n,"with expiration",t.expiration)):(n=(t=(t=E.get("_snrs_notify_capping"))&&g.isObject(t)?t:{}
1)[e.id]||0,t[e.id]=++n,E.set("_snrs_notify_capping",t),f.log("Store:setNotificationCapping done",n)))},getNotificationCapping:function(e){var t,n;if(f.log("Store:getNotificationCapping",e),e.id)return t=0,e.capping&&e.capping.expiration?t=(t=E.get("_snrs_notify_capping_"+e.id))||0:(n=E.get("_snrs_notify_capping"))&&g.isObject(n)&&n[e.id]&&(t=n[e.id]),f.log("Store:getNotificationCapping value",t),t},getProfileConfig:function(){var e,t=k.getContainer("_snrs_profile_config");return!t||!(e=t.snrsProfileConfigExpire)||18e4<Date.now()-parseInt(e)?null:t},setProfileConfig:function(e){Array.isArray(e[b.EVENT_LIST_SIGNED_IDENTIFIED])&&k.saveContainer("_snrs_profile_config",e)&&k.setToContainer("_snrs_profile_config","snrsProfileConfigExpire",Date.now())}},Q={PERMISSION_AGREED:"agreed",PERMISSION_BLOCKED:"blocked",PERMISSION_DEFAULT:"default",init:function(){return f.log("WebPushApp:init"),h.uniquePromiseHandler("WebPushApp.init",function(e,t){if(f.log("WebPushApp:init",D._config.mode),D._config.mode!==D.CONFIG_WEBPUSH_MODE_NATIVE)return t(new Error("Unable to init web push app"));Q.initProvider().then(function(){f.log("WebPushApp:init done"),e()}).catch(function(e){f.error("WebPushApp:init error",e),t(e)})})},parseFirebaseErrorCode:function(e){switch(e){case"messaging/permission-blocked":case"messaging/notifications-blocked":return D.EVENT_ERROR_CODE_PERMISSION_BLOCKED;case"messaging/permission-default":case"messaging/notifications-default":return D.EVENT_ERROR_CODE_PERMISSION_DEFAULT;default:return D.EVENT_ERROR_CODE_PERMISSION_UNKNOWN}},initProvider:function(){return f.log("WebPushApp:initProvider",A),A.init()},requestPermission:function(e){return A.requestPermission(e)},getToken:function(){return A.getToken()},deleteToken:function(e){return A.deleteToken(e)},showNotification:function(e){return A.showNotification(e)},getPermission:function(){return A.getPermission()},getDomain:function(){return A.getDomain()}},O={_initialized:!1,_html:null,_container:null,_widgetCtr:null,_widgetStateCtr:null,_buttonTriggerCtr:null,_closeBtn:null,_widgetClass:"snrs-webpush--widget",_widgetStateContainerClass:"snrs-webpush--widget-state-container",_buttonTriggerClass:"snrs-webpush--widget-trigger",_triggerWidgetCloseClass:"snrs-webpush--trigger-widget-close",_triggerWidgetOpenClass:"snrs-webpush--trigger-widget-open",_triggerHideClass:"snrs-webpush--trigger-hide",_triggerShowClass:"snrs-webpush--trigger-show",_containerShownClass:"snrs-webpush--shown",_widgetOpenedClass:"snrs-webpush--widget-opened",_statePrefixClass:"snrs-webpush--state-",STATE_SUBSCRIBE:"subscribe",STATE_UNSUBSCRIBE:"unsubscribe",STATE_UNKNOWN:"unknown",_closeBtnClass:"snrs-webpush--close",_options:{},_callbackStack:{onStateContentChange:function(){},onStateChange:function(){},onButtonTriggerClick:function(){},onWidgetClose:function(){},onWidgetOpen:function(){},onShow:function(){},onHide:function(){}},getStateOptionList:function(){return[O.STATE_SUBSCRIBE,O.STATE_UNSUBSCRIBE,O.STATE_UNKNOWN]},init:function(r){return new Je(function(e,t){var n;return f.log("WebPushFloatingButton:init - initialized:",O._initialized,r),O._initialized?e():(O._options=g.extend({},r),O._options?(O._html=O._options.content,O._html?O._options.change_state&&g.isEmpty(O._options.state_content)?(f.error("WebPushFloatingButton:init - State content options are not defined",O._options),t(new Error("State content options are not defined"))):((n=document.createElement("div")).innerHTML=O._html,O._container=n.childNodes[0],O._widgetCtr=O._container.querySelector("."+O._widgetClass),O._widgetStateCtr=O._container.querySelector("."+O._widgetStateContainerClass),O._buttonTriggerCtr=O._container.querySelector("."+O._buttonTriggerClass),O._widgetCtr&&O._buttonTriggerCtr?(O._options.change_state&&!O._widgetStateCtr&&(f.info("WebPushFloatingButton:init - Widget state container is not defined - used widget container instead"),h.addClass(O._widgetCtr,O._widgetStateContainerClass),O._widgetStateCtr=O._widgetCtr),h.removeClass(O._container,O._containerShownClass),O.updateState(O.STATE_UNKNOWN),document.body&&(document.body.appendChild(O._container),O.attachGeneralActions(Ke.document)),O._initialized=!0,void e()):(f.error("WebPushFloatingButton:init - Content is invali
1d",O._widgetCtr,O._buttonTriggerCtr),t(new Error("Content is invalid")))):(f.error("WebPushFloatingButton:init - Content is not defined",O._options),t(new Error("Content is not defined")))):(f.error("WebPushFloatingButton:init - options are not defined",O._options),t(new Error("Options are not defined"))))})},attachGeneralActions:function(e){f.log("WebPushFloatingButton:_attachGeneralActions"),e=e||O._container,h.attachHandlerByClassName(e,O._buttonTriggerClass,"click",O.onButtonTriggerClick.bind(O)),h.attachHandlerByClassName(e,O._triggerWidgetCloseClass,"click",O.closeWidget.bind(O)),h.attachHandlerByClassName(e,O._triggerWidgetOpenClass,"click",O.openWidget.bind(O)),h.attachHandlerByClassName(e,O._triggerHideClass,"click",O.hide.bind(O)),h.attachHandlerByClassName(e,O._triggerShowClass,"click",O.show.bind(O))},updateState:function(e){if(f.log("WebPushFloatingButton:updateState",e,O._options),!g.inArray(e,O.getStateOptionList()))throw new Error('State value "'+e+'" is invalid');h.removeClass(O._container,O._statePrefixClass+O.STATE_UNKNOWN),h.removeClass(O._container,O._statePrefixClass+O.STATE_SUBSCRIBE),h.removeClass(O._container,O._statePrefixClass+O.STATE_UNSUBSCRIBE),h.addClass(O._container,O._statePrefixClass+e),O._triggerCallback("onStateChange",e),O._options.change_state&&O._widgetStateCtr&&(O._options.state_content&&O._options.state_content[e]!==x?(O._widgetStateCtr.innerHTML=O._options.state_content[e],O.attachGeneralActions(O._widgetStateCtr),O._triggerCallback("onStateContentChange",e,O._widgetStateCtr)):f.error("WebPushFloatingButton:updateState Content is not defined for current state",e,O._options.state_content))},_triggerCallback:function(e){if(f.log("WebPushFloatingButton:_triggerCallback",e,O._callbackStack),O._callbackStack[e]){for(var t=new Array(arguments.length-1),n=0;n<t.length;++n)t[n]=arguments[n+1];var r=O._callbackStack[e];if(g.isFunction(r))if(f.log("WebPushFloatingButton:_triggerCallback call with args",e,t,r),!1===r.apply(O,t))return!1}},onStateContentChangeHandler:function(e){O._callbackStack.onStateContentChange=e},onStateChangeHandler:function(e){O._callbackStack.onStateChange=e},onButtonTriggerClickHandler:function(e){O._callbackStack.onButtonTriggerClick=e},onWidgetCloseHandler:function(e){O._callbackStack.onWidgetClose=e},onWidgetOpenHandler:function(e){O._callbackStack.onWidgetOpen=e},onShowHandler:function(e){O._callbackStack.onShow=e},onHideHandler:function(e){O._callbackStack.onHide=e},show:function(){var e=O.isShown();f.log("WebPushFloatingButton:show - hasShow",!!e),e||(h.addClass(O._container,O._containerShownClass),O._triggerCallback("onShow"))},hide:function(){var e=O.isShown();f.log("WebPushFloatingButton:hide - hasShow",!!e),e&&(h.removeClass(O._container,O._containerShownClass),O._triggerCallback("onHide"))},isShown:function(){return h.hasClass(O._container,O._containerShownClass)},isHidden:function(){return!O.isShown()},isWidgetOpened:function(){return h.hasClass(O._container,O._widgetOpenedClass)},isWidgetClosed:function(){return!O.isWidgetOpened()},onButtonTriggerClick:function(){return!1!==O._triggerCallback("onButtonTriggerClick")&&(O.isWidgetOpened()?O.closeWidget():O.openWidget())},closeWidget:function(){var e=O.isWidgetOpened();f.log("WebPushFloatingButton:closeWidget - isWidgetOpened",!!e),e&&(h.removeClass(O._container,O._widgetOpenedClass),O._triggerCallback("onWidgetClose"))},openWidget:function(){var e=O.isWidgetOpened();f.log("WebPushFloatingButton:closeWidget - isWidgetOpened",!!e),e||(h.addClass(O._container,O._widgetOpenedClass),O._triggerCallback("onWidgetOpen"))}},D={CONFIG_WEBPUSH_MODE_NATIVE:"native",CONFIG_WEBPUSH_MODE_EXTERNAL:"external",EVENT_ERROR_CODE_PERMISSION_BLOCKED:"permission-blocked",EVENT_ERROR_CODE_PERMISSION_DEFAULT:"permission-default",EVENT_ERROR_CODE_PERMISSION_UNKNOWN:"permission-unknown",_stylesUrl:[],_config:{},_appIsReady:x,_serviceWorker:null,_callbackStack:{onWebPushSubscribe:function(){},onWebPushSubscribeBlock:function(){},onWebPushSubscribeDiscard:function(){},onWebPushUnsubscribe:function(){},onBrowserPermissionAgree:function(){},onBrowserPermissionBlock:function(){},onBrowserPermissionDiscard:function(){},onMessage:function(){}},onWebPushSubscribe:function(e){D._callbackStack.onWebPushSubscribe=e},onWebPushSubscribeBlock:function(e){D._callbackStack.onWebPushSubscribeBlock=e},onWebPushSubscribeDiscard:function(e){D._callbackStack.onWebPushSubscribeDiscard=e},onWebPushUnsubscribe:function(e){D._callbackStack.onWebPushUnsubscribe=e},onBrowserPermissionAgree:function(e){D._callbackStack.onBrowserPermissionAgree=e},onBrowserPermissionBlock:function(e){D._callbackStack.onBrowserPermissionBlock=e},onBrowserPermissionDiscard:function(e){D._callbackStack.onBrowserPermissionDiscard=e},onMessage:function(e){D._callbackStack.onMessage=e},getConfigWebpushModeSupportedList:function(){return[D.CONFIG_WEBPUSH_MODE_NATIVE,D.CONFIG_WEBPUSH_MODE_EXTERNAL]},init:function(n){return h.uniquePromiseHandler("WebPushManager.init",function(e,t){f.log("WebPushManager:init",n),m.getWebPushProfileConfig().then(function(e){return Je.resolve(g.extend(e||{},n||{}))}).then(D.setConfig).then(D.initState).then(D.isWebPushSupported).then(function(){return D.attachHandlers(Ke.document)}).then(function(){return D.initApp().then(function(){return D.checkAndSynchronizeStateIfRequired().then(function(e){f.log("WebPushManager:init checkAndSynchronizeStateIfRequired then",e)}).catch(function(e){f.error("WebPushManager:init checkAndSynchronizeStateIfRequired then error",e)}),Je.resolve()}).then(function(){return D.initFloatingButton().then(function(){f.log("WebPushManager:init initFloatingButton done")}).catch(function(e){f.error("WebPushManager:init initFloatingButton Can not init floating button - error occurred",e)}),Je.resolve()}).catch(function(e){f.error("WebPushManager:init initApp error",e)}),Je.resolve()}).then(function(){f.log("WebPushManager:init done"),e()}).catch(function(e){f.error("WebPushManager:init error",e),t(e)})})},getMode:function(){return D._config.mode},getDomain:function(){return Q.getDomain()},initFloatingButton:function(){return new Je(function(e,t){var n;return D._config.floating_button?(n=D._config.language)?(O.onStateContentChangeHandler(D.onFloatingButtonStateContentChange.bind(D)),O.init(n.floating_button).then(function(){D.attachHandlers(O._container),D.updateFloatingButtonState(),O.show(),e()}).catch(t)):(f.error("WebPushManager:init Can not init floating button - language config is not defined",D._config),t(new Error("Language config is not defined"))):(f.log("WebPushManager:init Floating button is disabled",D._config),e())})},onFloatingButtonStateContentChange:function(e,t){f.log("WebPushManager:onFloatingButtonStateContentChange",e,t),D.attachHandlers(t)},onWebPushStateSubscriptionChange:function(e,t){f.log("WebPushManager:onWebPushStateChange",e,t),f.log("WebPushManager:onWebPushStateChange WebPushFloatingButton._initialized",O._initialized),O._initialized&&D.updateFloatingButtonState()},updateFloatingButtonState:function(){return new Je(function(e,t){if(!O._initialized)return f.error("WebPushManager:init Can not update floating button state - module is not initialized",O),t(new Error("Can not update floating button state - module is not initialized"));var n=null;switch(N.getSubscription()){case N.SUBSCRIPTION_UNKNOWN:n=O.STATE_UNKNOWN;break;case N.SUBSCRIPTION_SUBSCRIBE:n=O.STATE_SUBSCRIBE;break;case N.SUBSCRIPTION_UNSUBSCRIBE:n=O.STATE_UNSUBSCRIBE}O.updateState(n),e()})},initApp:function(){return new h.uniquePromiseHandler("WebPushManager.initApp",function(e,t){f.log("WebPushManager:initApp"),Q.init().then(function(){var e=N.getSubscription();return f.log("WebPushManager:initApp check subscription",e),e!==N.SUBSCRIPTION_UNKNOWN?Je.resolve():(f.log("WebPushManager:initApp 0"),new Je(function(t,e){D.sendRequestToCheckSubscription().then(function(e){f.log("WebPushManager:initApp sendRequestToCheckSubscription then",e),N.setSubscription(e,!0),t()}).catch(function(e){f.error("WebPushManager:initApp Can not get subscription",e),t()})}))}).then(function(){var e=N.getBrowserPermission();return f.log("WebPushManager:initApp check browser permission",e),e!==N.BROWSER_PERMISSION_DEFAULT?Je.resolve():(f.log("WebPushManager:initApp 0"),new Je(function(t,e){D.getBrowserPermission().then(function(e){f.log("WebPushManager:initApp getBrowserPermission then",e),N.setBrowserPermission(e,!1),t()}).catch(function(e){f.error("WebPushManager:initApp Can not get browser permission",e),t()})}))}).then(function(){f.log("WebPushManager:initApp done"),D._appIsReady=!0,e()}).catch(function(e){return f.error("WebPushManager:initApp Can not init web push app",e),D._appIsReady=!1,t(new Error("Can not init web push app"))})})},prepareStyles:function(){return new Je(function(e,t){if(f.log("WebPushManager:prepareStyles"),!D._stylesUrl)return e();h.addStyles(D._stylesUrl).then(function(){e()}).catch(function(e){f.error(e),t(e)})})},setConfig:function(r){return new Je(function(e,t){r=r||{},f.log("WebPushManager:setConfig",r);var n={service_worker_path:"/snr-sw.js",service_worker_scope:"/",sender_id:null,public_vapid:null,agreement_page_domain:null,agreement_page_url:"/agreement.html",external_page_iframe_url:"/iframeWorker.html",mode:D.CONFIG_WEBPUSH_MODE_NATIVE,enabled:!1};f.log("WebPushManager:setConfig extend",n,D._config,r),D._config=g.extend({}
1,n,D._config,r),D._config.service_worker_path||(D._config.service_worker_path=n.service_worker_path),D._config.service_worker_scope||(D._config.service_worker_scope=n.service_worker_scope),f.log("WebPushManager:setConfig return ",D._config),e()})},initState:function(){return new Je(function(t,e){f.log("WebPushManager:initState"),N.init().then(function(){f.log("WebPushManager:initState done"),N.onStateSubscriptionChangeHandler(D.onWebPushStateSubscriptionChange.bind(D)),t()}).catch(function(e){return f.error("WebPushManager:initState Can not restore state from cache",e),t()})})},checkAndSynchronizeStateIfRequired:function(){return new Je(function(e,t){f.log("WebPushManager:checkAndSynchronizeStateIfRequired"),navigator.serviceWorker.getRegistrations().then(function(e){return e[0].pushManager.getSubscription().then(function(e){var t;f.log("WebPushManager:checkAndSynchronizeStateIfRequired current subscription",e),e&&(t=h.uint8ArrayToBase64Url(new Uint8Array(e.options.applicationServerKey)),null!==D._config.public_vapid)&&t!==D._config.public_vapid&&(f.log("WebPushManager:checkAndSynchronizeStateIfRequired publicVapid and server keys differ. Unsubscribing."),e.unsubscribe().then(function(){N.setBrowserPermissionSaved(!1),N.setSubscriptionSaved(!1)}))}).catch(function(e){f.error("WebPushManager:checkAndSynchronizeStateIfRequired could not convert server key to string",e)})}).then(function(){var n=N.isSwVersionChanged(D._serviceWorker);if(!n&&N.isSubscriptionSaved()&&N.isBrowserPermissionSaved())return e();Je.resolve().then(function(){var e=N.getBrowserPermission();return n||!N.isBrowserPermissionSaved()&&e===N.BROWSER_PERMISSION_AGREED?(f.log("WebPushManager:checkAndSynchronizeStateIfRequired try saving browser permission",e),new Je(function(t,e){D.getToken().then(function(e){if(f.log("WebPushManager:checkAndSynchronizeStateIfRequired getToken then",e),!n&&!N.isTokenChanged(e))return f.log("WebPushManager:checkAndSynchronizeStateIfRequired getToken token has the same value - do not send request",e),N.setBrowserPermissionSaved(!0),t(e);N.setToken(e),N.setServiceWorkerVersion(D._serviceWorker),D.sendBrowserPermissionRequest(e,D._config.public_vapid).then(function(){N.setBrowserPermissionSaved(!0)}).catch(function(e){f.error("WebPushManager:checkAndSynchronizeStateIfRequired sendAddBrowserPermissionRequest then error",e)}),t(e)}).catch(function(e){f.error("WebPushManager:checkAndSynchronizeStateIfRequired getToken then error",e),t()})})):Je.resolve()}).then(function(e){var n=N.getSubscription();return N.isSubscriptionSaved()||n===N.SUBSCRIPTION_UNKNOWN?Je.resolve():(f.log("WebPushManager:checkAndSynchronizeStateIfRequired try saving subscription",n),new Je(function(e,t){if(n===N.SUBSCRIPTION_SUBSCRIBE)D.sendSubscribeRequest().then(function(){N.setSubscriptionSaved(!0)}).catch(function(e){f.error("WebPushManager:checkAndSynchronizeStateIfRequired sendSubscribeRequest then error",e)});else{if(n!==N.SUBSCRIPTION_UNSUBSCRIBE)return e();D.sendUnsubscribeRequest().then(function(){N.setSubscriptionSaved(!0)}).catch(function(e){f.error("WebPushManager:checkAndSynchronizeStateIfRequired sendUnsubscribeRequest then error",e)})}e()}))}).then(function(){e()}).catch(function(e){t(e)})}).catch(function(e){return f.error("WebPushManager:checkAndSynchronizeStateIfRequired could not get current subscription",e),t(new Error("Could not get current subscription"))})})},getBrowserPermission:function(){return f.log("WebPushManager:getBrowserPermission"),new Je(function(t,e){Q.getPermission().then(function(e){f.log("WebPushManager:getBrowserPermission getPermission then",e),t(D.mapAppPermissionToBrowserPermissionValues(e))}).catch(e)})},getSubscription:function(){return f.log("WebPushManager:getSubscription"),D.getSubscriptionState()},mapAppPermissionToBrowserPermissionValues:function(e){switch(e){case Q.PERMISSION_DEFAULT:return N.BROWSER_PERMISSION_DEFAULT;case Q.PERMISSION_BLOCKED:return N.BROWSER_PERMISSION_BLOCKED;case Q.PERMISSION_AGREED:return N.BROWSER_PERMISSION_AGREED}},isWebPushSupported:function(){return new Je(function(e,t){return f.log("WebPushManager:isWebPushSupported",D._config,document.location,u.getProtocol()),D._config.enabled?g.inArray(D._config.mode,D.getConfigWebpushModeSupportedList())?D._config.mode===D.CONFIG_WEBPUSH_MODE_NATIVE&&"localhost"!==document.location.hostname&&"https"!==u.getProtocol()?(f.error('WebPushManager:isWebPushSupported WebPush service do not support unsecured protocol "%s"',document.location.protocol),t(new Error("WebPush service do not support unsecured protocol"))):"PushManager"in Ke?void e():(f.error("WebPushManager:isWebPushSupported This browser does not support push notification"),t(new Error("This browser does not support push notification"))):(f.error('WebPushManager:isWebPushSupported WebPush mode "%s" is not supported',D._config.mode),t(new Error("WebPush mode is not supported"))):(f.info("WebPushManager:isWebPushSupported WebPush is currently disabled",D._config.enabled),t(new Error("WebPush is currently disabled")))})},isWebPushAppReady:function(){return new Je(function(e,t){f.log("WebPushManager:isWebPushAppReady",D._appIsReady),(!0===D._appIsReady?Je.resolve():!1===D._appIsReady?Je.reject(new Error("App not initialized")):D.initApp()).then(function(){e()}).catch(function(e){return f.error("WebPushManager:isWebPushAppReady WebPush app is currently not available"),t(new Error("WebPush is currently not available"))})})},checkSubscribeRequestNeed:function(){var e=N.getSubscription(),t=N.getBrowserPermission();return f.log("WebPushManager:checkSubscribeRequestNeed",e,t),t===N.BROWSER_PERMISSION_DEFAULT||t===N.BROWSER_PERMISSION_AGREED&&e!==N.SUBSCRIPTION_SUBSCRIBE},getSubscriptionState:function(){return N.getSubscription()},getBrowserPermissionState:function(){return N.getBrowserPermission()},attachHandlers:function(n,r){return new Je(function(e,t){f.log("WebPushManager:attachEvents",n,r),h.attachHandlerByClassName(n,"snrs-webpush--trigger-subscribe","click",D.onWebPushTriggerSubscribeHandler,r),h.attachHandlerByClassName(n,"snrs-webpush--trigger-subscribeDiscard","click",D.onWebPushTriggerSubscribeDiscardHandler,r),h.attachHandlerByClassName(n,"snrs-webpush--trigger-unsubscribe","click",D.onWebPushTriggerUnsubscribeHandler,r),e()})},onWebPushTriggerSubscribeHandler:function(){return new Je(function(t,n){f.log("WebPushManager:onWebPushTriggerSubscribeHandler"),D.subscribe().then(function(e){return f.log("WebPushManager:onWebPushTriggerSubscribeHandler requestPermission then hasShowed value",e),t(e)}).catch(function(e){f.error("WebPushManager:onWebPushTriggerSubscribeHandler requestPermission error occurred",e),n(e)})})},onWebPushTriggerSubscribeDiscardHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushTriggerSubscribeDiscardHandler"),D.onWebPushSubscribeDiscardHandler().then(function(){e()}).catch(function(e){f.error("WebPushManager:onWebPushTriggerSubscribeDiscardHandler onWebPushSubscribeDiscardHandler error occurred",e),t(e)})})},onWebPushTriggerUnsubscribeHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushTriggerUnsubscribeHandler"),D.unsubscribe().then(function(){f.log("WebPushManager:onWebPushTriggerUnsubscribeHandler requestPermission then"),e()}).catch(function(e){f.error("WebPushManager:onWebPushTriggerUnsubscribeHandler error occurred",e),t(e)})})},getMessageChannel:function(){return new Je(function(e,t){if(f.log("WebPushManager:getMessageChannel"),!Ke.MessageChannel)return t(new Error("MessageChannel is not supported"));t=new Ke.MessageChannel;f.log("WebPushManager:getMessageChannel result",t),e(t)})},onServiceWorkerMessageHandler:function(e){f.log("WebPushManager:onServiceWorkerMessageHandler onmessage",e.data,e),"snrSwVersionSet"!==e.data.action&&"snrSwInstall"!==e.data.action||(f.log("WebPushManager:onServiceWorkerMessageHandler",e.data.version),D._serviceWorker=e.data.version,D.checkAndSynchronizeStateIfRequired())},onMessageClickHandler:function(n){return new Je(function(e,t){f.log("WebPushManager:onMessageClickHandler",n),e()})},onBrowserPermissionAgreeHandler:function(){return new Je(function(t,n){f.log("WebPushManager:onBrowserPermissionAgreeHandler"),N.setBrowserPermission(N.BROWSER_PERMISSION_AGREED,!1),D.getToken().then(function(e){f.log("WebPushManager:onBrowserPermissionAgreeHandler getToken then",e),b.trackClientEvent("","webpush.permissionAgree",{token:e}),D._callbackStack.onBrowserPermissionAgree(),D.onWebPushSubscribeHandler(),t()}).catch(function(e){f.error("WebPushManager:onBrowserPermissionAgreeHandler getToken then error",e),n(e)})})},onBrowserPermissionBlockHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onBrowserPermissionBlockHandler"),N.setBrowserPermission(N.BROWSER_PERMISSION_BLOCKED,!1),b.trackClientEvent("","webpush.permissionBlock",{}),D._callbackStack.onBrowserPermissionBlock(),D.onWebPushSubscribeBlockHandler(),e()})},onBrowserPermissionDiscardHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onBrowserPermissionDiscardHandler"),b.trackClientEvent("","webpush.permissionDiscard",{}),D._callbackStack.onBrowserPermissionDiscard(),D.onWebPushSubscribeDiscardHandler(),e()})},onWebPushSubscribeHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushSubscribeHandler"),N.setSubscription(N.SUBSCRIPTION_SUBSCRIBE,!1),b.trackClientEvent("","webpush.subscribe",{}),D.checkAndSynchronizeStateIfRequired(),D._callbackStack.onWebPushSubscribe(),e()})},onWebPushSubscribeBlockHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushSubscribeBlockHandler"),b.trackClientEvent("","webpush.subscribeBlock",{}),D._callbackStack.onWebPushSubscribeBlock(),e()})},onWebPushSubscribeDiscardHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushSubscribeDiscardHandler"),b.trackClientEvent("","webpush.subscribeDiscard",{}),D._callbackStack.onWebPushSubscribeDiscard(),e()})},onWebPushUnsubscribeHandler:function(){return new Je(function(e,t){f.log("WebPushManager:onWebPushUnsubscribeHandler"),N.setSubscription(N.SUBSCRIPTION_UNSUBSCRIBE,!1),b.trackClientEvent("","webpush.unsubscribe",{}),D.checkAndSynchronizeStateIfRequired(),D._callbackStack.onWebPushUnsubscribe(),e()})},requestPermission:function(e){return new Je(function(t,n){e=e||{},Q.requestPermission(e).then(function(e){f.log("WebPushManager:requestPermission then",e),t(e)}).catch(function(e){f.error("WebPushManager:requestPermission then error",e),n(e)})})},subscribe:function(e){return new Je(function(t,n){e=e||{},Q.requestPermission(e).then(function(e){if(f.log("WebPushManager:requestPermission then",e),!1===e)return N.setBrowserPermission(N.BROWSER_PERMISSION_AGREED,!1),D.onWebPushSubscribeHandler(),t(e);t(e)}).catch(function(e){f.error("WebPushManager:requestPermission then error",e),e.code===D.EVENT_ERROR_CODE_PERMISSION_BLOCKED&&(N.setBrowserPermission(N.BROWSER_PERMISSION_BLOCKED,!1),D.onWebPushSubscribeBlockHandler()),n(e)})})},unsubscribe:function(e){return new Je(function(e,t){f.log("WebPushManager:unsubscribe"),D.onWebPushUnsubscribeHandler().then(function(){f.log("WebPushManager:unsubscribe then"),e()}).catch(function(e){f.error("WebPushManager:unsubscribe then error",e),t(new Error("Unable to unsubscribe webpush notifications"))})})},getToken:function(){return new Je(function(t,n){Q.getToken().then(function(e){if(e)return f.log("WebPushManager:getToken Token has been received",e),t(e);f.log("WebPushManager:getToken Can not get token, permission required"),t()}).catch(function(e){f.error("WebPushManager:getToken Can not get token, it has been blocked",e),n(e)})})},deleteToken:function(e){return new Je(function(t,n){Q.deleteToken(e).then(function(e){f.log("WebPushManager:deleteToken Token has been deleted",e),N.setBrowserPermission(N.BROWSER_PERMISSION_AGREED,!1),t()}).catch(function(e){f.error("WebPushManager:deleteToken Can not delete token, error occurred",e),n(new Error("Can not delete token, error occurred"))})})},sendSubscribeRequest:function(){return new Je(function(e,t){f.log("WebPushManager:sendSubscribeRequest"),T.subscribeWebPushForClient().then(function(){f.log("WebPushManager:sendSubscribeRequest subscribed"),e()}).catch(function(e){f.error("WebPushManager:sendSubscribeRequest Can not subscribe, error occurred",e),t(new Error("Can not save subscribe status of notifications, error occurred"))})})},sendUnsubscribeRequest:function(){return new Je(function(e,t){return f.log("WebPushManager:sendUnsubscribeRequest"),T.unsubscribeWebPushForClient().then(function(){f.log("WebPushManager:sendUnsubscribeRequest unsubscribed"),e()}).catch(function(e){f.error("WebPushManager:sendUnsubscribeRequest Can not unsubscribe web push, error occurred",e),t(new Error("Can not save unsubscribe status of notifications, error occurred"))}),e()})},sendRequestToCheckSubscription:function(){return new Je(function(t,n){f.log("WebPushManager:sendRequestToCheckSubscription for domain",D.getDomain()),T.checkWebPushSubscriptionForClient(D.getDomain()).then(function(e){if(f.log("WebPushManager:sendRequestToCheckSubscription subscription",e,D.getDomain()),!g.inArray(e,N.getSubscriptionOptionList()))return Je.reject(new Error("Subscription status is invali
1d"));t(e)}).catch(function(e){f.error("WebPushManager:sendRequestToCheckSubscription Can not get subscription status of notifications, error occurred",e),n(new Error("Can not get subscription status of notifications, error occurred"))})})},sendBrowserPermissionRequest:function(r,i){return new Je(function(t,n){f.log("WebPushManager:sendBrowserPermissionRequest for domain",D.getDomain()),navigator.serviceWorker.getRegistrations().then(function(e){return e[0].pushManager.getSubscription().then(function(e){return f.log("WebPushManager:sendBrowserPermissionRequest current subscription",e),i?e.toJSON():null}).catch(function(e){f.error("WebPushManager:sendBrowserPermissionRequest could not get subscription",e)})}).then(function(e){T.addBrowserPermissionWebPushForClient(r,D.getDomain(),e,N.getServiceWorkerVersion()).then(function(){f.log("WebPushManager:sendBrowserPermissionRequest Token has been saved",r,D.getDomain()),t()}).catch(function(e){f.error("WebPushManager:sendBrowserPermissionRequest Can not save token, error occurred",e),n(new Error("Can not save token, error occurred"))})}).catch(function(e){f.error("WebPushManager:sendBrowserPermissionRequest could not get subscription",e)})})},onTokenRefresh:function(){f.log("WebPushManager:onTokenRefresh"),N.setBrowserPermission(N.BROWSER_PERMISSION_AGREED,!1),D.checkAndSynchronizeStateIfRequired()},onMessageHandler:function(e){f.log("WebPushManager:onMessageHandler",e),e&&g.isDocumentVisible()&&(e.notification?D.showNotification(e):e.data&&D.onMessageClickHandler(e.data),D._callbackStack.onMessage(e))},showNotification:function(n){return new Je(function(e,t){if(f.log("WebPushManager:showNotification",n),!n||!n.notification)return t(new Error("Payload is empty or it have not notification key"));n.notification=g.extend({},n.data,n.notification),Q.showNotification(n).then(function(){f.log("WebPushManager:showNotification then",n)}).catch(function(e){f.error("Can not show notification",e),t(new Error("Can not show notification"))})})}},A={_firebaseAppNamespace:"SyneriseApp",_firebaseApp:null,_firebaseMessangingApp:null,_serviceWorkerRegistration:null,init:function(){return new Je(function(e,t){f.log("WebPushNativeApp:init firebase",U),A.initFcmApp().then(A.registerServiceWorker).then(function(){f.log("WebPushNativeApp:init done"),e()}).catch(function(e){f.error("WebPushNativeApp:init error",e),t(e)})})},initFcmApp:function(){return new Je(function(e,t){var n;return f.log("WebPushNativeApp:initFcmApp"),U?D._config.api_key?D._config.project_id?D._config.sender_id?D._config.app_id?(n={apiKey:D._config.api_key,projectId:D._config.project_id,messagingSenderId:D._config.sender_id,appId:D._config.app_id},A._firebaseApp=U.initializeApp(n,A._firebaseAppNamespace),A._firebaseMessangingApp=U.messaging(A._firebaseApp),A._firebaseMessangingApp.onTokenRefresh(function(){f.log("WebPushNativeApp:initFcmApp onTokenRefresh"),D.onTokenRefresh()}),A._firebaseMessangingApp.onMessage(function(e){f.log("WebPushNativeApp:initFcmApp onMessage",e),D.onMessageHandler(e)}),D._config.public_vapid&&(f.log("WebPushNativeApp:initFcmApp usePublicVapidKey ",D._config.public_vapid),A._firebaseMessangingApp.usePublicVapidKey(D._config.public_vapid)),void e()):t(new Error("App id is required for web push")):t(new Error("Sender id is required for web push")):t(new Error("Project id is required for web push")):t(new Error("Api key is required for web push")):t(new Error("Firebase Cloud Messaging APP is required"))})},registerServiceWorker:function(){return new Je(function(n,t){if(f.log("WebPushNativeApp:registerServiceWorker"),!A._firebaseApp||!A._firebaseMessangingApp)return t(new Error("WebPush manager is not initialized"));if(!("serviceWorker"in navigator))return t(new Error("Service worker in not supported"));navigator.serviceWorker.addEventListener("message",function(e){e.data&&e.data.action&&D.onServiceWorkerMessageHandler(e)});var e=m.getBuildHash();navigator.serviceWorker.register(D._config.service_worker_path+"?hash="+e,{scope:D._config.service_worker_scope}).then(function(e){f.log("WebPushNativeApp:registerServiceWorker Registration succeeded. Scope is "+e.scope),A._serviceWorkerRegistration=e;function t(){A._firebaseMessangingApp.useServiceWorker(A._serviceWorkerRegistration),A._serviceWorkerRegistration.active.postMessage({action:"snrSwVersionGet"}),n()}e.installing?e.installing.addEventListener("statechange",function(e){"activated"===e.target.state&&t()}):e.active&&t()}).catch(function(e){f.fatal("WebPushNativeApp:registerServiceWorker Registration failed with ",e),t(new Error("Service worker registration failed"))})})},getDomain:function(){return location.hostname},requestPermission:function(e){return new Je(function(t,n){if(e=e||{},f.log("WebPushNativeApp:requestPermission",e),!A._firebaseApp||!A._firebaseMessangingApp)return n(new Error("WebPush manager is not initialized"));A.getToken().then(function(e){if(f.log("WebPushNativeApp:requestPermission getToken then",e),e)return t(!1);A._firebaseMessangingApp.requestPermission().then(function(e){f.log("WebPushNativeApp:requestPermission Notification permission granted",e),D.onBrowserPermissionAgreeHandler()}).catch(function(e){f.error("WebPushNativeApp:requestPermission Unable to get permission to notify",e);var t=new Error("Unable to get permission to notify");switch(t.code=Q.parseFirebaseErrorCode(e.code),t.code){case D.EVENT_ERROR_CODE_PERMISSION_BLOCKED:D.onBrowserPermissionBlockHandler();break;case D.EVENT_ERROR_CODE_PERMISSION_DEFAULT:D.onBrowserPermissionDiscardHandler()}}),t()}).catch(function(e){f.error("WebPushNativeApp:requestPermission getToken then error",e);var t=new Error("Unable to request permission to notify");t.code=e.code,n(t)})})},getPermission:function(){return new Je(function(n,r){if(f.log("WebPushNativeApp:getPermission"),!A._firebaseApp||!A._firebaseMessangingApp)return r(new Error("WebPush manager is not initialized"));A.getToken().then(function(e){return f.log("WebPushNativeApp:getPermission getToken then",e),n(e?Q.PERMISSION_AGREED:Q.PERMISSION_DEFAULT)}).catch(function(e){if(f.error("WebPushNativeApp:getPermission getToken then error",e),e.code===D.EVENT_ERROR_CODE_PERMISSION_BLOCKED)return n(Q.PERMISSION_BLOCKED);var t=new Error("Unable to get permission");t.code=e.code,r(t)})})},getToken:function(){return new Je(function(t,n){if(f.log("WebPushNativeApp:getToken"),!A._firebaseApp||!A._firebaseMessangingApp)return n(new Error("WebPush manager is not initialized"));A._firebaseMessangingApp.getToken().then(function(e){f.log("WebPushNativeApp:getToken then",e),t(e)}).catch(function(e){f.error(e),f.error("WebPushNativeApp:getToken Can not get token, it has been blocked",e);var t=new Error("Can not get token, it has been blocked");t.code=Q.parseFirebaseErrorCode(e.code),n(t)})})},deleteToken:function(e){return new Je(function(t,n){if(f.log("WebPushNativeApp:deleteToken"),!A._firebaseApp||!A._firebaseMessangingApp)return n(new Error("WebPush manager is not initialized"));A._firebaseMessangingApp.deleteToken(e).then(function(e){t(e)}).catch(function(e){f.error("WebPushNativeApp:deleteToken Can not delete token, error occurred",e),n(new Error("Can not delete token, error occurred"))})})},showNotification:function(o){return new Je(function(r,i){f.log("WebPushNativeApp:showNotification",o),navigator.serviceWorker.getRegistrations().then(function(e){f.log("WebPushNativeApp:showNotification serviceWorker getRegistrations",o,e);var t=document.location.origin+D._config.service_worker_scope;[].forEach.call(e,function(n){t==n.scope&&D.getMessageChannel().then(function(e){var t={action:"worker.showNotification",notificationPayload:o};e.port1.onmessage=D.onServiceWorkerMessageHandler,n.active.postMessage(t,[e.port2]),r()}).catch(function(e){f.error("Can not show notification. Can not get message channel",e),i(new Error("Can not show notification. Can not get message channel"))})})}).catch(function(e){f.error("Can not show notification. Service worker is not ready yet",e),i(new Error("Can not show notification. Service worker is not ready yet"))})})}},N={SUBSCRIPTION_SUBSCRIBE:"subscribe",SUBSCRIPTION_UNSUBSCRIBE:"unsubscribe",SUBSCRIPTION_UNKNOWN:"unknown",BROWSER_PERMISSION_AGREED:"agreed",BROW
1SER_PERMISSION_BLOCKED:"blocked",BROWSER_PERMISSION_DEFAULT:"default",_data:{subscription:"unknown",subscriptionSaved:!1,permission:"default",permissionSaved:!1,tokenTime:null,tokenHash:null,serviceWorker:null},_dataLocalStorageKey:"snr-wp-state",_tokenSavedIntervalRefresh:36e5,_callbackStack:{onStateChange:function(){},onStateSubscriptionChange:function(){}},init:function(){return new Je(function(t,e){f.log("WebPushState:init"),N.restoreStateFromLocalCache().then(function(){var e=I.getClientUuid();f.log("WebPushState:init current state",N._data),f.log("WebPushState:init uuids",e,N._data.uuid),f.log("WebPushState:init synchronized",N._data.permissionSaved),N._data.uuid&&e&&e===N._data.uuid?N._data.tokenTime?(new Date).getTime()-N._data.tokenTime>=N._tokenSavedIntervalRefresh&&(f.log("WebPushState:init timeout occurred for token saved status, clear permission saved status"),N._data.permissionSaved=!1):(f.log("WebPushState:init token time is not defined, clear permission saved status"),N._data.permissionSaved=!1):(f.log("WebPushState:init other client uuid, clear state for this client"),N._data.permissionSaved=!1,N._data.subscriptionSaved=!1,N._data.subscription=N.SUBSCRIPTION_UNKNOWN,N._data.tokenHash=null,N._data.tokenTime=null,N.saveStateInLocalCache()),f.log("WebPushState:init done",N._data),t()}).catch(function(e){return f.error("WebPushState:init Can not restore state from cache - used default values",e),t()})})},_triggerCallback:function(e){if(f.log("WebPushState:_triggerCallback",e),N._callbackStack[e]){for(var t=new Array(arguments.length-1),n=0;n<t.length;++n)t[n]=arguments[n+1];var r=N._callbackStack[e];if(g.isFunction(r))if(f.log("WebPushState:_triggerCallback call with args",e,t,r),!1===r.apply(N,t))return!1}},onStateChangeHandler:function(e){N._callbackStack.onStateChange=e},onStateSubscriptionChangeHandler:function(e){N._callbackStack.onStateSubscriptionChange=e},getBrowserPermissionOptionList:function(){return[N.BROWSER_PERMISSION_AGREED,N.BROWSER_PERMISSION_BLOCKED,N.BROWSER_PERMISSION_DEFAULT]},getSubscriptionOptionList:function(){return[N.SUBSCRIPTION_SUBSCRIBE,N.SUBSCRIPTION_UNSUBSCRIBE,N.SUBSCRIPTION_UNKNOWN]},getServiceWorkerVersion:function(){return N._data.serviceWorker},setServiceWorkerVersion:function(e){N._data.serviceWorker=e,N.saveStateInLocalCache()},getSubscription:function(){return N._data.subscription},isSubscriptionSaved:function(){return N._data.subscriptionSaved},setSubscription:function(e,t){if(f.log("WebPushState:setSubscription",e,t=void 0!==t&&!!t),!g.inArray(e,N.getSubscriptionOptionList()))throw new Error('Subscription value "'+e+'" is invalid');var n=N._data.subscription;N._data.subscription=e,N._data.subscriptionSaved=t,N._triggerCallback("onStateSubscriptionChange",e,n),N.saveStateInLocalCache()},setSubscriptionSaved:function(e){f.log("WebPushState:setSubscriptionSaved",e=void 0!==e&&!!e),N._data.subscriptionSaved=e,N.saveStateInLocalCache()},getBrowserPermission:function(){return N._data.permission},isBrowserPermissionSaved:function(){return N._data.permissionSaved},setBrowserPermission:function(e,t){if(f.log("WebPushState:setBrowserPermission",e,t=void 0!==t&&!!t),!g.inArray(e,N.getBrowserPermissionOptionList()))throw new Error('Browser permission value "'+e+'" is invalid');N._data.permission=e,N._data.permissionSaved=t,N._data.tokenTime=(new Date).getTime(),N.saveStateInLocalCache()},isToken:function(){return!!N._data.tokenHash},setToken:function(e){f.log("WebPushState:setToken",e),N.setTokenHash(e?N.prepareHashForToken(e):null)},setTokenHash:function(e){f.log("WebPushState:setTokenHash",e),N._data.tokenHash=e||null,N.saveStateInLocalCache()},prepareHashForToken:function(e){return f.log("WebPushState:prepareHashForToken",e),h.hashString(e)+""},isTokenChanged:function(e){if(f.log("WebPushState:isTokenChanged",e),e)return!N._data.tokenHash||N._data.tokenHash!==N.prepareHashForToken(e);throw new Error("Token not defined")},isSwVersionChanged:function(e){return f.log("WebPushState:isSwVersionChanged",e,N._data.serviceWorker),e&&N._data.serviceWorker!==e},setBrowserPermissionSaved:function(e){f.log("WebPushState:setBrowserPermissionSaved",e=void 0!==e&&!!e),N._data.permissionSaved=e,
1N._data.tokenTime=(new Date).getTime(),N.saveStateInLocalCache()},saveStateInLocalCache:function(){return new Je(function(e,t){var n;f.log("WebPushState:saveStateInLocalCache",N._data),k.isAvailable()&&(n=N.prepareObjectForCacheState(N._data),k.set(N._dataLocalStorageKey,n),f.log("WebPushState:saveStateInLocalCache saved stateObject",n)),O._triggerCallback("onStateChange",N._data),e()})},restoreStateFromLocalCache:function(){return new Je(function(e,t){if(f.log("WebPushState:restoreStateFromLocalCache"),!k.isAvailable())return e();var n=k.get(N._dataLocalStorageKey),r=N.prepareObjectFromCacheState(n);if(r)for(var i in r)r.hasOwnProperty(i)&&(N._data[i]=r[i]);f.log("WebPushState:restoreStateFromLocalCache restored state",N._data),e()})},prepareObjectForCacheState:function(e){f.log("WebPushState:prepareObjectForCacheState state",e);var t=I.getClientUuid(),n={permissionSaved:e.permissionSaved?"1":"0",subscriptionSaved:e.subscriptionSaved?"1":"0"};return e.tokenTime&&(n.tokenTime=e.tokenTime),e.tokenHash&&(n.tokenHash=e.tokenHash),e.subscription&&(n.subscription=e.subscription),e.serviceWorker&&(n.serviceWorker=e.serviceWorker),e.permission&&(n.permission=e.permission),t&&(n.uuid=t),f.log("WebPushState:prepareObjectForCacheState return stateForCache",n),n},prepareObjectFromCacheState:function(e){f.log("WebPushState:prepareObjectFromCacheState",e);var t={};return void 0===e?f.log("WebPushState:prepareObjectFromCacheState Not found"):(t.permissionSaved="1"===e.permissionSaved,t.subscriptionSaved="1"===e.subscriptionSaved,e.tokenTime&&(t.tokenTime=parseInt(e.tokenTime,10)),e.tokenHash&&(t.tokenHash=e.tokenHash),e.subscription&&(t.subscription=e.subscription),e.serviceWorker&&(t.serviceWorker=e.serviceWorker),e.permission&&(t.permission=e.permission),e.uuid&&(t.uuid=e.uuid),f.log("WebPushState:prepareObjectFromCacheState state",t)),t}};p.init({startTime:L.getTime()});try{var Z,ee=new Je(function(e){Z=e}),te=(m._readyResolve=Z,{init:m.init.bind(m),isReady:m.isReady.bind(m),ready:m.ready.bind(m),onReady:ee,auth:{apiKey:l.apiKey.bind(l),trackerKey:l.trackerKey.bind(l)},client:{setAccessToken:d.setAccessToken.bind(d),clearAccessToken:d.clearAccessToken.bind(d),getCurrentClient:d.getCurrentClient.bind(d),update:d.updateClientParams.bind(d),notify:d.notify.bind(d),setUuid:d.setUuid.bind(d),hashIdentity:d.hashIdentity.bind(d),getIdentityHash:d.getIdentityHash.bind(d),setUuidAndIdentityHash:d.setUuidAndIdentityHash.bind(d)},event:{track:b.track.bind(b),pageVisit:b.pageVisit.bind(b),sendFormData:b.sendFormData.bind(b),trackCustomEvent:b.trackCustomEvent.bind(b),requiresAuthorization:b.requiresAuthorization.bind(b),dynamicContentShow:b.dynamicContentShow.bind(b),dynamicContentClick:b.dynamicContentClick.bind(b),recommendationView:b.recommendationView.bind(b),recommendationClick:b.recommendationClick.bind(b),itemSearchClick:b.itemSearchClick.bind(b)},device:{getAcceptLanguageList:u.getAcceptLanguageList.bind(j),getLanguage:u.getLanguage.bind(j),getProtocol:u.getProtocol.bind(j),getScreenInfo:u.getScreenInfo.bind(j),isCrawler:u.isCrawler.bind(j)},core:{getVersion:m.getVersion.bind(m),getModuleName:m.getModuleName.bind(m),getFullVersion:m.getFullVersion.bind(m),getBuildTime:m.getBuildTime.bind(m),getBuildHash:m.getBuildHash.bind(m),getTrackerHost:m.getTrackerHost.bind(m),getOption:m.getOption.bind(m)}});void 0!==j&&(te.dataLayer={init:j.init.bind(j)}),void 0!==c&&(te.dynamicContent={setCustomVariablesFunction:c.setCustomVariablesFunction.bind(c),get:d.getAndRenderDynamicContentsForClient.bind(d),getRendered:c.getRenderedDynamicContent.bind(c)}),void 0!==D&&(te.webPush={init:D.init.bind(D),checkSubscribeRequestNeed:D.checkSubscribeRequestNeed.bind(D),isWebPushSupported:D.isWebPushSupported.bind(D),isWebPushAppReady:D.isWebPushAppReady.bind(D),requestPermission:D.requestPermission.bind(D),subscribe:D.subscribe.bind(D),unsubscribe:D.unsubscribe.bind(D),getToken:D.getToken.bind(D),showNotification:D.showNotification.bind(D),onMessage:D.onMessage.bind(D),onWebPushSubscribe:D.onWebPushSubscribe.bind(D),onWebPushSubscribeBlock:D.onWebPushSubscribeBlock.bind(D),onWebPushSubscribeDiscard:D.onWebPushSubscribeDiscard.bind(D),onBrowserPermissionAgree:D.onBrowserPermissionAgree.bind(D),onBrowserPermissionBlock:D.onBrowserPermissionBlock.bind(D),onBrowserPermissionDiscard:D.onBrowserPermissionDiscard.bind(D)}),void 0!==_&&(te.form={marker:_.marker.bind(_),initMarker:_.init.bind(_)})}catch(e){f.fatal(e)}if(F=Ke.SyneriseObjectNamespace||"SR",Ke[F]=te,void 0===Ke.SyneriseTC&&Ke.SyneriseTC,"object"===(typeof SyneriseTC).toLowerCase())console.error("WARNING: 
1SyneriseTC is already initialized!");else{var ne={config:null,domain:null,path:null,init:function(e,t){return(this.config=e).domain&&(this.domain=e.domain),e.path&&(this.path=e.path),($this=this).get("_snrs_sdk_domain",function(e){e&&($this.domain=e)}),this.ready(t),this},ready:function(e){return"function"==typeof e&&e(),this},getDomain:function(){var e;return null!==this.domain?this.domain:"localhost"!==(e=document.location.hostname)?"."+(e=e.replace(/^www\./i,"")):e},getPath:function(){return null!==this.path?this.path:"/"},set:function(e,t,n,r,i,o,s){var a;return r="; path="+(r=void 0!==r&&r?r:this.getPath()),i=void 0!==(i=void 0!==i&&i?i:this.getDomain())&&i?"; domain="+i:"",o=void 0===o||o?"; Secure":"",s=void 0!==s&&s?"; SameSite="+s:"; SameSite=None",m.getOption("localStorageMode")?null===t?k.remove(e):(a=new Date(n),a=Math.round(a.getTime()/1e3),k.setStringWithTtl(e,t,a)):document.cookie=e+"="+t+"; expires="+n+i+r+o+s,R.log("Cookie have been SET "+e),this},get:function(e,t){var n="";if(m.getOption("localStorageMode"))n=k.getStringWithTtl(e)||"";else for(var r=document.cookie.split("; "),i=0;i<r.length;i++){var o=r[i].split("=")[0],s=r[i].split("=")[1];e===o&&(n=unescape(s))}R.log('GET cookie "'+e+'"'),t(n)},remove:function(e,t){return this.set(e,null,0,null,t)}},R=(SyneriseTC={ver:3,dataType:{traffic:"traffic",formData:"formData",staticFile:"staticFile"},stat:{},server_port:{traffic:{http:80,https:443},formData:{http:80,https:443},staticFile:{http:80,https:443}},hosts:{traffic:"tck.snrbox.com",formData:"tck.snrbox.com",staticFile:"tc.snrbox.com"},forceProtocol:"https",domain:null,uuid:null,permUuid:null,oldUuid:null,identity:null,identityHash:"",resetUUIDMode:null,resetUuid:!1,uniqueVisitTime:86400,campaignUID:0,trackerUID:"",ushash:"_ush",ushashValue:"",short_last:1800,perm_last:3456e4,perm_ttl:null,cookieManagerConfig:{},cookieList:{},cookiePath:"/",uniqueVisits:1,allVisits:1,sessionVisits:1,globalControlGroup:!0,appear:Math.round((new Date).getTime()/1e3),lastVisit:0,screen:null,ref:null,os:null,user:null,pageTimeLast:0,singleSessUid:h.generateUUID(),productId:null,botNotReact:!0,triggerPageVisitOnHashChange:!1,formCatch:{storageKeyIndex:"synerise-form-catch",stdType:"form",inputDataAttr:{skip:"skip",skipAsAttribute:"skip-as-attribute"},skipFields:["__EVENTVALIDATION","__VIEWSTATEGENERATOR","__VIEWSTATE","__EVENTARGUMENT","__EVENTTARGET"],catchMode:"only-defined"},trafficStorageKeyIndex:"synerise-traffic-storage",gACode:null,customStatParams:null,customPageVisit:!1,customizeMetadata:null,trackerSpecialParams:{emailClick:{requiredParams:{snrs_cl:".+",snrs_cp:".+",snrs_medium:"email",snrs_he:"(-?[0-9]+)?"},category:"client.web.browser.mail",action:"newsletter.click",labelFromParam:"snrs_cp",processStatParams:function(e,t){if(b.jwtRequired||d.getAccessToken()||(n=SyneriseTC.checkIdentityHashExists(),SyneriseTC.shouldResetUUID(n)&&(n||e.uuid===t.snrs_cl?n&&t.snrs_he&&e.identityHash!==t.snrs_he&&SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl):(SyneriseTC.setOldUuid(e.uuid),e.uuid=t.snrs_cl,SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl)))),"snrs_redir"in t)return!1;var n={id:t.snrs_cp,campaignTitle:t.snrs_cp_title};e.params=SyneriseTC.appendToJson(e.params,n)}},webPushClick:{requiredParams:{snrs_cl:".+",snrs_cp:".+",snrs_cp_title:".*",snrs_medium:"web_push",snrs_he:"(-?[0-9]+)?"},category:"client.web.browser.pushmessage",action:"webpush.click",labelFromParam:"snrs_cp",processStatParams:function(e,t){if(b.jwtRequired||d.getAccessToken()||(n=SyneriseTC.checkIdentityHashExists(),SyneriseTC.shouldResetUUID(n)&&(n||e.uuid===t.snrs_cl?!n&&t.snrs_he&&e.identityHash!==t.snrs_he&&SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl):(SyneriseTC.setOldUuid(e.uuid),e.uuid=t.snrs_cl,SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl)))),"snrs_redir"in t)return!1;var n={id:t.snrs_cp,campaignTitle:t.snrs_cp_title};e.params=SyneriseTC.appendToJson(e.params,n)}},utm:{requiredParams:{"(snrs?|utm)_.*":".*"},processStatParams:function(s,a){ne.get("_snrs_params",function(e){for(var t in R.log("utm processStatParams stat&snrsUrlParams&cookieSnrsParams",s,a,e),e=e&&JSON.parse(e),R.log("utm processStatParams cookieSnrsParams",e=e||{}),a){var n;a.hasOwnProperty(t)&&(n=a[t],e[t]=n)}for(var r in e){var i;e.hasOwnProperty(r)&&(i=e[r],e[r]=escape(i))}R.log("utm processStatParams cookieSnrsParams after escape",e);var o=new Date,o=(o.setTime(o.getTime()+2592e5),o.toGMTString());ne.set("_snrs_params",JSON.stringify(e),o),s.params=SyneriseTC.appendToJson(s.params,e)})}},uuidFromUrl:{requiredParams:{snrs_cl:".+",snrs_he:"(-?[0-9]+)?"},processStatParams:function(e,t){var n;b.jwtRequired||d.getAccessToken()||(n=SyneriseTC.checkIdentityHashExists(),SyneriseTC.shouldResetUUID(n)&&(n||e.uuid===t.snrs_cl?n&&t.snrs_he&&e.user_hash!==t.snrs_he&&SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl):(SyneriseTC.setOldUuid(e.uuid),e.uuid=t.snrs_cl,SyneriseTC.setNewUUIDAndIdentityHash(t.snrs_he,t.snrs_cl))))}},resetUuid:{requiredParams:{snrs_reset_uuid:"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},processStatParams:function(e,t){b.jwtRequired||d.getAccessToken()||(SyneriseTC.restoreSessionCookies(),SyneriseTC.clearCookieList(),SyneriseTC.setNewUUIDAndIdentityHash("",t.snrs_reset_uuid))}}}
1,callbacks:{onReady:[],onStore:[]},isReady:!1,isInitialized:!1,ready:function(e){return R.log("Added onReady callback"),this.isReady?this.executeCallbacks([e]):this.callbacks.onReady.push(e),this},enhanceCookieManagerConfig:function(e){for(var t in e)e[t][0]&&e[t][1]&&"setDomain"===e[t][0]&&(this.cookieManagerConfig.domain=e[t][1]),e[t][0]&&e[t][1]&&"setPath"===e[t][0]&&(this.cookieManagerConfig.path=e[t][1])},init:function(n){var r;R.setDebugLevel(),this.isInitialized?R.log("ALREADY INITIALIZED!"):(this.isInitialized=!0,re.get(),this.prepareCookieList(),r=this,R.log("Initializing cookie managers"),this.enhanceCookieManagerConfig(n),ne.init(this.cookieManagerConfig,function(){R.log("Cookie manager initialized"),r.collect(),r.checkExternalCookies(),r.manageCookies(r.getCookieList(),function(){var e,t;r.setInitParams(n),r.checkUserHash(),r.gACode&&null!==r.gACode&&r.setGATracker(),!1!==r.customPageVisit||m.getOption("disablePageHistoryTracking")||r.initPageHandler(),r.resendStoredData(r.formCatch.storageKeyIndex,function(e,t,n){r.customStatParams=t,r.storeFormData(r.customStatParams,function(){r.removeStoredData(r.formCatch.storageKeyIndex,e)}),r.customStatParams=null}),r.resendStoredData(r.trafficStorageKeyIndex,function(e,t,n){r.storeTraffic(t,function(){r.removeStoredData(r.trafficStorageKeyIndex,e)})}),r.initFormCatch(),(!1===r.customPageVisit||r.customPageVisit&&!r.uuid)&&(e=!1===r.customPageVisit?{}:{"x-snr-skip":!0},t=r.storeData(r.trafficStorageKeyIndex,r.buildParamsForStat()),r.storeTraffic(e,function(){r.removeStoredData(r.trafficStorageKeyIndex,t)})),r.isReady=!0,R.log("Executing onReady callbacks"),r.executeCallbacks(r.callbacks.onReady),re.log(re.get()),void 0!==r.initCookieMatchers&&r.initCookieMatchers()})}))},getPageHandler:function(){return this._pageHandler||(this._pageHandler=se(this,Ke.history,R)),this._pageHandler},getHashChangeHandler:function(){return this._hashChangeHandler||(this._hashChangeHandler=oe(Ke,R)),this._hashChangeHandler},initPageHandler:function(){var e=this.getPageHandler();e&&(e.attachHistoryHandler(),this.getTriggerPageVisitOnHashChange())&&e.attachHashHandler(this.getHashChangeHandler())},setTriggerPageVisitOnHashChange:function(e){this.triggerPageVisitOnHashChange=e},getTriggerPageVisitOnHashChange:function(){return this.triggerPageVisitOnHashChange},setInitParams:function(e){for(var t in R.balloon("Init with params",e),e)if(e.hasOwnProperty(t))try{var n,r=e[t][0];void 0!==r&&(this.hasOwnProperty(r)?(n=e[t][1],Array.isArray(n)||(n=[n]),this[r].apply(this,n)):R.log(new Error('Unknown function "'+r+'" in init args!')))}catch(e){R.log(e),R.balloon("Method not allowed or missing args")}if(""===this.trackerUID||!this.trackerUID)throw new Error("Method not allowed or missing args")},clearCookieList:function(){var t=this,n=t.getCookieList();[].forEach.call(Object.keys(n),function(e){t.removeCookie(n[e])})},synchronizeUuidDifferences:function(){var e=E.get("_snrs_p"),t=E.get("_snrs_uuid");!t||e&&e.uuid&&t===e.uuid||(this.clearCookieList(),this.setNewUUIDAndIdentityHash("",t))},checkExternalCookies:function(e){var n=this;n.synchronizeUuidDifferences(),ne.get("_snrs_reset_uuid",function(e){"true"===e||1===Number(e)?(R.balloon("Reset UUID by cookie flag"),n.clearCookieList(),n.setResetUuid(!0),ne.remove("_snrs_reset_uuid")):h.validateUUID(e)&&(R.balloon("Reset UUID by cookie with value"+e),n.clearCookieList(),n.setNewUUIDAndIdentityHash("",e),ne.remove("_snrs_reset_uuid"))}),ne.get("_snrs_reset_uuid_and_identity_hash",function(e){var t;e&&2===(e=e.split(":")).length&&(t=e[0],e=e[1],n.clearCookieList(),n.setNewUUIDAndIdentityHash(e,t),ne.remove("_snrs_reset_uuid_and_identity_hash"))}),"function"==typeof e&&e()},setGeneratedUuid:function(){var e=h.generateUUID();R.balloon('CHANGING UUID! "'+this.uuid+'" to "'+e+'"'),this.setUuid(e,!0)},setUuid:function(t,e){if(t&&!h.validateUUID(t)){f.error("setUuid uuid is invalid & will be reset "+t);var n=t.match("amp")?t.replace("amp;","").replace("amp%253B",""):t;if(this.prevUuid&&n===this.prevUuid)return R.warning("setUuid uuid matches prevUuid & will be ignored "+t),!1;this.prevUuid=n,this.setOldUuid(t),h.validateUUID(n)?t=n:(t=null,this.setResetUuid(!0)),e=!0}this.uuid=t,R.balloon("SETTING UUID TO: "+this.uuid),t&&!this.permUuid&&(this.permUuid=this.uuid,R.balloon("SETTING PERM-UUID TO: "+this.permUuid)),!0===e&&(n=this.getCookieList(),this.removeCookie(n.perm),this.removeCookie(n.shorta),this.manageCookies(n,function(){}));try{d.getCurrentClient().then(function(e){e&&(e.uuid=t,d.updateClientParams(e,!1))})}catch(e){R.error("ERROR: setUuid client",e)}},getUuid:function(){return this.uuid},setOldUuid:function(e){this.oldUuid=e},getOldUuid:function(){return this.oldUuid},setResetUuid:function(e){R.balloon("SET RESET UUID TO: "+e),this.resetUuid=e},getResetUuid:function(){return this.resetUuid},mergeObjects:function(e,t){for(var n in t){var r;t.hasOwnProperty(n)&&("object"==typeof(r=t[n])&&"object"==typeof e[n]?e[n]=this.mergeObjects(e[n],r):e[n]=r)}return e},appendToJson:function(e,t){var n=t;return e&&(n=JSON.parse(e),n=SyneriseTC.mergeObjects(n,t)),JSON.stringify(n)},parseDataType:function(e){return void 0!==e&&void 0!==this.dataType[e]?e:this.dataType.traffic},getProtocol:function(){var e;return void 0!==this.forceProtocol&&this.forceProtocol?this.forceProtocol:(e=(e=void 0!==document.location.protocol?document.location.protocol:"https").replace(":","")).match("https?")?e:"https"},getHost:function(e){return e=this.parseDataType(e),this.hosts[e]},getPort:function(e,t){t=this.parseDataType(t);var n=this.server_port[t].http;return n="undefined"!==this.server_port[t][e]?this.server_port[t][e]:n},prepareUrl:function(e){return T.trackingDomain+e},prepareCookieList:function(){var e=this.perm_ttl||this.perm_last;this.cookieList={shorta:{name:"_snrs_sa",last:this.short_last},shortb:{name:"_snrs_sb",last:this.short_last},perm:{name:"_snrs_p",last:e},uuid:{name:"_snrs_uuid",last:e},permUuid:{name:"_snrs_puuid",last:e}}},getCookieList:function(){return this.cookieList&&this.cookieList.length||this.prepareCookieList(),this.cookieList},manageCookies:function(t,n){var r=0;for(i in t)t.hasOwnProperty(i)&&r++;var i,o=this;for(i in t)t.hasOwnProperty(i)&&this.getCookie(t[i],function(e){void 0!==e&&e&&o.updateOpt(e),o.setCookie(t[i]),0===--r&&n()});o.setStartOpt()},setStartOpt:function(){var e=Math.round((new Date).getTime()/1e3);this.appear=this.appear||e,this.initial=this.initial||e,this.lastVisit=this.lastVisit||e,this.current=this.current||e,this.allVisits=this.allVisits||1,this.sessionVisits=this.sessionVisits||1,this.uniqueVisits=this.uniqueVisits||1},updateOpt:function(e){for(var t=e.split("&"),n={},e=(new Date).getTime()/1e3,r=0;r<t.length;r++){var i=t[r].split(":");n[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}n.hasOwnProperty("uuid")&&"undefined"!==n.uuid&&"null"!==n.uuid&&n.uuid&&(this.setUuid(n.uuid),n.hasOwnProperty("permUuid")||(this.permUuid=this.getUuid())),n.hasOwnProperty("permUuid")&&"undefined"!==n.permUuid&&"null"!==n.permUuid&&n.permUuid&&(this.permUuid=n.permUuid),n.hasOwnProperty("prevUuid")&&"undefined"!==n.prevUuid&&"null"!==n.prevUuid&&n.prevUuid&&(this.prevUuid=n.prevUuid),n.hasOwnProperty("identityHash")&&"undefined"!==n.identityHash&&"null"!==n.identityHash&&n.identityHash&&(this.identityHash=n.identityHash),n.hasOwnProperty("emailHash")&&"undefined"!==n.emailHash&&"null"!==n.emailHash&&n.emailHash&&(this.identityHash=n.emailHash),n.hasOwnProperty("appear")&&(this.appear=n.appear,this.pageTimeLast=Math.round(e-this.appear),n.hasOwnProperty("ssui
1d"))&&(this.singleSessUid=n.ssuid),n.hasOwnProperty("init")&&(this.initial=n.init),n.hasOwnProperty("globalControlGroup")&&(this.globalControlGroup=n.globalControlGroup),n.hasOwnProperty("last")&&(this.lastVisit=n.last,e-this.lastVisit>this.uniqueVisitTime?(this.lastVisit=e,n.hasOwnProperty("uniqueVisits")&&(this.uniqueVisits=++n.uniqueVisits)):n.hasOwnProperty("uniqueVisits")&&(this.uniqueVisits=n.uniqueVisits)),n.hasOwnProperty("sessionVisits")&&(this.sessionVisits=++n.sessionVisits),n.hasOwnProperty("allVisits")&&(this.allVisits=++n.allVisits),n.hasOwnProperty("init")&&(this.current=Math.round((new Date).getTime()/1e3))},storeData:function(e,t,n){void 0!==n&&n||(n=e+"_"+h.generateUUID());var r=this.getSavedData(e);return k.setString(n,JSON.stringify(t)),r[n]=n,k.setString(e,JSON.stringify(r)),n},removeStoredData:function(e,t){var n=this.getSavedData(e);k.remove(t),delete n[t],k.setString(e,JSON.stringify(n))},resendStoredData:function(e,t){var n,r,i=this.getSavedData(e);if(i)for(var o in i)i.hasOwnProperty(o)&&(n=null,(r=k.getString(o))&&(n=JSON.parse(r)),R.log("SAVED DATA: "+o,n),!n||(void 0===n.__retried__&&(n.__retried__=1),R.log("RESEND DATA RETRY: "+n.__retried__),5<n.__retried__)?this.removeStoredData(e,o):(n.__retried__++,this.storeData(e,n,o),t(o,n)))},sleep:function(e){for(var t=(new Date).getTime();(new Date).getTime()<t+e;);},caughtForms:[],initFormCatch:function(e){e=void 0===e?document:e;var a=this,t=[];"form"===e.nodeName.toLowerCase()?t.push(e):t=e.getElementsByTagName("form");for(var n=0;n<t.length;n++)(i=>{var e,o,s=i.getAttribute("data-synerise");null!==s&&-1===a.caughtForms.indexOf(i)&&(""===s.replace(" ","")&&(s=a.formCatch.stdType),R.balloon("Binding to form: "+s,i),e=i.getAttribute("data-synerise-catch-mode")||a.formCatch.catchMode,R.log("Catch mode: "+e),o=i.onsubmit,i.onsubmit=function(e){R.log("Form on submit",e,this);var t,n,r=!0;"function"===(typeof o).toLowerCase()&&(r=o(e),R.log("Original submit returned:",r));try{!1===r?R.balloon("STOPPED FORM SUBMIT (ORIGINAL SUBMIT RETURNED FALSE)",i):(t=a.getFormData(i),(n=i.getAttribute("data-synerise"))&&(s=n),a.sendFormData.call(a,s,t.fields,t.fieldsMapping,t.skipAsAttributes))}catch(e){R.error("ERROR:",e)}return a.sleep(500),r},a.caughtForms.push(i))})(t[n])},getSavedForms:function(){return this.parseJson(k.getString(this.formCatch.storageKeyIndex))},getSavedData:function(e){return this.parseJson(k.getString(e))},sendForm:function(e){},setNewUUIDAndIdentityHash:function(e,t){R.log('Set new uuid and identityHash" '+e+" "+t+'"'),R.balloon("Identity hash has been changed !"),R.balloon('CHANGING UUID! "'+this.uuid+'" to "'+t+'"'),this.setUuid(t),this.setResetUuid(!0),this.identityHash=e;t=this.getCookieList();this.setCookie(t.uuid),this.setCookie(t.perm)},checkIdentityHashExists:function(){return this.identityHash&&"null"!==this.identityHash&&"0"!==this.identityHash&&0!==this.identityHash},shouldResetUUID:function(e){var t=this.resetUUIDMode;return null===t&&void 0!==m&&m._profileConfig&&m._profileConfig.resetUUID&&m._profileConfig.resetUUID.mode&&(t=m._profileConfig.resetUUID.mode,this.resetUUIDMode=t),!t||"always"===t||"never"!==t&&("not_recognized"!==t||!(e!==x?e:this.checkIdentityHashExists()))},resetUUIDByIdentityHash:function(e){var t;e&&(this.checkIdentityHashExists()&&(R.log('Saved identity hash: "'+this.identityHash+'"'),parseInt(e)!==parseInt(this.identityHash))&&(R.balloon("Identity hash has been changed !"),R.balloon('CHANGING UUID! "'+this.uuid+'" to "null"'),this.setUuid(null),this.setResetUuid(!0),this.restoreSessionCookies(),t=this.getCookieList(),this.removeCookie(t.uuid)),this.identityHash=String(e),t=this.getCookieList(),this.setCookie(t.perm))},restoreSessionCookies:function(){this.singleSessUid=h.generateUUID(),this.appear=Math.round((new Date).getTime()/1e3),this.lastVisit=0,this.pageTimeLast=0,this.sessionVisits=1,this.uniqueVisits=1,this.allVisits=1,this.sessionVisits=1;var e=this.getCookieList();this.setCookie(e.shorta),this.setCookie(e.shortb)},setGlobalControlGroup:function(e){this.globalControlGroup=e;e=this.getCookieList();this.setCookie(e.perm)},sendFormData:function(e,t,s,a,c){R.log("sendFormData",this,e,t,s,a);var u=this;return new Je(function(n,o){u.ready(function(){c=c||function(){}
1,(s=void 0!==s&&s?s:u.formCatch.inputDataAttr)[u.identity]=s[u.identity]||u.formCatch.inputDataAttr[u.identity];var r,i={formType:e,formFieldsMapping:JSON.stringify(s),formData:JSON.stringify(t),formSkipAsAttributes:JSON.stringify(a),category:"client.web.browser.contact",action:"form.submit",label:e};r=t,new Je(function(n,e){if(void 0===r[s[u.identity]])return n(!1);b.requiresAuthorization(i.action).then(function(e){var t;return e?n(!1):(e=r[s[u.identity]],t=u.hashString(e),R.log('Generated hash "'+t+'" from "'+u.identity+" "+e+'"'),u.resetUUIDByIdentityHash(t),n(!0))})}).then(function(e){u.customStatParams=i;var t=u.storeData(u.formCatch.storageKeyIndex,u.mergeObjects(u.customStatParams,u.buildParamsForStat()));u.storeFormData(i,function(){c(u.uuid)}).then(function(){u.removeStoredData(u.formCatch.storageKeyIndex,t),n(u.uuid)}).catch(o),u.customStatParams=null}).catch(o)})})},getCookie:function(e,t){ne.get(e.name,t)},setCookie:function(e){var t=this.buildSForCookie(e.name),n=new Date,n=(n.setTime(n.getTime()+1e3*e.last),n.toGMTString());return ne.set(e.name,t,n)},removeCookie:function(e){return ne.remove(e.name)},checkUserHash:function(){var e={name:this.ushash},t=this;this.getCookie(e,function(e){e&&(t.ushashValue=e)})},setTracker:function(e){this.trackerUID=e},setCustomPageVisit:function(e){this.customPageVisit=e},setCustomizeMetadata:function(e){this.customizeMetadata=e},setCookieExpiration:function(e){this.perm_ttl=24*e*60*60},setDomain:function(e){R.log("set custom domain",e),this.domain=e},setPath:function(e){R.log("set custom cookie path",e),this.cookiePath=e},setIdentity:function(e){this.identity=e,this.formCatch.inputDataAttr[e]=e},setCampaign:function(e){this.campaignUID=e},setGAnalyticsCode:function(e){this.gACode=e},setProductId:function(e){this.productId=e},collect:function(){this.screen=this.getScreenInfo(),this.ref=this.getReferrer();var e=this.getOsInfo();return!1!==e&&(this.os=e),this.user=this.getUserInfo(),!1},isCrawler:function(){return!(m.getOption("allowGoogleBot")&&u.isGoogleCrawler()||"BOT"!==this.os.os)},hashString:function(e){var t=0;if(0!==e.length)for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n);t&=t}return t},buildSForCookie:function(e){var t,n=[],r=[];if(r[this.cookieList.shorta.name]={ssuid:this.singleSessUid,appear:this.appear,sessionVisits:this.sessionVisits},r[this.cookieList.shortb.name]={ssuid:this.singleSessUid,leaves:Math.round((new Date).getTime()/1e3)},r[this.cookieList.perm.name]={host:this.user.hostn,permUuid:this.permUuid,uuid:this.uuid,identityHash:this.identityHash,user_hash:this.ushashValue,init:this.initial,last:this.lastVisit,current:this.current,uniqueVisits:this.uniqueVisits,allVisits:this.allVisits,globalControlGroup:this.globalControlGroup},this.prevUuid&&(r[this.cookieList.perm.name].prevUuid=this.prevUuid),r[this.cookieList.uuid.name]=this.uuid,r[this.cookieList.permUuid.name]=this.permUuid,"string"===(typeof r[e]).toLowerCase())return r[e];for(t in r[e])r[e].hasOwnProperty(t)&&n.push(encodeURIComponent(t)+":"+encodeURIComponent(r[e][t]));return n.join("&")},buildSForStat:function(e){return function e(t,n){var r=[];for(var i in t){var o,s;t.hasOwnProperty(i)&&i&&(o=n?n+"["+i+"]":i,s=t[i],i.trim())&&r.push("object"==typeof s&&s?e(s,o):encodeURIComponent(o)+"="+encodeURIComponent(s))}return r.join("&")}(this.buildParamsForStat(e))},buildParamsForStat:function(e){var t,n,r,i,o,s=Math.round((new Date).getTime()/1e3),a=m?m.getFullVersion()+":"+m.getBuildTime():null,c={uuid:this.getUuid(),ssuid:this.singleSessUid,user_hash:this.ushashValue,identity:this.identity,identityHash:this.identityHash,tck:this.trackerUID,campaign:this.user.campaign,host:this.user.hostn,location:this.user.loc,title:this.user.ptitle,ver:this.user.ver,color:this.screen.color,encoding:this.screen.encoding,lang:this.screen.language,res:this.screen.resolution,refdomain:this.ref.domain,ref:this.ref.ref,browser:this.os.browser,browserver:this.os.browserVersion,ecookies:this.os.cookies,os:this.os.os,osver:this.os.osVersion,init:s,last:this.lastVisit,current:s,long:this.pageTimeLast,visits:this.allVisits,s_visits:this.sessionVisits,u24_visits:this.uniqueVisits,productRef:this.productId,eventUUID:h.generateUUID(),snr_sdk_version:a},s=(this.user.uriHash&&(c.uriHash=this.user.uriHash),c.uuid&&null!=c.uuid||delete c.uuid,this.perm_ttl&&(c["x-snr-cookie-ttl-sec"]=this.perm_ttl),this.getResetUuid()&&(c.resetUuid=this.getResetUuid(),void 0!==this.resetCookieMatchers)&&this.resetCookieMatchers(),this.appendOgTags(c),this.customStatParams&&(c.params=this.customStatParams),!1),u=(c.params&&(s="form.submit"===c.params.action),c.params&&"string"!==(typeof c.params).toLowerCase()&&(c.params=JSON.stringify(c.params)),this.get
1SnrsUrlParams());if(R.balloon("SnrsUrlParams: "+JSON.stringify(u)),!s)for(var l in this.trackerSpecialParams)this.trackerSpecialParams.hasOwnProperty(l)&&(i=!(r=n=t=null),((e,t)=>{for(var n in t)if(t.hasOwnProperty(n)){var r,i=t[n],o=!1;for(r in e)if(e.hasOwnProperty(r)){var s=e[r];if(r.match(n)&&s.match(i)){o=!0;break}}if(!o)return!1}return!0})(u,(o=this.trackerSpecialParams[l]).requiredParams)?((i="function"==typeof o.processStatParams?!1!==o.processStatParams(c,u):i)&&(void 0!==o.category&&o.category&&(t=o.category),void 0!==o.action&&o.action&&(n=o.action),void 0!==o.label?r=o.label:void 0!==o.labelFromParam&&(r=u[o.labelFromParam])),R.log('Processing "'+l+'" special params. Result: '+t+" / "+n+" / "+r),t&&(c.category=t),n&&(c.action=n),r&&(c.label=r)):R.log('Special params in url failed for "'+l+'". For parameters: ',u,o.requiredParams));if(this.identityHash&&(c.identityHash=this.identityHash),this.getOldUuid()&&(c.oldUuid=this.getOldUuid()),void 0!==e&&e)for(var d in e)e.hasOwnProperty(d)&&(c[d]=e[d]);return c},getSnrsUrlParams:function(){var e,t,n={},r=document.location.search.split("&");for(e in r)r.hasOwnProperty(e)&&(t=r[e],t=new RegExp(/(\?|&)?((snrs?|utm)_[^=\?&]+)=([^=&\?]*)/gi).exec(t))&&5===t.length&&(n[t[2]]=t[4]);return n},appendOgTags:function(e){var t=this.getOgTag();0!=Object.keys(t).length?(e.ogTags=JSON.stringify(t),R.log("Adding og tags: "+e.ogTags)):R.log("No og tags in document")},getOnlyPrimitivePairsWithLimit:function(e){var t,n={},r=0;for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if("object"==typeof i&&null!==i&&!Array.isArray(i)||(n[t]=i,r++),20<=r)break}return n},getOgTag:function(){for(var e,t={},n={"product:category":"array"},r=new RegExp("og:("+["title","url","type","site_name","image","category"].join("|")+")|product:.+","i"),i=document.getElementsByTagName("meta"),o=0;o<i.length;o++){var s,a=i[o];a.getAttribute("property")&&(s=a.getAttribute("property"),r.test(s))&&(a=a.getAttribute("content"),void 0!==n[s]?"array"===n[s]&&(void 0===t[s]&&(t[s]=[]),t[s].push(a)):void 0===t[s]&&(t[s]=a))}return t="function"!=typeof this.customizeMetadata||"object"!=typeof(e=this.customizeMetadata(t))||null===e||Array.isArray(e)?t:this.getOnlyPrimitivePairsWithLimit(e)},getScreenInfo:function(){var e,t=null,n=null,r=null,i=null;return screen?(t=screen.width+"x"+screen.height,n=screen.colorDepth+"-bit"):java&&(t=(e=java.awt.Toolkit.getDefaultToolkit().getScreenSize()).width+"x"+e.height),navigator.language?r=navigator.language.toLowerCase():navigator.browserLanguage&&(r=navigator.browserLanguage.toLowerCase()),document.characterSet?i=this.encodeString(document.characterSet):document.charset&&(i=this.encodeString(document.charset)),{encoding:i,resolution:t,color:n,language:r}},parseJson:function(t){var e={};if("string"===(typeof t).toLowerCase())try{e=JSON.parse(t)}catch(e){R.balloon("parseJson - Wrong JSON format! :: "+t)}else e={};return e},getOsInfo:function(){return u.getOsInfo()},getUserInfo:function(){var e=document.location.pathname+document.location.search,e={ver:this.ver,campaign:this.campaignUID,ptitle:this.encodeString(document.title),hostn:this.encodeString(document.location.hostname),loc:e};return location.hash&&(e.uriHash=location.hash),e},getReferrer:function(){var e,t,n=document.referrer,r=0;return"0"==n||""==n||"-"==n||(e=n.indexOf("://"))<0?{domain:"",ref:""}:(t="",-1<(n=n.substring(e+3,n.length)).indexOf("/")&&(-1<(t=n.substring(n.indexOf("/"),n.length)).indexOf("?")&&(t=t.substring(0,t.indexOf("?"))),n=n.substring(0,n.indexOf("/"))),-1<(e=(r=n=n.toLowerCase()).indexOf(":"))&&(r=r.substring(0,e)),0===n.indexOf("www.")&&(n=n.substring(4,n.length)),{domain:this.encodeChar(n,null),ref:this.encodeChar(t,null)})},setGATracker:function(){var e=document.createElement("script");m.getOption("nonce")&&(e.nonce=m.getOption("nonce")),e.setAttribute("type","text/javascript"),e.innerText="ga('set', '&uid', '"+this.uuid+"');ga('set', 'dimension1', '"+this.uuid+"'); ga('send', 'pageview');",document.body.appendChild(e)},getFormData:function(e,t){var n={fieldsMapping:{},fields:{},skipAsAttributes:[]};if(e&&"form"===e.nodeName.toLowerCase()){var r,i,o="",s=e.getAttribute("data-synerise-catch-mode")||this.formCatch.catchMode;for(R.log("Catch mode: "+s),r=e.elements.length-1;0<=r;r-=1){var a,c=(a=e.elements[r]).name,u=a.getAttribute("data-synerise");if(u!==this.formCatch.inputDataAttr.skip)if("all"!==s&&null===u)R.log('Skipped field: "'+c+'" - "data-synerise" attribute is not defined');else{if(u===this.formCatch.inputDataAttr.skipAsAttribute&&(n.skipAsAttributes.push(c),u=null),""===c){if(!u)continue;c=u}if(-1!==this.formCatch.skipFields.indexOf(c))R.log("Skipped field: "+c);else{o="";var l,d=a.getAttribute("data-synerise-value");switch(null!=d?o=d:void 0!==a.value&&(o=a.value),!0===t&&(o=this.encodeString(o)),a.nodeName.toUpperCase()){case"INPUT":switch(void 0!==u&&u&&(n.fieldsMapping[u]=c),a.type){case"password":case"reset":break;case"text":case"hidden":case"button":case"submit":n.fields[c]=o;break;case"checkbox":case"radio":a.checked&&(n.fields[c]=o);break;case"file":break;default:n.fields[c]=o}break;case"TEXTAREA":u!=c&&(p.setEnabled(!0),f.fatal("getFormData:formElement::TEXTAREA "+JSON.stringify({"data-synerise":u,name:c}
1))),n.fields[c]=o;break;case"SELECT":switch(a.type){case"select-one":u!=c&&(p.setEnabled(!0),f.fatal("getFormData:formElement:select-one::SELECT "+JSON.stringify({"data-synerise":u,name:c}))),n.fields[c]=o;break;case"select-multiple":for(u!=c&&(p.setEnabled(!0),f.fatal("getFormData:formElement:select-multiple::SELECT "+JSON.stringify({"data-synerise":u,name:c}))),i=a.options.length-1;0<=i;i-=1)a.options[i].selected&&(o=null!=(l=a.options[i].getAttribute("data-synerise-value"))?l:a.options[i].value,!0===t&&(o=this.encodeString(o)),n.fields[c]=o)}break;case"BUTTON":switch(a.type){case"submit":case"button":n.fields[c]=o}}}}}}return n},domObject:{getClassList:function(e){if(void 0!==e.className)return e.className.split(" ")},hasClass:function(e,t){for(var n=this.getClassList(e),r=0;r<n.length;r++)if(n[r]===t)return!0;return!1}},appendJS:function(e,t){re.get(e),R.balloon("JS Loading: "+e);function n(e,t){return!!(e=document.getElementsByTagName(e)).length&&((e=e[0]).appendChild(t),!0)}var r=document.createElement("script");m.getOption("nonce")&&(r.nonce=m.getOption("nonce")),r.onload=function(){R.balloon("JS Loaded: "+e+" in "+re.get(e).getElapsedTimeString()),t&&t()},r.src=e;n("head",r)||n("body",r)||n("html",r)},encodeString:function(e,t){return("function"==typeof encodeURIComponent?t?encodeURI:encodeURIComponent:escape)(e)},encodeChar:function(e){var t="";if(!e||""===e)return"";for(var n=0;n<e.length;n++)" "===e.charAt(n)?t+="+":t+=e.charAt(n);return t},executeCallbacks:function(e,t){if(t=void 0===t?[this]:t,!e||!e.length)return!1;for(var n in e)e.hasOwnProperty(n)&&"function"===(typeof(n=e[n])).toLowerCase()&&n.apply(this,n,t)},store:function(s,a,t){var c=this;return new Je(function(n,r){if(a="function"===(typeof a).toLowerCase()?a:function(){},c.isCrawler())return R.warning("Prevented store - crawler detected"),a.apply(c,a,[c]),n();s=s||{},t=c.parseDataType(t);var i=re.get("store_"+t),e=c.buildSForStat(s),o=c.prepareUrl("/"+c.trackerUID+".gif?"+e);new Je(function(t,e){if(s.action===x||!s.action)return t(null);b.requiresAuthorization(s.action).then(function(e){if(!e)return t(null);e=d.getAccessToken();t(e?{Authorization:"Bearer "+e}:null)})}).then(function(e){var t;if(m.getOption("doNotTrack"))return t=h.generateUUID(),c.setResetUuid(!1),c.setUuid(t,!0),a.apply(c,a,[c]),n();ie.get(o,function(e){return 200===e.status?(c.setResetUuid(!1),(e=e.getResponseHeader("Client-UUID"))&&"null"!==e.toLowerCase()&&(R.balloon("GOT Client-UUID IN HEADER FROM tck: `"+e+"` !"),h.validateUUID(e)||(e=h.generateUUID()),c.setUuid(e,!0)),i.log(),a.apply(c,a,[c]),n()):(R.error("XHR - ERROR LOADING PIX !!!"),c.getUuid()&&"null"!=c.getUuid().toLowerCase()||(e=h.generateUUID(),R.balloon("UUID is NULL SET NEW UUID: `"+e+"` !"),c.setUuid(e,!0),a.apply(c,a,[c])),r(new Error("Network request failed")))},e)})})},storeTraffic:function(n,r){return new Je(function(e,t){SyneriseTC.store(n,r,SyneriseTC.dataType.traffic).then(e).catch(t)})},storeFormData:function(n,r){return new Je(function(e,t){SyneriseTC.store(n,r,SyneriseTC.dataType.formData).then(e).catch(t)})},pageVisit:function(r){var i=this;return new Je(function(t,n){i.ready(function(){i.checkExternalCookies(function(){R.log("custom page visit with data: ",r),i.collect();var e=i.storeData(i.trafficStorageKeyIndex,i.buildParamsForStat());i.storeTraffic(r,function(){i.removeStoredData(i.trafficStorageKeyIndex,e)}).then(t).catch(n)})})})}},"undefined"!=typeof CookieMatchers&&(SyneriseTC.initCookieMatchers=CookieMatchers.initCookieMatchers.bind(CookieMatchers),SyneriseTC.resetCookieMatchers=CookieMatchers.resetCookieMatchers.bind(CookieMatchers),SyneriseTC.initCookieMatching=CookieMatchers.initCookieMatching.bind(CookieMatchers),SyneriseTC.setCookieMatchersPromise=CookieMatchers.setCo
1okieMatchersPromise.bind(CookieMatchers),SyneriseTC.getCookieMatchersPromise=CookieMatchers.getCookieMatchersPromise.bind(CookieMatchers)),{debug:!1,target:"console",boxObject:null,balloonObject:null,balloonTimeout:null,setDebugLevel:function(){this.debug=document.location.href.match(/SYNERISETC_DEBUG=?(box|console)?/i),this.debug&&this.debug.length&&void 0!==this.debug[1]&&this.debug[1]&&(this.target=this.debug[1].toLowerCase())},_write:function(e,t){if(this.debug&&"undefined"!=typeof console){for(var n in t)if(t.hasOwnProperty(n)&&n instanceof Error){e="error";break}var r=re.get().getElapsedTimeString();"console"===this.target?(void 0===console[e]&&(e="info"),console[e]("SyneriseTC ["+r+"]",t)):"box"===this.target&&this.boxLogger(e,r,t)}else this._write=function(){}},balloon:function(){if(!this.debug)return!1;this.balloonObject||(this.balloonObject=document.createElement("div"),this.balloonObject.tabindex="0",this.balloonObject.style="position: fixed; bottom: 0px; right: 0px; z-index: 999999; background: #EEE; color: #000; border: 1px solid #F00; padding: 5px 5px; font-family: monospace; white-space: pre;");var e,t,n=document.createElement("li"),r=(n.style="border-bottom: 1px solid #ddd; padding: 2px 5px;",[]);for(e in arguments)!arguments.hasOwnProperty(e)||arguments[e]instanceof HTMLElement||(t="",isNaN(e)&&(t+=e+": "),r.push(t+=arguments[e]));n.innerHTML=r.join(" &#9483; ");function i(){s.balloonTimeout&&clearTimeout(s.balloonTimeout),s.balloonTimeout=setTimeout(function(){document.body.removeChild(s.balloonObject),s.balloonObject=null},15e3)}var o=document.createElement("ul"),s=(o.appendChild(n),this.balloonObject.appendChild(o),this);this.balloonObject.onmouseover=function(){clearTimeout(s.balloonTimeout)},this.balloonObject.onmouseout=i,document.body.appendChild(this.balloonObject),i(),this._write("log",arguments)},log:function(){this._write("log",arguments)},error:function(){this.balloon.apply(this,arguments),this._write("error",arguments)},warning:function(){this._write("warning",arguments)},boxLogger:function(e,t,n){this.boxObject||(this.boxObject=document.createElement("div"),this.boxObject.id="SYNERISE_TC_LOGGER_BOX",this.boxObject.style.position="fixed",this.boxObject.style.bottom="0px",this.boxObject.style.right="0px",this.boxObject.style.width="98%",this.boxObject.style.height="50%",this.boxObject.style.padding="5px 10px",this.boxObject.style.margin="0 auto",this.boxObject.style.overflowY="auto",this.boxObject.style.wordWrap="break-word",this.boxObject.style.background="lightsteelblue",this.boxObject.style.color="black",this.boxObject.style.fontSize="1.2em",this.boxObject.style.fontWeight="bold",this.boxObject.style.lineHeight="1.5em",document.body.appendChild(this.boxObject));var r,i="#000";for(r in"error"===e.toLowerCase()&&(i="#F00"),this.boxObject.innerHTML+='<div style="font-size: 0.8em; font-weight: normal;">--- '+t+"</div>",n)n.hasOwnProperty(r)&&(this.boxObject.innerHTML+='<div style="color: '+i+';">'+n[r]+"</div>")}}),re={objects:[],_timerObject:function(e){this.label=e,this.time=(new Date).getTime(),this.getLabel=function(){return this.label},this.getElapsedTime=function(){return(new Date).getTime()-this.time},this.getElapsedTimeString=function(){return this.getElapsedTime()+" ms"},this.log=function(){re.log(this)}},create:function(e){var t=new this._timerObject(e);return this.objects[e]=t},get:function(e){return void 0===this.objects[e=void 0!==e&&e?e:"__main__"]&&(this.objects[e]=new this._timerObject(e)),this.objects[e]},log:function(e){R.log('Timer "'+e.getLabel()+'" took '+e.getElapsedTimeString())}},ie={get:function(e,t,n){return this._request("GET",e,{},t,n)},post:function(e,t,n,r,i){return void 0===i&&(i="application/x-www-form-urlencoded"),R.log("XHR POST DATA: "+t),this._request("POST",e,t,n,r,i)},_request:function(e,t,n,r,i,o){re.get(t);var s,a=new XMLHttpRequest;if(a.open(e,t,!0),a.withCredentials=!1,a.timeout=5e3,a.ontimeout=function(e){R.error("XHR Timeout!!",e)},void 0!==i)for(var c in i)i.hasOwnProperty(c)&&(s=i[c],a.setRequestHeader(c,s));o&&a.setRequestHeader("Content-type",o),R.log('XHR Requesting "'+t+'" using method "'+e+'"'),a.onreadystatechange=function(){4===a.readyState&&(R.log('XHR Request Finished "'+t+'" in '+re.get(t).getElapsedTimeStr
1ing()),r(a))},a.send(n)}},L=!1;if("undefined"!=typeof _riseA&&_riseA.length?L=_riseA:void 0!==Ke._riseA&&Ke._riseA.length?L=Ke._riseA:(R.setDebugLevel(),R.warning('WARNING: "_riseA" is undefined or empty')),L)try{SyneriseTC.init(L)}catch(e){R.setDebugLevel(),R.error("ERROR:",e)}}function oe(t,n){try{if(n.log("createHashChangeHandler"),"onhashchange"in t){if(t.addEventListener)return n.log("createHashChangeHandler created by addEventListener"),{addHashChangeCallback:function(e){t.addEventListener("hashchange",e)},removeHashChangeCallback:function(e){t.removeEventListener("hashchange",e)}};if(t.attachEvent)return n.log("createHashChangeHandler created by attachEvent"),{addHashChangeCallback:function(e){t.attachEvent("onhashchange",e)},removeHashChangeCallback:function(e){t.detachEvent("onhashchange",e)}}}return n.log("createHashChangeHandler unsupported"),{addHashChangeCallback:function(){},removeHashChangeCallback:function(){}}}catch(e){return n.error("createHashChangeHandler error occurred",e),{addHashChangeCallback:function(){},removeHashChangeCallback:function(){}}}}function se(t,e,a){function n(){a.log("page handler - collect data"),t.collect();var e=t.storeData(t.trafficStorageKeyIndex,t.buildParamsForStat());t.storeTraffic({},function(){t.removeStoredData(t.trafficStorageKeyIndex,e)})}function c(e){try{setTimeout(function(){a.log("page handler - history handler - after time delay",e),n()},200)}catch(e){a.log("page handler - history handler error",e)}}return{attachHistoryHandler:function(){var t,n,r,i,o,s;a.log("page handler - attachHistoryHandler"),n=a,r=(t=e).pushState,t.pushState=function(e){return"function"==typeof t.onpushstate&&t.onpushstate({state:e}),n.log("page handler - history handler pushState triggered",e),c(e),r.apply(t,arguments)},o=a,s=(i=e).replaceState,i.replaceState=function(e){return"function"==typeof i.onreplacestate&&i.onreplacestate({state:e}),o.log("page handler - history handler replaceState triggered",e),c(e),s.apply(i,arguments)}},attachHashHandler:function(e){a.log("page handler - attachHashHandler"),e.addHashChangeCallback(function(e){a.log("page handler - hash handler change triggered",e),n()})}}}})(window,void 0);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.