UNPKG

@gitlab/application-sdk-browser

Version:

Client side Browser SDK for GitLab Application services

7 lines 64.3 kB
var e=function(){return e=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},e.apply(this,arguments)};function n(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function t(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function r(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function i(e){if(!function(e){return"string"==typeof e&&o.test(e)}(e))throw TypeError("Invalid UUID");var n,t=new Uint8Array(16);return t[0]=(n=parseInt(e.slice(0,8),16))>>>24,t[1]=n>>>16&255,t[2]=n>>>8&255,t[3]=255&n,t[4]=(n=parseInt(e.slice(9,13),16))>>>8,t[5]=255&n,t[6]=(n=parseInt(e.slice(14,18),16))>>>8,t[7]=255&n,t[8]=(n=parseInt(e.slice(19,23),16))>>>8,t[9]=255&n,t[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=n/4294967296&255,t[12]=n>>>24&255,t[13]=n>>>16&255,t[14]=n>>>8&255,t[15]=255&n,t}for(var a,u=[],c=0;c<256;++c)u.push((c+256).toString(16).slice(1));function s(e,n=0){return(u[e[n+0]]+u[e[n+1]]+u[e[n+2]]+u[e[n+3]]+"-"+u[e[n+4]]+u[e[n+5]]+"-"+u[e[n+6]]+u[e[n+7]]+"-"+u[e[n+8]]+u[e[n+9]]+"-"+u[e[n+10]]+u[e[n+11]]+u[e[n+12]]+u[e[n+13]]+u[e[n+14]]+u[e[n+15]]).toLowerCase()}var l=new Uint8Array(16);function f(){if(!a&&!(a="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return a(l)}function d(e,n,t){function r(e,r,o,a){var u;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var n=[],t=0;t<e.length;++t)n.push(e.charCodeAt(t));return n}(e)),"string"==typeof r&&(r=i(r)),16!==(null===(u=r)||void 0===u?void 0:u.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var c=new Uint8Array(16+e.length);if(c.set(r),c.set(e,r.length),(c=t(c))[6]=15&c[6]|n,c[8]=63&c[8]|128,o){a=a||0;for(var l=0;l<16;++l)o[a+l]=c[l];return o}return s(c)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function v(e){return 14+(e+64>>>9<<4)+1}function g(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function p(e,n,t,r,o,i){return g((a=g(g(n,e),g(r,i)))<<(u=o)|a>>>32-u,t);var a,u}function m(e,n,t,r,o,i,a){return p(n&t|~n&r,e,n,o,i,a)}function h(e,n,t,r,o,i,a){return p(n&r|t&~r,e,n,o,i,a)}function y(e,n,t,r,o,i,a){return p(n^t^r,e,n,o,i,a)}function w(e,n,t,r,o,i,a){return p(t^(n|~r),e,n,o,i,a)}d("v3",48,(function(e){if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=new Uint8Array(n.length);for(var t=0;t<n.length;++t)e[t]=n.charCodeAt(t)}return function(e){for(var n=[],t=32*e.length,r="0123456789abcdef",o=0;o<t;o+=8){var i=e[o>>5]>>>o%32&255,a=parseInt(r.charAt(i>>>4&15)+r.charAt(15&i),16);n.push(a)}return n}(function(e,n){e[n>>5]|=128<<n%32,e[v(n)-1]=n;for(var t=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<e.length;a+=16){var u=t,c=r,s=o,l=i;t=m(t,r,o,i,e[a],7,-680876936),i=m(i,t,r,o,e[a+1],12,-389564586),o=m(o,i,t,r,e[a+2],17,606105819),r=m(r,o,i,t,e[a+3],22,-1044525330),t=m(t,r,o,i,e[a+4],7,-176418897),i=m(i,t,r,o,e[a+5],12,1200080426),o=m(o,i,t,r,e[a+6],17,-1473231341),r=m(r,o,i,t,e[a+7],22,-45705983),t=m(t,r,o,i,e[a+8],7,1770035416),i=m(i,t,r,o,e[a+9],12,-1958414417),o=m(o,i,t,r,e[a+10],17,-42063),r=m(r,o,i,t,e[a+11],22,-1990404162),t=m(t,r,o,i,e[a+12],7,1804603682),i=m(i,t,r,o,e[a+13],12,-40341101),o=m(o,i,t,r,e[a+14],17,-1502002290),t=h(t,r=m(r,o,i,t,e[a+15],22,1236535329),o,i,e[a+1],5,-165796510),i=h(i,t,r,o,e[a+6],9,-1069501632),o=h(o,i,t,r,e[a+11],14,643717713),r=h(r,o,i,t,e[a],20,-373897302),t=h(t,r,o,i,e[a+5],5,-701558691),i=h(i,t,r,o,e[a+10],9,38016083),o=h(o,i,t,r,e[a+15],14,-660478335),r=h(r,o,i,t,e[a+4],20,-405537848),t=h(t,r,o,i,e[a+9],5,568446438),i=h(i,t,r,o,e[a+14],9,-1019803690),o=h(o,i,t,r,e[a+3],14,-187363961),r=h(r,o,i,t,e[a+8],20,1163531501),t=h(t,r,o,i,e[a+13],5,-1444681467),i=h(i,t,r,o,e[a+2],9,-51403784),o=h(o,i,t,r,e[a+7],14,1735328473),t=y(t,r=h(r,o,i,t,e[a+12],20,-1926607734),o,i,e[a+5],4,-378558),i=y(i,t,r,o,e[a+8],11,-2022574463),o=y(o,i,t,r,e[a+11],16,1839030562),r=y(r,o,i,t,e[a+14],23,-35309556),t=y(t,r,o,i,e[a+1],4,-1530992060),i=y(i,t,r,o,e[a+4],11,1272893353),o=y(o,i,t,r,e[a+7],16,-155497632),r=y(r,o,i,t,e[a+10],23,-1094730640),t=y(t,r,o,i,e[a+13],4,681279174),i=y(i,t,r,o,e[a],11,-358537222),o=y(o,i,t,r,e[a+3],16,-722521979),r=y(r,o,i,t,e[a+6],23,76029189),t=y(t,r,o,i,e[a+9],4,-640364487),i=y(i,t,r,o,e[a+12],11,-421815835),o=y(o,i,t,r,e[a+15],16,530742520),t=w(t,r=y(r,o,i,t,e[a+2],23,-995338651),o,i,e[a],6,-198630844),i=w(i,t,r,o,e[a+7],10,1126891415),o=w(o,i,t,r,e[a+14],15,-1416354905),r=w(r,o,i,t,e[a+5],21,-57434055),t=w(t,r,o,i,e[a+12],6,1700485571),i=w(i,t,r,o,e[a+3],10,-1894986606),o=w(o,i,t,r,e[a+10],15,-1051523),r=w(r,o,i,t,e[a+1],21,-2054922799),t=w(t,r,o,i,e[a+8],6,1873313359),i=w(i,t,r,o,e[a+15],10,-30611744),o=w(o,i,t,r,e[a+6],15,-1560198380),r=w(r,o,i,t,e[a+13],21,1309151649),t=w(t,r,o,i,e[a+4],6,-145523070),i=w(i,t,r,o,e[a+11],10,-1120210379),o=w(o,i,t,r,e[a+2],15,718787259),r=w(r,o,i,t,e[a+9],21,-343485551),t=g(t,u),r=g(r,c),o=g(o,s),i=g(i,l)}return[t,r,o,i]}(function(e){if(0===e.length)return[];for(var n=8*e.length,t=new Uint32Array(v(n)),r=0;r<n;r+=8)t[r>>5]|=(255&e[r/8])<<r%32;return t}(e),8*e.length))}));var b={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function k(e,n,t){if(b.randomUUID&&!n&&!e)return b.randomUUID();var r=(e=e||{}).random||(e.rng||f)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(var o=0;o<16;++o)n[t+o]=r[o];return n}return s(r)}function S(e,n,t,r){switch(e){case 0:return n&t^~n&r;case 1:case 3:return n^t^r;case 2:return n&t^n&r^t&r}}function T(e,n){return e<<n|e>>>32-n}d("v5",80,(function(e){var n=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,a=Math.ceil(i/16),u=new Array(a),c=0;c<a;++c){for(var s=new Uint32Array(16),l=0;l<16;++l)s[l]=e[64*c+4*l]<<24|e[64*c+4*l+1]<<16|e[64*c+4*l+2]<<8|e[64*c+4*l+3];u[c]=s}u[a-1][14]=8*(e.length-1)/Math.pow(2,32),u[a-1][14]=Math.floor(u[a-1][14]),u[a-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<a;++f){for(var d=new Uint32Array(80),v=0;v<16;++v)d[v]=u[f][v];for(var g=16;g<80;++g)d[g]=T(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var p=t[0],m=t[1],h=t[2],y=t[3],w=t[4],b=0;b<80;++b){var k=Math.floor(b/20),E=T(p,5)+S(k,m,h,y)+w+n[k]+d[b]>>>0;w=y,y=h,h=T(m,30)>>>0,m=p,p=E}t[0]=t[0]+p>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+h>>>0,t[3]=t[3]+y>>>0,t[4]=t[4]+w>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}));function E(e){if(!e)return e;switch(4-e.length%4){case 2:e+="==";break;case 3:e+="="}return function(e){var n,t,r,o,i,a,u=function(e){return decodeURIComponent(e.split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))},c=0,s=0,l="",f=[];if(!e)return e;e+="";do{n=(a=C.indexOf(e.charAt(c++))<<18|C.indexOf(e.charAt(c++))<<12|(o=C.indexOf(e.charAt(c++)))<<6|(i=C.indexOf(e.charAt(c++))))>>16&255,t=a>>8&255,r=255&a,f[s++]=64===o?String.fromCharCode(n):64===i?String.fromCharCode(n,t):String.fromCharCode(n,t,r)}while(c<e.length);return l=f.join(""),u(l.replace(/\0+$/,""))}(e.replace(/-/g,"+").replace(/_/g,"/"))}function x(e){if(!e)return e;var n=function(e){var n,t,r,o,i,a=0,u=0,c=[];if(!e)return e;e=unescape(encodeURIComponent(e));do{n=(i=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,t=i>>12&63,r=i>>6&63,o=63&i,c[u++]=C.charAt(n)+C.charAt(t)+C.charAt(r)+C.charAt(o)}while(a<e.length);var s=c.join(""),l=e.length%3;return(l?s.slice(0,l-3):s)+"===".slice(l||3)}(e);return n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function A(){var e,n={},t=[],r=[],o=[],i=function(e,t){null!=t&&""!==t&&(n[e]=t)};return{add:i,addDict:function(e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&i(n,e[n])},addJson:function(e,n,o){if(o&&I(o)){var i={keyIfEncoded:e,keyIfNotEncoded:n,json:o};r.push(i),t.push(i)}},addContextEntity:function(e){o.push(e)},getPayload:function(){return n},getJson:function(){return t},withJsonProcessor:function(n){e=n},build:function(){return null==e||e(this,r,o),n}}}function P(e){return function(n,t,o){for(var i=function(t,r,o){var i=JSON.stringify(t);e?n.add(r,x(i)):n.add(o,i)},a=function(t,r){var o=t||function(){var t=n.getPayload();if(e?t.cx:t.co)return JSON.parse(e?E(t.cx):t.co)}();return o?o.data=o.data.concat(r.data):o=r,o},u=void 0,c=0,s=t;c<s.length;c++){var l=s[c];"cx"===l.keyIfEncoded?u=a(u,l.json):i(l.json,l.keyIfEncoded,l.keyIfNotEncoded)}(t.length=0,o.length)&&(u=a(u,{schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:r([],o,!0)}),o.length=0);u&&i(u,"cx","co")}}function I(e){if(!O(e))return!1;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))return!0;return!1}function O(e){return null!=e&&(e.constructor==={}.constructor||e.constructor===[].constructor)}var L,U="Snowplow: ";!function(e){e[e.none=0]="none",e[e.error=1]="error",e[e.warn=2]="warn",e[e.debug=3]="debug",e[e.info=4]="info"}(L||(L={}));var j=function(e){void 0===e&&(e=L.warn);return{setLogLevel:function(n){e=L[n]?n:L.warn},warn:function(n,t){for(var o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];if(e>=L.warn&&"undefined"!=typeof console){var a=U+n;t?console.warn.apply(console,r([a+"\n",t],o,!1)):console.warn.apply(console,r([a],o,!1))}},error:function(n,t){for(var o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];if(e>=L.error&&"undefined"!=typeof console){var a=U+n+"\n";t?console.error.apply(console,r([a+"\n",t],o,!1)):console.error.apply(console,r([a],o,!1))}},debug:function(n){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];e>=L.debug&&"undefined"!=typeof console&&console.debug.apply(console,r([U+n],t,!1))},info:function(n){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];e>=L.info&&"undefined"!=typeof console&&console.info.apply(console,r([U+n],t,!1))}}}();function D(){var e=[],n=[],t={},r={},o=function(o){var i=function(e){for(var n=e.getJson(),t=0,r=n;t<r.length;t++){var o=r[t];if("ue_px"===o.keyIfEncoded&&"object"==typeof o.json.data){var i=o.json.data.schema;if("string"==typeof i)return i}}return""}(o),a=function(e){var n=e.getPayload().e;return"string"==typeof n?n:""}(o),u=[],c=Y(e.concat(Object.values(t)),o,a,i);u.push.apply(u,c);var s=function(e,n,t,r){var o,i=W(e),a=function(e){var o=function(e,n,t,r){if(H(e)){var o=e[0],i=!1;try{i=o({event:n.getPayload(),eventType:t,eventSchema:r})}catch(e){i=!1}if(!0===i)return Y(e[1],n,t,r)}else if(F(e)&&function(e,n){var t=0,r=0,o=e.accept;Array.isArray(o)?e.accept.some((function(e){return J(e,n)}))&&r++:"string"==typeof o&&J(o,n)&&r++;var i=e.reject;Array.isArray(i)?e.reject.some((function(e){return J(e,n)}))&&t++:"string"==typeof i&&J(i,n)&&t++;if(r>0&&0===t)return!0;if(0===r&&t>0)return!1;return!1}(e[0],r))return Y(e[1],n,t,r);return[]}(e,n,t,r);if(o&&0!==o.length)return o},u=i.map(a);return(o=[]).concat.apply(o,u.filter((function(e){return null!=e&&e.filter(Boolean)})))}(n.concat(Object.values(r)),o,a,i);return u.push.apply(u,s),u};return{getGlobalPrimitives:function(){return e.concat(Object.values(t))},getConditionalProviders:function(){return n.concat(Object.values(r))},addGlobalContexts:function(o){if(Array.isArray(o)){for(var i=[],a=[],u=0,c=o;u<c.length;u++){G(f=c[u])?i.push(f):q(f)&&a.push(f)}e=e.concat(a),n=n.concat(i)}else for(var s=0,l=Object.entries(o);s<l.length;s++){var f,d=l[s],v=d[0];G(f=d[1])?r[v]=f:q(f)&&(t[v]=f)}},clearGlobalContexts:function(){n=[],e=[],r={},t={}},removeGlobalContexts:function(o){for(var i=function(o){"string"==typeof o?(delete r[o],delete t[o]):G(o)?n=n.filter((function(e){return!Q(o,e)})):q(o)&&(e=e.filter((function(e){return!Q(o,e)})))},a=0,u=o;a<u.length;a++){i(u[a])}},getApplicableContexts:function(e){return o(e)}}}function R(e){for(var n,t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return null!==(n=null==e?void 0:e.map((function(e){if("function"!=typeof e)return e;try{return e.apply(void 0,t)}catch(e){return}})).filter(Boolean))&&void 0!==n?n:[]}function B(e){var n=e.split(".");return!!(n&&n.length>1)&&function(e){if("*"===e[0]||"*"===e[1])return!1;if(e.slice(2).length>0){for(var n=!1,t=0,r=e.slice(2);t<r.length;t++)if("*"===r[t])n=!0;else if(n)return!1;return!0}return 2==e.length}(n)}function N(e){var n=new RegExp("^iglu:((?:(?:[a-zA-Z0-9-_]+|\\*).)+(?:[a-zA-Z0-9-_]+|\\*))/([a-zA-Z0-9-_.]+|\\*)/jsonschema/([1-9][0-9]*|\\*)-(0|[1-9][0-9]*|\\*)-(0|[1-9][0-9]*|\\*)$").exec(e);if(null!==n&&B(n[1]))return n.slice(1,6)}function V(e){var n=N(e);if(n){var t=n[0];return 5===n.length&&B(t)}return!1}function _(e){return function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))}(e)?e.every((function(e){return V(e)})):"string"==typeof e&&V(e)}function z(e){var n=e;return!!(I(n)&&"schema"in n&&"data"in n)&&("string"==typeof n.schema&&"object"==typeof n.data)}function M(e){return"function"==typeof e&&e.length<=1}function q(e){return M(e)||z(e)}function H(e){return!(!Array.isArray(e)||2!==e.length)&&(Array.isArray(e[1])?M(e[0])&&e[1].every(q):M(e[0])&&q(e[1]))}function F(e){return!(!Array.isArray(e)||2!==e.length)&&(!!function(e){var n=e,t=0;if(null!=e&&"object"==typeof e&&!Array.isArray(e)){if(Object.prototype.hasOwnProperty.call(n,"accept")){if(!_(n.accept))return!1;t+=1}if(Object.prototype.hasOwnProperty.call(n,"reject")){if(!_(n.reject))return!1;t+=1}return t>0&&t<=2}return!1}(e[0])&&(Array.isArray(e[1])?e[1].every(q):q(e[1])))}function G(e){return H(e)||F(e)}function J(e,n){if(!V(e))return!1;var t=N(e),r=function(e){var n=new RegExp("^iglu:([a-zA-Z0-9-_.]+)/([a-zA-Z0-9-_]+)/jsonschema/([1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)$").exec(e);if(null!==n)return n.slice(1,6)}(n);if(t&&r){if(!function(e,n){var t=n.split("."),r=e.split(".");if(t&&r){if(t.length!==r.length)return!1;for(var o=0;o<r.length;o++)if(!X(t[o],r[o]))return!1;return!0}return!1}(t[0],r[0]))return!1;for(var o=1;o<5;o++)if(!X(t[o],r[o]))return!1;return!0}return!1}function X(e,n){return e&&n&&"*"===e||e===n}function W(e){return Array.isArray(e)?e:Array.of(e)}function Y(e,n,t,r){var o,i=W(e).map((function(e){var o=function(e,n,t,r){if(z(e))return[e];if(M(e)){var o=function(e,n,t,r){var o=void 0;try{return o=e({event:n.getPayload(),eventType:t,eventSchema:r}),Array.isArray(o)&&o.every(z)||z(o)?o:void 0}catch(e){o=void 0}return o}(e,n,t,r);if(z(o))return[o];if(Array.isArray(o))return o}return}(e,n,t,r);if(o&&0!==o.length)return o}));return(o=[]).concat.apply(o,i.filter((function(e){return null!=e&&e.filter(Boolean)})))}function Z(e,n){return"function"==typeof e?e===n:JSON.stringify(e)===JSON.stringify(n)}function Q(e,n){if(G(e)){if(!G(n))return!1;var t=e[0],r=e[1],o=n[0],i=n[1];return!!Z(t,o)&&(Array.isArray(r)?!!Array.isArray(i)&&(r.length===i.length&&r.reduce((function(e,n,t){return e&&Z(n,i[t])}),!0)):!Array.isArray(i)&&Z(r,i))}return!!q(e)&&(!!q(n)&&Z(e,n))}function $(n){void 0===n&&(n={});var t=!0,o=n.base64,i=n.corePlugins,a=n.callback,u=null!=i?i:[],c=function(e,n,o){var i=function(e){return{addPluginContexts:function(n){var t=n?r([],n,!0):[];return e.forEach((function(e){try{e.contexts&&t.push.apply(t,e.contexts())}catch(e){j.error("Error adding plugin contexts",e)}})),t}}}(n),a=D(),u=e,c={};function s(e,n){c[e]=n}var l={track:function(e,r,s){if(t){e.withJsonProcessor(P(u)),e.add("eid",k()),e.addDict(c);var l=function(e){return null==e?{type:"dtm",value:(new Date).getTime()}:"number"==typeof e?{type:"dtm",value:e}:"ttm"===e.type?{type:"ttm",value:e.value}:{type:"dtm",value:e.value||(new Date).getTime()}}(s);e.add(l.type,l.value.toString());var f=function(e,n){var t=a.getApplicableContexts(e),r=[];return n&&n.length&&r.push.apply(r,n),t&&t.length&&r.push.apply(r,t),r}(e,i.addPluginContexts(r)),d=function(e){if(e&&e.length)return{schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:e}}(f);if(void 0!==d&&e.addJson("cx","co",d),n.forEach((function(n){try{n.beforeTrack&&n.beforeTrack(e)}catch(e){j.error("Plugin beforeTrack",e)}})),!n.find((function(n){try{return n.filter&&!1===n.filter(e.build())}catch(e){return j.error("Plugin filter",e),!1}}))){"function"==typeof o&&o(e);var v=e.build();return n.forEach((function(e){try{e.afterTrack&&e.afterTrack(v)}catch(e){j.error("Plugin afterTrack",e)}})),v}}else j.error("Track called on deactivated tracker")},addPayloadPair:s,getBase64Encoding:function(){return u},setBase64Encoding:function(e){u=e},addPayloadDict:function(e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(c[n]=e[n])},resetPayloadPairs:function(e){c=O(e)?e:{}},setTrackerVersion:function(e){s("tv",e)},setTrackerNamespace:function(e){s("tna",e)},setAppId:function(e){s("aid",e)},setPlatform:function(e){s("p",e)},setUserId:function(e){s("uid",e)},setScreenResolution:function(e,n){s("res",e+"x"+n)},setViewport:function(e,n){s("vp",e+"x"+n)},setColorDepth:function(e){s("cd",e)},setTimezone:function(e){s("tz",e)},setLang:function(e){s("lang",e)},setIpAddress:function(e){s("ip",e)},setUseragent:function(e){s("ua",e)},addGlobalContexts:function(e){a.addGlobalContexts(e)},clearGlobalContexts:function(){a.clearGlobalContexts()},removeGlobalContexts:function(e){a.removeGlobalContexts(e)}};return l}(null==o||o,u,a),s=e(e({},c),{addPlugin:function(e){var n,t,r=e.plugin;u.push(r),null===(n=r.logger)||void 0===n||n.call(r,j),null===(t=r.activateCorePlugin)||void 0===t||t.call(r,s)},deactivate:function(){u.forEach((function(e){var n;null===(n=e.deactivatePlugin)||void 0===n||n.call(e,s)})),u.length=0,t=!1}});return null==u||u.forEach((function(e){var n,t;null===(n=e.logger)||void 0===n||n.call(e,j),null===(t=e.activateCorePlugin)||void 0===t||t.call(e,s)})),s}function K(e){var n=e.event,t=n.schema,r=n.data,o=A(),i={schema:"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0",data:{schema:t,data:r}};return o.add("e","ue"),o.addJson("ue_px","ue_pr",i),o}function ee(e){return K({event:{schema:"iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1",data:ne({targetUrl:e.targetUrl,elementId:e.elementId,elementClasses:e.elementClasses,elementTarget:e.elementTarget,elementContent:e.elementContent})}})}function ne(e,n){void 0===n&&(n={});var t={};for(var r in e)(n[r]||null!==e[r]&&void 0!==e[r])&&(t[r]=e[r]);return t}function te(e){var n=e.maxSize,t=void 0===n?1e3:n,o=e.events,i=r([],void 0===o?[]:o,!0),a=function(){return Promise.resolve(i.length)};return{count:a,add:function(e){for(i.push(e);i.length>t;)i.shift();return a()},removeHead:function(e){for(var n=0;n<e;n++)i.shift();return Promise.resolve()},iterator:function(){var e=0,n=r([],i,!0);return{next:function(){return e<n.length?Promise.resolve({value:n[e++],done:!1}):Promise.resolve({value:void 0,done:!0})}}},getAll:function(){return Promise.resolve(r([],i,!0))},getAllPayloads:function(){return Promise.resolve(i.map((function(e){return e.payload})))}}}var re="iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4";function oe(e){return JSON.stringify({schema:re,data:e})}function ie(n){var t,r,o=n.endpoint,i=n.protocol,a=void 0===i?"https":i,u=n.port,c=n.eventMethod,s=void 0===c?"post":c,l=n.customHeaders,f=n.connectionTimeout,d=n.keepalive,v=void 0!==d&&d,g=n.postPath,p=void 0===g?"/com.snowplowanalytics.snowplow/tp2":g,m=n.useStm,h=void 0===m||m,y=n.maxPostBytes,w=void 0===y?4e4:y,b=n.credentials,k=void 0===b?"include":b,S=[],T="post"===s.toLowerCase();function E(){var e=S.reduce((function(e,n){return e+(T?n.getPOSTRequestBytesCount():n.getGETRequestBytesCount())}),0);return T&&(e+=88),e}function x(){return S.length>0?S[0].getServerAnonymization():void 0}function C(){var e=o;return o.includes("://")||(e="".concat(a,"://").concat(o)),u&&(e="".concat(e,":").concat(u)),e+(T?p:"/i")}function A(n,o){I(!1),r=new AbortController,t=setTimeout((function(){var e="Request timed out";console.error(e),t=void 0,I(!1,e)}),null!=f?f:5e3);var i,a=e({headers:(i=new Headers,T&&i.append("Content-Type","application/json; charset=UTF-8"),l&&Object.keys(l).forEach((function(e){i.append(e,l[e])})),x()&&i.append("SP-Anonymous","*"),i),signal:r.signal,keepalive:v,credentials:k},o);return new Request(n,a)}function P(){var e=function(e){for(var n=(new Date).getTime().toString(),t=0;t<e.length;t++)e[t].stm=n;return e}(S.map((function(e){return e.getPOSTRequestBody()})));return A(C(),{method:"POST",body:oe(e)})}function I(e,n){if(void 0!==t&&(clearTimeout(t),t=void 0),void 0!==r){var o=r;r=void 0,e||o.abort(n)}}return{addEvent:function(e){return!(S.length>0&&x()!==e.getServerAnonymization())&&(S.push(e),!0)},getEvents:function(){return S},toRequest:function(){if(0!==S.length)return T?P():function(){if(1!==S.length)throw new Error("Only one event can be sent in a GET request");return A(S[0].getGETRequestURL(C(),h),{method:"GET"})}()},countBytes:E,countEvents:function(){return S.length},isFull:function(){return T?E()>=w:S.length>=1},closeRequest:I}}function ae(e){for(var n=0,t=0;t<e.length;t++){var r=e.charCodeAt(t);r<=127?n+=1:r<=2047?n+=2:r>=55296&&r<=57343?(n+=4,t++):n+=r<65535?3:4}return n}function ue(e){var n=null,t=null,r=null,o=null;function i(){return e.payload}function a(e){return null===n&&(n=function(e){var n={co:!0,cx:!0},t=[];for(var r in e)e.hasOwnProperty(r)&&!n[r]&&t.push(r+"="+encodeURIComponent(e[r]));for(var o in n)e.hasOwnProperty(o)&&n[o]&&t.push(o+"="+encodeURIComponent(e[o]));return"?"+t.join("&")}(e)),n}function u(){var e;return null===t&&(e=i(),t=Object.keys(e).map((function(n){return[n,e[n]]})).reduce((function(e,n){var t=n[0],r=n[1];return e[t]=r.toString(),e}),{})),t}return{getPayload:i,getServerAnonymization:function(){var n;return null!==(n=e.svrAnon)&&void 0!==n&&n},getGETRequestURL:function(e,n){var t=a(i());return n?e+t.replace("?","?stm="+(new Date).getTime()+"&"):e+t},getGETRequestBytesCount:function(){if(null===r){var e=a(i());r=ae(e)}return r},getPOSTRequestBody:u,getPOSTRequestBytesCount:function(){return null===o&&(o=ae(JSON.stringify(u()))),o}}}function ce(e){var r=e.endpoint,o=e.eventMethod,i=void 0===o?"post":o,a=e.postPath,u=e.protocol,c=e.port,s=e.maxPostBytes,l=void 0===s?4e4:s,f=e.maxGetBytes,d=e.bufferSize,v=void 0===d?1:d,g=e.customHeaders,p=e.serverAnonymization,m=e.connectionTimeout,h=e.keepalive,y=e.idService,w=e.dontRetryStatusCodes,b=void 0===w?[]:w,k=e.retryStatusCodes,S=void 0===k?[]:k,T=e.retryFailedRequests,E=void 0===T||T,x=e.onRequestFailure,C=e.onRequestSuccess,A=e.customFetch,P=void 0===A?fetch:A,I=e.useStm,O=e.eventStore,L=void 0===O?te({}):O,U=e.credentials,D=!1,R=!1,B="post"===i.toLowerCase();function N(e,n){void 0!==x&&setTimeout((function(){try{null==x||x(e,n)}catch(e){j.error("Error in onRequestFailure",e)}}),0)}function V(e){return n(this,void 0,void 0,(function(){var n,r,o,i,a,u;return t(this,(function(t){switch(t.label){case 0:if(void 0===(n=e.toRequest()))throw new Error("Empty batch");r=e.getEvents().map((function(e){return e.getPayload()})),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,P(n)];case 2:return[4,(o=t.sent()).text()];case 3:return t.sent(),e.closeRequest(!0),o.ok?(function(e,n){void 0!==C&&setTimeout((function(){try{null==C||C(e,n)}catch(e){j.error("Error in onRequestSuccess",e)}}),0)}(r,o),[2,{success:!0,retry:!1,status:o.status}]):(c=o.status,i=!(c>=200&&c<300||!E||!S.includes(c)&&b.includes(c)),N({events:r,status:o.status,message:o.statusText,willRetry:i},o),[2,{success:!1,retry:i,status:o.status}]);case 4:return a=t.sent(),e.closeRequest(!1),u="string"==typeof a?a:a?a.message:"Unknown error",N({events:r,message:u,willRetry:!0}),[2,{success:!1,retry:!0}];case 5:return[2]}var c}))}))}function _(){return ie({endpoint:r,protocol:u,port:c,eventMethod:i,customHeaders:g,connectionTimeout:m,keepalive:h,maxPostBytes:l,useStm:I,credentials:U,postPath:a})}function z(){return n(this,void 0,void 0,(function(){var e;return t(this,(function(n){switch(n.label){case 0:return!y||D?[3,2]:(D=!0,e=new Request(y,{method:"GET"}),[4,P(e)]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))}function M(){return n(this,void 0,void 0,(function(){var e;return t(this,(function(n){switch(n.label){case 0:if(R)return[3,5];R=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,q()];case 2:return n.sent(),[3,5];case 3:return e=n.sent(),j.error("Error sending events",e),[3,5];case 4:return R=!1,[7];case 5:return[2]}}))}))}function q(){return n(this,void 0,void 0,(function(){var e,n,r,o,i,a,u,c,s;return t(this,(function(t){switch(t.label){case 0:return[4,z()];case 1:t.sent(),e=_(),n=L.iterator(),t.label=2;case 2:return e.isFull()?[3,4]:[4,n.next()];case 3:return r=t.sent(),o=r.value,r.done||void 0===o?[3,4]:(i=ue(o),e.addEvent(i)?[3,2]:[3,4]);case 4:return 0===e.countEvents()?[2]:[4,V(e)];case 5:return a=t.sent(),u=a.success,c=a.retry,s=a.status,!u&&c?[3,7]:(u||j.error("Status ".concat(s,", will not retry.")),[4,L.removeHead(e.countEvents())]);case 6:t.sent(),t.label=7;case 7:return u?[4,q()]:[3,9];case 8:t.sent(),t.label=9;case 9:return[2]}}))}))}return b=b.concat([400,401,403,410,422]),{flush:M,input:function(e){return n(this,void 0,void 0,(function(){var n,r,o;return t(this,(function(t){switch(t.label){case 0:return n=function(e){var n=e.payload,t=e.svrAnon;return{payload:n,svrAnon:void 0!==t&&t}}({payload:e,svrAnon:p}),r=ue(n),i=r,c=function(e,n){return j.warn("Event ("+e+"B) too big, max is "+n)},(B?((u=(a=i.getPOSTRequestBytesCount()+88)>l)&&c(a,l),u):void 0!==f&&((u=(a=i.getGETRequestBytesCount())>f)&&c(a,f),u))?((o=_()).addEvent(r),[4,V(o)]):[3,2];case 1:return t.sent(),[3,5];case 2:return[4,L.add(n)];case 3:return t.sent()>=v?[4,M()]:[3,5];case 4:t.sent(),t.label=5;case 5:return[2]}var i,a,u,c}))}))},setCollectorUrl:function(e){r=e},setAnonymousTracking:function(e){p=e},setBufferSize:function(e){v=e}}}var se,le,fe={exports:{}},de={exports:{}};se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le={rotl:function(e,n){return e<<n|e>>>32-n},rotr:function(e,n){return e<<32-n|e>>>n},endian:function(e){if(e.constructor==Number)return 16711935&le.rotl(e,8)|4278255360&le.rotl(e,24);for(var n=0;n<e.length;n++)e[n]=le.endian(e[n]);return e},randomBytes:function(e){for(var n=[];e>0;e--)n.push(Math.floor(256*Math.random()));return n},bytesToWords:function(e){for(var n=[],t=0,r=0;t<e.length;t++,r+=8)n[r>>>5]|=e[t]<<24-r%32;return n},wordsToBytes:function(e){for(var n=[],t=0;t<32*e.length;t+=8)n.push(e[t>>>5]>>>24-t%32&255);return n},bytesToHex:function(e){for(var n=[],t=0;t<e.length;t++)n.push((e[t]>>>4).toString(16)),n.push((15&e[t]).toString(16));return n.join("")},hexToBytes:function(e){for(var n=[],t=0;t<e.length;t+=2)n.push(parseInt(e.substr(t,2),16));return n},bytesToBase64:function(e){for(var n=[],t=0;t<e.length;t+=3)for(var r=e[t]<<16|e[t+1]<<8|e[t+2],o=0;o<4;o++)8*t+6*o<=8*e.length?n.push(se.charAt(r>>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],t=0,r=0;t<e.length;r=++t%4)0!=r&&n.push((se.indexOf(e.charAt(t-1))&Math.pow(2,-2*r+8)-1)<<2*r|se.indexOf(e.charAt(t))>>>6-2*r);return n}},de.exports=le;var ve={utf8:{stringToBytes:function(e){return ve.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(ve.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var n=[],t=0;t<e.length;t++)n.push(255&e.charCodeAt(t));return n},bytesToString:function(e){for(var n=[],t=0;t<e.length;t++)n.push(String.fromCharCode(e[t]));return n.join("")}}},ge=ve;function pe(e){try{var n=window.localStorage;return n.removeItem(e),n.removeItem(e+".expires"),!0}catch(e){return!1}}function me(e){try{return window.sessionStorage.getItem(e)}catch(e){return}}!function(){var e=de.exports,n=ge.utf8,t=ge.bin,r=function(r,o){var i=e.wordsToBytes(function(t){t.constructor==String?t=n.stringToBytes(t):"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||(t=t.toString());var r=e.bytesToWords(t),o=8*t.length,i=[],a=1732584193,u=-271733879,c=-1732584194,s=271733878,l=-1009589776;r[o>>5]|=128<<24-o%32,r[15+(o+64>>>9<<4)]=o;for(var f=0;f<r.length;f+=16){for(var d=a,v=u,g=c,p=s,m=l,h=0;h<80;h++){if(h<16)i[h]=r[f+h];else{var y=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=y<<1|y>>>31}var w=(a<<5|a>>>27)+l+(i[h]>>>0)+(h<20?1518500249+(u&c|~u&s):h<40?1859775393+(u^c^s):h<60?(u&c|u&s|c&s)-1894007588:(u^c^s)-899497514);l=s,s=c,c=u<<30|u>>>2,u=a,a=w}a+=d,u+=v,c+=g,s+=p,l+=m}return[a,u,c,s,l]}(r));return o&&o.asBytes?i:o&&o.asString?t.bytesToString(i):e.bytesToHex(i)};r._blocksize=16,r._digestsize=20,fe.exports=r}();var he={sessionId:!0,sourceId:!0,sourcePlatform:!1,userId:!1,reason:!1};function ye(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}function we(e){return Number.isInteger&&Number.isInteger(e)||"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function be(e){return!(!e||"function"!=typeof e)}function ke(e){if(!(t=e)||"string"!=typeof t.valueOf()){e=e.text||"";var n=document.getElementsByTagName("title");n&&null!=n[0]&&(e=n[0].text)}var t;return e}function Se(e){var n=new RegExp("^(?:(?:https?|ftp):)/*(?:[^@]+@)?([^:/#]+)").exec(e);return n?n[1]:e}function Te(e){var n=e.length;return"."===e.charAt(--n)&&(e=e.slice(0,n)),"*."===e.slice(0,2)&&(e=e.slice(1)),e}function Ee(e){var n=window,t=Ce("referrer",n.location.href)||Ce("referer",n.location.href);if(t)return t;if(e)return e;try{if(n.top)return n.top.document.referrer;if(n.parent)return n.parent.document.referrer}catch(e){}return document.referrer}function xe(e,n,t,r){return e.addEventListener?(e.addEventListener(n,t,r),!0):e.attachEvent?e.attachEvent("on"+n,t):void(e["on"+n]=t)}function Ce(e,n){var t=new RegExp("^[^#]*[?&]"+e+"=([^&#]*)").exec(n);return t?decodeURIComponent(t[1].replace(/\+/g," ")):null}function Ae(e,n,t,r,o){Ie(e,"",-1,n,t,r,o)}function Pe(e){for(var n=document.cookie.split("; "),t=[],r=0;r<n.length;r++)n[r].substring(0,e.length)===e&&t.push(n[r]);return t}function Ie(e,n,t,r,o,i,a){return arguments.length>1?document.cookie=e+"="+encodeURIComponent(null!=n?n:"")+(t?"; Expires="+new Date(+new Date+1e3*t).toUTCString():"")+(r?"; Path="+r:"")+(o?"; Domain="+o:"")+(i?"; SameSite="+i:"")+(a?"; Secure":""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}function Oe(e){if(null==e||"object"!=typeof e||Array.isArray(e))return function(){return!0};var n=Object.prototype.hasOwnProperty.call(e,"allowlist"),t=function(e){var n={},t=e.allowlist||e.denylist;if(t){Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++)n[t[r]]=!0}return n}(e);return function(e,n){if(e.hasOwnProperty("filter")&&e.filter)return e.filter;return n}(e,(function(e){return function(e,n){for(var t=Le(e),r=0,o=t;r<o.length;r++){if(n[o[r]])return!0}return!1}(e,t)===n}))}function Le(e){return e.className.match(/\S+/g)||[]}function Ue(e,n){var t,r=null!==(t=e.eventStore)&&void 0!==t?t:function(e){var n=e.trackerId,t=e.maxLocalStorageQueueSize,r=void 0===t?1e3:t,o=e.useLocalStorage,i=void 0===o||o,a="snowplowOutQueue_".concat(n),u=function(){if(i){var e=window.localStorage.getItem(a),n=e?JSON.parse(e):[];return te({maxSize:r,events:n})}return te({maxSize:r})}(),c=u.getAll,s=u.getAllPayloads,l=u.add,f=u.count,d=u.iterator,v=u.removeHead;function g(){return i?c().then((function(e){window.localStorage.setItem(a,JSON.stringify(e))})):Promise.resolve()}return{count:f,add:function(e){return l(e),g().then(f)},removeHead:function(e){return v(e),g()},iterator:d,getAll:c,getAllPayloads:s,setUseLocalStorage:function(e){i=e}}}(e);e.eventStore=r;var o=ce(e);return n.bufferFlushers.push(o.flush),{enqueueRequest:o.input,executeQueue:o.flush,setAnonymousTracking:o.setAnonymousTracking,setCollectorUrl:o.setCollectorUrl,setBufferSize:o.setBufferSize,setUseLocalStorage:function(e){r.hasOwnProperty("setUseLocalStorage")&&r.setUseLocalStorage(e)}}}function je(e,n,t){var r,o,i,a;return"translate.googleusercontent.com"===e?(""===t&&(t=n),e=Se(n=null!==(o=n,i="u",r=(a=new RegExp("^(?:https?|ftp)(?::/*(?:[^?]+))([?][^#]+)").exec(o))&&(null==a?void 0:a.length)>1?Ce(i,a[1]):null)&&void 0!==r?r:"")):"cc.bingj.com"!==e&&"webcache.googleusercontent.com"!==e||(e=Se(n=document.links[0].href)),[e,n,t]}var De=0,Re=1,Be=2,Ne=3,Ve=4,_e=5,ze=6,Me=7,qe=8,He=9,Fe=10;function Ge(e,n){void 0===n&&(n={memorizedVisitCount:1});var t=n.memorizedVisitCount;Ze(e)?(e[Me]=e[ze],e[_e]=e[Ve],e[Ne]++):e[Ne]=t;var r=k();return e[ze]=r,e[Fe]=0,e[qe]="",e[He]=void 0,r}function Je(e){e[Ve]=Math.round((new Date).getTime()/1e3)}function Xe(e,n,t){var r=e[He];return{userId:t?"00000000-0000-0000-0000-000000000000":e[Re],sessionId:e[ze],eventIndex:e[Fe],sessionIndex:e[Ne],previousSessionId:t?null:e[Me]||null,storageMechanism:"localStorage"==n?"LOCAL_STORAGE":"COOKIE_1",firstEventId:e[qe]||null,firstEventTimestamp:r?new Date(r).toISOString():null}}function We(e){return e[ze]}function Ye(e){return e[Ne]}function Ze(e){return"0"===e[De]}function Qe(e){return e[Fe]}var $e="iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0",Ke="iglu:com.snowplowanalytics.snowplow/browser_context/jsonschema/2-0-0",en="iglu:com.snowplowanalytics.snowplow/client_session/jsonschema/1-0-2",nn="iglu:com.snowplowanalytics.snowplow/application/jsonschema/1-0-0";var tn,rn=!1;var on="x";function an(){return"ResizeObserver"in window?(tn||(tn=un()),function(){if(!rn&&document&&document.body&&document.documentElement){rn=!0;var e=new ResizeObserver((function(e){for(var n=0,t=e;n<t.length;n++){var r=t[n];r.target!==document.body&&r.target!==document.documentElement||(tn=un())}}));e.observe(document.body),e.observe(document.documentElement)}}(),tn):un()}function un(){return{viewport:sn(cn()),documentSize:sn((e=document.documentElement,n=document.body,t=n?Math.max(n.offsetHeight,n.scrollHeight):0,r=Math.max(e.clientWidth,e.offsetWidth,e.scrollWidth),o=Math.max(e.clientHeight,e.offsetHeight,e.scrollHeight,t),isNaN(r)||isNaN(o)?"":r+on+o)),resolution:sn(screen.width+on+screen.height),colorDepth:screen.colorDepth,devicePixelRatio:window.devicePixelRatio,cookiesEnabled:window.navigator.cookieEnabled,online:window.navigator.onLine,browserLanguage:window.navigator.language||window.navigator.userLanguage,documentLanguage:document.documentElement.lang,webdriver:window.navigator.webdriver,deviceMemory:window.navigator.deviceMemory,hardwareConcurrency:window.navigator.hardwareConcurrency};var e,n,t,r,o}function cn(){var e,n;if("innerWidth"in window)e=window.innerWidth,n=window.innerHeight;else{var t=document.documentElement||document.body;e=t.clientWidth,n=t.clientHeight}return Math.max(0,e)+on+Math.max(0,n)}function sn(e){return e&&e.split(on).map((function(e){return Math.floor(Number(e))})).join(on)}function ln(e){var n,t,r,o=!0;function i(){if(void 0!==n&&(clearTimeout(n),n=void 0),!o&&(o=!0,void 0!==t)){var r=t[0],i=t[1],a=t[2],u=t[3],c=t[4],s=t[5];Ie(e,r,i,a,u,c,s)}}return{getValue:function(){var n;return t&&(!r||r>new Date)&&null!==(n=t[0])&&void 0!==n?n:Ie(e)},setValue:function(e,a,u,c,s,l){return t=[e,a,u,c,s,l],o=!1,void 0===n&&(n=setTimeout((function(){n=void 0,i()}),10)),r=new Date(Date.now()+1e3*Math.min(.05,null!=a?a:.05)),!0},deleteValue:function(r,i,a,u){t=void 0,o=!0,void 0!==n&&(clearTimeout(n),n=void 0),Ae(e,r,i,a,u)},flush:i}}var fn=function(){var e={};function n(n){return e[n]||(e[n]=ln(n)),e[n]}return{getCookie:function(e){return n(e).getValue()},setCookie:function(e,t,r,o,i,a,u){return n(e).setValue(t,r,o,i,a,u)},deleteCookie:function(e,t,r,o,i){n(e).deleteValue(t,r,o,i)},clearCache:function(){e={}},flush:function(){for(var n=0,t=Object.values(e);n<t.length;n++){t[n].flush()}}}}(),dn={getCookie:Ie,setCookie:function(e,n,t,r,o,i,a){return Ie(e,n,t,r,o,i,a),-1!==document.cookie.indexOf("".concat(e,"="))},deleteCookie:Ae,flush:function(){}};function vn(n,t,o,i,a,u){void 0===u&&(u={});var c=[],s=function(n,t,o,i,a,u){var s,l,f,d,v,g,p,m,h,y,w,b,S,T,E,x,C,P,I,O;u.eventMethod=null!==(s=u.eventMethod)&&void 0!==s?s:"post";var L,U,D=function(e){var n;return null!==(n=e.stateStorageStrategy)&&void 0!==n?n:"cookieAndLocalStorage"},R=function(e){var n;return"boolean"!=typeof e.anonymousTracking&&!0===(null===(n=e.anonymousTracking)||void 0===n?void 0:n.withSessionTracking)},B=function(e){var n;return"boolean"!=typeof e.anonymousTracking&&!0===(null===(n=e.anonymousTracking)||void 0===n?void 0:n.withServerAnonymisation)},N=function(e){return!!e.anonymousTracking},V=null!==(f=null===(l=null==u?void 0:u.contexts)||void 0===l?void 0:l.browser)&&void 0!==f&&f,_=null===(v=null===(d=null==u?void 0:u.contexts)||void 0===d?void 0:d.webPage)||void 0===v||v,z=u.synchronousCookieWrite?dn:fn;c.push((L=function(e){return yn?null:e},U=function(e){return mn?e:L(e)},{beforeTrack:function(e){var n=Gn("ses"),t=ot(),r=0===Qe(t);if(re=!!J&&!!z.getCookie(J),vn||re)nt();else{Ze(t)?(ne=n||"none"==wn?We(t):Ge(t),kn=Ye(t)):(new Date).getTime()-bn>1e3*pn&&(kn++,ne=Ge(t,{memorizedVisitCount:kn})),Je(t),function(e,n){if(0===e[Fe]){var t=n.build();e[qe]=t.eid;var r=t.dtm||t.ttm;e[He]=r?parseInt(r):void 0}}(t,e),function(e){e[Fe]+=1}(t);var o=an(),i=o.viewport,a=o.documentSize;e.add("vp",i),e.add("ds",a),e.add("vid",U(kn)),e.add("sid",U(ne)),e.add("duid",L(function(e){return e[Re]}(t))),e.add("uid",L(te)),_n(),e.add("refr",qn(M||le)),e.add("url",qn(q||se));var u=Xe(t,wn,yn);if(!An||yn&&!mn||function(e,n){var t={schema:en,data:n};e.addContextEntity(t)}(e,u),"none"!=wn){Kn(t);var c=$n();n&&!r||!c||!Pn||In||(z.flush(),Pn(u),In=!1)}bn=(new Date).getTime()}}})),_&&c.push({contexts:function(){return[{schema:$e,data:{id:ut()}}]}}),V&&c.push({contexts:function(){return[{schema:Ke,data:e(e({},an()),{tabId:ct()})}]}}),c.push.apply(c,null!==(g=u.plugins)&&void 0!==g?g:[]);var M,q,H,F,G,J,X,W,Y,Z,Q,K,ee,ne,te,re,oe,ie=$({base64:null!==(p=u.encodeBase64)&&void 0!==p?p:"post"!==u.eventMethod,corePlugins:c,callback:function(e){vn||re||Sn.enqueueRequest(e.build())}}),ae=document.characterSet||document.charset,ue=je(window.location.hostname,window.location.href,Ee()),ce=Te(ue[0]),se=ue[1],le=ue[2],de=null!==(m=u.platform)&&void 0!==m?m:"web",ve=null!==(h=u.appId)&&void 0!==h?h:"",ge=u.appVersion,be=document.title,Oe=!1,Le=null===(y=u.resetActivityTrackingOnPageView)||void 0===y||y,tn=null!==(w=u.cookieName)&&void 0!==w?w:"_sp_",rn=null!==(b=u.cookieDomain)&&void 0!==b?b:void 0,on=null!==(S=u.discoverRootDomain)&&void 0!==S?S:void 0===rn,un="/",cn=null!==(T=u.cookieSameSite)&&void 0!==T?T:"Lax",sn=null===(E=u.cookieSecure)||void 0===E||E,ln=window.navigator.doNotTrack||window.navigator.msDoNotTrack||window.doNotTrack,vn=void 0!==u.respectDoNotTrack&&(u.respectDoNotTrack&&("yes"===ln||"1"===ln)),gn=null!==(x=u.cookieLifetime)&&void 0!==x?x:63072e3,pn=null!==(C=u.sessionCookieTimeout)&&void 0!==C?C:1800,mn=R(u),hn=B(u),yn=N(u),wn=D(u),bn=(new Date).getTime(),kn=1,Sn=Ue(e({trackerId:n,endpoint:it(i),serverAnonymization:hn,useLocalStorage:"localStorage"==wn||"cookieAndLocalStorage"==wn},u),a),Tn=!1,En=null!==(P=u.preservePageViewIdForUrl)&&void 0!==P&&P,xn=void 0,Cn={enabled:!1,installed:!1,configurations:{}},An=null!==(O=null===(I=u.contexts)||void 0===I?void 0:I.session)&&void 0!==O&&O,Pn=u.onSessionUpdateCallback,In=!1,On="boolean"==typeof(oe=u.useExtendedCrossDomainLinker||!1)?{useExtendedCrossDomainLinker:oe}:{useExtendedCrossDomainLinker:!0,collectCrossDomainAttributes:oe},Ln=On.useExtendedCrossDomainLinker,Un=On.collectCrossDomainAttributes;on&&!rn&&(rn=function(e,n){for(var t=window.location.hostname,r="_sp_root_domain_test_",o=r+(new Date).getTime(),i="_test_value_"+(new Date).getTime(),a=t.split("."),u=a.length-2;u>=0;u--){var c=a.slice(u).join(".");if(Ie(o,i,0,"/",c,e,n),Ie(o)===i){Ae(o,"/",c,e,n);for(var s=Pe(r),l=0;l<s.length;l++)Ae(s[l],"/",c,e,n);return c}}return t}(cn,sn));var jn=an(),Dn=jn.browserLanguage,Rn=jn.resolution,Bn=jn.colorDepth,Nn=jn.cookiesEnabled,Vn=function(){if("object"==typeof Intl&&"function"==typeof Intl.DateTimeFormat)return(new Intl.DateTimeFormat).resolvedOptions().timeZone}();function _n(){(ue=je(window.location.hostname,window.location.href,Ee()))[1]!==se&&(le=Ee(se)),ce=Te(ue[0]),se=ue[1]}function zn(n){return function(t){var r=t.currentTarget,o=function(n,t,r){var o,i=(new Date).getTime(),a=e(e({},he),t),u=r.domainUserId,c=r.userId,s=r.sessionId,l=r.sourceId,f=r.sourcePlatform,d=r.event,v=d.currentTarget,g="function"==typeof a.reason?a.reason(d):null===(o=null==v?void 0:v.textContent)||void 0===o?void 0:o.trim();return n?[u,i,a.sessionId&&s,a.userId&&ye(c||""),a.sourceId&&ye(l||""),a.sourcePlatform&&f,a.reason&&ye(g||"")].map((function(e){return e||""})).join(".").replace(/([.]*$)/,""):r.domainUserId+"."+i}(n,Un,{domainUserId:ee,userId:te||void 0,sessionId:ne,sourceId:ve,sourcePlatform:de,event:t});(null==r?void 0:r.href)&&(r.href=function(e,n,t){var r=n+"="+t,o=e.split("#"),i=o[0].split("?"),a=i.shift(),u=i.join("?");if(u){for(var c=!0,s=u.split("&"),l=0;l<s.length;l++)if(s[l].substr(0,n.length+1)===n+"="){c=!1,s[l]=r,u=s.join("&");break}c&&(u=r+"&"+u)}else u=r;return o[0]=a+"?"+u,o.join("#")}(r.href,"_sp",o))}}function Mn(e){for(var n=zn(Ln),t=0;t<document.links.length;t++){var r=document.links[t];!r.spDecorationEnabled&&e(r)&&(r.addEventListener("click",n,!0),r.addEventListener("mousedown",n,!0),r.spDecorationEnabled=!0)}}function qn(e){var n;return F&&(n=new RegExp("#.*"),e=e.replace(n,"")),G&&(n=new RegExp("[{}]","g"),e=e.replace(n,"")),e}function Hn(e){var n=new RegExp("^([a-z]+):").exec(e);return n?n[1]:null}function Fn(e){return tn+e+"."+K}function Gn(e){var n=Fn(e);return"localStorage"==wn? /*! * Core functionality for Snowplow Browser trackers v4.3.0 (http://bit.ly/sp-js) * Copyright 2022 Snowplow Analytics Ltd, 2010 Anthon Pang * Licensed under BSD-3-Clause */ function(e){try{var n=window.localStorage,t=n.getItem(e+".expires");return null===t||+t>Date.now()?n.getItem(e):(n.removeItem(e),void n.removeItem(e+".expires"))}catch(e){return}}(n):"cookie"==wn||"cookieAndLocalStorage"==wn?z.getCookie(n):void 0}function Jn(){_n(),K=fe.exports((rn||ce)+(un||"/")).slice(0,4)}function Xn(){var e=new Date;X=e.getTime()}function Wn(){!function(){var e=Yn(),n=e[0];n<W?W=n:n>Y&&(Y=n);var t=e[1];t<Z?Z=t:t>Q&&(Q=t)}(),Xn()}function Yn(){var e=document.documentElement;return e?[e.scrollLeft||window.pageXOffset,e.scrollTop||window.pageYOffset]:[0,0]}function Zn(){var e=Yn(),n=e[0];W=n,Y=n;var t=e[1];Z=t,Q=t}function Qn(e){return Math.round(e)}function $n(){return et(Fn("ses"),"*",pn)}function Kn(e){var n=Fn("id"),t=function(e,n){var t=r([],e,!0);return n&&(t[Re]="",t[Me]=""),t.shift(),t.join(".")}(e,yn);return et(n,t,gn)}function et(e,n,t){return!(yn&&!mn)&&("localStorage"==wn?function(e,n,t){void 0===t&&(t=63072e3);try{var r=window.localStorage,o=Date.now()+1e3*t;return r.setItem("".concat(e,".expires"),o.toString()),r.setItem(e,n),!0}catch(e){return!1}}(e,n,t):("cookie"==wn||"cookieAndLocalStorage"==wn)&&z.setCookie(e,n,t,un,rn,cn,sn))}function nt(e){var n=Fn("id"),t=Fn("ses");pe(n),pe(t),z.deleteCookie(n,un,rn,cn,sn),z.deleteCookie(t,un,rn,cn,sn),(null==e?void 0:e.preserveSession)||(ne=k(),kn=1),(null==e?void 0:e.preserveUser)||(ee=yn?"":k(),te=null)}function tt(e){e&&e.stateStorageStrategy&&(u.stateStorageStrategy=e.stateStorageStrategy,wn=D(u)),yn=N(u),mn=R(u),hn=B(u),Sn.setUseLocalStorage("localStorage"==wn||"cookieAndLocalStorage"==wn),Sn.setAnonymousTracking(hn)}function rt(){if(!yn||mn){var e="none"!=wn&&!!Gn("ses"),n=ot();ee=function(e,n){var t;return e[Re]?t=e[Re]:n?(t="",e[Re]=t):(t=k(),e[Re]=t),t}(n,yn),ne=e?We(n):Ge(n),kn=Ye(n),"none"!=wn&&($n(),Je(n),Kn(n),Qe(n)||z.flush())}}function ot(){return"none"==wn?["1","",0,0,0,void 0,"","","",void 0,0]:function(e,n,t,r){var o,i=new Date,a=Math.round(i.getTime()/1e3);e?(o=e.split(".")).unshift("0"):o=["1",n,a,r,a,"",t],o[ze]&&"undefined"!==o[ze]||(o[ze]=k()),o[Me]&&"undefined"!==o[Me]||(o[Me]=""),o[qe]&&"undefined"!==o[qe]||(o[qe]=""),o[He]&&"undefined"!==o[He]||(o[He]=""),o[Fe]&&"undefined"!==o[Fe]||(o[Fe]=0);var u=function(e,n){var t=parseInt(e);return isNaN(t)?n:t},c=function(e){return e?u(e,void 0):void 0};return[o[De],o[Re],u(o[Be],a),u(o[Ne],r),u(o[Ve],a),c(o[_e]),o[ze],o[Me],o[qe],c(o[He]),u(o[Fe],0)]}(Gn("id")||void 0,ee,ne,kn)}function it(e){return 0===e.indexOf("http")?e:("https:"===document.location.protocol?"https":"http")+"://"+e}function at(){Tn&&null!=a.pageViewId||(a.pageViewId=k(),a.pageViewUrl=q||se)}function ut(){return function(){if(null==a.pageViewId)return!0;if(Tn||!En)return!1;if(void 0===a.pageViewUrl)return!0;var e=q||se;if(!0===En||"full"==En||!("URL"in window))return a.pageViewUrl!=e;var n=new URL(e),t=new URL(a.pageViewUrl);if("pathname"==En)return n.pathname!=t.pathname;if("pathnameAndSearch"==En)return n.pathname!=t.pathname||n.search!=t.search;return!1}()&&(a.pageViewId=k(),a.pageViewUrl=q||se),a.pageViewId}function ct(){if("none"===wn||yn||!_)return null;var e="_sp_tab_id",n=me(e);return n||(!function(e,n){try{return window.sessionStorage.setItem(e,n),!0}catch(e){return!1}}(e,k()),n=me(e)),n||null}function st(e,n){return(e||[]).concat(n?n():[])}function lt(e){var n=e.title,t=e.context,r=e.timestamp,o=e.contextCallback;_n(),xn&&xn==ut()&&at(),xn=ut(),be=document.title,n?(H=n,Oe=!0):Oe&&(H=null);var i=ke(H||be);ie.track(function(e){var n=e.pageUrl,t=e.pageTitle,r=e.referrer,o=A();return o.add("e","pv"),o.add("url",n),o.add("page",t),o.add("refr",r),o}({pageUrl:qn(q||se),pageTitle:i,referrer:qn(M||le)}),st(t,o),r);var a=new Date,u=!1;if(Cn.enabled&&!Cn.installed){Cn.installed=!0,u=!0;var c={update:function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,n=Object.defineProperty({},"passive",{get:function(){e=!0},set:function(){}}),t=function(){};window.addEventListener("testPassiveEventSupport",t,n),window.removeEventListener("testPassiveEventSupport",t,n),c.hasSupport=e}}};c.update();var s="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";Object.prototype.hasOwnProperty.call(c,"hasSupport")?xe(document,s,Xn,{passive:!0}):xe(document,s,Xn),Zn();var l=function(e,n){return void 0===n&&(n=Xn),function(e){return xe(document,e,n)}};["click","mouseup","mousedown","mousemove","keypress","keydown","keyup","touchend","touchstart"].forEach(l(document)),["resize","focus","blur"].forEach(l(window)),l(window,Wn)("scroll")}if(Cn.enabled&&(Le||u)){X=a.getTime();var f=void 0;for(f in Cn.configurations){var d=Cn.configurations[f];d&&(window.clearInterval(d.activityInterval),ft(d,t,o))}}}function ft(e,n,t){var r=function(e,n){_n(),e({context:n,pageViewId:ut(),minXOffset:W,minYOffset:Z,maxXOffset:Y,maxYOffset:Q}),Zn()},o=function(){var o=new Date;X+e.configHeartBeatTimer>o.getTime()&&r(e.callback,st(n,t))};0===e.configMinimumVisitLength?e.activityInterval=window.setInterval(o,e.configHeartBeatTimer):e.activityInterval=window.setTimeout((function(){var i=new Date;X+e.configMinimumVisitLength>i.getTime()&&r(e.callback,st(n,t)),e.activityInterval=window.setInterval(o,e.configHeartBeatTimer)}),e.configMinimumVisitLength)}function dt(e){var n=e.minimumVisitLength,t=e.heartbeatDelay,r=e.callback;if(we(n)&&we(t))return{configMinimumVisitLength:1e3*n,configHeartBeatTimer:1e3*t,callback:r};j.error("Activity tracking minimumVisitLength & heartbeatDelay must be integers")}function vt(e){var n=e.context,t=e.minXOffset,r=e.minYOffset,o=e.maxXOffset,i=e.maxYOffset,a=document.title;a!==be&&(be=a,H=void 0),ie.track(function(e){var n=e.pageUrl,t=e.pageTitle,r=e.referrer,o=e.minXOffset,i=e.maxXOffset,a=e.minYOffset,u=e.maxYOffset,c=A();return c.add("e","pp"),c.add("url",n),c.add("page",t),c.add("refr",r),o&&!isNaN(Number(o))&&c.add("pp_mix",o.toString()),i&&!isNaN(Number(i))&&c.add("pp_max",i.toString()),a&&!isNaN(Number(a))&&c.add("pp_miy",a.toString()),u&&!isNaN(Number(u))&&c.add("pp_may",u.toString()),c}({pageUrl:qn(q||se),pageTitle:ke(H||be),referrer:qn(M||le),minXOffset:Qn(t),maxXOffset:Qn(o),minYOffset:Qn(r),maxYOffset:Qn(i)}),n)}function gt(e){var n=Cn.configurations[e];0===(null==n?voi