UNPKG

17.2 kBJavaScriptView Raw
1var _satellite=function(){"use strict";if(window.atob){var e,t,n,r="log",o="info",i="warn",a="error",u=10===parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])?"[Launch]":"🚀",c=!1,s=function(e){if(c&&window.console){var t=Array.prototype.slice.call(arguments,1);t.unshift(u),window.console[e].apply(window.console,t)}},f=s.bind(null,r),l=s.bind(null,o),d=s.bind(null,i),p=s.bind(null,a),g={log:f,info:l,warn:d,error:p,get outputEnabled(){return c},set outputEnabled(e){c=e},createPrefixedLogger:function(e){var t="["+e+"]";return{log:f.bind(null,t),info:l.bind(null,t),warn:d.bind(null,t),error:p.bind(null,t)}}},v=function(e){return"string"==typeof e?e.replace(/\s+/g," ").trim():e},m="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h=se(function(e,t){!function(t){if(e.exports=t(),!!0){var n=window.Cookies,r=window.Cookies=t();r.noConflict=function(){return window.Cookies=n,r}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}return function t(n){function r(t,o,i){var a;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},r.defaults,i)).expires){var u=new Date;u.setMilliseconds(u.getMilliseconds()+864e5*i.expires),i.expires=u}i.expires=i.expires?i.expires.toUTCString():"";try{a=JSON.stringify(o),/^[\{\[]/.test(a)&&(o=a)}catch(e){}o=n.write?n.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var c="";for(var s in i)i[s]&&(c+="; "+s,!0!==i[s]&&(c+="="+i[s]));return document.cookie=t+"="+o+c}t||(a={});for(var f=document.cookie?document.cookie.split("; "):[],l=/(%[0-9A-Z]{2})+/g,d=0;d<f.length;d++){var p=f[d].split("="),g=p.slice(1).join("=");'"'===g.charAt(0)&&(g=g.slice(1,-1));try{var v=p[0].replace(l,decodeURIComponent);if(g=n.read?n.read(g,v):n(g,v)||g.replace(l,decodeURIComponent),this.json)try{g=JSON.parse(g)}catch(e){}if(t===v){a=g;break}t||(a[v]=g)}catch(e){}}return a}}return r.set=r,r.get=function(e){return r.call(r,e)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,n){r(t,"",e(n,{expires:-1}))},r.withConverter=t,r}(function(){})})}),y={get:h.get,set:h.set,remove:h.remove},b=window,w=function(e,t){var n="com.adobe.reactor."+(t||"");return{getItem:function(t){try{return b[e].getItem(n+t)}catch(e){return null}},setItem:function(t,r){try{return b[e].setItem(n+t,r),!0}catch(e){return!1}}}},x=w("localStorage"),_=w("sessionStorage","dataElements."),j=w("localStorage","dataElements."),E="pageview",C="session",k="visitor",O={},I=function(e){var t;try{t=JSON.stringify(e)}catch(e){}return t},P=function(e,t,n){var r;switch(t){case E:return void(O[e]=n);case C:return void((r=I(n))&&_.setItem(e,r));case k:return void((r=I(n))&&j.setItem(e,r))}},M=P,A=function(e,t){var n;switch(t){case E:return O.hasOwnProperty(e)?O[e]:null;case C:return null===(n=_.getItem(e))?n:JSON.parse(n);case k:return null===(n=j.getItem(e))?n:JSON.parse(n)}},R=function(e){x.getItem("dataElementCookiesMigrated")||(Object.keys(e).forEach(function(t){!function(e,t){var n=y.get("_sdsat_"+e);void 0!==n&&P(e,t,n)}(t,e[t].storageDuration)}),x.setItem("dataElementCookiesMigrated",!0))},S=function(e,t,n,r){return"Failed to execute data element module "+e.modulePath+" for data element "+t+". "+n+(r?"\n"+r:"")},F=function(e){return void 0!==e&&null!==e},U={text:function(e){return e.textContent},cleanText:function(e){return v(e.textContent)}},N=function(e,t,n){for(var r,o=e,i=0,a=t.length;i<a;i++){if(null==o)return;var u=t[i];if(n&&"@"===u.charAt(0)){var c=u.slice(1);o=U[c](o)}else if(o.getAttribute&&(r=u.match(/^getAttribute\((.+)\)$/))){var s=r[1];o=o.getAttribute(s)}else o=o[u]}return o},L=document,D=se(function(e){!function(t){var n=setTimeout;function r(){}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void u(t.promise,e)}a(t.promise,r)}else(1===e._state?a:u)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void s((r=n,i=t,function(){r.apply(i,arguments)}),e)}e._state=1,e._value=t,c(e)}catch(t){u(e,t)}var r,i}function u(e,t){e._state=2,e._value=t,c(e)}function c(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)i(e,e._deferreds[t]);e._deferreds=null}function s(e,t){var n=!1;try{e(function(e){n||(n=!0,a(t,e))},function(e){n||(n=!0,u(t,e))})}catch(e){if(n)return;n=!0,u(t,e)}}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=new this.constructor(r);return i(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},o.all=function(e){var t=Array.prototype.slice.call(e);return new o(function(e,n){if(0===t.length)return e([]);var r=t.length;function o(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,function(e){o(i,e)},n)}t[i]=a,0==--r&&e(t)}catch(e){n(e)}}for(var i=0;i<t.length;i++)o(i,t[i])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(e){return new o(function(t,n){n(e)})},o.race=function(e){return new o(function(t,n){for(var r=0,o=e.length;r<o;r++)e[r].then(t,n)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){n(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},o._setImmediateFn=function(e){o._immediateFn=e},o._setUnhandledRejectionFn=function(e){o._unhandledRejectionFn=e},e.exports?e.exports=o:t.Promise||(t.Promise=o)}(m)}),T=window.Promise||D,B=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,V=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i<arguments.length;i++){for(var a in n=Object(arguments[i]))q.call(n,a)&&(o[a]=n[a]);if(B){r=B(n);for(var u=0;u<r.length;u++)J.call(n,r[u])&&(o[r[u]]=n[r[u]])}}return o},$=function(e,t,n,r){t=t||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var i=/\+/g;e=e.split(t);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var u=e.length;a>0&&u>a&&(u=a);for(var c=0;c<u;++c){var s,f,l,d,p=e[c].replace(i,"%20"),g=p.indexOf(n);g>=0?(s=p.substr(0,g),f=p.substr(g+1)):(s=p,f=""),l=decodeURIComponent(s),d=decodeURIComponent(f),fe(o,l)?Array.isArray(o[l])?o[l].push(d):o[l]=[o[l],d]:o[l]=d}return o},K=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},z=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(r){var o=encodeURIComponent(K(r))+n;return Array.isArray(e[r])?e[r].map(function(e){return o+encodeURIComponent(K(e))}).join(t):o+encodeURIComponent(K(e[r]))}).join(t):r?encodeURIComponent(K(r))+n+encodeURIComponent(K(e)):""},H=se(function(e,t){t.decode=t.parse=$,t.encode=t.stringify=z}),Z={cookie:y,document:L,"load-script":function(e){var t=document.createElement("script");t.src=e,t.async=!0;var n=function(e,t){return new T(function(n,r){"onload"in t?(t.onload=function(){n(t)},t.onerror=function(){r(new Error("Failed to load script "+e))}):"readyState"in t&&(t.onreadystatechange=function(){var e=t.readyState;"loaded"!==e&&"complete"!==e||(t.onreadystatechange=null,n(t))})})}(e,t);return document.getElementsByTagName("head")[0].appendChild(t),n},"object-assign":V,promise:T,"query-string":{parse:function(e){return"string"==typeof e&&(e=e.trim().replace(/^[?#&]/,"")),H.parse(e)},stringify:function(e){return H.stringify(e)}},window:b},G=!1,Q=window._satellite;if(Q&&!window.__satelliteLoaded){window.__satelliteLoaded=!0;var W=Q.container;delete Q.container;var X=W.property.settings.undefinedVarsReturnEmpty,Y=W.dataElements||{};R(Y);var ee,te=function(e){return Y[e]},ne=(e={},t=function(t){var n=e[t];if(!n)throw new Error("Module "+t+" not found.");return n},{registerModule:function(t,n,r,o,i){var a={definition:n,extensionName:r,require:o,turbine:i};a.require=o,e[t]=a},hydrateCache:function(){Object.keys(e).forEach(function(e){try{n(e)}catch(n){var t="Error initializing module "+e+". "+n.message+(n.stack?"\n"+n.stack:"");g.error(t)}})},getModuleExports:n=function(e){var n=t(e);return n.hasOwnProperty("exports")||(n.exports=function(e,t,n){var r={exports:{}};return e.call(r.exports,r,r.exports,t,n),r.exports}(n.definition.script,n.require,n.turbine)),n.exports},getModuleDefinition:function(e){return t(e).definition},getModuleExtensionName:function(e){return t(e).extensionName}}),re=function(e,t,n,r){return function(o){var i=t(o);if(!i)return r?"":null;var a,u=i.storageDuration;try{a=e.getModuleExports(i.modulePath)}catch(e){return void g.error(S(i,o,e.message,e.stack))}if("function"==typeof a){var c;try{c=a(n(i.settings))}catch(e){return void g.error(S(i,o,e.message,e.stack))}return u&&(F(c)?M(o,u,c):c=A(o,u)),F(c)||(c=i.defaultValue||""),"string"==typeof c&&(i.cleanText&&(c=v(c)),i.forceLowerCase&&(c=c.toLowerCase())),c}g.error(S(i,o,"Module did not export a function."))}}(ne,te,function(){return ee.apply(null,arguments)},X),oe={},ie=function(e){return function(){if("string"==typeof arguments[0])e[arguments[0]]=arguments[1];else if(arguments[0]){var t=arguments[0];for(var n in t)e[n]=t[n]}}}(oe),ae=function(e,t){return function(n){var r=n.split(".")[0];return Boolean(t(n)||"this"===r||"event"===r||"target"===r||e.hasOwnProperty(r))}}(oe,te),ue=function(e,t,n){return function(r,o){var i;if(t(r))i=n(r);else{var a=r.split("."),u=a.shift();"this"===u?o&&(i=N(o.element,a,!0)):"event"===u?o&&(i=N(o,a)):"target"===u?o&&(i=N(o.target,a)):i=N(e[u],a)}return i}}(oe,te,re);ee=function(e,t,n){var r,o,i,a,u=[],c=function(r,o,i){if(!e(o))return r;u.push(o);var a=t(o,i);return u.pop(),null==a&&n?"":a};return r=function(e,t){var n=/^%([^%]+)%$/.exec(e);return n?c(e,n[1],t):e.replace(/%(.+?)%/g,function(e,n){return c(e,n,t)})},o=function(e,t){for(var n={},r=Object.keys(e),o=0;o<r.length;o++){var i=r[o],u=e[i];n[i]=a(u,t)}return n},i=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++)n.push(a(e[r],t));return n},a=function(e,t){return"string"==typeof e?r(e,t):Array.isArray(e)?i(e,t):"object"==typeof e&&null!==e?o(e,t):e},function(e,t){return u.length>10?(g.error("Data element circular reference detected: "+u.join(" -> ")),e):a(e,t)}}(ae,ue,X);var ce=w("localStorage");g.outputEnabled="true"===ce.getItem("debug"),function(e,t,n,r,o){var i=g.createPrefixedLogger("Custom Script");e.track=function(){},e.getVisitorId=function(){return null},e.property={name:t.property.name},e.buildInfo=t.buildInfo,e.logger=i,e.notify=function(e,t){switch(g.warn("_satellite.notify is deprecated. Please use the `_satellite.logger` API."),t){case 3:i.info(e);break;case 4:i.warn(e);break;case 5:i.error(e);break;default:i.log(e)}},e.getVar=r,e.setVar=o,e.setCookie=function(e,t,n){var r="",o={};n&&(r=", { expires: "+n+" }",o.expires=n);var i='_satellite.setCookie is deprecated. Please use _satellite.cookie.set("'+e+'", "'+t+'"'+r+").";g.warn(i),y.set(e,t,o)},e.readCookie=function(e){return g.warn('_satellite.readCookie is deprecated. Please use _satellite.cookie.get("'+e+'").'),y.get(e)},e.removeCookie=function(e){g.warn('_satellite.removeCookie is deprecated. Please use _satellite.cookie.remove("'+e+'").'),y.remove(e)},e.cookie=y,e.pageBottom=function(){},e.setDebug=n;var a=!1;Object.defineProperty(e,"_container",{get:function(){return a||(g.warn("_satellite._container may change at any time and should only be used for debugging."),a=!0),t}})}(Q,W,function(e){ce.setItem("debug",e),g.outputEnabled=e},ue,ie),function(e,t,n,r){var o=e.extensions,i=e.buildInfo,a=e.property.settings;if(o){var u=function(e,t){return function(n,r){var o=e[n];if(o){var i=o.modules;if(i)for(var a=Object.keys(i),u=0;u<a.length;u++){var c=a[u],s=i[c];if(s.shared&&s.name===r)return t.getModuleExports(c)}}}}(o,t);Object.keys(o).forEach(function(e){var c,s,f=o[e],l=function(e,t){return function(){return t?e(t):{}}}(n,f.settings);if(f.modules){var d=g.createPrefixedLogger(f.displayName),p=(c=f.hostedLibFilesBaseUrl,s=i.minified,function(e){if(s){var t=e.split(".");t.splice(t.length-1||1,0,"min"),e=t.join(".")}return c+e}),v={buildInfo:i,getDataElementValue:r,getExtensionSettings:l,getHostedLibFileUrl:p,getSharedModule:u,logger:d,propertySettings:a,replaceTokens:n};Object.keys(f.modules).forEach(function(n){var r=f.modules[n],o=function(e){return function(t){if(0===t.indexOf("@adobe/reactor-")){var n=t.substr("@adobe/reactor-".length),r=Z[n];if(r)return r}if(0===t.indexOf("./")||0===t.indexOf("../"))return e(t);throw new Error('Cannot resolve module "'+t+'".')}}(function(e){var r=function(e,t){var n,r;r=".js",-1===(n=t).indexOf(r,n.length-r.length)&&(t+=".js");var o,i=t.split("/"),a=(o=e,o.substr(0,o.lastIndexOf("/"))).split("/");return i.forEach(function(e){e&&"."!==e&&(".."===e?a.length&&a.pop():a.push(e))}),a.join("/")}(n,e);return t.getModuleExports(r)});t.registerModule(n,r,e,o,v)})}}),t.hydrateCache()}}(W,ne,ee,re),function(e,t,n,r,o){var i=function(e){return function(t,n){var r=e._monitors;r&&(G||(g.warn("The _satellite._monitors API may change at any time and should only be used for debugging."),G=!0),r.forEach(function(e){e[t]&&e[t](n)}))}}(e),a=function(e){var t=n.getModuleDefinition(e.modulePath);return t&&t.displayName||e.modulePath},u=function(e,t,n,r){return"Failed to execute "+a(e)+" for "+t.name+" rule. "+n+(r?"\n"+r:"")},c=function(e,t){if(e.conditions)for(var c=0;c<e.conditions.length;c++){var s,f=e.conditions[c];f.settings=f.settings||{};try{s=n.getModuleExports(f.modulePath)}catch(t){return void g.error(u(f,e,t.message,t.stack))}if("function"!=typeof s)return void g.error(u(f,e,"Module did not export a function."));var l,d=r(f.settings,t);try{l=s(d,t)}catch(t){return g.error(u(f,e,t.message,t.stack)),void i("ruleConditionFailed",{rule:e,condition:f})}if(!l&&!f.negate||l&&f.negate){var p=a(f);return g.log("Condition "+p+" for rule "+e.name+" not met."),void i("ruleConditionFailed",{rule:e,condition:f})}}!function(e,t){o()&&e.actions&&e.actions.forEach(function(o){var i;o.settings=o.settings||{};try{i=n.getModuleExports(o.modulePath)}catch(t){return void g.error(u(o,e,t.message,t.stack))}if("function"==typeof i){var a=r(o.settings,t);try{i(a,t)}catch(t){return void g.error(u(o,e,t.message,t.stack))}}else g.error(u(o,e,"Module did not export a function."))}),g.log('Rule "'+e.name+'" fired.'),i("ruleCompleted",{rule:e})}(e,t)};(function(e){var t=[];return e.forEach(function(e){e.events&&e.events.forEach(function(n){t.push({rule:e,event:n})})}),t.sort(function(e,t){return e.event.ruleOrder-t.event.ruleOrder})})(t).forEach(function(e){var t,o,a,s=e.rule,f=e.event;f.settings=f.settings||{};try{t=n.getModuleExports(f.modulePath),o=n.getModuleDefinition(f.modulePath).name,a=n.getModuleExtensionName(f.modulePath)}catch(e){return void g.error(u(f,s,e.message,e.stack))}if("function"==typeof t){var l=r(f.settings),d={$type:a+"."+o,$rule:{id:s.id,name:s.name}};try{t(l,function(e){i("ruleTriggered",{rule:s}),c(s,function(e,t){return V(t=t||{},e),t.hasOwnProperty("type")||Object.defineProperty(t,"type",{get:function(){return g.warn("Accessing event.type in Adobe Launch has been deprecated and will be removed soon. Please use event.$type instead."),t.$type}}),t}(d,e))})}catch(e){return void g.error(u(f,s,e.message,e.stack))}}else g.error(u(f,s,"Module did not export a function."))})}(Q,W.rules||[],ne,ee,function(){return"true"!==ce.getItem("hideActivity")})}return Q}function se(e,t){return e(t={exports:{}},t.exports),t.exports}function fe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}console.warn("Adobe Launch is unsupported in IE 9 and below.")}();
\No newline at end of file