Socket
Socket
Sign inDemoInstall

@analytics/core

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@analytics/core - npm Package Compare versions

Comparing version 0.5.2 to 0.6.0

LICENSE

55

CHANGELOG.md

@@ -6,2 +6,57 @@ # Change Log

# 0.6.0 (2020-07-14)
### Bug Fixes
* **core:** disable ‘os’ for node until build fixed ([4610cd0](https://github.com/DavidWells/analytics/commit/4610cd0))
* **core:** expore devtools when debug set to true ([8dd38b7](https://github.com/DavidWells/analytics/commit/8dd38b7))
* **core:** fix campaign event ([8df0eaa](https://github.com/DavidWells/analytics/commit/8df0eaa))
* **core:** fix payload for .once listeners ([4cf07b7](https://github.com/DavidWells/analytics/commit/4cf07b7))
* **core:** remove async keyword ([6446e72](https://github.com/DavidWells/analytics/commit/6446e72))
* **core:** save last event & history ([275e89a](https://github.com/DavidWells/analytics/commit/275e89a))
* **core:** set anonId when setItemEnd occurs for ANON_ID ([5401cda](https://github.com/DavidWells/analytics/commit/5401cda))
* **core plugins:** run .page .track .identify callbacks when no plugins found ([09dfd78](https://github.com/DavidWells/analytics/commit/09dfd78))
* namespaced plugin config values should reflect current plugin ([a3cc443](https://github.com/DavidWells/analytics/commit/a3cc443)), closes [#25](https://github.com/DavidWells/analytics/issues/25)
* **debug:** support debug enhancer when no dev tools found ([c2a93c7](https://github.com/DavidWells/analytics/commit/c2a93c7))
* **utils:** fix build for node & testing + add iife build ([20a5021](https://github.com/DavidWells/analytics/commit/20a5021))
### Features
* **cli:** add analytics CLI for automate plugin docs & more to come ([297476c](https://github.com/DavidWells/analytics/commit/297476c))
* **core:** add analytics.reset for clean slate ([f30b83d](https://github.com/DavidWells/analytics/commit/f30b83d))
* **core:** add browser tab visible and window mouseout events ([ae65b37](https://github.com/DavidWells/analytics/commit/ae65b37))
* **core:** add debug to plugin action mods ([3c47088](https://github.com/DavidWells/analytics/commit/3c47088))
* **core:** add debug utilities ([daaef87](https://github.com/DavidWells/analytics/commit/daaef87))
* **core:** add deeper event log support for debugging ([5a8e810](https://github.com/DavidWells/analytics/commit/5a8e810))
* **core:** add enable / disable integration ([acc5390](https://github.com/DavidWells/analytics/commit/acc5390))
* add @analytics/core ([6b00148](https://github.com/DavidWells/analytics/commit/6b00148))
* add conditional enable/disable on track/page/identify ([d33587b](https://github.com/DavidWells/analytics/commit/d33587b))
* **core:** Expose setItem, removeItem, EVENTS, & CONSTANTS in api ([808b9ae](https://github.com/DavidWells/analytics/commit/808b9ae))
* Add methods key for plugins to provide custom methods ([9e0debe](https://github.com/DavidWells/analytics/commit/9e0debe))
* **core:** add enable/disable integration by array of providers ([ddf596f](https://github.com/DavidWells/analytics/commit/ddf596f))
* **core:** add getPersistedUserData for initial state ([6620881](https://github.com/DavidWells/analytics/commit/6620881))
* **core:** add network events ([b2e06b6](https://github.com/DavidWells/analytics/commit/b2e06b6))
* **core:** add offline handler ([c4e2b11](https://github.com/DavidWells/analytics/commit/c4e2b11))
* **core:** add querystring API for triggering events + identify calls via utm params ([44d05d5](https://github.com/DavidWells/analytics/commit/44d05d5))
* **core:** add queuing & heartbeat mechanism for handling load loading analytic scripts ([7058b39](https://github.com/DavidWells/analytics/commit/7058b39))
* **core:** add storage constants ([04036a1](https://github.com/DavidWells/analytics/commit/04036a1))
* **core:** add storage middleware to allow for third party plugins to intercept / audit persistance data ([96fb50f](https://github.com/DavidWells/analytics/commit/96fb50f))
* **core:** add timestamp for track, identify, & page calls ([33d8338](https://github.com/DavidWells/analytics/commit/33d8338))
* **core:** add timeZone & locale to context ([d627a52](https://github.com/DavidWells/analytics/commit/d627a52))
* **core:** listen to window events for future session feature ([4acebc5](https://github.com/DavidWells/analytics/commit/4acebc5))
* **core:** pass state getter to integrations as last arg ([29566d1](https://github.com/DavidWells/analytics/commit/29566d1))
* **core:** queue track, page, & identify calls if browser offline ([41f7f78](https://github.com/DavidWells/analytics/commit/41f7f78))
* **fullstory:** add fullstory plugin ([255ce77](https://github.com/DavidWells/analytics/commit/255ce77))
* **plugin-system:** add new core plugin engine ([e122572](https://github.com/DavidWells/analytics/commit/e122572))
* **plugins:** refactor plugins to allow for hooking into plugin specific events/methods ([c1c5379](https://github.com/DavidWells/analytics/commit/c1c5379))
* add page.last & track.last to state ([c8ce5cc](https://github.com/DavidWells/analytics/commit/c8ce5cc))
* add perfume.js performance metrics plugin ([2a4b3f2](https://github.com/DavidWells/analytics/commit/2a4b3f2))
* make .track, .page, .identify, .reset return promise for async usage ([4069c03](https://github.com/DavidWells/analytics/commit/4069c03))
## [0.5.2](https://github.com/DavidWells/analytics/compare/analytics@0.5.0...analytics@0.5.2) (2020-07-05)

@@ -8,0 +63,0 @@

2

dist/@analytics/core.min.js

@@ -1,1 +0,1 @@

var _analytics=function(t){"use strict";var e=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var n=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var r=function(){throw new TypeError("")};var H=function(t){return e(t)||n(t)||r()};function o(t,e){return t(e={exports:{}},e.exports),e.exports}var Z=o(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r});var d=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function a(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 K=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(n,!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e};function Q(t,e,n,r,o){for(e=e.split?e.split("."):e,r=0;r<e.length;r++)t=t?t[e[r]]:o;return t===o?n:t}function i(t,e,n,r,o,a){if("undefined"!=typeof window)return 1<arguments.length?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(o?"; domain="+o:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var tt="object"===("undefined"==typeof self?"undefined":u(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":u(global))&&global.global===global&&global||void 0;!function(){try{i("_c_","1");var t=-1!==document.cookie.indexOf("_c_");i("_c_","",-1)}catch(t){return}}();function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function et(t){return"function"==typeof t}function nt(t){return"string"==typeof t}function rt(t){if("object"!==c(t)||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function f(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}var ot="undefined"!=typeof document;function at(t){var e=function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return ot&&window.location.search.substring(1)}(t);return e?function(t){var e,n=/([^&=]+)=?([^&]*)/g,r={};for(;e=n.exec(t);){var o=f(e[1]),a=f(e[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var i=""===a||a;r[o]=i}}for(var u in r){var c=u.split("[");if(1<c.length){var s=[];c.forEach(function(t,e){var n=t.replace(/[?[\]\\ ]/g,"");s.push(n)}),l(r,s,r[u]),delete r[u]}}return r}(e):{}}function l(t,e,n){for(var r=e.length-1,o=0;o<r;++o){var a=e[o];a in t||(t[a]={}),t=t[a]}t[e[r]]=n}function it(){for(var t,e,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return t=s(),e=s(),n=s(),r=s(),"".concat(o[255&t]+o[t>>8&255]+o[t>>16&255]+o[t>>24&255],"-").concat(o[255&e]).concat(o[e>>8&255],"-").concat(o[e>>16&15|64]).concat(o[e>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])}function s(){return 4294967295*Math.random()|0}var p="function",y="undefined",g="reducer",h="@@redux/",v=h+"INIT",b=h+Math.random().toString(36),m=function(){return("undefined"==typeof Symbol?"undefined":Z(Symbol))===p&&Symbol.observable||"@@observable"}(),w=" != "+p;function ut(t,e,n){if(Z(e)===p&&Z(n)===y&&(n=e,e=void 0),Z(n)!==y){if(Z(n)!==p)throw new Error("enhancer"+w);return n(ut)(t,e)}if(Z(t)!==p)throw new Error(g+w);var r=t,o=e,a=[],i=a,u=!1;function c(){i===a&&(i=a.slice())}function s(){return o}function f(e){if(Z(e)!==p)throw new Error("Listener"+w);var n=!0;return c(),i.push(e),function(){if(n){n=!1,c();var t=i.indexOf(e);i.splice(t,1)}}}function l(t){if(!rt(t))throw new Error("Act != obj");if(Z(t.type)===y)throw new Error("ActType "+y);if(u)throw new Error("Dispatch in "+g);try{u=!0,o=r(o,t)}finally{u=!1}for(var e=a=i,n=0;n<e.length;n++){(0,e[n])()}return t}return l({type:v}),d({dispatch:l,subscribe:f,getState:s,replaceReducer:function(t){if(Z(t)!==p)throw new Error("next "+g+w);r=t,l({type:v})}},m,function(){var n=f;return d({subscribe:function(t){if("object"!==Z(t))throw new TypeError("Observer != obj");function e(){t.next&&t.next(s())}return e(),{unsubscribe:n(e)}}},m,function(){return this})})}function ct(t){for(var e=Object.keys(t),d={},n=0;n<e.length;n++){var r=e[n];Z(t[r])===p&&(d[r]=t[r])}var h,o,m=Object.keys(d);try{o=d,Object.keys(o).forEach(function(t){var e=o[t],n=e(void 0,{type:v});if(Z(n)===y||Z(e(void 0,{type:b}))===y)throw new Error(g+" "+t+" "+y)})}catch(t){h=t}return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(h)throw h;for(var n,r,o,a=!1,i={},u=0;u<m.length;u++){var c=m[u],s=d[c],f=t[c],l=s(f,e);if(Z(l)===y){var p=(n=c,o=void 0,"action "+((o=(r=e)&&r.type)&&o.toString()||"?")+g+" "+n+" returns "+y);throw new Error(p)}i[c]=l,a=a||l!==f}return a?i:t}}function st(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}var ft=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","loadPlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],lt=["name","EVENTS","config","loaded"],pt=ft.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:".concat(t)},pluginReadyType:function(t){return"ready:".concat(t)}});var dt="__anon_id",ht="__user_id",mt="__user_traits",x=Object.freeze({ANON_ID:dt,USER_ID:ht,USER_TRAITS:mt}),yt=/^utm_/,gt=/^an_prop_/,vt=/^an_trait_/;var E="analytics",bt="userId",wt="anonymousId";function xt(t,e){return{userId:e.getItem(ht)||t.an_uid,anonymousId:e.getItem(dt)||t.an_aid||it(),traits:e.getItem(mt)||{}}}var Et=function(t){return"__TEMP__"+t};var St=o(function(t){var e=function(i){var c,t=Object.prototype,f=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function u(t,e,n,r){var a,i,u,c,o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),f=new _(r||[]);return s._invoke=(a=t,i=n,u=f,c=p,function(t,e){if(c===h)throw new Error("");if(c===m){if("throw"===t)throw e;return j()}for(u.method=t,u.arg=e;;){var n=u.delegate;if(n){var r=I(n,u);if(r){if(r===y)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===p)throw c=m,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=h;var o=l(a,i,u);if("normal"===o.type){if(c=u.done?m:d,o.arg===y)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c=m,u.method="throw",u.arg=o.arg)}}),s}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}i.wrap=u;var p="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function g(){}function a(){}function s(){}var v={};v[o]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(P([])));w&&w!==t&&f.call(w,o)&&(v=w);var x=s.prototype=g.prototype=Object.create(v);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(c,s){var e;this._invoke=function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,o){var a=l(c[t],c,n);if("throw"!==a.type){var i=a.arg,u=i.value;return u&&"object"==typeof u&&f.call(u,"__await")?s.resolve(u.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):s.resolve(u).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)})}o(a.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function I(t,e){var n=t.iterator[e.method];if(n===c){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=c,I(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("")}return y}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,y;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=c),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError(""),e.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(f.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=c,t.done=!0,t};return r.next=r}}return{next:j}}function j(){return{value:c,done:!0}}return a.prototype=x.constructor=s,s.constructor=a,s[r]=a.displayName="GeneratorFunction",i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===a||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(x),t},i.awrap=function(t){return{__await:t}},E(S.prototype),S.prototype[n]=function(){return this},i.AsyncIterator=S,i.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var a=new S(u(t,e,n,r),o);return i.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},E(x),x[r]="Generator",x[o]=function(){return this},x.toString=function(){return"[object Generator]"},i.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},i.values=P,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&f.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return a.type="throw",a.arg=n,r.next=t,e&&(r.method="next",r.arg=c),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=f.call(o,"catchLoc"),u=f.call(o,"finallyLoc");if(i&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&f.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=c),y}},i}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function S(t,e,n,r,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}var It=function(u){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=u.apply(t,i);function o(t){S(r,e,n,o,a,"next",t)}function a(t){S(r,e,n,o,a,"throw",t)}o(void 0)})}};function Ot(o,a,i){return new Promise(function(e,n){return a()?e(o):i<1?n(K(K({},o),{},{queue:!0})):(r=10,new Promise(function(t){return setTimeout(t,r)})).then(function(t){return Ot(o,a,i-10).then(e,n)});var r})}function kt(u,t,c){var s=t(),e=u.getState(),f=e.plugins,n=e.context,l=e.queue,p=e.user;if(!n.offline&&l&&l.actions&&l.actions.length){var r=l.actions.reduce(function(t,e,n){return f[e.plugin].loaded?(t.process.push(e),t.processIndex.push(n)):(t.requeue.push(e),t.requeueIndex.push(n)),t},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(r.processIndex&&r.processIndex.length){r.processIndex.forEach(function(t){var e=l.actions[t],n=e.plugin,r=e.payload.type,o=s[n][r];if(o&&et(o)){var a=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return[bt,wt].reduce(function(t,e){return function(t,e,n){if(t.hasOwnProperty(n)&&!t[n]&&e[n])return Object.assign({},t,d({},"".concat(n),e[n]));return t}(t,n,e)},t)}(e.payload,p);o({payload:a,config:f[n].config,instance:c});var i="".concat(r,":").concat(n);u.dispatch(K(K({},a),{},{type:i,_:{called:i,from:"queueDrain"}}))}});var o=l.actions.filter(function(t,e){return!~r.processIndex.indexOf(e)});l.actions=o}}}var I=function(t){if(Array.isArray(t))return t};var O=function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n};var k=function(){throw new TypeError("")};var _=function(t,e){return I(t)||O(t,e)||k()};function P(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(e).filter(function(t){var e=r.plugins||{};return!1!==e[t]&&(!0===e[t]||!1!==e.all&&(!n[t]||!1!==n[t].enabled))}).map(function(t){return e[t]})}var j=/Start$/,N=/^bootstrap/,A=/^ready/;function _t(t,e,n,r,o){return T.apply(this,arguments)}function T(){return(T=It(St.mark(function t(e,n,r,o,a){var i,u,c,s,f,l,p,d,h,m,y,g;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=et(n)?n():n,u=e.type,c=u.replace(j,""),e._&&e._.called)return t.abrupt("return",e);t.next=5;break;case 5:return s=r.getState(),f=P(i,s.plugins,e.options),l=f.map(function(t){return t.name}),p=V(u,f,i),t.next=11,M({action:e,data:{exact:p.before,namespaced:p.beforeNS},state:s,allPlugins:i,allMatches:p,instance:r,store:o,EVENTS:a});case 11:if(F(d=t.sent,l.length))return t.abrupt("return",d);t.next=14;break;case 14:if(u!==c){t.next=18;break}h=d,t.next=21;break;case 18:return t.next=20,M({action:K(K({},d),{},{type:c}),data:{exact:p.during,namespaced:p.duringNS},state:s,allPlugins:i,allMatches:p,instance:r,store:o,EVENTS:a});case 20:h=t.sent;case 21:if(u.match(j))return m="".concat(c,"End"),t.next=25,M({action:K(K({},h),{},{type:m}),data:{exact:p.after,namespaced:p.afterNS},state:s,allPlugins:i,allMatches:p,instance:r,store:o,EVENTS:a});t.next=28;break;case 25:y=t.sent,(g=L(y))&&g({payload:y});case 28:return t.abrupt("return",d);case 29:case"end":return t.stop()}},t)}))).apply(this,arguments)}function L(r){return!!r.meta&&Object.keys(r.meta).reduce(function(t,e){var n=r.meta[e];return et(n)?n:t},!1)}function M(t){return z.apply(this,arguments)}function z(){return(z=It(St.mark(function t(e){var y,i,g,n,v,r,b,o,w,a,x,E,u,S,I,O,c,s;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return y=e.data,i=e.action,g=e.instance,n=e.state,v=e.allPlugins,r=e.allMatches,b=e.store,o=e.EVENTS,w=n.plugins,a=n.context,x=i.type,E=x.match(j),u=y.exact.map(function(t){return t.pluginName}),E&&(u=r.during.map(function(t){return t.pluginName})),S=B(g,u),I=y.exact.reduce(function(t,e){var n=e.pluginName,r=e.methodName,o=!1;return r.match(/^initialize/)||r.match(/^reset/)||(o=!w[n].loaded),a.offline&&r.match(/^(page|track|identify)/)&&(o=!0),t["".concat(n)]=o,t},{}),t.next=10,y.exact.reduce(function(){var r=It(St.mark(function t(e,n,r){var c,o,a;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c=n.pluginName,t.next=3,e;case 3:if(o=t.sent,y.namespaced&&y.namespaced[c])return t.next=7,y.namespaced[c].reduce(function(){var r=It(St.mark(function t(e,n,r){var o,a,i,u;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=function(r,o,a){return function(t,e){var n=a||o;return K(K({},r),{},{abort:{reason:t,plugins:e||[o],caller:x,from:n}})}},t.next=3,e;case 3:if(o=t.sent,n.method&&et(n.method)){t.next=6;break}return t.abrupt("return",o);case 6:return X(n.methodName,n.pluginName),t.next=9,n.method({payload:o,instance:g,abort:a(o,c,n.pluginName),config:q(n.pluginName,w,v),plugins:w});case 9:return i=t.sent,u=rt(i)?i:{},t.abrupt("return",Promise.resolve(K(K({},o),u)));case 12:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));t.next=11;break;case 7:a=t.sent,o[c]=a,t.next=12;break;case 11:o[c]=i;case 12:return t.abrupt("return",Promise.resolve(o));case 13:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve({}));case 10:return O=t.sent,t.next=13,y.exact.reduce(function(){var r=It(St.mark(function t(e,n,r){var o,a,i,u,c,s,f,l,p,d,h,m;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=y.exact.length===r+1,a=n.pluginName,i=v[a],t.next=5,e;case 5:if(u=t.sent,c=O[a]?O[a]:{},E&&(c=u),U(c,a))return D({data:c,method:x,instance:g,pluginName:a,store:b}),t.abrupt("return",Promise.resolve(u));t.next=11;break;case 11:if(U(u,a))return o&&D({data:u,method:x,instance:g,store:b}),t.abrupt("return",Promise.resolve(u));t.next=14;break;case 14:if(I.hasOwnProperty(a)&&!0===I[a])return b.dispatch({type:"queue",plugin:a,payload:c,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(u));t.next=17;break;case 17:return s=S(O[a],v[a]),t.next=20,i[x]({hello:a,abort:s.abort,payload:c,instance:g,config:q(a,w,v),plugins:w});case 20:return f=t.sent,l=rt(f)?f:{},p=K(K({},u),l),U(d=O[a],a)?D({data:d,method:x,instance:g,pluginName:a,store:b}):(h="".concat(x,":").concat(a),(h.match(/:/g)||[]).length<2&&!x.match(N)&&!x.match(A)&&(m=E?p:c,g.dispatch(K(K({},m),{},{type:h,_:{called:h,from:"submethod"}})))),t.abrupt("return",Promise.resolve(p));case 26:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));case 13:if(c=t.sent,x.match(j)||x.match(/^registerPlugin/)||x.match(A)||x.match(N)||x.match(/^params/)||x.match(/^userIdChanged/)){t.next=21;break}if(o.plugins.includes(x),c._&&c._.originalAction===x)return t.abrupt("return",c);t.next=18;break;case 18:s=K(K({},c),{_:{originalAction:c.type,called:c.type,from:"engineEnd"}}),F(c,y.exact.length)&&!x.match(/End$/)&&(s=K(K({},s),{type:c.type+"Aborted"})),b.dispatch(s);case 21:return t.abrupt("return",c);case 22:case"end":return t.stop()}},t)}))).apply(this,arguments)}function D(t){var e=t.data,n=t.method,r=(t.instance,t.pluginName),o=n+"Aborted"+(r?":"+r:"");t.store.dispatch(K(K({},e),{},{type:o,_:{called:o,from:"abort"}}))}function q(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function R(n,t){return t.reduce(function(t,e){return e[n]?t.concat({methodName:n,pluginName:e.name,method:e[n]}):t},[])}function C(t,e){var n=t.replace(j,""),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function V(c,s,t){var e=C(c).map(function(t){return R(t,s)});return s.reduce(function(t,e){var n=e.name,r=C(c,n).map(function(t){return R(t,s)}),o=_(r,3),a=o[0],i=o[1],u=o[2];return a.length&&(t.beforeNS[n]=a),i.length&&(t.duringNS[n]=i),u.length&&(t.afterNS[n]=u),t},{before:e[0],beforeNS:{},during:e[1],duringNS:{},after:e[2],afterNS:{}})}function U(t,e){var n=t.abort;return!!n&&(!0===n||($(n,e)||n&&$(n.plugins,e)))}function F(t,e){var n=t.abort;if(!n)return!1;if(!0===n||nt(n))return!0;var r=n.plugins;return G(n)&&n.length===e||G(r)&&r.length===e}function G(t){return Array.isArray(t)}function $(t,e){return!(!t||!G(t))&&t.includes(e)}function B(m,y){return function(t,e,n){var r=e.config,o=e.name,a="".concat(o,".").concat(t.type);n&&(a=n.event);var i,u,c,s,f,l,p,d,h=t.type.match(j)?(c=o,s=a,f=y,l=n,p=t,function(t,e){var n=l?l.name:c,r=e&&G(e)?e:f;if(l&&(!(r=e&&G(e)?e:[c]).includes(c)||1!==r.length))throw new Error("Method ".concat(s," can only abort ").concat(c," plugin. ").concat(JSON.stringify(r)," input valid"));return K(K({},p),{},{abort:{reason:t,plugins:r,caller:s,_:n}})}):(i=t,u=a,function(){throw new Error(i.type+" action not cancellable. Remove abort in "+u)});return{payload:(d=t,Object.keys(d).reduce(function(t,e){return"type"===e||(rt(d[e])?t[e]=Object.assign({},d[e]):t[e]=d[e]),t},{})),instance:m,config:r||{},abort:h}}}function X(t,e){var n=J(t);if(n&&n.name===e){var r=J(n.method),o=r?"or "+r.method:"";throw new Error([e+" plugin is calling method "+t,"Plugins cant call themselves","Use ".concat(n.method," ").concat(o," in ").concat(e," plugin insteadof ").concat(t)].join("\n"))}}function J(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Pt(){return(new Date).getTime()}var W=function(t,e){if(!(t instanceof e))throw new TypeError("")},jt=function t(){var i=this;W(this,t),d(this,"before",[]),d(this,"after",[]),d(this,"addMiddleware",function(t,e){i[e]=i[e].concat(t)}),d(this,"removeMiddleware",function(e,t){var n=i[t].findIndex(function(t){return t===e});-1!==n&&(i[t]=[].concat(H(i[t].slice(0,n)),H(i[t].slice(n+1))))}),d(this,"dynamicMiddlewares",function(a){return function(o){return function(r){return function(t){var e={getState:o.getState,dispatch:function(t){return o.dispatch(t)}},n=i[a].map(function(t){return t(e)});return st.apply(void 0,H(n))(r)(t)}}}})},Nt={};var Y,At,Tt,Lt;Y=function(){if(!ot)return!1;var t=navigator.appVersion;return~t.indexOf("Win")?"Windows":~t.indexOf("Mac")?"MacOS":~t.indexOf("X11")?"UNIX":~t.indexOf("Linux")?"Linux":"Unknown OS"}(),At=ot?document.referrer:null,Tt=function(){if(!ot)return null;var t=navigator,e=t.language,n=t.languages,r=t.userLanguage;return n&&n.length?n[0]:r||e}(),Lt="undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone;var Mt={initialized:!1,sessionId:it(),app:null,version:null,debug:!1,offline:!!ot&&!navigator.onLine,os:{name:Y},userAgent:ot?navigator.userAgent:"node",library:{name:E,version:"0.5.2"},timezone:Lt,locale:Tt,campaign:{},referrer:At};function zt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Mt,e=1<arguments.length?arguments[1]:void 0,n=t.initialized,r=e.type,o=e.campaign;switch(r){case pt.campaign:return K(K({},t),{campaign:o});case pt.offline:return K(K({},t),{offline:!0});case pt.online:return K(K({},t),{offline:!1});default:return n?t:K(K(K({},Mt),t),{initialized:!0})}}var Dt=["plugins","reducers","storage"];function qt(t){var e=t;try{e=JSON.parse(JSON.stringify(t))}catch(t){}return e}var Rt=/#.*$/;function Ct(t){var e=function(){if(ot)for(var t,e=document.getElementsByTagName("link"),n=0;t=e[n];n++)if("canonical"===t.getAttribute("rel"))return t.getAttribute("href")}();return e?e.match(/\?/)?e:e+t:window.location.href.replace(Rt,"")}var Vt=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!ot)return t;var e,n,r=document,o=r.title,a=r.referrer,i=window,u=i.location,c=i.innerWidth,s=i.innerHeight,f=u.hash,l=u.search,p=Ct(l),d={title:o,url:p,path:(e=p,n=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e),"/"+(n&&n[3]?n[3].split("?")[0].replace(Rt,""):"")),hash:f,search:l,width:c,height:s};return a&&""!==a&&(d.referrer=a),K(K({},d),t)},Ut={last:{},history:[]};function Ft(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Ut,e=1<arguments.length?arguments[1]:void 0,n=e.properties,r=e.options,o=e.meta;switch(e.type){case pt.page:var a=qt(K({properties:n,meta:o},Object.keys(r).length&&{options:r}));return K(K({},t),{last:a,history:t.history.concat(a)});default:return t}}var Gt={last:{},history:[]};function $t(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Gt,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.meta,o=e.options,a=e.event,i=e.properties;switch(n){case pt.track:var u=qt(K(K({event:a,properties:i},Object.keys(o).length&&{options:o}),{},{meta:r}));return K(K({},t),{last:u,history:t.history.concat(u)});default:return t}}var Bt={actions:[]};function Xt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Bt,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.payload;switch(n){case"queue":var o;return o=r&&r.type&&r.type===pt.identify?[e].concat(t.actions):t.actions.concat(e),K(K({},t),{},{actions:o});case"dequeue":return[];default:return t}}function Jt(e){var n=function(t,e,n){if(!ot)return!1;var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(t){r(t,e)})}.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return n(!0),function(t){return n(!1)}}function Wt(){return Array.prototype.slice.call(arguments).reduce(function(t,e){return t||(et(e)?e:t)},!1)}function Yt(){var i="__"+E+"__";return tt[i]=[],function(a){return function(t,e,n){var r=a(t,e,n),o=r.dispatch;return Object.assign(r,{dispatch:function(t){var e=t.action||t;return tt[i].push(e),o(t)}})}}}function Ht(t){return function(){return st(st.apply(null,arguments),Yt())}}var Zt=function(t,e,n){return{type:pt.setItemStart,timestamp:Pt(),key:t,value:e,options:n}},Kt=function(t,e){return{type:pt.removeItemStart,timestamp:Pt(),key:t,options:e}};function Qt(){var a,t,e,s,f,l,p,n,d,h,i,b,w,x,E,u,r,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=o.reducers||{},m=(o.plugins||[]).reduce(function(t,e){if(et(e))return t.middlewares=t.middlewares.concat(e),t;if(e.NAMESPACE&&(e.name=e.NAMESPACE),!e.name)throw new Error("https://lytics.dev/errors/1");var n=e.EVENTS?Object.keys(e.EVENTS).map(function(t){return e.EVENTS[t]}):[],r=Object.keys(e).concat(n),o=new Set(t.events.concat(r));if(t.events=Array.from(o),t.pluginsArray=t.pluginsArray.concat(e),t.plugins[e.name])throw new Error(e.name+" plugin loaded twice");return t.plugins[e.name]=e,t.plugins[e.name].loaded||(t.plugins[e.name].loaded=function(){return!0}),t},{plugins:{},pluginsArray:[],middlewares:[],events:[]}),y=o.storage?o.storage:{getItem:function(t){return tt[t]},setItem:function(t,e){return tt[t]=e},removeItem:function(t){return tt[t]=void 0}},g=(a=y,function(t,e,n){var r=e.getState("user")[t];if(r)return r;if(n&&rt(n)&&n[t])return n[t];var o=xt({},a)[t];return o||(tt[Et(t)]?tt[Et(t)]:null)}),v=m.plugins,S=m.events.filter(function(t){return!lt.includes(t)}),I=new Set(S.concat(ft).filter(function(t){return!lt.includes(t)})),O=Array.from(I).sort(),k=S.sort(),_=function(){return v},P=new jt,j=P.addMiddleware,N=P.removeMiddleware,A=P.dynamicMiddlewares,T=function(){throw new Error("Abort disabled in listener")},L=function(e,n){return function(t){n&&n(t),e(t)}},M=at(),z=xt(M,y),D={identify:function(t,n,r,o){var a=nt(t)?t:null,i=rt(t)?t:n,u=r||{},c=D.user(),s=(tt[Et(bt)]=a)||i.userId||g(bt,D,i);return new Promise(function(t,e){W.dispatch(K(K({type:pt.identifyStart,userId:s,traits:i||{},options:u,anonymousId:c.anonymousId},c.id&&c.id!==a&&{previousId:c.id}),{},{meta:{timestamp:Pt(),callback:L(t,Wt(n,r,o))}}))})},track:function(t,n,r,o){var a=rt(t)?t.event:t;if(!a||!nt(a))throw new Error("Event missing");var i=rt(t)?t:n||{},u=rt(r)?r:{};return new Promise(function(t,e){W.dispatch({type:pt.trackStart,event:a,properties:i,options:u,userId:g(bt,D,n),anonymousId:g(wt,D,n),meta:{timestamp:Pt(),callback:L(t,Wt(n,r,o))}})})},page:function(n,r,o){var a=rt(n)?n:{},i=rt(r)?r:{};return new Promise(function(t,e){W.dispatch({type:pt.pageStart,properties:Vt(a),options:i,userId:g(bt,D,a),anonymousId:g(wt,D,a),meta:{timestamp:Pt(),callback:L(t,Wt(n,r,o))}})})},user:function(t){if(t===bt||"id"===t)return g(bt,D);var e=D.getState("user");return t?Q(e,t):e},reset:function(n){return new Promise(function(t,e){W.dispatch({type:pt.resetStart,timestamp:Pt(),callback:L(t,n)})})},ready:function(t){return D.on(pt.ready,t)},on:function(n,r){if(!n||!et(r))return!1;if(n===pt.bootstrap)throw new Error(".on disabled for "+n);var o=/Start$|Start:/;if("*"===n){var t=function(t){return function(e){return function(t){return t.type.match(o)&&r({payload:t,instance:D,plugins:v}),e(t)}}},e=function(t){return function(e){return function(t){return t.type.match(o)||r({payload:t,instance:D,plugins:v}),e(t)}}};return j(t,te),j(e,ee),function(){N(t,te),N(e,ee)}}var a=n.match(o)?te:ee,i=function(t){return function(e){return function(t){return t.type===n&&r({payload:t,instance:D,plugins:v,abort:T}),e(t)}}};return j(i,a),function(){return N(i,a)}},once:function(t,n){if(!t||!et(n))return!1;if(t===pt.bootstrap)throw new Error(".once disabled for "+t);var r=D.on(t,function(t){var e=t.payload;n({payload:e,instance:D,plugins:v,abort:T}),r()});return r},getState:function(t){var e=W.getState();return t?Q(e,t):Object.assign({},e)},dispatch:function(t){var e,n=nt(t)?{type:t}:t;if(e=n.type,ft.includes(e))throw new Error("reserved action "+n.type);var r=n.meta||{},o=t._||{},a=K(K({},n),{},{meta:K({timestamp:Pt()},r),_:K({originalAction:n.type},o)});W.dispatch(a)},enablePlugin:function(t,e){var n,r;W.dispatch((n=t,r=e,{type:pt.enablePlugin,name:n,callback:r,_:{originalAction:pt.enablePlugin}}))},disablePlugin:function(t,e){var n,r;W.dispatch((n=t,r=e,{type:pt.disablePlugin,name:n,callback:r,_:{originalAction:pt.disablePlugin}}))},loadPlugin:function(t){W.dispatch({type:pt.loadPlugin,plugins:t?[t]:Object.keys(_())})},storage:{getItem:y.getItem,setItem:function(t,e,n){W.dispatch(Zt(t,e,n))},removeItem:function(t,e){W.dispatch(Kt(t,e))}},setAnonymousId:function(t,e){D.storage.setItem(dt,t,e)},events:{all:O,core:ft,plugins:k}},q=m.middlewares.concat([A(te),(b=D,w=_,x={all:O,plugins:k},E={},function(v){return function(g){return e=It(St.mark(function t(e){var n,r,o,a,i,u,c,s,f,l,p,d,h,m,y;return St.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.type,r=e.name,o=e.callback,(a=e).abort)return t.abrupt("return",g(e));t.next=4;break;case 4:if(n!==pt.disablePlugin&&n!==pt.enablePlugin||et(o)&&o(r),n===pt.loadPlugin)return i=w(),u=Object.keys(i).filter(function(t){return e.plugins.includes(t)}).reduce(function(t,e){return t[e]=i[e],t},{}),c={type:pt.initializeStart,plugins:e.plugins},t.next=11,_t(c,u,b,v,x);t.next=13;break;case 11:return s=t.sent,t.abrupt("return",g(s));case 13:if(n===pt.initializeEnd&&(f=w(),l=Object.keys(f),p=l.filter(function(t){return e.plugins.includes(t)}).map(function(t){return f[t]}),d=[],h=[],m=p.map(function(e){var t=e.loaded,n=e.name;return Ot(e,t,1e4).then(function(t){E[n]||(v.dispatch({type:pt.pluginReadyType(n),name:n,events:Object.keys(e).filter(function(t){return!lt.includes(t)})}),E[n]=!0),d=d.concat(n)}).catch(function(t){if(t instanceof Error)throw new Error(t);return h=h.concat(t.name),t})}),Promise.all(m).then(function(t){setTimeout(function(){l.length===m.length&&v.dispatch({type:pt.ready,plugins:d,failed:h})},0)})),n!==pt.bootstrap)return/^ready:([^:]*)$/.test(n)&&setTimeout(function(){return kt(v,w,b)},0),t.next=18,_t(e,w,b,v,x);t.next=20;break;case 18:return y=t.sent,t.abrupt("return",g(y));case 20:return t.abrupt("return",g(a));case 21:case"end":return t.stop()}},t)})),function(t){return e.apply(this,arguments)};var e}}),(i=y,function(t){return function(a){return function(t){var e=t.type,n=t.key,r=t.value,o=t.options;if(e===pt.setItem||e===pt.removeItem){if(t.abort)return a(t);e===pt.setItem?i.setItem(n,r,o):i.removeItem(n,o)}return a(t)}}}),(p=D,n=p.storage,d=n.setItem,h=n.getItem,function(c){return function(u){return function(t){if(t.type===pt.bootstrap){var o=t.params,e=t.user;h(dt)||d(dt,e.anonymousId);var n=Object.keys(t.params);if(n.length){var r=o.an_uid,a=o.an_event,i=n.reduce(function(t,e){if(e.match(yt)||e.match(/^(d|g)clid/)){var n=e.replace(yt,""),r="campaign"===n?"name":n;t.campaign[r]=o[e]}return e.match(gt)&&(t.props[e.replace(gt,"")]=o[e]),e.match(vt)&&(t.traits[e.replace(vt,"")]=o[e]),t},{campaign:{},props:{},traits:{}});c.dispatch(K(K({type:pt.params,raw:o},i),r?{userId:r}:{})),r&&setTimeout(function(){return p.identify(r,i.traits)},0),a&&setTimeout(function(){return p.track(a,i.props)},0),Object.keys(i.campaign).length&&c.dispatch({type:pt.campaign,campaign:i.campaign})}}return u(t)}}}),(t=D,e=t.storage,s=e.setItem,f=e.removeItem,l=e.getItem,function(c){return function(u){return function(t){var e=t.userId,n=t.traits,r=t.options,o=t.callback;if(t.type===pt.reset&&([ht,mt,dt].forEach(function(t){return f(t)}),[bt,wt,"traits"].forEach(function(t){tt[Et(t)]=void 0}),et(o)&&o()),t.type===pt.identify){l(dt)||s(dt,it());var a=l(ht),i=l(mt)||{};a&&a!==e&&c.dispatch({type:pt.userIdChanged,old:{userId:a,traits:i},new:{userId:e,traits:n},options:r}),e&&s(ht,e),n&&s(mt,K(K({},i),n))}return u(t)}}}),A(ee)]),R={context:zt,user:(r=y,function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(e&&e.type===pt.setItemEnd&&e.key===dt)return Object.assign({},t,{anonymousId:e.value});switch(e.type){case pt.identify:return Object.assign({},t,{userId:e.userId,traits:K(K({},t.traits),e.traits)});case pt.reset:return[bt,wt,"traits"].forEach(function(t){tt[Et(t)]=null}),[ht,dt,mt].forEach(function(t){r.removeItem(t)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}),page:Ft,track:$t,plugins:(u=_,function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Nt,t=1<arguments.length?arguments[1]:void 0,e={};if("initialize:aborted"===t.type)return n;if(/^registerPlugin:([^:]*)$/.test(t.type)){var r=t.type.split(":")[1],o=u()[r];return o&&r?(e[r]={enabled:!0,initialized:!o.initialize,loaded:Boolean(o.loaded()),config:o.config||{}},K(K({},n),e)):n}if(/^initialize:([^:]*)$/.test(t.type)){var a=t.type.split(":")[1],i=u()[a];return i&&a?(e[a]=K(K({},n[a]),{initialized:!0,loaded:Boolean(i.loaded())}),K(K({},n),e)):n}if(/^ready:([^:]*)$/.test(t.type))return e[t.name]=K(K({},n[t.name]),{loaded:!0}),K(K({},n),e);switch(t.type){case pt.disablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=K(K({},n[e]),{enabled:!1}),t},n):e[t.name]=K(K({},n[t.name]),{enabled:!1}),K(K({},n),e);case pt.enablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=K(K({},n[e]),{enabled:!0}),t},n):e[t.name]=K(K({},n[t.name]),{enabled:!0}),K(K({},n),e);default:return n}}),queue:Xt},C=st,V=st;if(ot&&o.debug){var U=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;U&&(C=U({trace:!0,traceLimit:25})),V=function(){return 0===arguments.length?Yt():rt(Z(arguments[0]))?Ht(arguments[0]):Ht().apply(null,arguments)}}var F,G,$,B,X=(F=o,Object.keys(F).reduce(function(t,e){return Dt.includes(e)||(t[e]=F[e]),t},{})),J={context:X,user:z,plugins:m.pluginsArray.reduce(function(t,e){var n=e.name,r=e.config,o=e.loaded;return t[n]={enabled:!0,initialized:Boolean(!e.initialize),loaded:Boolean(o()),config:r||{}},t},{})},W=ut(ct(K(K({},R),c)),J,V(C(function(){for(var t=arguments.length,c=new Array(t),e=0;e<t;e++)c[e]=arguments[e];return function(u){return function(t,e,n){var r,o=u(t,e,n),a=o.dispatch,i={getState:o.getState,dispatch:function(t){return a(t)}};return r=c.map(function(t){return t(i)}),a=st.apply(void 0,H(r))(o.dispatch),K(K({},o),{},{dispatch:a})}}}.apply(void 0,H(q))))),Y=Object.keys(v);return W.dispatch({type:pt.bootstrap,plugins:Y,config:X,params:M,user:z}),W.dispatch({type:pt.registerPlugins,plugins:Y}),m.pluginsArray.map(function(t,e){var n=t.bootstrap,r=t.config;n&&et(n)&&n({instance:D,config:r,payload:t});var o=m.pluginsArray.length===e+1;W.dispatch({type:pt.registerPluginType(t.name),name:t.name,plugin:t}),o&&W.dispatch({type:pt.initializeStart,plugins:Y})}),Jt(function(t){W.dispatch({type:t?pt.offline:pt.online})}),G=W,$=_,B=D,setInterval(function(){return kt(G,$,B)},3e3),D}var te="before",ee="after";return t.default=Qt,t.init=Qt,t.Analytics=Qt,t.EVENTS=pt,t.CONSTANTS=x,t}({});
var _analytics=function(t){"use strict";var e=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var n=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var r=function(){throw new TypeError("")};var Z=function(t){return e(t)||n(t)||r()};function a(t,e){return t(e={exports:{}},e.exports),e.exports}var K=a(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r});var d=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function o(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 Q=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(n,!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e};function tt(t,e,n,r,a){for(e=e.split?e.split("."):e,r=0;r<e.length;r++)t=t?t[e[r]]:a;return t===a?n:t}function i(t,e,n,r,a,o){if("undefined"!=typeof window)return 1<arguments.length?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(a?"; domain="+a:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var et="object"===("undefined"==typeof self?"undefined":u(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":u(global))&&global.global===global&&global||void 0;!function(){try{i("_c_","1");var t=-1!==document.cookie.indexOf("_c_");i("_c_","",-1)}catch(t){return}}();function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nt(t){return"function"==typeof t}function rt(t){return"string"==typeof t}function at(t){if("object"!==c(t)||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function l(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}var ot="undefined"!=typeof document;function it(t){var e=function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return ot&&window.location.search.substring(1)}(t);return e?function(t){var e,n=/([^&=]+)=?([^&]*)/g,r={};for(;e=n.exec(t);){var a=l(e[1]),o=l(e[2]);if("[]"===a.substring(a.length-2))a=a.substring(0,a.length-2),(r[a]||(r[a]=[])).push(o);else{var i=""===o||o;r[a]=i}}for(var u in r){var c=u.split("[");if(1<c.length){var s=[];c.forEach(function(t,e){var n=t.replace(/[?[\]\\ ]/g,"");s.push(n)}),f(r,s,r[u]),delete r[u]}}return r}(e):{}}function f(t,e,n){for(var r=e.length-1,a=0;a<r;++a){var o=e[a];o in t||(t[o]={}),t=t[o]}t[e[r]]=n}function ut(){for(var t,e,n,r,a=[],o=0;o<256;o++)a[o]=(o<16?"0":"")+o.toString(16);return t=s(),e=s(),n=s(),r=s(),"".concat(a[255&t]+a[t>>8&255]+a[t>>16&255]+a[t>>24&255],"-").concat(a[255&e]).concat(a[e>>8&255],"-").concat(a[e>>16&15|64]).concat(a[e>>24&255],"-").concat(a[63&n|128]).concat(a[n>>8&255],"-").concat(a[n>>16&255]).concat(a[n>>24&255]).concat(a[255&r]).concat(a[r>>8&255]).concat(a[r>>16&255]).concat(a[r>>24&255])}function s(){return 4294967295*Math.random()|0}var p="function",y="undefined",g="reducer",h="@@redux/",v=h+"INIT",b=h+Math.random().toString(36),m=function(){return("undefined"==typeof Symbol?"undefined":K(Symbol))===p&&Symbol.observable||"@@observable"}(),w=" != "+p;function ct(t,e,n){if(K(e)===p&&K(n)===y&&(n=e,e=void 0),K(n)!==y){if(K(n)!==p)throw new Error("enhancer"+w);return n(ct)(t,e)}if(K(t)!==p)throw new Error(g+w);var r=t,a=e,o=[],i=o,u=!1;function c(){i===o&&(i=o.slice())}function s(){return a}function l(e){if(K(e)!==p)throw new Error("Listener"+w);var n=!0;return c(),i.push(e),function(){if(n){n=!1,c();var t=i.indexOf(e);i.splice(t,1)}}}function f(t){if(!at(t))throw new Error("Act != obj");if(K(t.type)===y)throw new Error("ActType "+y);if(u)throw new Error("Dispatch in "+g);try{u=!0,a=r(a,t)}finally{u=!1}for(var e=o=i,n=0;n<e.length;n++){(0,e[n])()}return t}return f({type:v}),d({dispatch:f,subscribe:l,getState:s,replaceReducer:function(t){if(K(t)!==p)throw new Error("next "+g+w);r=t,f({type:v})}},m,function(){var n=l;return d({subscribe:function(t){if("object"!==K(t))throw new TypeError("Observer != obj");function e(){t.next&&t.next(s())}return e(),{unsubscribe:n(e)}}},m,function(){return this})})}function st(t){for(var e=Object.keys(t),d={},n=0;n<e.length;n++){var r=e[n];K(t[r])===p&&(d[r]=t[r])}var h,a,m=Object.keys(d);try{a=d,Object.keys(a).forEach(function(t){var e=a[t],n=e(void 0,{type:v});if(K(n)===y||K(e(void 0,{type:b}))===y)throw new Error(g+" "+t+" "+y)})}catch(t){h=t}return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(h)throw h;for(var n,r,a,o=!1,i={},u=0;u<m.length;u++){var c=m[u],s=d[c],l=t[c],f=s(l,e);if(K(f)===y){var p=(n=c,a=void 0,"action "+((a=(r=e)&&r.type)&&a.toString()||"?")+g+" "+n+" returns "+y);throw new Error(p)}i[c]=f,o=o||f!==l}return o?i:t}}function lt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}var ft=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","loadPlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],pt=["name","EVENTS","config","loaded"],dt=ft.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:".concat(t)},pluginReadyType:function(t){return"ready:".concat(t)}});var ht="__anon_id",mt="__user_id",yt="__user_traits",x=Object.freeze({ANON_ID:ht,USER_ID:mt,USER_TRAITS:yt}),gt=/^utm_/,vt=/^an_prop_/,bt=/^an_trait_/;var E="analytics",wt="userId",xt="anonymousId",Et=["enable","disable","load"];function St(t,e){return{userId:e.getItem(mt)||t.an_uid,anonymousId:e.getItem(ht)||t.an_aid||ut(),traits:e.getItem(yt)||{}}}var It=function(t){return"__TEMP__"+t};var Ot=a(function(t){var e=function(i){var c,t=Object.prototype,l=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},a=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function u(t,e,n,r){var o,i,u,c,a=e&&e.prototype instanceof g?e:g,s=Object.create(a.prototype),l=new _(r||[]);return s._invoke=(o=t,i=n,u=l,c=p,function(t,e){if(c===h)throw new Error("");if(c===m){if("throw"===t)throw e;return j()}for(u.method=t,u.arg=e;;){var n=u.delegate;if(n){var r=I(n,u);if(r){if(r===y)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===p)throw c=m,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=h;var a=f(o,i,u);if("normal"===a.type){if(c=u.done?m:d,a.arg===y)continue;return{value:a.arg,done:u.done}}"throw"===a.type&&(c=m,u.method="throw",u.arg=a.arg)}}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}i.wrap=u;var p="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function g(){}function o(){}function s(){}var v={};v[a]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(P([])));w&&w!==t&&l.call(w,a)&&(v=w);var x=s.prototype=g.prototype=Object.create(v);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(c,s){var e;this._invoke=function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,a){var o=f(c[t],c,n);if("throw"!==o.type){var i=o.arg,u=i.value;return u&&"object"==typeof u&&l.call(u,"__await")?s.resolve(u.__await).then(function(t){e("next",t,r,a)},function(t){e("throw",t,r,a)}):s.resolve(u).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,a)})}a(o.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function I(t,e){var n=t.iterator[e.method];if(n===c){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=c,I(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("")}return y}var r=f(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,y;var a=r.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=c),e.delegate=null,y):a:(e.method="throw",e.arg=new TypeError(""),e.delegate=null,y)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=c,t.done=!0,t};return r.next=r}}return{next:j}}function j(){return{value:c,done:!0}}return o.prototype=x.constructor=s,s.constructor=o,s[r]=o.displayName="GeneratorFunction",i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===o||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(x),t},i.awrap=function(t){return{__await:t}},E(S.prototype),S.prototype[n]=function(){return this},i.AsyncIterator=S,i.async=function(t,e,n,r,a){void 0===a&&(a=Promise);var o=new S(u(t,e,n,r),a);return i.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(x),x[r]="Generator",x[a]=function(){return this},x.toString=function(){return"[object Generator]"},i.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},i.values=P,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=c),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var a=this.tryEntries[e],o=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var i=l.call(a,"catchLoc"),u=l.call(a,"finallyLoc");if(i&&u){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(i){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!u)throw new Error("");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;k(n)}return a}}throw new Error("")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=c),y}},i}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function S(t,e,n,r,a,o,i){try{var u=t[o](i),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,a)}var kt=function(u){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=u.apply(t,i);function a(t){S(r,e,n,a,o,"next",t)}function o(t){S(r,e,n,a,o,"throw",t)}a(void 0)})}};function _t(a,o,i){return new Promise(function(e,n){return o()?e(a):i<1?n(Q(Q({},a),{},{queue:!0})):(r=10,new Promise(function(t){return setTimeout(t,r)})).then(function(t){return _t(a,o,i-10).then(e,n)});var r})}function Pt(u,t,c){var s=t(),e=u.getState(),l=e.plugins,n=e.context,f=e.queue,p=e.user;if(!n.offline&&f&&f.actions&&f.actions.length){var r=f.actions.reduce(function(t,e,n){return l[e.plugin].loaded?(t.process.push(e),t.processIndex.push(n)):(t.requeue.push(e),t.requeueIndex.push(n)),t},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(r.processIndex&&r.processIndex.length){r.processIndex.forEach(function(t){var e=f.actions[t],n=e.plugin,r=e.payload.type,a=s[n][r];if(a&&nt(a)){var o=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return[wt,xt].reduce(function(t,e){return function(t,e,n){if(t.hasOwnProperty(n)&&!t[n]&&e[n])return Object.assign({},t,d({},"".concat(n),e[n]));return t}(t,n,e)},t)}(e.payload,p);a({payload:o,config:l[n].config,instance:c});var i="".concat(r,":").concat(n);u.dispatch(Q(Q({},o),{},{type:i,_:{called:i,from:"queueDrain"}}))}});var a=f.actions.filter(function(t,e){return!~r.processIndex.indexOf(e)});f.actions=a}}}var I=function(t){if(Array.isArray(t))return t};var O=function(t,e){var n=[],r=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(a)throw o}}return n};var k=function(){throw new TypeError("")};var _=function(t,e){return I(t)||O(t,e)||k()};function P(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(e).filter(function(t){var e=r.plugins||{};return!1!==e[t]&&(!0===e[t]||!1!==e.all&&(!n[t]||!1!==n[t].enabled))}).map(function(t){return e[t]})}var j=/Start$/,A=/^bootstrap/,N=/^ready/;function jt(t,e,n,r,a){return T.apply(this,arguments)}function T(){return(T=kt(Ot.mark(function t(e,n,r,a,o){var i,u,c,s,l,f,p,d,h,m,y,g;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=nt(n)?n():n,u=e.type,c=u.replace(j,""),e._&&e._.called)return t.abrupt("return",e);t.next=5;break;case 5:return s=r.getState(),l=P(i,s.plugins,e.options),f=l.map(function(t){return t.name}),p=V(u,l,i),t.next=11,M({action:e,data:{exact:p.before,namespaced:p.beforeNS},state:s,allPlugins:i,allMatches:p,instance:r,store:a,EVENTS:o});case 11:if(F(d=t.sent,f.length))return t.abrupt("return",d);t.next=14;break;case 14:if(u!==c){t.next=18;break}h=d,t.next=21;break;case 18:return t.next=20,M({action:Q(Q({},d),{},{type:c}),data:{exact:p.during,namespaced:p.duringNS},state:s,allPlugins:i,allMatches:p,instance:r,store:a,EVENTS:o});case 20:h=t.sent;case 21:if(u.match(j))return m="".concat(c,"End"),t.next=25,M({action:Q(Q({},h),{},{type:m}),data:{exact:p.after,namespaced:p.afterNS},state:s,allPlugins:i,allMatches:p,instance:r,store:a,EVENTS:o});t.next=28;break;case 25:y=t.sent,(g=L(y))&&g({payload:y});case 28:return t.abrupt("return",d);case 29:case"end":return t.stop()}},t)}))).apply(this,arguments)}function L(r){return!!r.meta&&Object.keys(r.meta).reduce(function(t,e){var n=r.meta[e];return nt(n)?n:t},!1)}function M(t){return z.apply(this,arguments)}function z(){return(z=kt(Ot.mark(function t(e){var y,i,g,n,v,r,b,a,w,o,x,E,u,S,I,O,c,s;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return y=e.data,i=e.action,g=e.instance,n=e.state,v=e.allPlugins,r=e.allMatches,b=e.store,a=e.EVENTS,w=n.plugins,o=n.context,x=i.type,E=x.match(j),u=y.exact.map(function(t){return t.pluginName}),E&&(u=r.during.map(function(t){return t.pluginName})),S=B(g,u),I=y.exact.reduce(function(t,e){var n=e.pluginName,r=e.methodName,a=!1;return r.match(/^initialize/)||r.match(/^reset/)||(a=!w[n].loaded),o.offline&&r.match(/^(page|track|identify)/)&&(a=!0),t["".concat(n)]=a,t},{}),t.next=10,y.exact.reduce(function(){var r=kt(Ot.mark(function t(e,n,r){var c,a,o;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return c=n.pluginName,t.next=3,e;case 3:if(a=t.sent,y.namespaced&&y.namespaced[c])return t.next=7,y.namespaced[c].reduce(function(){var r=kt(Ot.mark(function t(e,n,r){var a,o,i,u;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=function(r,a,o){return function(t,e){var n=o||a;return Q(Q({},r),{},{abort:{reason:t,plugins:e||[a],caller:x,from:n}})}},t.next=3,e;case 3:if(a=t.sent,n.method&&nt(n.method)){t.next=6;break}return t.abrupt("return",a);case 6:return X(n.methodName,n.pluginName),t.next=9,n.method({payload:a,instance:g,abort:o(a,c,n.pluginName),config:q(n.pluginName,w,v),plugins:w});case 9:return i=t.sent,u=at(i)?i:{},t.abrupt("return",Promise.resolve(Q(Q({},a),u)));case 12:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));t.next=11;break;case 7:o=t.sent,a[c]=o,t.next=12;break;case 11:a[c]=i;case 12:return t.abrupt("return",Promise.resolve(a));case 13:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve({}));case 10:return O=t.sent,t.next=13,y.exact.reduce(function(){var r=kt(Ot.mark(function t(e,n,r){var a,o,i,u,c,s,l,f,p,d,h,m;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=y.exact.length===r+1,o=n.pluginName,i=v[o],t.next=5,e;case 5:if(u=t.sent,c=O[o]?O[o]:{},E&&(c=u),U(c,o))return D({data:c,method:x,instance:g,pluginName:o,store:b}),t.abrupt("return",Promise.resolve(u));t.next=11;break;case 11:if(U(u,o))return a&&D({data:u,method:x,instance:g,store:b}),t.abrupt("return",Promise.resolve(u));t.next=14;break;case 14:if(I.hasOwnProperty(o)&&!0===I[o])return b.dispatch({type:"queue",plugin:o,payload:c,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(u));t.next=17;break;case 17:return s=S(O[o],v[o]),t.next=20,i[x]({hello:o,abort:s.abort,payload:c,instance:g,config:q(o,w,v),plugins:w});case 20:return l=t.sent,f=at(l)?l:{},p=Q(Q({},u),f),U(d=O[o],o)?D({data:d,method:x,instance:g,pluginName:o,store:b}):(h="".concat(x,":").concat(o),(h.match(/:/g)||[]).length<2&&!x.match(A)&&!x.match(N)&&(m=E?p:c,g.dispatch(Q(Q({},m),{},{type:h,_:{called:h,from:"submethod"}})))),t.abrupt("return",Promise.resolve(p));case 26:case"end":return t.stop()}},t)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));case 13:if(c=t.sent,x.match(j)||x.match(/^registerPlugin/)||x.match(N)||x.match(A)||x.match(/^params/)||x.match(/^userIdChanged/)){t.next=21;break}if(a.plugins.includes(x),c._&&c._.originalAction===x)return t.abrupt("return",c);t.next=18;break;case 18:s=Q(Q({},c),{_:{originalAction:c.type,called:c.type,from:"engineEnd"}}),F(c,y.exact.length)&&!x.match(/End$/)&&(s=Q(Q({},s),{type:c.type+"Aborted"})),b.dispatch(s);case 21:return t.abrupt("return",c);case 22:case"end":return t.stop()}},t)}))).apply(this,arguments)}function D(t){var e=t.data,n=t.method,r=(t.instance,t.pluginName),a=n+"Aborted"+(r?":"+r:"");t.store.dispatch(Q(Q({},e),{},{type:a,_:{called:a,from:"abort"}}))}function q(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function R(n,t){return t.reduce(function(t,e){return e[n]?t.concat({methodName:n,pluginName:e.name,method:e[n]}):t},[])}function C(t,e){var n=t.replace(j,""),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function V(c,s,t){var e=C(c).map(function(t){return R(t,s)});return s.reduce(function(t,e){var n=e.name,r=C(c,n).map(function(t){return R(t,s)}),a=_(r,3),o=a[0],i=a[1],u=a[2];return o.length&&(t.beforeNS[n]=o),i.length&&(t.duringNS[n]=i),u.length&&(t.afterNS[n]=u),t},{before:e[0],beforeNS:{},during:e[1],duringNS:{},after:e[2],afterNS:{}})}function U(t,e){var n=t.abort;return!!n&&(!0===n||($(n,e)||n&&$(n.plugins,e)))}function F(t,e){var n=t.abort;if(!n)return!1;if(!0===n||rt(n))return!0;var r=n.plugins;return G(n)&&n.length===e||G(r)&&r.length===e}function G(t){return Array.isArray(t)}function $(t,e){return!(!t||!G(t))&&t.includes(e)}function B(m,y){return function(t,e,n){var r=e.config,a=e.name,o="".concat(a,".").concat(t.type);n&&(o=n.event);var i,u,c,s,l,f,p,d,h=t.type.match(j)?(c=a,s=o,l=y,f=n,p=t,function(t,e){var n=f?f.name:c,r=e&&G(e)?e:l;if(f&&(!(r=e&&G(e)?e:[c]).includes(c)||1!==r.length))throw new Error("Method ".concat(s," can only abort ").concat(c," plugin. ").concat(JSON.stringify(r)," input valid"));return Q(Q({},p),{},{abort:{reason:t,plugins:r,caller:s,_:n}})}):(i=t,u=o,function(){throw new Error(i.type+" action not cancellable. Remove abort in "+u)});return{payload:(d=t,Object.keys(d).reduce(function(t,e){return"type"===e||(at(d[e])?t[e]=Object.assign({},d[e]):t[e]=d[e]),t},{})),instance:m,config:r||{},abort:h}}}function X(t,e){var n=J(t);if(n&&n.name===e){var r=J(n.method),a=r?"or "+r.method:"";throw new Error([e+" plugin is calling method "+t,"Plugins cant call themselves","Use ".concat(n.method," ").concat(a," in ").concat(e," plugin insteadof ").concat(t)].join("\n"))}}function J(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function At(){return(new Date).getTime()}var W=function(t,e){if(!(t instanceof e))throw new TypeError("")},Nt=function t(){var i=this;W(this,t),d(this,"before",[]),d(this,"after",[]),d(this,"addMiddleware",function(t,e){i[e]=i[e].concat(t)}),d(this,"removeMiddleware",function(e,t){var n=i[t].findIndex(function(t){return t===e});-1!==n&&(i[t]=[].concat(Z(i[t].slice(0,n)),Z(i[t].slice(n+1))))}),d(this,"dynamicMiddlewares",function(o){return function(a){return function(r){return function(t){var e={getState:a.getState,dispatch:function(t){return a.dispatch(t)}},n=i[o].map(function(t){return t(e)});return lt.apply(void 0,Z(n))(r)(t)}}}})},Tt={};var Y,H,Lt,Mt;Y=function(){if(!ot)return!1;var t=navigator.appVersion;return~t.indexOf("Win")?"Windows":~t.indexOf("Mac")?"MacOS":~t.indexOf("X11")?"UNIX":~t.indexOf("Linux")?"Linux":"Unknown OS"}(),H=ot?document.referrer:null,Lt=function(){if(!ot)return null;var t=navigator,e=t.language,n=t.languages,r=t.userLanguage;return n&&n.length?n[0]:r||e}(),Mt="undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone;var zt={initialized:!1,sessionId:ut(),app:null,version:null,debug:!1,offline:!!ot&&!navigator.onLine,os:{name:Y},userAgent:ot?navigator.userAgent:"node",library:{name:E,version:"0.5.2"},timezone:Mt,locale:Lt,campaign:{},referrer:H};function Dt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:zt,e=1<arguments.length?arguments[1]:void 0,n=t.initialized,r=e.type,a=e.campaign;switch(r){case dt.campaign:return Q(Q({},t),{campaign:a});case dt.offline:return Q(Q({},t),{offline:!0});case dt.online:return Q(Q({},t),{offline:!1});default:return n?t:Q(Q(Q({},zt),t),{initialized:!0})}}var qt=["plugins","reducers","storage"];function Rt(t){var e=t;try{e=JSON.parse(JSON.stringify(t))}catch(t){}return e}var Ct=/#.*$/;function Vt(t){var e=function(){if(ot)for(var t,e=document.getElementsByTagName("link"),n=0;t=e[n];n++)if("canonical"===t.getAttribute("rel"))return t.getAttribute("href")}();return e?e.match(/\?/)?e:e+t:window.location.href.replace(Ct,"")}var Ut=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!ot)return t;var e,n,r=document,a=r.title,o=r.referrer,i=window,u=i.location,c=i.innerWidth,s=i.innerHeight,l=u.hash,f=u.search,p=Vt(f),d={title:a,url:p,path:(e=p,n=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e),"/"+(n&&n[3]?n[3].split("?")[0].replace(Ct,""):"")),hash:l,search:f,width:c,height:s};return o&&""!==o&&(d.referrer=o),Q(Q({},d),t)},Ft={last:{},history:[]};function Gt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Ft,e=1<arguments.length?arguments[1]:void 0,n=e.properties,r=e.options,a=e.meta;switch(e.type){case dt.page:var o=Rt(Q({properties:n,meta:a},Object.keys(r).length&&{options:r}));return Q(Q({},t),{last:o,history:t.history.concat(o)});default:return t}}var $t={last:{},history:[]};function Bt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:$t,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.meta,a=e.options,o=e.event,i=e.properties;switch(n){case dt.track:var u=Rt(Q(Q({event:o,properties:i},Object.keys(a).length&&{options:a}),{},{meta:r}));return Q(Q({},t),{last:u,history:t.history.concat(u)});default:return t}}var Xt={actions:[]};function Jt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Xt,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.payload;switch(n){case"queue":var a;return a=r&&r.type&&r.type===dt.identify?[e].concat(t.actions):t.actions.concat(e),Q(Q({},t),{},{actions:a});case"dequeue":return[];default:return t}}function Wt(e){var n=function(t,e,n){if(!ot)return!1;var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(t){r(t,e)})}.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return n(!0),function(t){return n(!1)}}function Yt(){return Array.prototype.slice.call(arguments).reduce(function(t,e){return t||(nt(e)?e:t)},!1)}function Ht(){var i="__"+E+"__";return et[i]=[],function(o){return function(t,e,n){var r=o(t,e,n),a=r.dispatch;return Object.assign(r,{dispatch:function(t){var e=t.action||t;return et[i].push(e),a(t)}})}}}function Zt(t){return function(){return lt(lt.apply(null,arguments),Ht())}}var Kt=function(t,e,n){return{type:dt.setItemStart,timestamp:At(),key:t,value:e,options:n}},Qt=function(t,e){return{type:dt.removeItemStart,timestamp:At(),key:t,options:e}};function te(){var o,t,e,s,l,f,p,n,d,h,i,b,w,x,E,u,r,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=a.reducers||{},m=(a.plugins||[]).reduce(function(t,n){if(nt(n))return t.middlewares=t.middlewares.concat(n),t;if(n.NAMESPACE&&(n.name=n.NAMESPACE),!n.name)throw new Error("https://lytics.dev/errors/1");var e=n.EVENTS?Object.keys(n.EVENTS).map(function(t){return n.EVENTS[t]}):[];if(n.methods){if(Et.includes(n.name))throw new Error(n.name+" is reserved plugin name");t.methods[n.name]=Object.keys(n.methods).reduce(function(t,e){var r;return t[e]=(r=n.methods[e],function(){var n=Array.prototype.slice.call(arguments),t=Array.apply(null,Array(r.length)).map(function(){}).map(function(t,e){if(n[e]||!1===n[e]||null===n[e])return n[e]}).concat(q);return r.apply({instance:q},t)}),t},{}),delete n.methods}var r=Object.keys(n).concat(e),a=new Set(t.events.concat(r));if(t.events=Array.from(a),t.pluginsArray=t.pluginsArray.concat(n),t.plugins[n.name])throw new Error(n.name+" already loaded");return t.plugins[n.name]=n,t.plugins[n.name].loaded||(t.plugins[n.name].loaded=function(){return!0}),t},{plugins:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),y=a.storage?a.storage:{getItem:function(t){return et[t]},setItem:function(t,e){return et[t]=e},removeItem:function(t){return et[t]=void 0}},g=(o=y,function(t,e,n){var r=e.getState("user")[t];if(r)return r;if(n&&at(n)&&n[t])return n[t];var a=St({},o)[t];return a||(et[It(t)]?et[It(t)]:null)}),v=m.plugins,S=m.events.filter(function(t){return!pt.includes(t)}),I=new Set(S.concat(ft).filter(function(t){return!pt.includes(t)})),O=Array.from(I).sort(),k=S.sort(),_=function(){return v},P=new Nt,j=P.addMiddleware,A=P.removeMiddleware,N=P.dynamicMiddlewares,T=function(){throw new Error("Abort disabled in listener")},L=function(e,n){return function(t){n&&n(t),e(t)}},M=it(),z=St(M,y),D=Q({enable:function(t,e){var n,r;Y.dispatch((n=t,r=e,{type:dt.enablePlugin,name:n,callback:r,_:{originalAction:dt.enablePlugin}}))},disable:function(t,e){var n,r;Y.dispatch((n=t,r=e,{type:dt.disablePlugin,name:n,callback:r,_:{originalAction:dt.disablePlugin}}))},load:function(t){Y.dispatch({type:dt.loadPlugin,plugins:t?[t]:Object.keys(_())})}},m.methods),q={identify:function(t,n,r,a){var o=rt(t)?t:null,i=at(t)?t:n,u=r||{},c=q.user(),s=(et[It(wt)]=o)||i.userId||g(wt,q,i);return new Promise(function(t,e){Y.dispatch(Q(Q({type:dt.identifyStart,userId:s,traits:i||{},options:u,anonymousId:c.anonymousId},c.id&&c.id!==o&&{previousId:c.id}),{},{meta:{timestamp:At(),callback:L(t,Yt(n,r,a))}}))})},track:function(t,n,r,a){var o=at(t)?t.event:t;if(!o||!rt(o))throw new Error("Event missing");var i=at(t)?t:n||{},u=at(r)?r:{};return new Promise(function(t,e){Y.dispatch({type:dt.trackStart,event:o,properties:i,options:u,userId:g(wt,q,n),anonymousId:g(xt,q,n),meta:{timestamp:At(),callback:L(t,Yt(n,r,a))}})})},page:function(n,r,a){var o=at(n)?n:{},i=at(r)?r:{};return new Promise(function(t,e){Y.dispatch({type:dt.pageStart,properties:Ut(o),options:i,userId:g(wt,q,o),anonymousId:g(xt,q,o),meta:{timestamp:At(),callback:L(t,Yt(n,r,a))}})})},user:function(t){if(t===wt||"id"===t)return g(wt,q);var e=q.getState("user");return t?tt(e,t):e},reset:function(n){return new Promise(function(t,e){Y.dispatch({type:dt.resetStart,timestamp:At(),callback:L(t,n)})})},ready:function(t){return q.on(dt.ready,t)},on:function(n,r){if(!n||!nt(r))return!1;if(n===dt.bootstrap)throw new Error(".on disabled for "+n);var a=/Start$|Start:/;if("*"===n){var t=function(t){return function(e){return function(t){return t.type.match(a)&&r({payload:t,instance:q,plugins:v}),e(t)}}},e=function(t){return function(e){return function(t){return t.type.match(a)||r({payload:t,instance:q,plugins:v}),e(t)}}};return j(t,ee),j(e,ne),function(){A(t,ee),A(e,ne)}}var o=n.match(a)?ee:ne,i=function(t){return function(e){return function(t){return t.type===n&&r({payload:t,instance:q,plugins:v,abort:T}),e(t)}}};return j(i,o),function(){return A(i,o)}},once:function(t,n){if(!t||!nt(n))return!1;if(t===dt.bootstrap)throw new Error(".once disabled for "+t);var r=q.on(t,function(t){var e=t.payload;n({payload:e,instance:q,plugins:v,abort:T}),r()});return r},getState:function(t){var e=Y.getState();return t?tt(e,t):Object.assign({},e)},dispatch:function(t){var e,n=rt(t)?{type:t}:t;if(e=n.type,ft.includes(e))throw new Error("reserved action "+n.type);var r=n.meta||{},a=t._||{},o=Q(Q({},n),{},{meta:Q({timestamp:At()},r),_:Q({originalAction:n.type},a)});Y.dispatch(o)},enablePlugin:D.enable,disablePlugin:D.disable,loadPlugin:D.load,plugins:D,storage:{getItem:y.getItem,setItem:function(t,e,n){Y.dispatch(Kt(t,e,n))},removeItem:function(t,e){Y.dispatch(Qt(t,e))}},setAnonymousId:function(t,e){q.storage.setItem(ht,t,e)},events:{all:O,core:ft,plugins:k}},R=m.middlewares.concat([N(ee),(b=q,w=_,x={all:O,plugins:k},E={},function(v){return function(g){return e=kt(Ot.mark(function t(e){var n,r,a,o,i,u,c,s,l,f,p,d,h,m,y;return Ot.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.type,r=e.name,a=e.callback,(o=e).abort)return t.abrupt("return",g(e));t.next=4;break;case 4:if(n!==dt.disablePlugin&&n!==dt.enablePlugin||nt(a)&&a(r),n===dt.loadPlugin)return i=w(),u=Object.keys(i).filter(function(t){return e.plugins.includes(t)}).reduce(function(t,e){return t[e]=i[e],t},{}),c={type:dt.initializeStart,plugins:e.plugins},t.next=11,jt(c,u,b,v,x);t.next=13;break;case 11:return s=t.sent,t.abrupt("return",g(s));case 13:if(n===dt.initializeEnd&&(l=w(),f=Object.keys(l),p=f.filter(function(t){return e.plugins.includes(t)}).map(function(t){return l[t]}),d=[],h=[],m=p.map(function(e){var t=e.loaded,n=e.name;return _t(e,t,1e4).then(function(t){E[n]||(v.dispatch({type:dt.pluginReadyType(n),name:n,events:Object.keys(e).filter(function(t){return!pt.includes(t)})}),E[n]=!0),d=d.concat(n)}).catch(function(t){if(t instanceof Error)throw new Error(t);return h=h.concat(t.name),t})}),Promise.all(m).then(function(t){setTimeout(function(){f.length===m.length&&v.dispatch({type:dt.ready,plugins:d,failed:h})},0)})),n!==dt.bootstrap)return/^ready:([^:]*)$/.test(n)&&setTimeout(function(){return Pt(v,w,b)},0),t.next=18,jt(e,w,b,v,x);t.next=20;break;case 18:return y=t.sent,t.abrupt("return",g(y));case 20:return t.abrupt("return",g(o));case 21:case"end":return t.stop()}},t)})),function(t){return e.apply(this,arguments)};var e}}),(i=y,function(t){return function(o){return function(t){var e=t.type,n=t.key,r=t.value,a=t.options;if(e===dt.setItem||e===dt.removeItem){if(t.abort)return o(t);e===dt.setItem?i.setItem(n,r,a):i.removeItem(n,a)}return o(t)}}}),(p=q,n=p.storage,d=n.setItem,h=n.getItem,function(c){return function(u){return function(t){if(t.type===dt.bootstrap){var a=t.params,e=t.user;h(ht)||d(ht,e.anonymousId);var n=Object.keys(t.params);if(n.length){var r=a.an_uid,o=a.an_event,i=n.reduce(function(t,e){if(e.match(gt)||e.match(/^(d|g)clid/)){var n=e.replace(gt,""),r="campaign"===n?"name":n;t.campaign[r]=a[e]}return e.match(vt)&&(t.props[e.replace(vt,"")]=a[e]),e.match(bt)&&(t.traits[e.replace(bt,"")]=a[e]),t},{campaign:{},props:{},traits:{}});c.dispatch(Q(Q({type:dt.params,raw:a},i),r?{userId:r}:{})),r&&setTimeout(function(){return p.identify(r,i.traits)},0),o&&setTimeout(function(){return p.track(o,i.props)},0),Object.keys(i.campaign).length&&c.dispatch({type:dt.campaign,campaign:i.campaign})}}return u(t)}}}),(t=q,e=t.storage,s=e.setItem,l=e.removeItem,f=e.getItem,function(c){return function(u){return function(t){var e=t.userId,n=t.traits,r=t.options,a=t.callback;if(t.type===dt.reset&&([mt,yt,ht].forEach(function(t){return l(t)}),[wt,xt,"traits"].forEach(function(t){et[It(t)]=void 0}),nt(a)&&a()),t.type===dt.identify){f(ht)||s(ht,ut());var o=f(mt),i=f(yt)||{};o&&o!==e&&c.dispatch({type:dt.userIdChanged,old:{userId:o,traits:i},new:{userId:e,traits:n},options:r}),e&&s(mt,e),n&&s(yt,Q(Q({},i),n))}return u(t)}}}),N(ne)]),C={context:Dt,user:(r=y,function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(e&&e.type===dt.setItemEnd&&e.key===ht)return Object.assign({},t,{anonymousId:e.value});switch(e.type){case dt.identify:return Object.assign({},t,{userId:e.userId,traits:Q(Q({},t.traits),e.traits)});case dt.reset:return[wt,xt,"traits"].forEach(function(t){et[It(t)]=null}),[mt,ht,yt].forEach(function(t){r.removeItem(t)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}),page:Gt,track:Bt,plugins:(u=_,function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Tt,t=1<arguments.length?arguments[1]:void 0,e={};if("initialize:aborted"===t.type)return n;if(/^registerPlugin:([^:]*)$/.test(t.type)){var r=t.type.split(":")[1],a=u()[r];return a&&r?(e[r]={enabled:!0,initialized:!a.initialize,loaded:Boolean(a.loaded()),config:a.config||{}},Q(Q({},n),e)):n}if(/^initialize:([^:]*)$/.test(t.type)){var o=t.type.split(":")[1],i=u()[o];return i&&o?(e[o]=Q(Q({},n[o]),{initialized:!0,loaded:Boolean(i.loaded())}),Q(Q({},n),e)):n}if(/^ready:([^:]*)$/.test(t.type))return e[t.name]=Q(Q({},n[t.name]),{loaded:!0}),Q(Q({},n),e);switch(t.type){case dt.disablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=Q(Q({},n[e]),{enabled:!1}),t},n):e[t.name]=Q(Q({},n[t.name]),{enabled:!1}),Q(Q({},n),e);case dt.enablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=Q(Q({},n[e]),{enabled:!0}),t},n):e[t.name]=Q(Q({},n[t.name]),{enabled:!0}),Q(Q({},n),e);default:return n}}),queue:Jt},V=lt,U=lt;if(ot&&a.debug){var F=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;F&&(V=F({trace:!0,traceLimit:25})),U=function(){return 0===arguments.length?Ht():at(K(arguments[0]))?Zt(arguments[0]):Zt().apply(null,arguments)}}var G,$,B,X,J=(G=a,Object.keys(G).reduce(function(t,e){return qt.includes(e)||(t[e]=G[e]),t},{})),W={context:J,user:z,plugins:m.pluginsArray.reduce(function(t,e){var n=e.name,r=e.config,a=e.loaded;return t[n]={enabled:!0,initialized:Boolean(!e.initialize),loaded:Boolean(a()),config:r||{}},t},{})},Y=ct(st(Q(Q({},C),c)),W,U(V(function(){for(var t=arguments.length,c=new Array(t),e=0;e<t;e++)c[e]=arguments[e];return function(u){return function(t,e,n){var r,a=u(t,e,n),o=a.dispatch,i={getState:a.getState,dispatch:function(t){return o(t)}};return r=c.map(function(t){return t(i)}),o=lt.apply(void 0,Z(r))(a.dispatch),Q(Q({},a),{},{dispatch:o})}}}.apply(void 0,Z(R))))),H=Object.keys(v);return Y.dispatch({type:dt.bootstrap,plugins:H,config:J,params:M,user:z}),Y.dispatch({type:dt.registerPlugins,plugins:H}),m.pluginsArray.map(function(t,e){var n=t.bootstrap,r=t.config;n&&nt(n)&&n({instance:q,config:r,payload:t});var a=m.pluginsArray.length===e+1;Y.dispatch({type:dt.registerPluginType(t.name),name:t.name,plugin:t}),a&&Y.dispatch({type:dt.initializeStart,plugins:H})}),Wt(function(t){Y.dispatch({type:t?dt.offline:dt.online})}),$=Y,B=_,X=q,setInterval(function(){return Pt($,B,X)},3e3),q}var ee="before",ne="after";return t.default=te,t.init=te,t.Analytics=te,t.EVENTS=dt,t.CONSTANTS=x,t}({});

@@ -68,2 +68,47 @@ declare module "analytics" {

/**
* Management methods for plugins. This is also where [custom methods](https://bit.ly/329vFXy) are loaded into the instance.
* @typedef {Object} Plugins
* @property {EnablePlugin} enable - Set storage value
* @property {DisablePlugin} disable - Remove storage value
* @example
*
* // Enable a plugin by namespace
* analytics.plugins.enable('keenio')
*
* // Disable a plugin by namespace
* analytics.plugins.disable('google-analytics')
*/
type Plugins = {
enable: EnablePlugin;
disable: DisablePlugin;
};
/**
* Enable analytics plugin
* @typedef {Function} EnablePlugin
* @param {String|Array} plugins - name of plugins(s) to disable
* @param {Function} [callback] - callback after enable runs
* @example
*
* analytics.plugins.enable('google')
*
* // Enable multiple plugins at once
* analytics.plugins.enable(['google', 'segment'])
*/
type EnablePlugin = (plugins: string | any[], callback?: (...params: any[]) => any) => void;
/**
* Disable analytics plugin
* @typedef {Function} DisablePlugin
* @param {String|Array} name - name of integration(s) to disable
* @param {Function} callback - callback after disable runs
* @example
*
* analytics.plugins.disable('google')
*
* analytics.plugins.disable(['google', 'segment'])
*/
type DisablePlugin = (name: string | any[], callback: (...params: any[]) => any) => void;
/**
* Analytic instance returned from initialization

@@ -81,4 +126,3 @@ * @typedef {Object} AnalyticsInstance

* @property {Storage} storage - storage methods
* @property {EnablePlugin} enablePlugin - Enable plugin
* @property {DisablePlugin} disablePlugin - Disable plugin
* @property {Plugins} plugins - plugin methods
*/

@@ -96,4 +140,3 @@ type AnalyticsInstance = {

storage: Storage;
enablePlugin: EnablePlugin;
disablePlugin: DisablePlugin;
plugins: Plugins;
};

@@ -355,29 +398,2 @@

/**
* Enable analytics plugin
* @typedef {Function} EnablePlugin
* @param {String|Array} plugins - name of plugins(s) to disable
* @param {Function} [callback] - callback after enable runs
* @example
*
* analytics.enablePlugin('google')
*
* // Enable multiple plugins at once
* analytics.enablePlugin(['google', 'segment'])
*/
type EnablePlugin = (plugins: string | any[], callback?: (...params: any[]) => any) => void;
/**
* Disable analytics plugin
* @typedef {Function} DisablePlugin
* @param {String|Array} name - name of integration(s) to disable
* @param {Function} callback - callback after disable runs
* @example
*
* analytics.disablePlugin('google')
*
* analytics.disablePlugin(['google', 'segment'])
*/
type DisablePlugin = (name: string | any[], callback: (...params: any[]) => any) => void;
/**
* Storage utilities for persisting data.

@@ -384,0 +400,0 @@ * These methods will allow you to save data in localStorage, cookies, or to the window.

{
"name": "@analytics/core",
"version": "0.5.2",
"version": "0.6.0",
"description": "Lightweight analytics library for tracking events, page views, & identifying users. Works with any third party analytics provider via an extendable plugin system.",

@@ -50,3 +50,3 @@ "keywords": [

"dependencies": {
"analytics-utils": "^0.2.1"
"analytics-utils": "^0.2.2"
},

@@ -80,3 +80,4 @@ "ava": {

"uglify-js": "^3.4.9"
}
},
"gitHead": "6235efa2a3431d781a29a91c82e4aeb2b2aec1d9"
}

@@ -30,4 +30,2 @@ # Analytics Core

* [analytics.getState](#analyticsgetstate)
* [analytics.enablePlugin](#analyticsenableplugin)
* [analytics.disablePlugin](#analyticsdisableplugin)
* [analytics.storage](#analyticsstorage)

@@ -37,2 +35,5 @@ * [analytics.storage.getItem](#analyticsstoragegetitem)

* [analytics.storage.removeItem](#analyticsstorageremoveitem)
* [analytics.plugins](#analyticsplugins)
* [analytics.plugins.enable](#analyticspluginsenable)
* [analytics.plugins.disable](#analyticspluginsdisable)
- [Events](#events)

@@ -42,2 +43,3 @@ - [Analytic plugins](#analytic-plugins)

* [React to any event](#react-to-any-event)
* [Custom methods](#custom-methods)
- [Plugin Naming Conventions](#plugin-naming-conventions)

@@ -495,37 +497,2 @@ - [Debugging analytics](#debugging-analytics)

### analytics.enablePlugin
Enable analytics plugin
**Arguments**
- **plugins** <code>String</code>|<code>Array</code> - name of plugins(s) to disable
- **[callback]** (optional) <code>Function</code> - callback after enable runs
**Example**
```js
analytics.enablePlugin('google')
// Enable multiple plugins at once
analytics.enablePlugin(['google', 'segment'])
```
### analytics.disablePlugin
Disable analytics plugin
**Arguments**
- **name** <code>String</code>|<code>Array</code> - name of integration(s) to disable
- **callback** <code>Function</code> - callback after disable runs
**Example**
```js
analytics.disablePlugin('google')
analytics.disablePlugin(['google', 'segment'])
```
### analytics.storage

@@ -597,2 +564,51 @@

```
### analytics.plugins
Management methods for plugins. This is also where [custom methods](https://bit.ly/329vFXy) are loaded into the instance.
**Example**
```js
// Enable a plugin by namespace
analytics.plugins.enable('keenio')
// Disable a plugin by namespace
analytics.plugins.disable('google-analytics')
```
### analytics.plugins.enable
Enable analytics plugin
**Arguments**
- **plugins** <code>String</code>|<code>Array</code> - name of plugins(s) to disable
- **[callback]** (optional) <code>Function</code> - callback after enable runs
**Example**
```js
analytics.plugins.enable('google')
// Enable multiple plugins at once
analytics.plugins.enable(['google', 'segment'])
```
### analytics.plugins.disable
Disable analytics plugin
**Arguments**
- **name** <code>String</code>|<code>Array</code> - name of integration(s) to disable
- **callback** <code>Function</code> - callback after disable runs
**Example**
```js
analytics.plugins.disable('google')
analytics.plugins.disable(['google', 'segment'])
```
<!-- AUTO-GENERATED-CONTENT:END -->

@@ -812,2 +828,72 @@

### Custom methods
Analytics plugins can provide their own custom functionality via the `methods` key.
```js
import Analytics from 'analytics'
// Example plugin with custom methods
const pluginOne = {
name: 'one',
// ... page, track, etc
/* Custom functions to expose to analytics instance */
methods: {
myCustomThing(one, two, three) {
const analyticsInstance = this.instance
console.log('Use full analytics instance', analyticsInstance)
},
otherCustomThing: (one, two, ...args) => {
// Arrow functions break this.instance context.
// The instance is instead injected as last arg
const analyticsInstance = args[args.length - 1]
console.log('Use full analytics instance', analyticsInstance)
},
// Async function examples
async fireCustomThing(one, two, three) {
const { track } = this.instance
console.log(one, two, three)
return 'data'
},
triggerSpecial: async (argOne, argTwo, ...args) => {
// Arrow functions break this.instance context.
// The instance is instead injected as last arg
const analyticsInstance = args[args.length - 1]
return argOne + argTwo
}
}
}
// Example plugin with custom methods
const pluginTwo = {
name: 'two',
page: () => { console.log('page view fired') }
// ... page, track, etc
/* Custom functions to expose to analytics instance */
methods: {
cookieBanner(one, two, three) {
const analyticsInstance = this.instance
console.log('Use full analytics instance', analyticsInstance)
const cookieSettings = analyticsInstance.storage.getItem('preferences-set')
if (!cookieSettings) {
// Show cookie settings
}
},
}
}
// Initialize analytics instance with plugins
const analytics = Analytics({
app: 'your-app-name',
plugins: [
pluginOne,
pluginTwo
]
})
// Using custom methods in your code
analytics.plugins.one.myCustomThing()
analytics.plugins.two.cookieBanner()
```
## Plugin Naming Conventions

@@ -814,0 +900,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc