@analytics/aws-pinpoint
Advanced tools
Comparing version 0.6.12 to 0.6.13
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.6.13](https://github.com/DavidWells/analytics/compare/@analytics/aws-pinpoint@0.6.12...@analytics/aws-pinpoint@0.6.13) (2021-07-26) | ||
**Note:** Version bump only for package @analytics/aws-pinpoint | ||
## [0.6.12](https://github.com/DavidWells/analytics/compare/@analytics/aws-pinpoint@0.6.11...@analytics/aws-pinpoint@0.6.12) (2021-07-20) | ||
@@ -8,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
var analyticsAWSPinpoint=function(e){"use strict";var t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var r=function(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach(function(n){t(e,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e};function i(e,t){return e(t={exports:{}},t.exports),t.exports}var o=i(function(e){function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t}),s=i(function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new O(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw o;return _()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=E(s,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=u(e,t,n);if("normal"===c.type){if(r=n.done?h:f,c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",f="suspendedYield",d="executing",h="completed",p={};function v(){}function g(){}function y(){}var m={};m[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(T([])));b&&b!==n&&r.call(b,o)&&(m=b);var S=y.prototype=v.prototype=Object.create(m);function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function A(e,t){var n;this._invoke=function(i,o){function s(){return new t(function(n,s){!function n(i,o,s,a){var c=u(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,s,a)},function(e){n("throw",e,s,a)}):t.resolve(f).then(function(e){l.value=e,s(l)},function(e){return n("throw",e,s,a)})}a(c.arg)}(i,o,n,s)})}return n=n?n.then(s,s):s()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=u(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:_}}function _(){return{value:t,done:!0}}return g.prototype=S.constructor=y,y.constructor=g,y[a]=g.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},x(A.prototype),A.prototype[s]=function(){return this},e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},x(S),S[a]="Generator",S[o]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function a(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var c=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,c,"next",e)}function c(e){a(o,r,i,s,c,"throw",e)}s(void 0)})}},u=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===l}(e)}(e)};var l="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function f(e,t){return!1!==t.clone&&t.isMergeableObject(e)?g((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function d(e,t,n){return e.concat(t).map(function(e){return f(e,n)})}function h(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function p(e,t){try{return t in e}catch(e){return!1}}function v(e,t,n){var r={};return n.isMergeableObject(e)&&h(e).forEach(function(t){r[t]=f(e[t],n)}),h(t).forEach(function(i){(function(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return"function"==typeof n?n:g}(i,n)(e[i],t[i],n):r[i]=f(t[i],n))}),r}function g(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||d,n.isMergeableObject=n.isMergeableObject||u,n.cloneUnlessOtherwiseSpecified=f;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):v(e,t,n):f(t,n)}g.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return g(e,n,t)},{})};var y=g,m="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0;function w(e){return m[e]}function b(e,t){return m[e]=t,t}var S="undefined",x=A();function A(e){if(void 0===e&&(e=!1),typeof x!==S&&!e)return x;x=!0;try{typeof localStorage!==S&&typeof JSON!==S||(x=!1),localStorage.setItem("_"+S,"1"),localStorage.removeItem("_"+S)}catch(e){x=!1}return x}function E(e){return x?localStorage.getItem(e):w(e)}function k(e){return x?localStorage.removeItem(e):void b(e,void 0)}var I="undefined",O=j(),T=P,_=P;function j(e){if(void 0===e&&(e=!1),typeof O!==I&&!e)return O;try{var t="_"+I;P(t,"1"),O=-1!==document.cookie.indexOf(t),P(t,"",-1)}catch(e){O=!1}return O}function P(e,t,n,r,i,o){if(typeof window!==I){var s=arguments.length>1;return O||(s?b(e,t):w(e)),s?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}A(),j();var M="undefined"!=typeof document;function N(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}const U=new TextEncoder,C={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},L=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"];class D{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:s,initRetryMs:a}){if(null==e)throw new TypeError("accessKeyId is a required option");if(null==t)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=s?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){const{method:n,url:r,headers:i,body:o}=e;null==(t=Object.assign({method:n,url:r,headers:i},t)).body&&i.has("Content-Type")&&(t.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await e.clone().arrayBuffer()),e=r}const n=new H(Object.assign({url:e},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());return delete r.aws,new Request(r.url.toString(),r)}async fetch(e,t){for(let n=0;n<=this.retries;n++){const r=fetch(await this.sign(e,t));if(n===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise(e=>setTimeout(e,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw new Error("An unknown error occurred, ensure retries is not negative")}}class H{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:s,service:a,region:c,cache:u,datetime:l,signQuery:f,appendSessionToken:d,allHeaders:h,singleEncode:p}){if(null==t)throw new TypeError("url is a required option");if(null==i)throw new TypeError("accessKeyId is a required option");if(null==o)throw new TypeError("secretAccessKey is a required option");let v,g;this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=s,a&&c||([v,g]=function(e,t){const{hostname:n,pathname:r}=e,i=n.replace("dualstack.","").match(/([^.]+)\.(?:([^.]*)\.)?amazonaws\.com(?:\.cn)?$/);let[o,s]=(i||["",""]).slice(1,3);if("us-gov"===s)s="us-gov-west-1";else if("s3"===s||"s3-accelerate"===s)s="us-east-1",o="s3";else if("iot"===o)o=n.startsWith("iot.")?"execute-api":n.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===r?"iotdevicegateway":"iotdata";else if("autoscaling"===o){const e=(t.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===e?o="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===e&&(o="autoscaling-plans")}else null==s&&o.startsWith("s3-")?(s=o.slice(3).replace(/^fips-|^external-1/,""),o="s3"):o.endsWith("-fips")?o=o.slice(0,-5):s&&/-\d$/.test(o)&&!/-\d$/.test(s)&&([o,s]=[s,o]);return[C[o]||o,s]}(this.url,this.headers)),this.service=a||v||"",this.region=c||g||"us-east-1",this.cache=u||new Map,this.datetime=l||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=f,this.appendSessionToken=d||"iotdevicegateway"===this.service,this.headers.delete("Host");const y=this.signQuery?this.url.searchParams:this.headers;if("s3"!==this.service||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD"),y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(e=>h||!L.includes(e)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(e=>e+":"+("host"===e?this.url.host:(this.headers.get(e)||"").replace(/\s+/g," "))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||y.has("X-Amz-Expires")||y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(e){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");p||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=V(this.encodedPath);const m=new Set;this.encodedSearch=[...this.url.searchParams].filter(([e])=>{if(!e)return!1;if("s3"===this.service){if(m.has(e))return!1;m.add(e)}return!0}).map(e=>e.map(e=>V(encodeURIComponent(e)))).sort(([e,t],[n,r])=>e<n?-1:e>n?1:t<r?-1:t>r?1:0).map(e=>e.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join();let n=this.cache.get(t);if(!n){const r=await z("AWS4"+this.secretAccessKey,e),i=await z(r,this.region),o=await z(i,this.service);n=await z(o,"aws4_request"),this.cache.set(t,n)}return R(await z(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,R(await K(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256");if(null==e){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=R(await K(this.body||""))}return e}}async function z(e,t){const n=await crypto.subtle.importKey("raw","string"==typeof e?U.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,U.encode(t))}async function K(e){return crypto.subtle.digest("SHA-256","string"==typeof e?U.encode(e):e)}function R(e){return Array.prototype.map.call(new Uint8Array(e),e=>("0"+e.toString(16)).slice(-2)).join("")}function V(e){return e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}var q=["id","createdAt","created"],W=function(){if(M)try{return sessionStorage.setItem("__","__"),sessionStorage.removeItem("__"),!0}catch(e){}return!1}();function X(e,t){return W?(sessionStorage.setItem(e,t),t):F(e,t)}function F(e,t){return m[e]=t,t}function B(e){return m[e]}var G={session:[function(e,t){var n=W?sessionStorage.getItem(e):B(e);return null==n&&t&&(n=X(e,t)),n},X],page:[B,F]};function J(e){var t=e?new Date(e):new Date;return[t.toISOString(),t.getTime()]}function Q(){var e=J(),t=e[0],n=e[1];return{id:N(),created:n,createdAt:t}}function Y(e,t){var n=Q(),r=G[e],i=r[0],o=r[1],s=!1;return $(Object.fromEntries(q.map(function(r){var a="__"+e+"__session__"+r,c=i(a);s=t||!c;var u=c&&!t?c:o(a,n[r]);return[r,"created"!==r?u:Number(u)]})),s)}function $(e,t){var n=Date.now();return e.elapsed=n-e.created,e.expires&&(e.remaining=Math.abs(e.expires-n)),e.isNew=t,e}function Z(e,t){void 0===e&&(e=30);var n=T("__session"),r=n?JSON.parse(n):ee(e);return t?r:$(r,!n)}function ee(e,t,n){void 0===e&&(e=30);var r=n?Z(e,!0):Q(),i=60*e,o=r.created;if(n){var s=J(),a=s[0],c=s[1];r.modified=c,r.modifiedAt=a,o=c}var u=J(o+1e3*i),l=u[0];return r.expires=u[1],r.expiresAt=l,t&&(r=Object.assign(r,t)),_("__session",JSON.stringify(r),i),$(r,!n)}var te=function(e,t){return void 0===e&&(e=30),ee(e||1,t,!0)},ne=Y.bind(null,"session"),re=Y.bind(null,"session",!0),ie=Y.bind(null,"page"),oe=Y.bind(null,"page",!0),se=function(){};var ae="object",ce="string",ue="?",le="name",fe="version",de="",he="function",pe="undefined",ve={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ge=[[/microsoft (windows) (vista|xp)/i],[le,fe],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[le,[fe,ye,ve]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[le,"Windows"],[fe,ye,ve]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[fe,/_/g,"."],[le,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[le,"MacOS"],[fe,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[fe,le],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[le,fe],[/\(bb(10);/i],[fe,[le,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[fe,[le,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[fe,[le,"webOS"]],[/crkey\/([\d\.]+)/i],[fe,[le,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[le,"Chromium OS"],fe],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[le,fe]];function ye(e,t){for(var n in t)if(o(t[n])===ae&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(me(t[n][r],e))return n===ue?void 0:n}else if(me(t[n],e))return n===ue?void 0:n;return e}function me(e,t){return o(e)===ce&&-1!==we(t).indexOf(we(e))}function we(e){return e.toLowerCase()}function be(e){var t=e||(("undefined"==typeof window?"undefined":o(window))!==pe&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:de),n={};return n[le]=void 0,n[fe]=void 0,function(e,t){for(var n,r,i,s,a,c,u=0;u<t.length&&!a;){var l=t[u],f=t[u+1];for(n=r=0;n<l.length&&!a;)if(a=l[n++].exec(e))for(i=0;i<f.length;i++)c=a[++r],s=f[i],o(s)===ae&&s.length>0?2==s.length?o(s[1])==he?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3==s.length?o(s[1])!==he||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:4==s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;u+=2}}.call(n,t,ge),n}var Se="Brave";function xe(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[e]||e}var Ae=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce(function(e,t){return e[t]=t,e},{}),Ee="_session.start",ke="_session.stop",Ie="pageView",Oe=Object.freeze({SESSION_START:Ee,SESSION_STOP:ke,SESSION_PAUSE:"_session.pause",SESSION_RESUME:"_session.resume",AUTH_SIGN_IN:"_userauth.sign_in",AUTH_SIGN_UP:"_userauth.sign_up",AUTH_FAIL:"_userauth.auth_fail",ECOM_PURCHASE:"_monetization.purchase",PAGE_VIEW:Ie}),Te="undefined"!=typeof window,_e=Ee,je=ke,Pe=("undefined"!=typeof navigator&&navigator&&navigator.sendBeacon,"__endpoint"),Me=[429,500],Ne=[202],Ue=400,Ce=function(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var e,t,n,r,i,o=window.navigator,s=o.platform,a=o.product,c=o.vendor,u=(o.userAgent,function(e){var t=e.userAgent,n=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(t);if(n)return{type:n[1],version:n[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(t);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(t);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(t);if(o){var s=e.brave&&e.brave.isBrave||!1;return{type:s?Se:o[1],version:o[2]}}var a=/.+(Safari)\/([0-9\.]+).*/i.exec(t);if(a)return{type:a[1],version:a[2]};var c=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(t);if(c)return{type:c[1],version:c[2]};var u=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(t)||["","NA","0.0.0"];return{type:u[1],version:u[2]}}(window.navigator)),l=u.type,f=u.version,d=l===Se?l:(c||"").split(" ")[0];return{platform:s,os:be(),make:d||a,model:l,version:f,name:[l,f].join("/"),language:(t=window.navigator,n=t.language,r=t.browserLanguage,i=t.languages,(n||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(e=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),e&&e[1]||"")}}();function Le(){return{}}var De=/.+\@.+\..+/;function He(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r({getContext:e.getContext||Le,credentials:e.credentials||{},getEndpointId:e.getEndpointId},e),n=t.debug?console.log:function(){},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getEndpointId,n=e.debug;return function(){var r=c(s.mark(function r(){var i,a,c,u,l,f,d,h,p,v=arguments;return s.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return i=v.length>0&&void 0!==v[0]?v[0]:[],a=v.length>1&&void 0!==v[1]?v[1]:{},r.next=4,t();case 4:if(c=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===o(a)&&Object.keys(a).length){r.next=13;break}r.t0=Ke(c),r.next=16;break;case 13:return r.next=15,Ye(a,e);case 15:r.t0=r.sent;case 16:return u=r.t0,l=u.ChannelType,u.Address&&(s=u.Address,De.test(s))&&(l=Ae.EMAIL),!l&&u.Address&&(l="android"===Ce.platform?l||Ae.GCM:l||Ae.APNS),n&&(console.log("Endpoint",u),l&&console.log("CHANNEL_TYPE",l)),u.RequestId=N(),u.ChannelType=l,u.Address&&(u.OptOut=u.OptOut||"NONE"),f=Ve(i),d=qe(c,u,f),r.prev=26,r.next=29,Fe(d,e);case 29:h=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),p=r.t1;case 36:return r.abrupt("return",{endpoint:u,response:h,error:p,events:i});case 37:case"end":return r.stop()}var s},r,null,[[26,32]])}));return function(){return r.apply(this,arguments)}}()}(t),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var n=c(s.mark(function n(r){var i,o,a,c,u=arguments;return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return i=u.length>1&&void 0!==u[1]?u[1]:{},o=u.length>2&&void 0!==u[2]?u[2]:{},a=u.length>3&&void 0!==u[3]&&u[3],"boolean"==typeof i&&(a=i={}),"boolean"==typeof o&&(a=o={}),n.next=7,We(r,i,t);case 7:if(c=n.sent,!Object.entries(o).length&&r!==Ie){n.next=12;break}return n.next=11,Ye(o,t);case 11:o=n.sent;case 12:if(e.push(c),!a){n.next=17;break}return n.abrupt("return",e.flush());case 17:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}()}(function(e,t){var n,r,i,o=(t=t||{}).initial||[],s=t.max||1/0,a=t.interval||1e4,c=t.onEmpty||se,u=t.onPause||se;function l(t){clearInterval(n);var r=o.splice(0,s);return r.length&&e(r,o),o.length?t?l():f():(i=!1,c(o))}function f(){i=!0,n=setInterval(l,a)}return o.length&&f(),{flush:function(e){l(e)},resume:l,push:function(e){return(r=o.push(e))>=s&&!t.throttle&&l(),i||f(),r},size:function(){return o.length},pause:function(e){e&&l(),clearInterval(n),i=!1,u(o)}}}(function(){var e=c(s.mark(function e(t,r){var o;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach(function(e){return n(">>>>> PROCESS queue",e)}),e.next=3,i(t,{});case 3:o=e.sent,n(">>>>> PROCESS queue response",o);case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),{max:10,interval:3e3,throttle:!0}),t);Ye({},e);var u=function(e){if(!Te)return Le;var t=function(e){return function(){e(je,!0)}}(e);return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}(a);return{updateEndpoint:function(e){return i([],e)},recordEvent:a,disable:function(){u()}}}function ze(e){return"".concat(Pe,".").concat(e)}function Ke(e){try{return JSON.parse(E(ze(e)))||{}}catch(e){}return{}}function Re(e,t){var n,r,i=ze(e),o="string"==typeof t?t:JSON.stringify(t);return n=i,r=o,x?localStorage.setItem(n,r):b(n,r),t}function Ve(e){return e.sort(function(e,t){var n=e.EventType,r=t.EventType;return n==_e?-1:r==_e?1:n==je?1:r==je?-1:void 0}).reduce(function(e,t){return r({},t,{},e)},{})}function qe(e,n,r){return{BatchItem:t({},e,{Endpoint:n,Events:r})}}function We(e){return Xe.apply(this,arguments)}function Xe(){return(Xe=c(s.mark(function e(n){var i,o,a,c,u,l,f,d,h,p,v,g,y,m,w,b,S,x,A,E,k,I,O,T,_,j,P,M,U,C,L,D=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=D.length>1&&void 0!==D[1]?D[1]:{},o=D.length>2&&void 0!==D[2]?D[2]:{},a=o.appTitle,c=o.appPackageName,u=o.appVersionCode,l=o.eventMapping,f=o.enrichEventAttributes,d=o.enrichEventMetrics,h=o.debug,p=h?console.log:function(){},v=xe(n,l),g=ie(),y=ne(),m=Te?Z():{},w=i.sessionId||m.id,b=i.sessionStart||m.createdAt,S=i.sessionStart?new Date(i.sessionStart).getTime():m.created,p("event pageSessionInfo",JSON.stringify(g)),p("event tabSessionData ",JSON.stringify(y)),p("event sessionData ",JSON.stringify(m)),x=i.attributes||{},A=i.eventId||N(),E=i.time?new Date(i.time):new Date,k=E.toISOString(),I=E.getTime()-S,O=r({date:k,sessionId:w},Te?{pageSession:g.id}:{}),!f){e.next=26;break}return e.next=23,f();case 23:e.t0=e.sent,e.next=27;break;case 26:e.t0={};case 27:if(T=e.t0,_=r({},O,{},T,{},x),j=i.metrics||{},P={sessionTime:m.elapsed||I,hour:E.getHours(),day:E.getDay()+1,month:E.getMonth()+1,year:E.getFullYear()},!d){e.next=37;break}return e.next=34,d();case 34:e.t1=e.sent,e.next=38;break;case 37:e.t1={};case 38:return M=e.t1,U=r({},P,{},M,{},j),e.next=42,st(_);case 42:return e.t2=e.sent,e.next=45,ut(U);case 45:return e.t3=e.sent,C={attributes:e.t2,metrics:e.t3},p("".concat(A,":").concat(v)),p("eventAttributes",C.attributes),p("eventMetrics",C.metrics),p("clientInfo",Ce),Je(o),L=t({},A,{EventType:v,Timestamp:k,AppPackageName:c,AppTitle:a,AppVersionCode:u,Attributes:C.attributes,Metrics:C.metrics,Session:{Id:w,StartTimestamp:b}}),n===ke&&(L[A].Session.Duration=I,L[A].Session.StopTimestamp=k),e.abrupt("return",L);case 55:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Fe(e,t){return Be.apply(this,arguments)}function Be(){return(Be=c(s.mark(function e(t,n){var r,i,o,a,c,u,l,f,d,h,p,v,g,y,m,w,b;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.pinpointRegion,i=n.pinpointAppId,o=n.lambdaArn,a=n.lambdaRegion,c=n.credentials,u=n.getCredentials,n.debug,l=c,Object.keys(l).length||!u){e.next=12;break}return e.prev=3,e.next=6,u();case 6:l=e.sent,e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(3),new Error(e.t0);case 12:return f={accessKeyId:l.accessKeyId||l.AccessKeyId,secretAccessKey:l.secretAccessKey||l.SecretKey,sessionToken:l.sessionToken||l.SessionToken,retries:5},d=new D(f),h=a||r,p=r||a,v=!0===n.fips?"-fips":"",g="https://lambda.".concat(h,".amazonaws.com/2015-03-31/functions/").concat(o,"/invocations"),y="https://pinpoint".concat(v,".").concat(p,".amazonaws.com/v1/apps/").concat(i,"/events"),m=o?g:y,w={body:JSON.stringify(t)},e.next=23,d.fetch(m,w).then(function(e){return e.json()});case 23:return(b=e.sent)&&b.Results&&Object.keys(b.Results).map(function(e){return b.Results[e]}).forEach(function(e){var t=e.EndpointItemResponse||{},n=e.EventsItemResponse||{};Object.keys(t).length&&(Ne.includes(t.StatusCode)||Me.includes(t.StatusCode)||Ge(t,Endpoint));var r=Object.keys(n);r.length&&r.forEach(function(e){})}),e.abrupt("return",b);case 26:case"end":return e.stop()}},e,null,[[3,9]])}))).apply(this,arguments)}function Ge(e,t){var n=e.StatusCode,r=e.Message;if(n===Ue){if(r.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(r.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}function Je(e){var t=e.appTitle||e.appPackageName||"",n=e.appVersionCode||"0.0.0";return t?"".concat(t,"@").concat(n):n}var Qe=!1;function Ye(){return $e.apply(this,arguments)}function $e(){return($e=c(s.mark(function e(){var t,n,r,i,o,a,c,u,l,f,d,h,p,v,g,m,w,b,S,x,A=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=A.length>0&&void 0!==A[0]?A[0]:{},n=A.length>1&&void 0!==A[1]?A[1]:{},r=n.getUserId,i=n.getEndpointId,n.enrichUserAttributes,o=n.endpointMigration,a=et(n),c=a.sessionKey?a.sessionKey():"sessions",u=a.pageViewKey?a.pageViewKey():"pageViews",l=ie(),f=l.id,d=Z(),e.next=11,i();case 11:if(h=e.sent,Qe||(Qe=!0,(p=E(Pe))&&(Re(h,p),k(Pe))),v=Ke(h),g=Je(n),m={AppVersion:g,Locale:Ce.language,Make:Ce.make,Model:Ce.model,ModelVersion:Ce.version,Platform:Ce.os.name||Ce.platform},Ce.os&&Ce.os.version&&(m.PlatformVersion=Ce.os.version),w={Attributes:{},Demographic:m,Location:{},Metrics:{}},Ce.device&&Ce.device.vendor&&(w.Attributes.DeviceMake=[Ce.device.vendor]),Ce.device&&Ce.device.model&&(w.Attributes.DeviceModel=[Ce.device.model]),Ce.device&&Ce.device.type&&(w.Attributes.DeviceType=[Ce.device.type]),!(t=y.all([v,w,t],{arrayMerge:Ze})).User||!t.User.UserId){e.next=27;break}return e.next=25,r();case 25:b=e.sent,t.User.UserId!==b&&(t.User.UserId=b);case 27:if(t.User&&t.User.UserId){e.next=32;break}return e.next=30,r();case 30:(S=e.sent)&&(t.User=t.User||{},t.User.UserId=S);case 32:if(!t.User||!t.User.UserAttributes){e.next=36;break}return e.next=35,st(t.User.UserAttributes,!0);case 35:t.User.UserAttributes=e.sent;case 36:return e.next=38,st(t.Attributes,!0);case 38:return t.Attributes=e.sent,e.next=41,ut(t.Metrics);case 41:if(t.Metrics=e.sent,t.Metrics[c]||(t.Metrics[c]=1),t.Metrics[u]||(t.Metrics[u]=1),o&&(t=o(h,t)),x=t.Attributes.lastSession){e.next=51;break}return t.Attributes.lastSessionDate=[d.createdAt],t.Attributes.lastSession=[d.id],t.Attributes.lastPageSession=[f],e.abrupt("return",Re(h,t));case 51:return x&&x[0]!==d.id&&(t.Attributes.lastSessionDate=[d.createdAt],t.Attributes.lastSession=[d.id],t.Metrics[c]+=1),t.Attributes.lastPageSession[0]!==f&&(t.Attributes.lastPageSession=[f],t.Metrics[u]+=1),e.abrupt("return",Re(h,t));case 54:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ze(e,t){return t}function et(e){var t=e.getContext;return"function"==typeof t?t():t}function tt(e,t){return nt.apply(this,arguments)}function nt(){return(nt=c(s.mark(function e(t,n){return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function rt(e){if(null!=e)return Array.isArray(e)?e.filter(it).map(function(e){return e.toString()}):ot(e)?e:e.toString()}function it(e){return null!=e}function ot(e){return null==e}function st(e){return at.apply(this,arguments)}function at(){return(at=c(s.mark(function e(t){var n,r,i,o,a,c,u=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]&&u[1],r={},e.t0=s.keys(t);case 3:if((e.t1=e.t0()).done){e.next=13;break}return i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],a=n?o:o[0],e.next=9,tt(a,rt);case 9:ot(c=e.sent)||(r[i]=c),e.next=3;break;case 13:return e.abrupt("return",r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ct(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))}function ut(e){return lt.apply(this,arguments)}function lt(){return(lt=c(s.mark(function e(t){var n,r;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=s.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,tt(t[r],ct);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}var ft=[["add","attach"],["remove","detach"]];function dt(e){var t=e?ft:ft.reverse(),n=t[1],r=t[0][0]+"EventListener";return function(t,i,o,s){if("undefined"==typeof window)return function(){};var a,c=s||!1,u=(i=(ht(i)?i.split(" "):i).map(function(e){return e.trim()}),ht(t)?Array.from(document.querySelectorAll(t)):[t]);if(!u.length)throw new Error("noElements");if(!i.length)throw new Error("noEvent");return u[0][r]?(a=vt(function(){return u.map(function(e){var t=pt(o,c);return i.forEach(function(n){return e[r](n,t,c)}),t})}),function(){return u.forEach(function(e,t){return i.forEach(function(r){e[n[0]+"EventListener"](r,a.listeners[t],c)})}),a.fn}):(a=vt(function(){return u.map(function(t){i.forEach(function(n){return t["on"+n]=e?pt(o,c):null})})}),function(){return u.forEach(function(t){i.forEach(function(n){return t["on"+n]=e?null:pt(o,c)})}),a.fn})}}function ht(e){return"string"==typeof e}function pt(e,t){return t&&t.once?(n=e,function(){return n&&(r=n.apply(this,arguments),n=null),r}):e;var n,r}function vt(e){var t=e();return{fn:e,listeners:t}}var gt=dt(!0),yt=(dt(),"undefined"==typeof window),mt="hidden";function wt(e){if(yt)return!1;var t=yt||mt in document?mt:["webkit","moz","ms","o"].reduce(function(e,t){var n=t+"Hidden";return!e&&n in document?n:e},null),n="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return e(Boolean(document[t]))},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}var bt=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function St(e){var t,n,r=e.onIdle,i=e.onWakeUp,o=e.onHeartbeat,s=e.timeout,a=void 0===s?1e4:s,c=e.throttle,u=void 0===c?2e3:c,l=!1,f=!1,d=new Date,h=function(){return clearTimeout(t)};function p(e){h(),o&&!l&&o(xt(d),e),i&&l&&(l=!1,i(xt(n),e),d=new Date),t=setTimeout(function(){l=!0,r&&(n=new Date,r(xt(d),e))},a)}var v=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=this,r=!1;return function(i){r||(e.call(n,i),r=!0,setTimeout(function(){return r=!1},t))}}(e,t.throttle||1e4),r=[];function i(){var e=wt(function(e){e||n({type:"tabVisible"})});return r=[e].concat(bt.map(function(e){return gt(document,e,n)})).concat(gt(window,"load",n)).concat(gt(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(e){return e()})}return i(),function(){return o(),i}}(p,{throttle:u});return{disable:function(){f=!0,l=!1,h();var e=v();return function(){return f=!1,d=new Date,p({type:"load"}),e()}},getStatus:function(){return{isIdle:l,isDisabled:f,active:l?0:xt(d,f),idle:l?xt(n,f):0}}}}function xt(e,t){return t?0:Math.round((new Date-e)/1e3)}var At={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}};function Et(){throw new Error("Pinpoint not loaded")}var kt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!1;return{name:"aws-pinpoint",config:r({},At,{},n),bootstrap:function(e){var t=e.config,n=e.instance;t.disableAnonymousTraffic&&!n.user("userId")&&n.once("identifyStart",function(e){e.plugins["aws-pinpoint"].loaded()||n.loadPlugin("aws-pinpoint")})},initialize:function(i){var o=i.config,s=i.instance,a=o.disableAnonymousTraffic,c=o.debug?console.log:function(){},u=s.getState(),l=u.user||{},f=l.userId,d=l.anonymousId,h=u.context||{},p=h.app,v=h.version,g=h.campaign,y=ie(),m=ne(),w=Z();if(c("initPageSession",y),c("initTabSession",m),c("initSessionData",w),w&&w.anonId&&w.anonId!==d){c("anonId different refresh session details"),oe(),re();var b=ee(30,{anonId:d,userId:f});c("newSessionForNewUser",b)}if(!f&&a)return!1;var S=Object.keys(g).reduce(function(e,t){return e["utm_".concat(t)]=g[t],e},{}),x=He(r({},o,{appTitle:o.appTitle||p,appPackageName:o.appPackageName||p,appVersionCode:o.appVersionCode||v,eventMapping:o.eventMapping,getEndpointId:function(){return s.user("anonymousId")},getUserId:function(){return s.user("userId")},getContext:function(){return{sessionKey:o.sessionKey,pageViewKey:o.pageViewKey,initialSession:w}},enrichEventAttributes:function(){return r({anonId:s.user("anonymousId"),userId:s.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},S)},enrichUserAttributes:o.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));e=x.recordEvent,t=x.updateEndpoint,w&&w.isNew&&(c("Start brand new session because cookie not found"),e(Ee)),St({timeout:18e5,throttle:2e4,onIdle:function(t,r){var i;c("Session idle. Active ".concat(t," seconds")),i=Z(),n.debug&&console.log("Stop session",i),e(ke,!0)},onWakeUp:function(t,r){var i;c("Session wakeup. Idle ".concat(t," seconds")),i=ee(30),n.debug&&console.log("START SESSION",i),e(Ee)},onHeartbeat:function(e,t){c("ping session",new Date),c("total active time",e);var n=s.user();te(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(t){if(t.payload,t.config,!e)return Et();i&&oe(),e(Ie),i=!0},track:function(t){var n=t.payload,r=t.config;if(t.instance,!e)return Et();if(!r.disableAnonymousTraffic||n.userId){var i,o=(i=n.properties,Object.keys(i).reduce(function(e,t){var n=i[t];return"number"==typeof n&&(e.metrics[t]=n),"string"!=typeof n&&"boolean"!=typeof n||(e.attributes[t]=n),e},{attributes:{},metrics:{}}));e(n.event,o)}},identify:function(e){var n=e.payload,r=n.userId,i=n.traits;if(!t)return Et();var o={},s={};r&&(s.UserId=r),i&&Object.keys(i).length&&(s.UserAttributes=i),i.email&&(o.Address=i.email,o.ChannelType=Ae.EMAIL),Object.keys(s).length&&(o.User=s),t(o,!0)},reset:function(e){var t=ze(e.instance.user("anonymousId"));storage.removeItem(t)},loaded:function(){return!!e}}};return e.default=kt,e.PINPOINT_EVENTS=Oe,e.formatEvent=We,e}({}); | ||
var analyticsAWSPinpoint=function(e){"use strict";var t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var r=function(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach(function(n){t(e,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e};function i(e,t){return e(t={exports:{}},t.exports),t.exports}var o=i(function(e){function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t}),s=i(function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new O(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw o;return j()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=E(s,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=u(e,t,n);if("normal"===c.type){if(r=n.done?h:f,c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l="suspendedStart",f="suspendedYield",d="executing",h="completed",p={};function v(){}function g(){}function y(){}var m={};m[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(T([])));b&&b!==n&&r.call(b,o)&&(m=b);var S=y.prototype=v.prototype=Object.create(m);function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function A(e,t){var n;this._invoke=function(i,o){function s(){return new t(function(n,s){!function n(i,o,s,a){var c=u(e[i],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,s,a)},function(e){n("throw",e,s,a)}):t.resolve(f).then(function(e){l.value=e,s(l)},function(e){return n("throw",e,s,a)})}a(c.arg)}(i,o,n,s)})}return n=n?n.then(s,s):s()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=u(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:j}}function j(){return{value:t,done:!0}}return g.prototype=S.constructor=y,y.constructor=g,y[a]=g.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},x(A.prototype),A.prototype[s]=function(){return this},e.AsyncIterator=A,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new A(c(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},x(S),S[a]="Generator",S[o]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function a(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}var c=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,c,"next",e)}function c(e){a(o,r,i,s,c,"throw",e)}s(void 0)})}},u=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===l}(e)}(e)};var l="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function f(e,t){return!1!==t.clone&&t.isMergeableObject(e)?g((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function d(e,t,n){return e.concat(t).map(function(e){return f(e,n)})}function h(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}(e))}function p(e,t){try{return t in e}catch(e){return!1}}function v(e,t,n){var r={};return n.isMergeableObject(e)&&h(e).forEach(function(t){r[t]=f(e[t],n)}),h(t).forEach(function(i){(function(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return"function"==typeof n?n:g}(i,n)(e[i],t[i],n):r[i]=f(t[i],n))}),r}function g(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||d,n.isMergeableObject=n.isMergeableObject||u,n.cloneUnlessOtherwiseSpecified=f;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):v(e,t,n):f(t,n)}g.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return g(e,n,t)},{})};var y=g,m="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0;function w(e){return m[e]}function b(e,t){return m[e]=t,t}var S="undefined",x=A();function A(e){if(void 0===e&&(e=!1),typeof x!==S&&!e)return x;x=!0;try{typeof localStorage!==S&&typeof JSON!==S||(x=!1),localStorage.setItem("_"+S,"1"),localStorage.removeItem("_"+S)}catch(e){x=!1}return x}function E(e){return x?localStorage.getItem(e):w(e)}function k(e){return x?localStorage.removeItem(e):void b(e,void 0)}var I="undefined",O=_(),T=P,j=P;function _(e){if(void 0===e&&(e=!1),typeof O!==I&&!e)return O;try{var t="_"+I;P(t,"1"),O=-1!==document.cookie.indexOf(t),P(t,"",-1)}catch(e){O=!1}return O}function P(e,t,n,r,i,o){if(typeof window!==I){var s=arguments.length>1;return O||(s?b(e,t):w(e)),s?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}A(),_();var M="undefined"!=typeof document;function N(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}const U=new TextEncoder,C={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},L=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"];class D{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:s,initRetryMs:a}){if(null==e)throw new TypeError("accessKeyId is a required option");if(null==t)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=null!=s?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){const{method:n,url:r,headers:i,body:o}=e;null==(t=Object.assign({method:n,url:r,headers:i},t)).body&&i.has("Content-Type")&&(t.body=null!=o&&i.has("X-Amz-Content-Sha256")?o:await e.clone().arrayBuffer()),e=r}const n=new H(Object.assign({url:e},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());return delete r.aws,new Request(r.url.toString(),r)}async fetch(e,t){for(let n=0;n<=this.retries;n++){const r=fetch(await this.sign(e,t));if(n===this.retries)return r;const i=await r;if(i.status<500&&429!==i.status)return i;await new Promise(e=>setTimeout(e,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw new Error("An unknown error occurred, ensure retries is not negative")}}class H{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:s,service:a,region:c,cache:u,datetime:l,signQuery:f,appendSessionToken:d,allHeaders:h,singleEncode:p}){if(null==t)throw new TypeError("url is a required option");if(null==i)throw new TypeError("accessKeyId is a required option");if(null==o)throw new TypeError("secretAccessKey is a required option");let v,g;this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=s,a&&c||([v,g]=function(e,t){const{hostname:n,pathname:r}=e,i=n.replace("dualstack.","").match(/([^.]+)\.(?:([^.]*)\.)?amazonaws\.com(?:\.cn)?$/);let[o,s]=(i||["",""]).slice(1,3);if("us-gov"===s)s="us-gov-west-1";else if("s3"===s||"s3-accelerate"===s)s="us-east-1",o="s3";else if("iot"===o)o=n.startsWith("iot.")?"execute-api":n.startsWith("data.jobs.iot.")?"iot-jobs-data":"/mqtt"===r?"iotdevicegateway":"iotdata";else if("autoscaling"===o){const e=(t.get("X-Amz-Target")||"").split(".")[0];"AnyScaleFrontendService"===e?o="application-autoscaling":"AnyScaleScalingPlannerFrontendService"===e&&(o="autoscaling-plans")}else null==s&&o.startsWith("s3-")?(s=o.slice(3).replace(/^fips-|^external-1/,""),o="s3"):o.endsWith("-fips")?o=o.slice(0,-5):s&&/-\d$/.test(o)&&!/-\d$/.test(s)&&([o,s]=[s,o]);return[C[o]||o,s]}(this.url,this.headers)),this.service=a||v||"",this.region=c||g||"us-east-1",this.cache=u||new Map,this.datetime=l||(new Date).toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=f,this.appendSessionToken=d||"iotdevicegateway"===this.service,this.headers.delete("Host");const y=this.signQuery?this.url.searchParams:this.headers;if("s3"!==this.service||this.headers.has("X-Amz-Content-Sha256")||this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD"),y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(e=>h||!L.includes(e)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(e=>e+":"+("host"===e?this.url.host:(this.headers.get(e)||"").replace(/\s+/g," "))).join("\n"),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&("s3"!==this.service||y.has("X-Amz-Expires")||y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),"s3"===this.service)try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(e){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");p||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=V(this.encodedPath);const m=new Set;this.encodedSearch=[...this.url.searchParams].filter(([e])=>{if(!e)return!1;if("s3"===this.service){if(m.has(e))return!1;m.add(e)}return!0}).map(e=>e.map(e=>V(encodeURIComponent(e)))).sort(([e,t],[n,r])=>e<n?-1:e>n?1:t<r?-1:t>r?1:0).map(e=>e.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join();let n=this.cache.get(t);if(!n){const r=await z("AWS4"+this.secretAccessKey,e),i=await z(r,this.region),o=await z(i,this.service);n=await z(o,"aws4_request"),this.cache.set(t,n)}return R(await z(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,R(await K(await this.canonicalString()))].join("\n")}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+"\n",this.signedHeaders,await this.hexBodyHash()].join("\n")}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256");if(null==e){if(this.body&&"string"!=typeof this.body&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=R(await K(this.body||""))}return e}}async function z(e,t){const n=await crypto.subtle.importKey("raw","string"==typeof e?U.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,U.encode(t))}async function K(e){return crypto.subtle.digest("SHA-256","string"==typeof e?U.encode(e):e)}function R(e){return Array.prototype.map.call(new Uint8Array(e),e=>("0"+e.toString(16)).slice(-2)).join("")}function V(e){return e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}var q=["id","createdAt","created"],W=function(){if(M)try{return sessionStorage.setItem("__","__"),sessionStorage.removeItem("__"),!0}catch(e){}return!1}();function X(e,t){return W?(sessionStorage.setItem(e,t),t):F(e,t)}function F(e,t){return m[e]=t,t}function B(e){return m[e]}var G={session:[function(e,t){var n=W?sessionStorage.getItem(e):B(e);return null==n&&t&&(n=X(e,t)),n},X],page:[B,F]};function J(e){var t=e?new Date(e):new Date;return[t.toISOString(),t.getTime()]}function Q(){var e=J(),t=e[0],n=e[1];return{id:N(),created:n,createdAt:t}}function Y(e,t){var n=Q(),r=G[e],i=r[0],o=r[1],s=!1;return $(Object.fromEntries(q.map(function(r){var a="__"+e+"__session__"+r,c=i(a);s=t||!c;var u=c&&!t?c:o(a,n[r]);return[r,"created"!==r?u:Number(u)]})),s)}function $(e,t){var n=Date.now();return e.elapsed=n-e.created,e.expires&&(e.remaining=Math.abs(e.expires-n)),e.isNew=t,e}function Z(e,t){void 0===e&&(e=30);var n=T("__session"),r=n?JSON.parse(n):ee(e);return t?r:$(r,!n)}function ee(e,t,n){void 0===e&&(e=30);var r=n?Z(e,!0):Q(),i=60*e,o=r.created;if(n){var s=J(),a=s[0],c=s[1];r.modified=c,r.modifiedAt=a,o=c}var u=J(o+1e3*i),l=u[0];return r.expires=u[1],r.expiresAt=l,t&&(r=Object.assign(r,t)),j("__session",JSON.stringify(r),i),$(r,!n)}var te=function(e,t){return void 0===e&&(e=30),ee(e||1,t,!0)},ne=Y.bind(null,"session"),re=Y.bind(null,"session",!0),ie=Y.bind(null,"page"),oe=Y.bind(null,"page",!0),se=function(){};var ae="object",ce="string",ue="?",le="name",fe="version",de="",he="function",pe="undefined",ve={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ge=[[/microsoft (windows) (vista|xp)/i],[le,fe],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[le,[fe,ye,ve]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[le,"Windows"],[fe,ye,ve]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[fe,/_/g,"."],[le,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[le,"MacOS"],[fe,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[fe,le],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[le,fe],[/\(bb(10);/i],[fe,[le,"BlackBerry"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[fe,[le,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[fe,[le,"webOS"]],[/crkey\/([\d\.]+)/i],[fe,[le,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[le,"Chromium OS"],fe],[/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/(unix) ?([\w\.]*)/i],[le,fe]];function ye(e,t){for(var n in t)if(o(t[n])===ae&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(me(t[n][r],e))return n===ue?void 0:n}else if(me(t[n],e))return n===ue?void 0:n;return e}function me(e,t){return o(e)===ce&&-1!==we(t).indexOf(we(e))}function we(e){return e.toLowerCase()}function be(e){var t=e||(("undefined"==typeof window?"undefined":o(window))!==pe&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:de),n={};return n[le]=void 0,n[fe]=void 0,function(e,t){for(var n,r,i,s,a,c,u=0;u<t.length&&!a;){var l=t[u],f=t[u+1];for(n=r=0;n<l.length&&!a;)if(a=l[n++].exec(e))for(i=0;i<f.length;i++)c=a[++r],s=f[i],o(s)===ae&&s.length>0?2==s.length?o(s[1])==he?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3==s.length?o(s[1])!==he||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:4==s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;u+=2}}.call(n,t,ge),n}var Se="Brave";function xe(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})[e]||e}var Ae=["PUSH","GCM","APNS","APNS_SANDBOX","APNS_VOIP","APNS_VOIP_SANDBOX","ADM","SMS","VOICE","EMAIL","BAIDU","CUSTOM"].reduce(function(e,t){return e[t]=t,e},{}),Ee="_session.start",ke="_session.stop",Ie="pageView",Oe=Object.freeze({SESSION_START:Ee,SESSION_STOP:ke,SESSION_PAUSE:"_session.pause",SESSION_RESUME:"_session.resume",AUTH_SIGN_IN:"_userauth.sign_in",AUTH_SIGN_UP:"_userauth.sign_up",AUTH_FAIL:"_userauth.auth_fail",ECOM_PURCHASE:"_monetization.purchase",PAGE_VIEW:Ie}),Te="undefined"!=typeof window,je=Ee,_e=ke,Pe=("undefined"!=typeof navigator&&navigator&&navigator.sendBeacon,"__endpoint"),Me=[429,500],Ne=[202],Ue=400,Ce=function(){if("undefined"==typeof window)return{};if(!window.navigator)return{};var e,t,n,r,i,o=window.navigator,s=o.platform,a=o.product,c=o.vendor,u=(o.userAgent,function(e){var t=e.userAgent,n=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(t);if(n)return{type:n[1],version:n[2]};var r=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(t);if(r)return{type:r[1],version:r[2]};var i=/(headlesschrome)(?:\/([\w\.]+)| )/i.exec(t);if(i)return{type:i[1],version:i[2]};var o=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(t);if(o){var s=e.brave&&e.brave.isBrave||!1;return{type:s?Se:o[1],version:o[2]}}var a=/.+(Safari)\/([0-9\.]+).*/i.exec(t);if(a)return{type:a[1],version:a[2]};var c=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(t);if(c)return{type:c[1],version:c[2]};var u=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(t)||["","NA","0.0.0"];return{type:u[1],version:u[2]}}(window.navigator)),l=u.type,f=u.version,d=l===Se?l:(c||"").split(" ")[0];return{platform:s,os:be(),make:d||a,model:l,version:f,name:[l,f].join("/"),language:(t=window.navigator,n=t.language,r=t.browserLanguage,i=t.languages,(n||r||(i||["en_US"])[0]).toLowerCase().replace("-","_")),timezone:(e=/\(([A-Za-z\s].*)\)/.exec((new Date).toString()),e&&e[1]||"")}}();function Le(){return{}}var De=/.+\@.+\..+/;function He(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r({getContext:e.getContext||Le,credentials:e.credentials||{},getEndpointId:e.getEndpointId},e),n=t.debug?console.log:function(){},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getEndpointId,n=e.debug;return function(){var r=c(s.mark(function r(){var i,a,c,u,l,f,d,h,p,v=arguments;return s.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return i=v.length>0&&void 0!==v[0]?v[0]:[],a=v.length>1&&void 0!==v[1]?v[1]:{},r.next=4,t();case 4:if(c=r.sent){r.next=8;break}return console.error("No endpoint id. check getEndpointId()"),r.abrupt("return");case 8:if("object"===o(a)&&Object.keys(a).length){r.next=13;break}r.t0=Ke(c),r.next=16;break;case 13:return r.next=15,Ye(a,e);case 15:r.t0=r.sent;case 16:return u=r.t0,l=u.ChannelType,u.Address&&(s=u.Address,De.test(s))&&(l=Ae.EMAIL),!l&&u.Address&&(l="android"===Ce.platform?l||Ae.GCM:l||Ae.APNS),n&&(console.log("Endpoint",u),l&&console.log("CHANNEL_TYPE",l)),u.RequestId=N(),u.ChannelType=l,u.Address&&(u.OptOut=u.OptOut||"NONE"),f=Ve(i),d=qe(c,u,f),r.prev=26,r.next=29,Fe(d,e);case 29:h=r.sent,r.next=36;break;case 32:r.prev=32,r.t1=r.catch(26),console.log("Error calling AWS",r.t1),p=r.t1;case 36:return r.abrupt("return",{endpoint:u,response:h,error:p,events:i});case 37:case"end":return r.stop()}var s},r,null,[[26,32]])}));return function(){return r.apply(this,arguments)}}()}(t),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var n=c(s.mark(function n(r){var i,o,a,c,u=arguments;return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return i=u.length>1&&void 0!==u[1]?u[1]:{},o=u.length>2&&void 0!==u[2]?u[2]:{},a=u.length>3&&void 0!==u[3]&&u[3],"boolean"==typeof i&&(a=i={}),"boolean"==typeof o&&(a=o={}),n.next=7,We(r,i,t);case 7:if(c=n.sent,!Object.entries(o).length&&r!==Ie){n.next=12;break}return n.next=11,Ye(o,t);case 11:o=n.sent;case 12:if(e.push(c),!a){n.next=17;break}return n.abrupt("return",e.flush());case 17:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}()}(function(e,t){var n,r,i,o=(t=t||{}).initial||[],s=t.max||1/0,a=t.interval||1e4,c=t.onEmpty||se,u=t.onPause||se;function l(t){clearInterval(n);var r=o.splice(0,s);return r.length&&e(r,o),o.length?t?l():f():(i=!1,c(o))}function f(){i=!0,n=setInterval(l,a)}return o.length&&f(),{flush:function(e){l(e)},resume:l,push:function(e){return(r=o.push(e))>=s&&!t.throttle&&l(),i||f(),r},size:function(){return o.length},pause:function(e){e&&l(),clearInterval(n),i=!1,u(o)}}}(function(){var e=c(s.mark(function e(t,r){var o;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach(function(e){return n(">>>>> PROCESS queue",e)}),e.next=3,i(t,{});case 3:o=e.sent,n(">>>>> PROCESS queue response",o);case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),{max:10,interval:3e3,throttle:!0}),t);Ye({},e);var u=function(e){if(!Te)return Le;var t=function(e){return function(){e(_e,!0)}}(e);return window.addEventListener("beforeunload",t),function(){return window.removeEventListener("beforeunload",t)}}(a);return{updateEndpoint:function(e){return i([],e)},recordEvent:a,disable:function(){u()}}}function ze(e){return"".concat(Pe,".").concat(e)}function Ke(e){try{return JSON.parse(E(ze(e)))||{}}catch(e){}return{}}function Re(e,t){var n,r,i=ze(e),o="string"==typeof t?t:JSON.stringify(t);return n=i,r=o,x?localStorage.setItem(n,r):b(n,r),t}function Ve(e){return e.sort(function(e,t){var n=e.EventType,r=t.EventType;return n==je?-1:r==je?1:n==_e?1:r==_e?-1:void 0}).reduce(function(e,t){return r({},t,{},e)},{})}function qe(e,n,r){return{BatchItem:t({},e,{Endpoint:n,Events:r})}}function We(e){return Xe.apply(this,arguments)}function Xe(){return(Xe=c(s.mark(function e(n){var i,o,a,c,u,l,f,d,h,p,v,g,y,m,w,b,S,x,A,E,k,I,O,T,j,_,P,M,U,C,L,D=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=D.length>1&&void 0!==D[1]?D[1]:{},o=D.length>2&&void 0!==D[2]?D[2]:{},a=o.appTitle,c=o.appPackageName,u=o.appVersionCode,l=o.eventMapping,f=o.enrichEventAttributes,d=o.enrichEventMetrics,h=o.debug,p=h?console.log:function(){},v=xe(n,l),g=ie(),y=ne(),m=Te?Z():{},w=i.sessionId||m.id,b=i.sessionStart||m.createdAt,S=i.sessionStart?new Date(i.sessionStart).getTime():m.created,p("event pageSessionInfo",JSON.stringify(g)),p("event tabSessionData ",JSON.stringify(y)),p("event sessionData ",JSON.stringify(m)),x=i.attributes||{},A=i.eventId||N(),E=i.time?new Date(i.time):new Date,k=E.toISOString(),I=E.getTime()-S,O=r({date:k,sessionId:w},Te?{pageSession:g.id}:{}),!f){e.next=26;break}return e.next=23,f();case 23:e.t0=e.sent,e.next=27;break;case 26:e.t0={};case 27:if(T=e.t0,j=r({},O,{},T,{},x),_=i.metrics||{},P={sessionTime:m.elapsed||I,hour:E.getHours(),day:E.getDay()+1,month:E.getMonth()+1,year:E.getFullYear()},!d){e.next=37;break}return e.next=34,d();case 34:e.t1=e.sent,e.next=38;break;case 37:e.t1={};case 38:return M=e.t1,U=r({},P,{},M,{},_),e.next=42,st(j);case 42:return e.t2=e.sent,e.next=45,ut(U);case 45:return e.t3=e.sent,C={attributes:e.t2,metrics:e.t3},p("".concat(A,":").concat(v)),p("eventAttributes",C.attributes),p("eventMetrics",C.metrics),p("clientInfo",Ce),Je(o),L=t({},A,{EventType:v,Timestamp:k,AppPackageName:c,AppTitle:a,AppVersionCode:u,Attributes:C.attributes,Metrics:C.metrics,Session:{Id:w,StartTimestamp:b}}),n===ke&&(L[A].Session.Duration=I,L[A].Session.StopTimestamp=k),e.abrupt("return",L);case 55:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Fe(e,t){return Be.apply(this,arguments)}function Be(){return(Be=c(s.mark(function e(t,n){var r,i,o,a,c,u,l,f,d,h,p,v,g,y,m,w,b;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.pinpointRegion,i=n.pinpointAppId,o=n.lambdaArn,a=n.lambdaRegion,c=n.credentials,u=n.getCredentials,n.debug,l=c,Object.keys(l).length||!u){e.next=12;break}return e.prev=3,e.next=6,u();case 6:l=e.sent,e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(3),new Error(e.t0);case 12:return f={accessKeyId:l.accessKeyId||l.AccessKeyId,secretAccessKey:l.secretAccessKey||l.SecretKey,sessionToken:l.sessionToken||l.SessionToken,retries:5},d=new D(f),h=a||r,p=r||a,v=!0===n.fips?"-fips":"",g="https://lambda.".concat(h,".amazonaws.com/2015-03-31/functions/").concat(o,"/invocations"),y="https://pinpoint".concat(v,".").concat(p,".amazonaws.com/v1/apps/").concat(i,"/events"),m=o?g:y,w={body:JSON.stringify(t)},e.next=23,d.fetch(m,w).then(function(e){return e.json()});case 23:return(b=e.sent)&&b.Results&&Object.keys(b.Results).map(function(e){return b.Results[e]}).forEach(function(e){var t=e.EndpointItemResponse||{},n=e.EventsItemResponse||{};Object.keys(t).length&&(Ne.includes(t.StatusCode)||Me.includes(t.StatusCode)||Ge(t,Endpoint));var r=Object.keys(n);r.length&&r.forEach(function(e){})}),e.abrupt("return",b);case 26:case"end":return e.stop()}},e,null,[[3,9]])}))).apply(this,arguments)}function Ge(e,t){var n=e.StatusCode,r=e.Message;if(n===Ue){if(r.startsWith("Missing ChannelType"))throw new Error("Missing ChannelType");if(r.startsWith("Exceeded maximum endpoint per user count"))throw new Error("Exceeded maximum endpoint per user count")}}function Je(e){var t=e.appTitle||e.appPackageName||"",n=e.appVersionCode||"0.0.0";return t?"".concat(t,"@").concat(n):n}var Qe=!1;function Ye(){return $e.apply(this,arguments)}function $e(){return($e=c(s.mark(function e(){var t,n,r,i,o,a,c,u,l,f,d,h,p,v,g,m,w,b,S,x,A=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=A.length>0&&void 0!==A[0]?A[0]:{},n=A.length>1&&void 0!==A[1]?A[1]:{},r=n.getUserId,i=n.getEndpointId,n.enrichUserAttributes,o=n.endpointMigration,a=et(n),c=a.sessionKey?a.sessionKey():"sessions",u=a.pageViewKey?a.pageViewKey():"pageViews",l=ie(),f=l.id,d=Z(),e.next=11,i();case 11:if(h=e.sent,Qe||(Qe=!0,(p=E(Pe))&&(Re(h,p),k(Pe))),v=Ke(h),g=Je(n),m={AppVersion:g,Locale:Ce.language,Make:Ce.make,Model:Ce.model,ModelVersion:Ce.version,Platform:Ce.os.name||Ce.platform},Ce.os&&Ce.os.version&&(m.PlatformVersion=Ce.os.version),w={Attributes:{},Demographic:m,Location:{},Metrics:{}},Ce.device&&Ce.device.vendor&&(w.Attributes.DeviceMake=[Ce.device.vendor]),Ce.device&&Ce.device.model&&(w.Attributes.DeviceModel=[Ce.device.model]),Ce.device&&Ce.device.type&&(w.Attributes.DeviceType=[Ce.device.type]),!(t=y.all([v,w,t],{arrayMerge:Ze})).User||!t.User.UserId){e.next=27;break}return e.next=25,r();case 25:b=e.sent,t.User.UserId!==b&&(t.User.UserId=b);case 27:if(t.User&&t.User.UserId){e.next=32;break}return e.next=30,r();case 30:(S=e.sent)&&(t.User=t.User||{},t.User.UserId=S);case 32:if(!t.User||!t.User.UserAttributes){e.next=36;break}return e.next=35,st(t.User.UserAttributes,!0);case 35:t.User.UserAttributes=e.sent;case 36:return e.next=38,st(t.Attributes,!0);case 38:return t.Attributes=e.sent,e.next=41,ut(t.Metrics);case 41:if(t.Metrics=e.sent,t.Metrics[c]||(t.Metrics[c]=1),t.Metrics[u]||(t.Metrics[u]=1),o&&(t=o(h,t)),x=t.Attributes.lastSession){e.next=51;break}return t.Attributes.lastSessionDate=[d.createdAt],t.Attributes.lastSession=[d.id],t.Attributes.lastPageSession=[f],e.abrupt("return",Re(h,t));case 51:return x&&x[0]!==d.id&&(t.Attributes.lastSessionDate=[d.createdAt],t.Attributes.lastSession=[d.id],t.Metrics[c]+=1),t.Attributes.lastPageSession[0]!==f&&(t.Attributes.lastPageSession=[f],t.Metrics[u]+=1),e.abrupt("return",Re(h,t));case 54:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ze(e,t){return t}function et(e){var t=e.getContext;return"function"==typeof t?t():t}function tt(e,t){return nt.apply(this,arguments)}function nt(){return(nt=c(s.mark(function e(t,n){return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function rt(e){if(null!=e)return Array.isArray(e)?e.filter(it).map(function(e){return e.toString()}):ot(e)?e:e.toString()}function it(e){return null!=e}function ot(e){return null==e}function st(e){return at.apply(this,arguments)}function at(){return(at=c(s.mark(function e(t){var n,r,i,o,a,c,u=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]&&u[1],r={},e.t0=s.keys(t);case 3:if((e.t1=e.t0()).done){e.next=13;break}return i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],a=n?o:o[0],e.next=9,tt(a,rt);case 9:ot(c=e.sent)||(r[i]=c),e.next=3;break;case 13:return e.abrupt("return",r);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ct(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))}function ut(e){return lt.apply(this,arguments)}function lt(){return(lt=c(s.mark(function e(t){var n,r;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=s.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,tt(t[r],ct);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}var ft=[["add","attach"],["remove","detach"]],dt=function(){};function ht(e){var t=e?ft:ft.reverse(),n=t[1],r=t[0][0]+"EventListener";return function(t,i,o,s){var a=o||dt;if("undefined"==typeof window)return a;var c,u=s||!1,l=pt(i),f=pt(vt(t)?document.querySelectorAll(t):t);if(!f.length)throw new Error("noElements");if(!l.length)throw new Error("noEvent");return f[0][r]?(c=yt(function(){return f.map(function(e){var t=gt(a,u);return l.forEach(function(n){return e[r](n,t,u)}),t})}),function(){return f.forEach(function(e,t){return l.forEach(function(r){e[n[0]+"EventListener"](r,c.listeners[t],u)})}),c.fn}):(c=yt(function(){return f.map(function(t){l.forEach(function(n){return t["on"+n]=e?gt(a,u):null})})}),function(){return f.forEach(function(t){l.forEach(function(n){return t["on"+n]=e?null:gt(a,u)})}),c.fn})}}function pt(e){if("[object Array]"===Object.prototype.toString.call(e))return e;if(vt(e))return e.split(" ").map(function(e){return e.trim()});if(NodeList.prototype.isPrototypeOf(e)){for(var t=[],n=e.length>>>0;n--;)t[n]=e[n];return t}return[e]}function vt(e){return"string"==typeof e}function gt(e,t){return t&&t.once?function(e,t){var n;return function(){return e&&(n=e.apply(t||this,arguments),e=null),n}}(e):e}function yt(e){return{fn:e,listeners:e()}}var mt=ht(!0),wt=(ht(),"undefined"==typeof window),bt="hidden";function St(e){if(wt)return!1;var t=wt||bt in document?bt:["webkit","moz","ms","o"].reduce(function(e,t){var n=t+"Hidden";return!e&&n in document?n:e},null),n="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return e(Boolean(document[t]))},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}var xt=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function At(e){var t,n,r=e.onIdle,i=e.onWakeUp,o=e.onHeartbeat,s=e.timeout,a=void 0===s?1e4:s,c=e.throttle,u=void 0===c?2e3:c,l=!1,f=!1,d=new Date,h=function(){return clearTimeout(t)};function p(e){h(),o&&!l&&o(Et(d),e),i&&l&&(l=!1,i(Et(n),e),d=new Date),t=setTimeout(function(){l=!0,r&&(n=new Date,r(Et(d),e))},a)}var v=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=this,r=!1;return function(i){r||(e.call(n,i),r=!0,setTimeout(function(){return r=!1},t))}}(e,t.throttle||1e4),r=[];function i(){var e=St(function(e){e||n({type:"tabVisible"})});return r=[e].concat(xt.map(function(e){return mt(document,e,n)})).concat(mt(window,"load",n)).concat(mt(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(e){return e()})}return i(),function(){return o(),i}}(p,{throttle:u});return{disable:function(){f=!0,l=!1,h();var e=v();return function(){return f=!1,d=new Date,p({type:"load"}),e()}},getStatus:function(){return{isIdle:l,isDisabled:f,active:l?0:Et(d,f),idle:l?Et(n,f):0}}}}function Et(e,t){return t?0:Math.round((new Date-e)/1e3)}var kt={disableAnonymousTraffic:!1,pinpointRegion:"us-east-1",eventMapping:{}};function It(){throw new Error("Pinpoint not loaded")}var Ot=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!1;return{name:"aws-pinpoint",config:r({},kt,{},n),bootstrap:function(e){var t=e.config,n=e.instance;t.disableAnonymousTraffic&&!n.user("userId")&&n.once("identifyStart",function(e){e.plugins["aws-pinpoint"].loaded()||n.loadPlugin("aws-pinpoint")})},initialize:function(i){var o=i.config,s=i.instance,a=o.disableAnonymousTraffic,c=o.debug?console.log:function(){},u=s.getState(),l=u.user||{},f=l.userId,d=l.anonymousId,h=u.context||{},p=h.app,v=h.version,g=h.campaign,y=ie(),m=ne(),w=Z();if(c("initPageSession",y),c("initTabSession",m),c("initSessionData",w),w&&w.anonId&&w.anonId!==d){c("anonId different refresh session details"),oe(),re();var b=ee(30,{anonId:d,userId:f});c("newSessionForNewUser",b)}if(!f&&a)return!1;var S=Object.keys(g).reduce(function(e,t){return e["utm_".concat(t)]=g[t],e},{}),x=He(r({},o,{appTitle:o.appTitle||p,appPackageName:o.appPackageName||p,appVersionCode:o.appVersionCode||v,eventMapping:o.eventMapping,getEndpointId:function(){return s.user("anonymousId")},getUserId:function(){return s.user("userId")},getContext:function(){return{sessionKey:o.sessionKey,pageViewKey:o.pageViewKey,initialSession:w}},enrichEventAttributes:function(){return r({anonId:s.user("anonymousId"),userId:s.user("userId"),hash:window.location.hash,path:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,host:window.location.hostname,url:window.location.origin+window.location.pathname},S)},enrichUserAttributes:o.enrichUserAttributes,enrichEventMetrics:function(){return{}}}));e=x.recordEvent,t=x.updateEndpoint,w&&w.isNew&&(c("Start brand new session because cookie not found"),e(Ee)),At({timeout:18e5,throttle:2e4,onIdle:function(t,r){var i;c("Session idle. Active ".concat(t," seconds")),i=Z(),n.debug&&console.log("Stop session",i),e(ke,!0)},onWakeUp:function(t,r){var i;c("Session wakeup. Idle ".concat(t," seconds")),i=ee(30),n.debug&&console.log("START SESSION",i),e(Ee)},onHeartbeat:function(e,t){c("ping session",new Date),c("total active time",e);var n=s.user();te(30,{anonId:n.anonymousId,userId:n.userId})}})},page:function(t){if(t.payload,t.config,!e)return It();i&&oe(),e(Ie),i=!0},track:function(t){var n=t.payload,r=t.config;if(t.instance,!e)return It();if(!r.disableAnonymousTraffic||n.userId){var i,o=(i=n.properties,Object.keys(i).reduce(function(e,t){var n=i[t];return"number"==typeof n&&(e.metrics[t]=n),"string"!=typeof n&&"boolean"!=typeof n||(e.attributes[t]=n),e},{attributes:{},metrics:{}}));e(n.event,o)}},identify:function(e){var n=e.payload,r=n.userId,i=n.traits;if(!t)return It();var o={},s={};r&&(s.UserId=r),i&&Object.keys(i).length&&(s.UserAttributes=i),i.email&&(o.Address=i.email,o.ChannelType=Ae.EMAIL),Object.keys(s).length&&(o.User=s),t(o,!0)},reset:function(e){var t=ze(e.instance.user("anonymousId"));storage.removeItem(t)},loaded:function(){return!!e}}};return e.default=Ot,e.PINPOINT_EVENTS=Oe,e.formatEvent=We,e}({}); |
{ | ||
"name": "@analytics/aws-pinpoint", | ||
"version": "0.6.12", | ||
"version": "0.6.13", | ||
"description": "AWS Pinpoint integration for 'analytics' module", | ||
@@ -50,8 +50,8 @@ "projectMeta": { | ||
"dependencies": { | ||
"@analytics/activity-utils": "^0.1.1", | ||
"@analytics/localstorage-utils": "^0.1.3", | ||
"@analytics/activity-utils": "^0.1.2", | ||
"@analytics/localstorage-utils": "^0.1.4", | ||
"@analytics/queue-utils": "^0.1.1", | ||
"@analytics/session-utils": "^0.1.4", | ||
"@analytics/session-utils": "^0.1.5", | ||
"analytics-plugin-tab-events": "^0.2.0", | ||
"analytics-utils": "^0.4.6", | ||
"analytics-utils": "^0.4.7", | ||
"aws4fetch": "^1.0.13", | ||
@@ -65,3 +65,3 @@ "deepmerge": "^4.2.2" | ||
}, | ||
"gitHead": "14801b882d61eb259537ec05ba9219991d978ce1" | ||
"gitHead": "285f64dc43c4a332de48785c22a452dc6805f993" | ||
} |
Sorry, the diff of this file is too big to display
468128
10729