1 |
- (()=>{var e,t,r={5802:()=>{},7629:(e,t,r)=>{"use strict";var n;r.d(t,{Z:()=>l});var i=new Uint8Array(16);function o(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,a=function(e){return"string"==typeof e&&s.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));const l=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(r))throw TypeError("Stringified UUID is invalid");return r}(n)}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e].call(o.exports,o,o.exports,i),o.exports}i.m=r,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".ana.min.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="ImpelAna:",i.l=(r,n,o,s)=>{if(e[r])e[r].push(n);else{var a,c;if(void 0!==o)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==r||h.getAttribute("data-webpack")==t+o){a=h;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",t+o),a.src=r),e[r]=[n];var d=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="https://cdn.impel.io/releases/analytics/ImpelAna@0.0.10/",(()=>{var e={179:0};i.f.j=(t,r)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,i)=>n=e[t]=[r,i]));r.push(n[2]=o);var s=i.p+i.u(t),a=new Error;i.l(s,(r=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,n[1](a)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,o,[s,a,c]=r,u=0;if(s.some((t=>0!==e[t]))){for(n in a)i.o(a,n)&&(i.m[n]=a[n]);c&&c(i)}for(t&&t(r);u<s.length;u++)o=s[u],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=self.webpackChunkImpelAna=self.webpackChunkImpelAna||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var o={};(()=>{"use strict";function e(e){var t=new Error(e);return t.source="ulid",t}i.r(o),i.d(o,{SCHEMA_VERSION:()=>J,addWidget:()=>z,configure:()=>W,emit:()=>$,meta:()=>B,subscribe:()=>O});var t="0123456789ABCDEFGHJKMNPQRSTVWXYZ",r=t.length,n=Math.pow(2,48)-1;function s(e){var n=Math.floor(e()*r);return n===r&&(n=r-1),t.charAt(n)}var a,c=(a||(a=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments[1];r||(r="undefined"!=typeof window?window:null);var n=r&&(r.crypto||r.msCrypto);if(n)return function(){var e=new Uint8Array(1);return n.getRandomValues(e),e[0]/255};try{var o=i(5802);return function(){return o.randomBytes(1).readUInt8()/255}}catch(e){}if(t){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch(e){}return function(){return Math.random()}}throw e("secure crypto unusable, insecure Math.random not allowed")}()),function(i){return isNaN(i)&&(i=Date.now()),function(i,o){if(isNaN(i))throw new Error(i+" must be a number");if(i>n)throw e("cannot encode time greater than "+n);if(i<0)throw e("time must be positive");if(!1===Number.isInteger(i))throw e("time must be an integer");for(var s=void 0,a="";o>0;o--)a=t.charAt(s=i%r)+a,i=(i-s)/r;return a}(i,10)+function(e,t){for(var r="";e>0;e--)r=s(t)+r;return r}(16,a)});function u(e){let t=c().toLowerCase();if(null===e||e.length<8)throw new TypeError("Invalid prefix: ${prefix}");return`${e.slice(0,8)}::${t}`}var l=i(7629);const h="SP::SESSIONSTORE",d=Object.freeze({NONE:Symbol("store_in_memory"),LS:Symbol("local_storage"),CK:Symbol("cookie")}),f=new class{constructor(){this.storeType=d.LS;try{localStorage.setItem("sts_test","TEST"),localStorage.removeItem("sts_test")}catch(e){this.storeType=d.CK}}fetchStore(){if(this._store=this._store||null,null===this._store){if(this.storeType===d.LS)this._store=localStorage.getItem(h);else if(this.storeType===d.CK);else if(this.storeType===d.NONE)return void(this._store={});try{this._store=JSON.parse(this._store)}catch(e){this._store={},this.setStore()}}null===this._store&&(this._store={},this.setStore())}setStore(){this.storeType===d.LS?localStorage.setItem(h,JSON.stringify(this._store)):(this.storeType,d.CK)}read(e){return this.fetchStore(),void 0===this._store[e]&&(this._store[e]=null),this._store[e]}write(e,t){return this.fetchStore(),this._store[e]=t,this.setStore(),this._store[e]}};let p,m=function(e=!1){let t=null;return e||(t=f.read("clid")),null===t&&(t=(0,l.Z)(),f.write("clid",t)),t}(),y=u(m);function w(){return p}const v=class{constructor(e,t,r){this.evid=u(m),this.clid=m,this.prid=y,this.ts=(new Date).toISOString(),this.version=J,this.type=e,this.cat=t,this.data=r}static get type(){return{PAGEVIEW:"page",METADATA:"meta",ENGAGEMENT:"engg"}}},g=(new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked"),new Error("request for lock canceled"));var _=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};class b{constructor(e,t=g){if(this._maxConcurrency=e,this._cancelError=t,this._queue=[],this._waiters=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}acquire(){const e=this.isLocked(),t=new Promise(((e,t)=>this._queue.push({resolve:e,reject:t})));return e||this._dispatch(),t}runExclusive(e){return _(this,void 0,void 0,(function*(){const[t,r]=yield this.acquire();try{return yield e(t)}finally{r()}}))}waitForUnlock(){return _(this,void 0,void 0,(function*(){return this.isLocked()?new Promise((e=>this._waiters.push({resolve:e}))):Promise.resolve()}))}isLocked(){return this._value<=0}release(){if(this._maxConcurrency>1)throw new Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){const e=this._currentReleaser;this._currentReleaser=void 0,e()}}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatch(){const e=this._queue.shift();if(!e)return;let t=!1;this._currentReleaser=()=>{t||(t=!0,this._value++,this._resolveWaiters(),this._dispatch())},e.resolve([this._value--,this._currentReleaser])}_resolveWaiters(){this._waiters.forEach((e=>e.resolve())),this._waiters=[]}}const E=["AccessDeniedException","ExpiredTokenException","ServiceUnavailableException","UnrecognizedClientException"];class C{constructor(e,t){this.region=e,this.idPool=t}async fetch(){let e=JSON.parse(f.read("fhcred"));return null!==(t=e)&&new Date(t.expiration)-new Date>6e5?e:await this.refresh();var t}async refresh(){const{CognitoIdentityClient:e,GetIdCommand:t,GetCredentialsForIdentityCommand:r}=await Promise.all([i.e(507),i.e(618)]).then(i.bind(i,2618));let n=f.read("ipid");null!=n&&n===this.idPool||f.write("ipid",this.idPool),this.cognitoIdentityClient=new e({region:this.region});let o=f.read("cognitoid");if(null==o||n!==this.idPool){const e=new t({IdentityPoolId:this.idPool});o=(await this.cognitoIdentityClient.send(e)).IdentityId,f.write("cognitoid",o)}const s=new r({IdentityId:o});let a=await this.cognitoIdentityClient.send(s),c={accessKeyId:a.Credentials.AccessKeyId,expiration:a.Credentials.Expiration,identityId:o,secretAccessKey:a.Credentials.SecretKey,sessionToken:a.Credentials.SessionToken};return f.write("fhcred",JSON.stringify(c)),c}}const S=new class{configure(e){if(this.conf={},"aws"!==e.type||"firehose"!==e.service||"cognito"!==e.auth.type)throw new RuntimeException("cannot configure transmitter");this.conf.stream=e.data[e.dest],this.conf.idPool=e.auth.data[e.auth.key],this.conf.region=e.aws_region,this.cognitoCredentials=new C(this.conf.region,this.conf.idPool),this.retries=0,this.maxRetries=2,this._updateClient()}ready(){return!!this.client}async transmit(e){try{await this._transmit(e),this.retries=0}catch(r){if(!(this.retries<this.maxRetries&&(t=r,400==t.$response.statusCode||E.includes(t.name))))throw Error(r);this.retries++,await this._updateClient(),await this.transmit(e)}var t}async _transmit(e){const t=new TextEncoder,{PutRecordBatchCommand:r}=await Promise.all([i.e(507),i.e(603)]).then(i.bind(i,8603)),n=new r({DeliveryStreamName:this.conf.stream,Records:[{Data:t.encode(JSON.stringify(e))}]});await this.client.send(n)}async _updateClient(){let e;e=this.retries===this.maxRetries?await this.cognitoCredentials.refresh():await this.cognitoCredentials.fetch();const{FirehoseClient:t}=await Promise.all([i.e(507),i.e(603)]).then(i.bind(i,8603));this.client=new t({credentials:e,region:this.conf.region})}},x=new class{configure(e){if(this.configured=!0,this.eventHandlers={},this.eventCategory={click:!1,drag:!1},"ana"===e)this.eventCategory.click=!0,this.eventCategory.drag=!0;else if("ana.engg.click"===e)this.eventCategory.click=!0;else{if("ana.engg.drag"!==e)throw new RuntimeException("cannot configure transmitter");this.eventCategory.drag=!0}}subscribe(e,t){const r=e.substring(0,e.indexOf("."))||e;this.configured||this.configure(e),this.eventHandlers[r]||(this.eventHandlers[r]=[]),this.eventHandlers[r].push(t)}publish(e,t){if(!this.configured||"engg"!==t.type||!this.eventHandlers[e])return;if(!this.eventCategory[t.cat]||"body"===t.data.t&&"body"===t.data.g)return;let r={ns:e||"",type:t.type||"",cat:t.cat||""},n=t.data||{};this.eventHandlers[e].forEach((e=>{try{e(r,n)}catch(e){throw Error(e)}}))}},I=new class{constructor(e){this._semaphore=new b(1,e)}acquire(){return e=this,t=void 0,n=function*(){const[,e]=yield this._semaphore.acquire();return e},new((r=void 0)||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}));var e,t,r,n}runExclusive(e){return this._semaphore.runExclusive((()=>e()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.release()}cancel(){return this._semaphore.cancel()}};let k,A=0,T=[];async function P(){!T.length||A>10||S.ready()&&I.runExclusive((async function(){var e=function(e){let t=[...e];for(var r=0;r<t.length;r++){let e=t[r],n=e.data?.t,i=w();"vdp"===n&&i&&(e.prid=i,t[r]=e)}return t}(T);T=[];try{await S.transmit(e)}catch(t){A++;let r=1e3+100*2**A;clearInterval(k),N(r),T=e.concat(T)}}))}function N(e){k=setInterval(P,e)}function R(e){A<=10&&I.runExclusive((function(){T.push(e),x.publish("ana",e)}))}function O(e,t){x.subscribe(e,t)}N(1e3);const M=window.location.href,L=document.referrer||null,q=window.top===window.self,D=()=>{const e=window.navigator.userAgent;return e.includes("function l(e)")?"unknown":e},j=window.location.hostname.replace(/^(www\.)+/,"");let U,V,G=!1;function K(e){const t={url:M,ref:L,top:q,chn:j,ua:D()};R(new v(v.type.PAGEVIEW,"start")),R(new v(v.type.METADATA,"page",{...t,...e}))}const H=function(){return!!document.cookie.match(new RegExp("(^| )SCOptout=([^;]+)"))||!!window.location.hash.split("&")[0].split(/[#!]|%23/).includes("implOptout")||!!navigator.globalPrivacyControl};let F=!1,J="";function W(e){J=e.schema_version,function(e){if(G)return;let t=e?.page_type,r=e?.spin;U=e?.exp_id,V=e?.exp_group,K({page_type:t,spin:r,exp_id:U,exp_group:V}),p=y,G=!0}(e),e.optout||H()?F=!0:function(e){for(const t of e)"aws"===t.type&&"firehose"===t.service&&S.configure(t)}(e.transmit)}function $(e,t){F||H()||R(new v(v.type.ENGAGEMENT,e,t))}function B(e,t){F||H()||R(new v(v.type.METADATA,e,t))}function z(e){!function(e){y=u(m),K({spin:e,parent_prid:w(),exp_id:U,exp_group:V})}(e)}})(),window.ImpelAna=o})();
|