!function(){var STATE_INITIALIZING=0,STATE_ERROR=-1,STATE_INITIALIZED=1,STATE_BLOCKED=2,_state=STATE_INITIALIZING,_queue,_baseHref=window.g_LumisRootPath,_cookiePath=window.g_LumisRootPath||"/",_cookieName="lumMonUid",_domain=null,_projectId=null,_cookie_storage={getItem:function(e){return e&&this.containsItem(e)?unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"),"$1")):null},setItem:function(e,t){e&&(document.cookie=escape(e)+"="+escape(t)+"; expires=Fri, 11 Jun 2128 08:53:20 GMT; path="+_cookiePath+(_domain?"; domain="+_domain:""),this.length=document.cookie.match(/\=/g).length)},removeItem:function(e){e&&this.containsItem(e)&&(document.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path="+_cookiePath,this.length--)},containsItem:function(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)}},_forceCookieStorage= /*@cc_on!@*/!!document.documentMode||!isLocalStorageAvailable(),_storage=_forceCookieStorage||window.g_LumisRootPath?_cookie_storage:window.localStorage;let defaultCallRestOptions={callback:null,contentType:null,customHeaders:null,blocking:null,includeRestResult:null,timeout:null};var _api={config:function(e){if(1!==e.args.length)throw"Illegal arguments";if(_state!==STATE_INITIALIZING)throw"'config' operation can only be called before the inclusion of 'track.js'";e=e.args[0];if(!_forceCookieStorage&&e.clientStorage)if("cookie"===e.clientStorage)_storage=_cookie_storage;else{if("local"!==e.clientStorage)throw'Invalid clientStorage value: "'+e.clientStorage+'"';_storage=window.localStorage}e.baseHref&&(_baseHref=e.baseHref),e.cookiePath&&(_cookiePath=e.cookiePath),e.cookieName&&(_cookieName=e.cookieName),e.domain&&(_domain=e.domain),e.projectId&&(_projectId=e.projectId)},identify:function(r){if(r.args.length<1||2maxArgs)throw`Illegal arguments. 'abtest -> ${targetOperation}' requires at most ${maxArgs} arguments. Received: `+operation.args;if(3<=operation.args.length&&!(operation.args[2]instanceof Function))throw"Illegal arguments. Argument #2 must be a function but it is "+typeof operation.args[2];if(4<=operation.args.length&&!operation.args[3]instanceof HTMLElement)throw"Illegal arguments. Argument #3 must be an HTML Element but it is "+typeof operation.args[3];if(5<=operation.args.length&&!(operation.args[4]instanceof Number)&&"number"!=typeof operation.args[4])throw"Illegal arguments. Argument #4 must be a number but it is "+typeof operation.args[4];var requiresSync=!1;switch(targetOperation){case"applyExperiment":let lumBaseElement=operation.args[3]||document.children[0];endpointOperation="applyExperiment",method="POST",requiresSync=!0,unboxFn=function(data){var obj={success:data.success};if(data.success&&data.restReturn){var restReturn=data.restReturn;if(restReturn.script)try{let fnScript=`let _fn = function(lumBaseElement) { ${restReturn.script} }; _fn`,fn=eval(fnScript);if(!(fn instanceof Function))throw`Script ${restReturn.script} should be the body of a function. But the following script didn't eval to a function: `+fnScript;fn(lumBaseElement)}catch(e){console.error(e),obj.success=!1}}return obj};break;case"experimentGoalAchieved":endpointOperation="experimentGoalAchieved",method="POST",unboxFn=function(e){return{success:e.success}};break;case"abandonExperiment":endpointOperation="abandonExperiment",method="POST",unboxFn=function(e){return{success:e.success}};break;default:throw"Illegal operation: "+targetOperation}var targetExperiment=operation.args[1];if(!/[a-fA-F0-9]{32}/.test(targetExperiment))throw"Wrong format for experiment identifier: "+targetExperiment;var callback=3<=operation.args.length&&operation.args[2],targetCallback=callback&&function(e){callback(unboxFn(e))},sendData=(!targetCallback&&requiresSync&&(targetCallback=function(e){unboxFn(e)}),{trackId:operation.trackId,referrer:document.location.href});let timeout=5<=operation.args.length&&operation.args[4];var endpoint="/lumis/service/analytics/abtest/api/rest/"+endpointOperation+"/"+targetExperiment;callRest(method,endpoint,sendData,{callback:targetCallback,includeRestResult:!0,timeout:timeout})}};function init(){_queue=window.lum_track.q||[],window.lum_track=function(){_queue.push([+new Date].concat([].slice.call(arguments))),processQueue()},_state=STATE_INITIALIZED,processQueue()}function getStorageTrackIdName(){return _storage===_cookie_storage?_cookieName:"lumMonUid"}function getTrackId(){return _storage.getItem(getStorageTrackIdName())}function setTrackId(e){_storage.setItem(getStorageTrackIdName(),e)}function processQueue(e,t){if(e=e||_queue)for(var r=0;_state!==STATE_BLOCKED&&r{console.error(`Call rest timed out: ${r} `+t,e);n&&n({success:!1})}),u.send(a),i&&(_state=STATE_BLOCKED)}else navigator.sendBeacon(getFullUrl(e),a)}function isLocalStorageAvailable(){try{var e=window.localStorage,t="lum__test__";return e.setItem(t,t),e.removeItem(t),1}catch(e){}}function getFullUrl(e){var t=_baseHref;return(t=_baseHref&&"/"==_baseHref[_baseHref.length-1]?_baseHref.substring(0,_baseHref.length-1):t)+(e=e&&"/"!=e[0]?"/"+e:e)}processQueue(window.lum_track.q,!0),getTrackId()?init():callRest("POST","/lumis/api/rest/lumis/monitor/v1/users",{},{callback:function(e){if(e.success)setTrackId(e.restReturn.lum_user.trackId),init();else{try{console.error(e.restReturn.error.message)}catch(e){}_state=STATE_ERROR}},customHeaders:{},includeRestResult:!0})}();