@cronapp/framework-analytics 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cronapp.framework.analytics.js +1 -0
- package/cronapp.json +38 -0
- package/cronapp.nls.json +6 -0
- package/icon.svg +130 -0
- package/package.json +24 -0
- package/src/main/browser/analyticsService.ts +80 -0
- package/src/main/browser/index.angularJs.ts +121 -0
- package/target/browser/cronapp.framework.analytics.js +1 -0
- package/tsconfig.json +12 -0
- package/webpack.config.js +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var t={305:function(t){t.exports=function(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}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{analytics:()=>t});var t={};n.r(t),n.d(t,{IAnalyticsPluginFactory:()=>mn,IAnalyticsService:()=>bn});var e=n(305),o=n.n(e),i="undefined",a="object",u="undefined"!=typeof process?process:{},c=(u.env&&u.env.NODE_ENV,"undefined"!=typeof document);function s(t,e){return e.charAt(0)[t]()+e.slice(1)}c&&window.location.hostname,null!=u.versions&&u.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,c&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var l=s.bind(null,"toUpperCase"),f=s.bind(null,"toLowerCase");function p(t,e){void 0===e&&(e=!0);var n=function(t){return h(t)?l("null"):"object"==typeof t?function(t){return g(t.constructor)?t.constructor.name:null}(t):Object.prototype.toString.call(t).slice(8,-1)}(t);return e?f(n):n}function d(t,e){return typeof e===t}var g=d.bind(null,"function"),y=d.bind(null,"string");function h(t){return null===t}function v(t,e){if("object"!=typeof e||h(e))return!1;if(e instanceof t)return!0;var n=p(new t(""));if(function(t){return t instanceof Error||y(t.message)&&t.constructor&&function(t){return"number"===p(t)&&!isNaN(t)}(t.constructor.stackTraceLimit)}(e))for(;e;){if(p(e)===n)return!0;e=Object.getPrototypeOf(e)}return!1}function m(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function b(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}function w(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function x(t,e,n){for(var r=e.length-1,o=0;o<r;++o){var i=e[o];if("__proto__"===i||"constructor"===i)break;i in t||(t[i]={}),t=t[i]}t[e[r]]=n}function O(){for(var t="",e=0,n=4294967295*Math.random()|0;e++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],o=15&n;t+="-"==r||"4"==r?r:("x"==r?o:3&o|8).toString(16),n=e%8==0?4294967295*Math.random()|0:n>>4}return t}d.bind(null,"undefined"),d.bind(null,"boolean"),d.bind(null,"symbol"),v.bind(null,TypeError),v.bind(null,SyntaxError),b(m,"form"),b(m,"button"),b(m,"input"),b(m,"select");var S="global",E="__global__",I=typeof self===a&&self.self===self&&self||typeof n.g===a&&n.g.global===n.g&&n.g||void 0;function j(t){return I[E][t]}function P(t,e){return I[E][t]=e}function k(t){delete I[E][t]}function _(t,e,n){var r;try{if(N(t)){var o=window[t];r=o[e].bind(o)}}catch(t){}return r||n}I[E]||(I[E]={});var A={};function N(t){if(typeof A[t]!==i)return A[t];try{var e=window[t];e.setItem(i,i),e.removeItem(i)}catch(e){return A[t]=!1}return A[t]=!0}var T,L="undefined"!=typeof process?process:{},M=(null==(T=L.env)||T.NODE_ENV,"undefined"!=typeof window);function D(t,e){return typeof e===t}M&&window.location.hostname,null!=L.versions&&L.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,M&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var C=D.bind(null,"function"),z=D.bind(null,"string"),R=(D.bind(null,"undefined"),D.bind(null,"boolean"));function U(t){if(!function(t){return t&&("object"==typeof t||null!==t)}(t))return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function $(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function V(t){return function(){return t.apply(void 0,[].slice.call(arguments).concat([].slice.call(arguments,1)))}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function F(t,e){if(t){if("string"==typeof t)return q(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(t,e):void 0}}function J(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||F(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t){return G="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},G(t)}function B(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function H(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){B(i,r,o,a,u,"next",t)}function u(t){B(i,r,o,a,u,"throw",t)}a(void 0)}))}}function W(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?X(Object(n),!0).forEach((function(e){W(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}V($),V($),V($),V($);var Z={exports:{}};!function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new k(r||[]);return i._invoke=function(t,e,n){var r=f;return function(o,i){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw i;return A()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=I(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=l(t,e,n);if("normal"===c.type){if(r=n.done?g:p,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=g,n.method="throw",n.arg=c.arg)}}}(t,n,a),i}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",g="completed",y={};function h(){}function v(){}function m(){}var b={};c(b,i,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(_([])));x&&x!==n&&r.call(x,i)&&(b=x);var O=m.prototype=h.prototype=Object.create(b);function S(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function I(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,I(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function j(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function _(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}return{next:A}}function A(){return{value:e,done:!0}}return v.prototype=m,c(O,"constructor",m),c(m,"constructor",v),v.displayName=c(m,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c(t,u,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},S(E.prototype),c(E.prototype,a,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new E(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(O),c(O,u,"Generator"),c(O,i,(function(){return this})),c(O,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=_,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.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;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(Z);var K=Z.exports,Q="function",tt="undefined",et="reducer",nt="@@redux/",rt=nt+"INIT",ot=nt+Math.random().toString(36),it=function(){return("undefined"==typeof Symbol?"undefined":G(Symbol))===Q&&Symbol.observable||"@@observable"}(),at=" != "+Q;function ut(t,e,n){if(G(e)===Q&&G(n)===tt&&(n=e,e=void 0),G(n)!==tt){if(G(n)!==Q)throw new Error("enhancer"+at);return n(ut)(t,e)}if(G(t)!==Q)throw new Error(et+at);var r=t,o=e,i=[],a=i,u=!1;function c(){a===i&&(a=i.slice())}function s(){return o}function l(t){if(G(t)!==Q)throw new Error("Listener"+at);var e=!0;return c(),a.push(t),function(){if(e){e=!1,c();var n=a.indexOf(t);a.splice(n,1)}}}function f(t){if(!U(t))throw new Error("Act != obj");if(G(t.type)===tt)throw new Error("ActType "+tt);if(u)throw new Error("Dispatch in "+et);try{u=!0,o=r(o,t)}finally{u=!1}for(var e=i=a,n=0;n<e.length;n++)(0,e[n])();return t}return f({type:rt}),W({dispatch:f,subscribe:l,getState:s,replaceReducer:function(t){if(G(t)!==Q)throw new Error("next "+et+at);r=t,f({type:rt})}},it,(function(){var t=l;return W({subscribe:function(e){if("object"!==G(e))throw new TypeError("Observer != obj");function n(){e.next&&e.next(s())}return n(),{unsubscribe:t(n)}}},it,(function(){return this}))}))}function ct(t,e){var n=e&&e.type;return"action "+(n&&n.toString()||"?")+et+" "+t+" returns "+tt}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))}}))}function lt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return function(n,r,o){var i,a=t(n,r,o),u=a.dispatch,c={getState:a.getState,dispatch:function(t){return u(t)}};return i=e.map((function(t){return t(c)})),u=st.apply(void 0,J(i))(a.dispatch),Y(Y({},a),{},{dispatch:u})}}}var ft="__anon_id",pt="__user_id",dt="__user_traits",gt="analytics",yt="userId",ht="anonymousId",vt=["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","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],mt=["name","EVENTS","config","loaded"],bt=vt.reduce((function(t,e){return t[e]=e,t}),{registerPluginType:function(t){return"registerPlugin:".concat(t)},pluginReadyType:function(t){return"ready:".concat(t)}}),wt=/^utm_/,xt=/^an_prop_/,Ot=/^an_trait_/;function St(t){var e=t.storage.setItem;return function(n){return function(r){return function(o){if(o.type===bt.bootstrap){var i=o.params,a=o.user,u=o.persistedUser,c=o.initialUser,s=u.userId===a.userId;u.anonymousId!==a.anonymousId&&e(ft,a.anonymousId),s||e(pt,a.userId),c.traits&&e(dt,Y(Y({},s&&u.traits?u.traits:{}),c.traits));var l=Object.keys(o.params);if(l.length){var f=i.an_uid,p=i.an_event,d=l.reduce((function(t,e){if(e.match(wt)||e.match(/^(d|g)clid/)){var n=e.replace(wt,""),r="campaign"===n?"name":n;t.campaign[r]=i[e]}return e.match(xt)&&(t.props[e.replace(xt,"")]=i[e]),e.match(Ot)&&(t.traits[e.replace(Ot,"")]=i[e]),t}),{campaign:{},props:{},traits:{}});n.dispatch(Y(Y({type:bt.params,raw:i},d),f?{userId:f}:{})),f&&setTimeout((function(){return t.identify(f,d.traits)}),0),p&&setTimeout((function(){return t.track(p,d.props)}),0),Object.keys(d.campaign).length&&n.dispatch({type:bt.campaign,campaign:d.campaign})}}return r(o)}}}}function Et(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.type===bt.setItemEnd){if(n.key===ft)return Y(Y({},e),{anonymousId:n.value});if(n.key===pt)return Y(Y({},e),{userId:n.value})}switch(n.type){case bt.identify:return Object.assign({},e,{userId:n.userId,traits:Y(Y({},e.traits),n.traits)});case bt.reset:return[pt,ft,dt].forEach((function(e){t.removeItem(e)})),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function It(t){return{userId:t.getItem(pt),anonymousId:t.getItem(ft),traits:t.getItem(dt)}}var jt=function(t){return"__TEMP__"+t};function Pt(t){var e=t.storage,n=e.setItem,r=e.removeItem,o=e.getItem;return function(t){return function(e){return function(i){var a=i.userId,u=i.traits,c=i.options;if(i.type===bt.reset&&([pt,dt,ft].forEach((function(t){r(t)})),[yt,ht,"traits"].forEach((function(t){k(jt(t))}))),i.type===bt.identify){o(ft)||n(ft,O());var s=o(pt),l=o(dt)||{};s&&s!==a&&t.dispatch({type:bt.userIdChanged,old:{userId:s,traits:l},new:{userId:a,traits:u},options:c}),a&&n(pt,a),u&&n(dt,Y(Y({},l),u))}return e(i)}}}}var kt={};function _t(t,e){kt[t]&&C(kt[t])&&(kt[t](e),delete kt[t])}function At(t,e,n){return new Promise((function(r,o){return e()?r(t):n<1?o(Y(Y({},t),{},{queue:!0})):new Promise((function(t){return setTimeout(t,10)})).then((function(i){return At(t,e,n-10).then(r,o)}))}))}function Nt(t,e,n){var r=e(),o=t.getState(),i=o.plugins,a=o.context,u=o.queue,c=o.user;if(!a.offline&&u&&u.actions&&u.actions.length){var s=u.actions.reduce((function(t,e,n){return i[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(s.processIndex&&s.processIndex.length){s.processIndex.forEach((function(e){var o=u.actions[e],a=o.plugin,s=o.payload.type,l=r[a][s];if(l&&C(l)){var f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[yt,ht].reduce((function(n,r){return t.hasOwnProperty(r)&&e[r]&&e[r]!==t[r]&&(n[r]=e[r]),n}),t)}(o.payload,c);l({payload:f,config:i[a].config,instance:n});var p="".concat(s,":").concat(a);t.dispatch(Y(Y({},f),{},{type:p,_:{called:p,from:"queueDrain"}}))}}));var l=u.actions.filter((function(t,e){return!~s.processIndex.indexOf(e)}));u.actions=l}}}function Tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(t).filter((function(t){var r=n.plugins||{};return R(r[t])?r[t]:!1!==r.all&&(!e[t]||!1!==e[t].enabled)})).map((function(e){return t[e]}))}var Lt=/Start$/,Mt=/^bootstrap/,Dt=/^ready/;function Ct(t,e,n,r,o){return zt.apply(this,arguments)}function zt(){return(zt=H(K.mark((function t(e,n,r,o,i){var a,u,c,s,l,f,p,d,g,y,h;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=C(n)?n():n,u=e.type,c=u.replace(Lt,""),!e._||!e._.called){t.next=5;break}return t.abrupt("return",e);case 5:return s=r.getState(),l=Tt(a,s.plugins,e.options),u===bt.initializeStart&&e.fromEnable&&(l=Object.keys(s.plugins).filter((function(t){var n=s.plugins[t];return e.plugins.includes(t)&&!n.initialized})).map((function(t){return a[t]}))),f=l.map((function(t){return t.name})),p=Jt(u,l),t.next=12,Rt({action:e,data:{exact:p.before,namespaced:p.beforeNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 12:if(!Bt(d=t.sent,f.length)){t.next=15;break}return t.abrupt("return",d);case 15:if(u!==c){t.next=19;break}g=d,t.next=22;break;case 19:return t.next=21,Rt({action:Y(Y({},d),{},{type:c}),data:{exact:p.during,namespaced:p.duringNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 21:g=t.sent;case 22:if(!u.match(Lt)){t.next=28;break}return y="".concat(c,"End"),t.next=26,Rt({action:Y(Y({},g),{},{type:y}),data:{exact:p.after,namespaced:p.afterNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 26:(h=t.sent).meta&&h.meta.hasCallback&&_t(h.meta.rid,{payload:h});case 28:return t.abrupt("return",d);case 29:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rt(t){return Ut.apply(this,arguments)}function Ut(){return Ut=H(K.mark((function t(e){var n,r,o,i,a,u,c,s,l,f,p,d,g,y,h,v,m,b;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.data,r=e.action,o=e.instance,i=e.state,a=e.allPlugins,u=e.allMatches,c=e.store,s=e.EVENTS,l=i.plugins,f=i.context,p=r.type,d=p.match(Lt),g=n.exact.map((function(t){return t.pluginName})),d&&(g=u.during.map((function(t){return t.pluginName}))),y=Xt(o,g),h=n.exact.reduce((function(t,e){var n=e.pluginName,r=e.methodName,o=!1;return r.match(/^initialize/)||r.match(/^reset/)||(o=!l[n].loaded),f.offline&&r.match(/^(page|track|identify)/)&&(o=!0),t["".concat(n)]=o,t}),{}),t.next=10,n.exact.reduce(function(){var t=H(K.mark((function t(e,i,u){var c,s,f;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=i.pluginName,t.next=3,e;case 3:if(s=t.sent,!n.namespaced||!n.namespaced[c]){t.next=11;break}return t.next=7,n.namespaced[c].reduce(function(){var t=H(K.mark((function t(e,n,r){var i,u,s,f;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=function(t,e,n){return function(r,o){var i=n||e;return Y(Y({},t),{},{abort:{reason:r,plugins:o||[e],caller:p,from:i}})}},t.next=3,e;case 3:if(i=t.sent,n.method&&C(n.method)){t.next=6;break}return t.abrupt("return",i);case 6:return Yt(n.methodName,n.pluginName),t.next=9,n.method({payload:i,instance:o,abort:u(i,c,n.pluginName),config:Vt(n.pluginName,l,a),plugins:l});case 9:return s=t.sent,f=U(s)?s:{},t.abrupt("return",Promise.resolve(Y(Y({},i),f)));case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve(r));case 7:f=t.sent,s[c]=f,t.next=12;break;case 11:s[c]=r;case 12:return t.abrupt("return",Promise.resolve(s));case 13:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve({}));case 10:return v=t.sent,t.next=13,n.exact.reduce(function(){var t=H(K.mark((function t(e,r,i){var u,s,f,g,m,b,w,x,O,S,E,I;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.exact.length===i+1,s=r.pluginName,f=a[s],t.next=5,e;case 5:if(g=t.sent,m=v[s]?v[s]:{},d&&(m=g),!Gt(m,s)){t.next=11;break}return $t({data:m,method:p,instance:o,pluginName:s,store:c}),t.abrupt("return",Promise.resolve(g));case 11:if(!Gt(g,s)){t.next=14;break}return u&&$t({data:g,method:p,instance:o,store:c}),t.abrupt("return",Promise.resolve(g));case 14:if(!h.hasOwnProperty(s)||!0!==h[s]){t.next=17;break}return c.dispatch({type:"queue",plugin:s,payload:m,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(g));case 17:return b=y(v[s],a[s]),t.next=20,f[p]({abort:b.abort,payload:m,instance:o,config:Vt(s,l,a),plugins:l});case 20:return w=t.sent,x=U(w)?w:{},O=Y(Y({},g),x),Gt(S=v[s],s)?$t({data:S,method:p,instance:o,pluginName:s,store:c}):((E="".concat(p,":").concat(s)).match(/:/g)||[]).length<2&&!p.match(Mt)&&!p.match(Dt)&&(I=d?O:m,o.dispatch(Y(Y({},I),{},{type:E,_:{called:E,from:"submethod"}}))),t.abrupt("return",Promise.resolve(O));case 26:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve(r));case 13:if(m=t.sent,p.match(Lt)||p.match(/^registerPlugin/)||p.match(Dt)||p.match(Mt)||p.match(/^params/)||p.match(/^userIdChanged/)){t.next=21;break}if(s.plugins.includes(p),!m._||m._.originalAction!==p){t.next=18;break}return t.abrupt("return",m);case 18:b=Y(Y({},m),{_:{originalAction:m.type,called:m.type,from:"engineEnd"}}),Bt(m,n.exact.length)&&!p.match(/End$/)&&(b=Y(Y({},b),{type:m.type+"Aborted"})),c.dispatch(b);case 21:return t.abrupt("return",m);case 22:case"end":return t.stop()}}),t)}))),Ut.apply(this,arguments)}function $t(t){var e=t.data,n=t.method;t.instance;var r=t.pluginName,o=n+"Aborted"+(r?":"+r:"");t.store.dispatch(Y(Y({},e),{},{type:o,_:{called:o,from:"abort"}}))}function Vt(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function qt(t,e){return e.reduce((function(e,n){return n[t]?e.concat({methodName:t,pluginName:n.name,method:n[t]}):e}),[])}function Ft(t,e){var n=t.replace(Lt,""),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function Jt(t,e,n){var r=Ft(t).map((function(t){return qt(t,e)}));return e.reduce((function(n,r){var o=r.name,i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||F(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Ft(t,o).map((function(t){return qt(t,e)})),3),a=i[0],u=i[1],c=i[2];return a.length&&(n.beforeNS[o]=a),u.length&&(n.duringNS[o]=u),c.length&&(n.afterNS[o]=c),n}),{before:r[0],beforeNS:{},during:r[1],duringNS:{},after:r[2],afterNS:{}})}function Gt(t,e){var n=t.abort;return!!n&&(!0===n||Wt(n,e)||n&&Wt(n.plugins,e))}function Bt(t,e){var n=t.abort;if(!n)return!1;if(!0===n||z(n))return!0;var r=n.plugins;return Ht(n)&&n.length===e||Ht(r)&&r.length===e}function Ht(t){return Array.isArray(t)}function Wt(t,e){return!(!t||!Ht(t))&&t.includes(e)}function Xt(t,e){return function(n,r,o){var i=r.config,a=r.name,u="".concat(a,".").concat(n.type);o&&(u=o.event);var c=n.type.match(Lt)?function(t,e,n,r,o){return function(i,a){var u=r?r.name:t,c=a&&Ht(a)?a:n;if(r&&(!(c=a&&Ht(a)?a:[t]).includes(t)||1!==c.length))throw new Error("Method ".concat(e," can only abort ").concat(t," plugin. ").concat(JSON.stringify(c)," input valid"));return Y(Y({},o),{},{abort:{reason:i,plugins:c,caller:e,_:u}})}}(a,u,e,o,n):function(t,e){return function(){throw new Error(t.type+" action not cancellable. Remove abort in "+e)}}(n,u);return{payload:Kt(n),instance:t,config:i||{},abort:c}}}function Yt(t,e){var n=Zt(t);if(n&&n.name===e){var r=Zt(n.method),o=r?"or "+r.method:"";throw new Error([e+" plugin is calling method "+t,"Plugins cant call self","Use ".concat(n.method," ").concat(o," in ").concat(e," plugin insteadof ").concat(t)].join("\n"))}}function Zt(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Kt(t){return Object.keys(t).reduce((function(e,n){return"type"===n||(U(t[n])?e[n]=Object.assign({},t[n]):e[n]=t[n]),e}),{})}function Qt(t,e,n){var r={};return function(o){return function(i){return function(){var a=H(K.mark((function a(u){var c,s,l,f,p,d,g,y,h,v,m,b;return K.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(c=u.type,s=u.abort,l=u.plugins,f=u,!s){a.next=4;break}return a.abrupt("return",i(u));case 4:if(c===bt.enablePlugin&&o.dispatch({type:bt.initializeStart,plugins:l,disabled:[],fromEnable:!0,meta:u.meta}),c===bt.disablePlugin&&setTimeout((function(){return _t(u.meta.rid,{payload:u})}),0),c===bt.initializeEnd&&(p=e(),d=Object.keys(p),g=d.filter((function(t){return l.includes(t)})).map((function(t){return p[t]})),y=[],h=[],v=u.disabled,m=g.map((function(t){var e=t.loaded,n=t.name;return At(t,e,1e4).then((function(e){return r[n]||(o.dispatch({type:bt.pluginReadyType(n),name:n,events:Object.keys(t).filter((function(t){return!mt.includes(t)}))}),r[n]=!0),y=y.concat(n),t})).catch((function(t){if(t instanceof Error)throw new Error(t);return h=h.concat(t.name),t}))})),Promise.all(m).then((function(t){var e={plugins:y,failed:h,disabled:v};setTimeout((function(){d.length===m.length+v.length&&o.dispatch(Y(Y({},{type:bt.ready}),e))}),0)}))),c===bt.bootstrap){a.next=13;break}return/^ready:([^:]*)$/.test(c)&&setTimeout((function(){return Nt(o,e,t)}),0),a.next=11,Ct(u,e,t,o,n);case 11:return b=a.sent,a.abrupt("return",i(b));case 13:return a.abrupt("return",i(f));case 14:case"end":return a.stop()}}),a)})));return function(t){return a.apply(this,arguments)}}()}}}function te(t){return function(e){return function(e){return function(n){var r=n.type,o=n.key,i=n.value,a=n.options;if(r===bt.setItem||r===bt.removeItem){if(n.abort)return e(n);r===bt.setItem?t.setItem(o,i,a):t.removeItem(o,a)}return e(n)}}}}function ee(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ne(t,e,n){return e&&ee(t.prototype,e),n&&ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var re=ne((function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),W(this,"before",[]),W(this,"after",[]),W(this,"addMiddleware",(function(t,n){e[n]=e[n].concat(t)})),W(this,"removeMiddleware",(function(t,n){var r=e[n].findIndex((function(e){return e===t}));-1!==r&&(e[n]=[].concat(J(e[n].slice(0,r)),J(e[n].slice(r+1))))})),W(this,"dynamicMiddlewares",(function(t){return function(n){return function(r){return function(o){var i={getState:n.getState,dispatch:function(t){return n.dispatch(t)}},a=e[t].map((function(t){return t(i)}));return st.apply(void 0,J(a))(r)(o)}}}}))}));function oe(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r={};if("initialize:aborted"===n.type)return e;if(/^registerPlugin:([^:]*)$/.test(n.type)){var o=ie(n.type,"registerPlugin"),i=t()[o];if(!i||!o)return e;var a=n.enabled;return r[o]={enabled:a,initialized:!!a&&Boolean(!i.initialize),loaded:!!a&&Boolean(i.loaded()),config:i.config||{}},Y(Y({},e),r)}if(/^initialize:([^:]*)$/.test(n.type)){var u=ie(n.type,bt.initialize),c=t()[u];return c&&u?(r[u]=Y(Y({},e[u]),{initialized:!0,loaded:Boolean(c.loaded())}),Y(Y({},e),r)):e}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=Y(Y({},e[n.name]),{loaded:!0}),Y(Y({},e),r);switch(n.type){case bt.disablePlugin:return Y(Y({},e),ae(n.plugins,!1,e));case bt.enablePlugin:return Y(Y({},e),ae(n.plugins,!0,e));default:return e}}}function ie(t,e){return t.substring(e.length+1,t.length)}function ae(t,e,n){return t.reduce((function(t,r){return t[r]=Y(Y({},n[r]),{enabled:e}),t}),n)}function ue(t){try{return JSON.parse(JSON.stringify(t))}catch(t){}return t}var ce={last:{},history:[]};function se(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ce,e=arguments.length>1?arguments[1]:void 0,n=e.type,r=e.event,o=e.properties,i=e.options,a=e.meta;if(n===bt.track){var u=ue(Y(Y({event:r,properties:o},Object.keys(i).length&&{options:i}),{},{meta:a}));return Y(Y({},t),{last:u,history:t.history.concat(u)})}return t}var le={actions:[]};function fe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le,e=arguments.length>1?arguments[1]:void 0,n=e.type,r=e.payload;switch(n){case"queue":var o;return o=r&&r.type&&r.type===bt.identify?[e].concat(t.actions):t.actions.concat(e),Y(Y({},t),{},{actions:o});case"dequeue":return[];default:return t}}var pe=/#.*$/;function de(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(pe,""):"")}var ge,ye,he,ve,me=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!M)return t;var e=document,n=e.title,r=e.referrer,o=window,i=o.location,a=o.innerWidth,u=o.innerHeight,c=i.hash,s=i.search,l=function(t){var e=function(){if(M)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(pe,"")}(s),f={title:n,url:l,path:de(l),hash:c,search:s,width:a,height:u};return r&&""!==r&&(f.referrer=r),Y(Y({},f),t)},be={last:{},history:[]};function we(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:be,e=arguments.length>1?arguments[1]:void 0,n=e.properties,r=e.options,o=e.meta;if(e.type===bt.page){var i=ue(Y({properties:n,meta:o},Object.keys(r).length&&{options:r}));return Y(Y({},t),{last:i,history:t.history.concat(i)})}return t}ge=function(){if(!M)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"}(),ye=M?document.referrer:null,he=function(){if(c){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}(),ve=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){}}();var xe={initialized:!1,sessionId:O(),app:null,version:null,debug:!1,offline:!!M&&!navigator.onLine,os:{name:ge},userAgent:M?navigator.userAgent:"node",library:{name:gt,version:"0.10.22"},timezone:ve,locale:he,campaign:{},referrer:ye};function Oe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xe,e=arguments.length>1?arguments[1]:void 0,n=t.initialized,r=e.type,o=e.campaign;switch(r){case bt.campaign:return Y(Y({},t),{campaign:o});case bt.offline:return Y(Y({},t),{offline:!0});case bt.online:return Y(Y({},t),{offline:!1});default:return n?t:Y(Y(Y({},xe),t),{initialized:!0})}}var Se=["plugins","reducers","storage"];function Ee(t,e,n){if(M){var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach((function(t){r(t,e)}))}}function Ie(t){var e=Ee.bind(null,"online offline",(function(e){return Promise.resolve(!navigator.onLine).then(t)}));return e(!0),function(t){return e(!1)}}function je(){return P(gt,[]),function(t){return function(e,n,r){var o=t(e,n,r),i=o.dispatch;return Object.assign(o,{dispatch:function(t){var e=t.action||t;return I[E][gt].push(e),i(t)}})}}}function Pe(t){return function(){return st(st.apply(null,arguments),je())}}function ke(t){return t?(e=t,"[object Array]"===Object.prototype.toString.call(e)?t:[t]):[];var e}function _e(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=O();return r&&(kt[i]=(t=r,e=function(t){for(var e,n=t||Array.prototype.slice.call(arguments),r=0;r<n.length;r++)if(C(n[r])){e=n[r];break}return e}(o),function(n){e&&e(n),t(n)})),Y(Y({},n),{},{rid:i,ts:(new Date).getTime()},r?{hasCallback:!0}:{})}function Ae(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.reducers||{},r=e.initialUser||{},i=(e.plugins||[]).reduce((function(t,e){if(C(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=!(!1===e.enabled),o=!(e.config&&!1===e.config.enabled);t.pluginEnabled[e.name]=r&&o,delete e.enabled,e.methods&&(t.methods[e.name]=Object.keys(e.methods).reduce((function(t,n){return t[n]=(r=e.methods[n],function(){for(var t=Array.prototype.slice.call(arguments),e=new Array(r.length),n=0;n<t.length;n++)e[n]=t[n];return e[e.length]=T,r.apply({instance:T},e)}),t;var r}),{}),delete e.methods);var i=Object.keys(e).concat(n),a=new Set(t.events.concat(i));if(t.events=Array.from(a),t.pluginsArray=t.pluginsArray.concat(e),t.plugins[e.name])throw new Error(e.name+"AlreadyLoaded");return t.plugins[e.name]=e,t.plugins[e.name].loaded||(t.plugins[e.name].loaded=function(){return!0}),t}),{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=e.storage?e.storage:{getItem:j,setItem:P,removeItem:k},u=function(t){return function(e,n,r){return n.getState("user")[e]||(r&&U(r)&&r[e]?r[e]:It(t)[e]||j(jt(e))||null)}}(a),s=i.plugins,l=i.events.filter((function(t){return!mt.includes(t)})).sort(),f=new Set(l.concat(vt).filter((function(t){return!mt.includes(t)}))),p=Array.from(f).sort(),d=function(){return s},g=new re,y=g.addMiddleware,h=g.removeMiddleware,v=g.dynamicMiddlewares,m=function(){throw new Error("Abort disabled inListener")},b=function(t){for(var e,n=Object.create(null),r=/([^&=]+)=?([^&]*)/g;e=r.exec(t);){var o=w(e[1]),i=w(e[2]);if(o)if("[]"===o.substring(o.length-2)){var a=n[o=o.substring(0,o.length-2)]||(n[o]=[]);n[o]=Array.isArray(a)?a:[],n[o].push(i)}else n[o]=""===i||i}for(var u in n){var c=u.split("[");c.length>1&&(x(n,c.map((function(t){return t.replace(/[?[\]\\ ]/g,"")})),n[u]),delete n[u])}return n}(function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return c&&window.location.search.substring(1)}(t)),S=It(a),E=Y(Y(Y(Y({},S),r),b.an_uid?{userId:b.an_uid}:{}),b.an_aid?{anonymousId:b.an_aid}:{});E.anonymousId||(E.anonymousId=O());var I,_,A,N=Y({enable:function(t,e){return new Promise((function(n){X.dispatch({type:bt.enablePlugin,plugins:ke(t),_:{originalAction:bt.enablePlugin}},n,[e])}))},disable:function(t,e){return new Promise((function(n){X.dispatch({type:bt.disablePlugin,plugins:ke(t),_:{originalAction:bt.disablePlugin}},n,[e])}))}},i.methods),T={identify:(A=H(K.mark((function t(e,n,r,o){var i,a,c,s,l;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=z(e)?e:null,a=U(e)?e:n,c=r||{},s=T.user(),P(jt(yt),i),l=i||a.userId||u(yt,T,a),t.abrupt("return",new Promise((function(t){X.dispatch(Y({type:bt.identifyStart,userId:l,traits:a||{},options:c,anonymousId:s.anonymousId},s.id&&s.id!==i&&{previousId:s.id}),t,[n,r,o])})));case 7:case"end":return t.stop()}}),t)}))),function(t,e,n,r){return A.apply(this,arguments)}),track:(_=H(K.mark((function t(e,n,r,o){var i,a,c;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((i=U(e)?e.event:e)&&z(i)){t.next=3;break}throw new Error("EventMissing");case 3:return a=U(e)?e:n||{},c=U(r)?r:{},t.abrupt("return",new Promise((function(t){X.dispatch({type:bt.trackStart,event:i,properties:a,options:c,userId:u(yt,T,n),anonymousId:u(ht,T,n)},t,[n,r,o])})));case 6:case"end":return t.stop()}}),t)}))),function(t,e,n,r){return _.apply(this,arguments)}),page:(I=H(K.mark((function t(e,n,r){var o,i;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=U(e)?e:{},i=U(n)?n:{},t.abrupt("return",new Promise((function(t){X.dispatch({type:bt.pageStart,properties:me(o),options:i,userId:u(yt,T,o),anonymousId:u(ht,T,o)},t,[e,n,r])})));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return I.apply(this,arguments)}),user:function(t){if(t===yt||"id"===t)return u(yt,T);if(t===ht||"anonId"===t)return u(ht,T);var e=T.getState("user");return t?o()(e,t):e},reset:function(t){return new Promise((function(e){X.dispatch({type:bt.resetStart},e,t)}))},ready:function(t){return T.on(bt.ready,t)},on:function(t,e){if(!t||!C(e))return!1;if(t===bt.bootstrap)throw new Error(".on disabled for "+t);var n=/Start$|Start:/;if("*"===t){var r=function(t){return function(t){return function(r){return r.type.match(n)&&e({payload:r,instance:T,plugins:s}),t(r)}}},o=function(t){return function(t){return function(r){return r.type.match(n)||e({payload:r,instance:T,plugins:s}),t(r)}}};return y(r,Ne),y(o,Te),function(){h(r,Ne),h(o,Te)}}var i=t.match(n)?Ne:Te,a=function(n){return function(n){return function(r){return r.type===t&&e({payload:r,instance:T,plugins:s,abort:m}),n(r)}}};return y(a,i),function(){return h(a,i)}},once:function(t,e){if(!t||!C(e))return!1;if(t===bt.bootstrap)throw new Error(".once disabled for "+t);var n=T.on(t,(function(t){var r=t.payload;e({payload:r,instance:T,plugins:s,abort:m}),n()}));return n},getState:function(t){var e=X.getState();return t?o()(e,t):Object.assign({},e)},dispatch:function(t){var e,n=z(t)?{type:t}:t;if(e=n.type,vt.includes(e))throw new Error("reserved action "+n.type);var r=t._||{},o=Y(Y({},n),{},{_:Y({originalAction:n.type},r)});X.dispatch(o)},enablePlugin:N.enable,disablePlugin:N.disable,plugins:N,storage:{getItem:a.getItem,setItem:function(t,e,n){X.dispatch({type:bt.setItemStart,key:t,value:e,options:n})},removeItem:function(t,e){X.dispatch({type:bt.removeItemStart,key:t,options:e})}},setAnonymousId:function(t,e){T.storage.setItem(ft,t,e)},events:{all:p,core:vt,plugins:l}},L=i.middlewares.concat([function(t){return function(t){return function(e){return e.meta||(e.meta=_e()),t(e)}}},v(Ne),Qt(T,d,{all:p,plugins:l}),te(a),St(T),Pt(T),v(Te)]),D={context:Oe,user:Et(a),page:we,track:se,plugins:oe(d),queue:fe},R=st,$=st;if(M&&e.debug){var V=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;V&&(R=V({trace:!0,traceLimit:25})),$=function(){return 0===arguments.length?je():U(G(arguments[0]))?Pe():Pe().apply(null,arguments)}}var q,F=function(t){return Object.keys(t).reduce((function(e,n){return Se.includes(n)||(e[n]=t[n]),e}),{})}(e),B=i.pluginsArray.reduce((function(t,e){var n=e.name,r=e.config,o=e.loaded,a=i.pluginEnabled[n];return t[n]={enabled:a,initialized:!!a&&Boolean(!e.initialize),loaded:Boolean(o()),config:r||{}},t}),{}),W={context:F,user:E,plugins:B},X=ut(function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var o=e[r];G(t[o])===Q&&(n[o]=t[o])}var i,a=Object.keys(n);try{!function(t){Object.keys(t).forEach((function(e){var n=t[e];if(G(n(void 0,{type:rt}))===tt||G(n(void 0,{type:ot}))===tt)throw new Error(et+" "+e+" "+tt)}))}(n)}catch(t){i=t}return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;if(i)throw i;for(var r=!1,o={},u=0;u<a.length;u++){var c=a[u],s=n[c],l=t[c],f=s(l,e);if(G(f)===tt){var p=ct(c,e);throw new Error(p)}o[c]=f,r=r||f!==l}return r?o:t}}(Y(Y({},D),n)),W,$(R(lt.apply(void 0,J(L)))));X.dispatch=(q=X.dispatch,function(t,e,n){var r=_e(t.meta,e,ke(n)),o=Y(Y({},t),{meta:r});return q.apply(null,[o])});var Z=Object.keys(s);X.dispatch({type:bt.bootstrap,plugins:Z,config:F,params:b,user:E,initialUser:r,persistedUser:S});var nt=Z.filter((function(t){return i.pluginEnabled[t]})),it=Z.filter((function(t){return!i.pluginEnabled[t]}));return X.dispatch({type:bt.registerPlugins,plugins:Z,enabled:i.pluginEnabled}),i.pluginsArray.map((function(t,e){var n=t.bootstrap,r=t.config,o=t.name;n&&C(n)&&n({instance:T,config:r,payload:t}),X.dispatch({type:bt.registerPluginType(o),name:o,enabled:i.pluginEnabled[o],plugin:t}),i.pluginsArray.length===e+1&&X.dispatch({type:bt.initializeStart,plugins:nt,disabled:it})})),Ie((function(t){X.dispatch({type:t?bt.offline:bt.online})})),function(t,e,n){setInterval((function(){return Nt(t,e,n)}),3e3)}(X,d,T),T}var Ne="before",Te="after",Le="cookie",Me=Re(),De=Ue,Ce=Ue;function ze(t){return Me?Ue(t,"",-1):k(t)}function Re(){if(void 0!==Me)return Me;var t="cookiecookie";try{Ue(t,t),Me=-1!==document.cookie.indexOf(t),ze(t)}catch(t){Me=!1}return Me}function Ue(t,e,n,r,o,i){if("undefined"!=typeof window){var a=arguments.length>1;return!1===Me&&(a?P(t,e):j(t)),a?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(o?"; domain="+o:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var $e,Ve="localStorage",qe=N.bind(null,"localStorage"),Fe=(_("localStorage","getItem",j),_("localStorage","setItem",P),_("localStorage","removeItem",k),"undefined"!=typeof process?process:{}),Je=(null==($e=Fe.env)||$e.NODE_ENV,"undefined"!=typeof window);function Ge(t,e){return typeof e===t}Je&&window.location.hostname,null!=Fe.versions&&Fe.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,Je&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Ge.bind(null,"function");var Be=Ge.bind(null,"string"),He=Ge.bind(null,"undefined");function We(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function Xe(t){return function(){return t.apply(void 0,[].slice.call(arguments).concat([].slice.call(arguments,1)))}}function Ye(t){var e=t;try{if("true"===(e=JSON.parse(t)))return!0;if("false"===e)return!1;if(function(t){if(!function(t){return t&&("object"==typeof t||null!==t)}(t))return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch(t){}if(null!==e&&""!==e)return e}Ge.bind(null,"boolean"),Xe(We),Xe(We),Xe(We),Xe(We);var Ze=qe(),Ke=Re();function Qe(t,e){if(t){var n=tn(e),r=!rn(n),o=en(n)?Ye(localStorage.getItem(t)):void 0;if(r&&!He(o))return o;var i=nn(n)?Ye(De(t)):void 0;if(r&&i)return i;var a=j(t);return r?a:{localStorage:o,cookie:i,global:a}}}function tn(t){return t?Be(t)?t:t.storage:"any"}function en(t){return Ze&&on(t,Ve)}function nn(t){return Ke&&on(t,Le)}function rn(t){return"*"===t||"all"===t}function on(t,e){return"any"===t||t===e||rn(t)}function an(t,e,n){return{location:t,current:e,previous:n}}var un={setItem:function(t,e,n){if(t&&!He(e)){var r={},o=tn(n),i=JSON.stringify(e),a=!rn(o);return en(o)&&(r[Ve]=an(Ve,e,Ye(localStorage.getItem(t))),localStorage.setItem(t,i),a)?r[Ve]:nn(o)&&(r[Le]=an(Le,e,Ye(De(t))),Ce(t,i),a)?r[Le]:(r[S]=an(S,e,j(t)),P(t,e),a?r[S]:r)}},getItem:Qe,removeItem:function(t,e){if(t){var n=tn(e),r=Qe(t,"*"),o={};return!He(r.localStorage)&&en(n)&&(localStorage.removeItem(t),o[Ve]=r.localStorage),!He(r.cookie)&&nn(n)&&(ze(t),o[Le]=r.cookie),!He(r.global)&&on(n,S)&&(k(t),o[S]=r.global),o}}};const cn=un;var sn=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 ln(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var fn=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ln(n,!0).forEach((function(e){sn(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ln(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t};var pn=function(t,e){return function(n,r){e(n,r,t)}},dn=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))},gn=cronapp.configuration.IConfigurationService,yn=cronapp.ioc.component,hn=cronapp.ioc.qualifier,vn=cronapp.ioc.bindSingleton;const mn="analyticsPluginFactory",bn="analyticsService";let wn=class{constructor(t,e){this.plugins=t,this.configurationService=e,cronapp.event.filterEvent(e.onDidChangeConfiguration,(t=>t.keys.includes("analytics.enabled")))(this.updateEnablement),this.updateEnablement().catch((t=>console.error(t)))}identify(t,e){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.identify(t,e)}))}track(t,e){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.track(t,e)}))}page(t){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.page(Object.assign({},t))}))}updateEnablement(){return dn(this,void 0,void 0,(function*(){if(yield this.configurationService.getValue("cronapp.framework.analytics.enabled",!0)){const t=yield this.configurationService.getValue("cronapp.framework.analytics.application.name","cronapp-application"),e=yield this.configurationService.getValue("cronapp.framework.analytics.application.version","1.0.0"),n=yield Promise.all(this.plugins.map((t=>t.createAnalyticsPlugin())));this.analytics=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ae(fn(fn({},{storage:cn}),t))}({app:t,version:e,plugins:n})}else this.analytics=null}))}};wn=function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}([yn(),pn(0,hn(mn,!0)),pn(1,hn(gn)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Array,Object])],wn),vn(bn,wn);const xn=angular;var On=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Sn=cronapp.angularJs.IAngularJsPlugin,En=cronapp.ioc.bindSingleton,In=cronapp.ioc.component,jn=cronapp.ioc.getInstance;class Pn{constructor(t){this.restrict="A",this.logService=t}static factory(){const t=t=>new Pn(t);return t.$inject=["$log"],t}link(t,e,n){const r=n[Pn.NAME],o={},i="crnAnalyticsEvent";for(const t in n.$attr)if(t.startsWith("crnAnalytics")&&t!==Pn.NAME&&t!==i){const e=t.substr(12).toLowerCase();o[e]=n[t],n.$observe(t,(t=>{o[e]=t}))}e.on(r,(()=>On(this,void 0,void 0,(function*(){const t=jn(bn);yield t.track(n[i],o)}))))}}Pn.NAME="crnAnalyticsOn";let kn=class{activate(){const t=xn.module("cronapp.analytics",["ui.router"]);t.directive(Pn.NAME,Pn.factory());const e=(t,e,n,r)=>{const o=jn(bn);n.onSuccess({},(e=>{r((()=>On(this,void 0,void 0,(function*(){yield o.page({title:t.viewTitleOnly})}))))}));const i=localStorage.getItem("_u");i&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(JSON.parse(i).user.username)}))));const a=window.localStorage.setItem.bind(localStorage),u=window.localStorage.removeItem.bind(localStorage);localStorage.setItem=(t,e)=>{"_u"===t&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(JSON.parse(e).user.username)})))),a(t,e)},localStorage.removeItem=t=>{"_u"===t&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(null)})))),u(t)}};return e.$inject=["$rootScope","$location","$transitions","$timeout"],t.run(e),Promise.resolve(t)}};kn=function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}([In()],kn),En(Sn,kn)})();var o=cronapp="undefined"==typeof cronapp?{}:cronapp;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
package/cronapp.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"postUpdate": {
|
|
3
|
+
"angularJs": {
|
|
4
|
+
"includes": [
|
|
5
|
+
{
|
|
6
|
+
"file": "index.html",
|
|
7
|
+
"script": "node_modules/@cronapp/framework-analytics/cronapp.framework.analytics.js",
|
|
8
|
+
"type": "script",
|
|
9
|
+
"layers": ["web"]
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"configuration": {
|
|
15
|
+
"title": "cronapp.framework.analytics.title",
|
|
16
|
+
"icon": "icon.svg",
|
|
17
|
+
"properties": {
|
|
18
|
+
"cronapp.framework.analytics.enabled": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"default": true,
|
|
21
|
+
"frameworks": ["browser"]
|
|
22
|
+
},
|
|
23
|
+
"cronapp.framework.analytics.application.name": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"default": "cronapp-application",
|
|
26
|
+
"frameworks": ["browser"]
|
|
27
|
+
},
|
|
28
|
+
"cronapp.framework.analytics.application.version": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"default": "1.0.0",
|
|
31
|
+
"frameworks": ["browser"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"api": {
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
package/cronapp.nls.json
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
10
|
+
id="Layer_1"
|
|
11
|
+
x="0"
|
|
12
|
+
y="0"
|
|
13
|
+
version="1.1"
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
xml:space="preserve"
|
|
16
|
+
sodipodi:docname="icon.svg"
|
|
17
|
+
width="24"
|
|
18
|
+
height="24"
|
|
19
|
+
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
|
|
20
|
+
id="metadata174"><rdf:RDF><cc:Work
|
|
21
|
+
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
|
22
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
|
23
|
+
id="defs172" /><sodipodi:namedview
|
|
24
|
+
pagecolor="#ffffff"
|
|
25
|
+
bordercolor="#666666"
|
|
26
|
+
borderopacity="1"
|
|
27
|
+
objecttolerance="10"
|
|
28
|
+
gridtolerance="10"
|
|
29
|
+
guidetolerance="10"
|
|
30
|
+
inkscape:pageopacity="0"
|
|
31
|
+
inkscape:pageshadow="2"
|
|
32
|
+
inkscape:window-width="2560"
|
|
33
|
+
inkscape:window-height="1367"
|
|
34
|
+
id="namedview170"
|
|
35
|
+
showgrid="false"
|
|
36
|
+
inkscape:zoom="9.1640625"
|
|
37
|
+
inkscape:cx="64"
|
|
38
|
+
inkscape:cy="49.268292"
|
|
39
|
+
inkscape:window-x="1280"
|
|
40
|
+
inkscape:window-y="32"
|
|
41
|
+
inkscape:window-maximized="0"
|
|
42
|
+
inkscape:current-layer="Layer_1" /><path
|
|
43
|
+
fill="#ffffff"
|
|
44
|
+
d="M 20.730159,22.47619 H 3.2698413 c -0.9603175,0 -1.7460318,-0.785714 -1.7460318,-1.746031 V 3.2698413 c 0,-0.9603175 0.7857143,-1.7460318 1.7460318,-1.7460318 H 20.730159 c 0.960317,0 1.746031,0.7857143 1.746031,1.7460318 V 20.730159 c 0,0.960317 -0.785714,1.746031 -1.746031,1.746031 z"
|
|
45
|
+
id="path139"
|
|
46
|
+
style="stroke-width:0.174603" />
|
|
47
|
+
<path
|
|
48
|
+
fill="#444b54"
|
|
49
|
+
d="M 1.5238095,16.906349 C 1.2269841,16.906349 1,16.679365 1,16.38254 V 7.984127 C 1,7.6873016 1.2269841,7.4603175 1.5238095,7.4603175 c 0.2968254,0 0.5238095,0.2269841 0.5238095,0.5238095 v 8.398413 c 0,0.296825 -0.2269841,0.523809 -0.5238095,0.523809 z"
|
|
50
|
+
id="path141"
|
|
51
|
+
style="stroke-width:0.174603" />
|
|
52
|
+
<path
|
|
53
|
+
fill="#444b54"
|
|
54
|
+
d="M 20.730159,23 H 7.6349206 c -0.2968254,0 -0.5238095,-0.226984 -0.5238095,-0.52381 0,-0.296825 0.2269841,-0.523809 0.5238095,-0.523809 H 20.730159 c 0.680952,0 1.222222,-0.54127 1.222222,-1.222222 V 3.2698413 c 0,-0.6809524 -0.54127,-1.2222223 -1.222222,-1.2222223 H 3.2698413 c -0.6809524,0 -1.2222223,0.5412699 -1.2222223,1.2222223 v 1.9206349 h 18.15873 c 0.296826,0 0.52381,0.2269841 0.52381,0.5238095 0,0.2968254 -0.226984,0.5238095 -0.52381,0.5238095 H 1.5238095 C 1.2269841,6.2380952 1,6.0111111 1,5.7142857 V 3.2698413 C 1,2.0126984 2.0126984,1 3.2698413,1 H 20.730159 C 21.987302,1 23,2.0126984 23,3.2698413 V 20.730159 C 23,21.987302 21.987302,23 20.730159,23 Z"
|
|
55
|
+
id="path143"
|
|
56
|
+
style="stroke-width:0.174603" />
|
|
57
|
+
<circle
|
|
58
|
+
cx="3.6190476"
|
|
59
|
+
cy="3.6190476"
|
|
60
|
+
fill="#444b54"
|
|
61
|
+
id="circle145"
|
|
62
|
+
style="stroke-width:0.174603"
|
|
63
|
+
r="0.52380955" />
|
|
64
|
+
<circle
|
|
65
|
+
cx="5.3650794"
|
|
66
|
+
cy="3.6190476"
|
|
67
|
+
fill="#444b54"
|
|
68
|
+
id="circle147"
|
|
69
|
+
style="stroke-width:0.174603"
|
|
70
|
+
r="0.52380955" />
|
|
71
|
+
<circle
|
|
72
|
+
cx="7.1111112"
|
|
73
|
+
cy="3.6190476"
|
|
74
|
+
fill="#444b54"
|
|
75
|
+
id="circle149"
|
|
76
|
+
style="stroke-width:0.174603"
|
|
77
|
+
r="0.52380955" />
|
|
78
|
+
<path
|
|
79
|
+
fill="#71c2ff"
|
|
80
|
+
d="m 2.9206349,21.603175 c -0.1047619,0 -0.2269841,-0.03492 -0.3142857,-0.104762 -0.2269841,-0.174603 -0.2793651,-0.50635 -0.087302,-0.733334 l 5.936508,-7.682539 c 0.087302,-0.104762 0.2095238,-0.192064 0.3666666,-0.192064 0.1396826,-0.01746 0.2793651,0.03492 0.4015873,0.122222 l 5.0634929,4.277778 3.544444,-7.5952379 c 0.122222,-0.2619048 0.436508,-0.3666667 0.698413,-0.2444444 0.261904,0.1222222 0.366666,0.4365079 0.244444,0.6984123 l -3.84127,8.20635 c -0.06984,0.139682 -0.209523,0.261904 -0.366666,0.296825 -0.157143,0.03492 -0.331746,0 -0.453969,-0.104762 L 8.9444444,14.18254 3.3396825,21.428571 c -0.1047619,0.104762 -0.2619047,0.174604 -0.4190476,0.174604 z"
|
|
81
|
+
id="path151"
|
|
82
|
+
style="stroke-width:0.174603" />
|
|
83
|
+
<circle
|
|
84
|
+
cx="2.920635"
|
|
85
|
+
cy="21.079365"
|
|
86
|
+
fill="#ffffff"
|
|
87
|
+
id="circle153"
|
|
88
|
+
style="stroke-width:0.174603"
|
|
89
|
+
r="1.3968254" />
|
|
90
|
+
<path
|
|
91
|
+
fill="#71c2ff"
|
|
92
|
+
d="M 2.9206349,23 C 1.8555556,23 1,22.144444 1,21.079365 1,20.014286 1.8555556,19.15873 2.9206349,19.15873 c 1.0650794,0 1.9206349,0.855556 1.9206349,1.920635 C 4.8412698,22.144444 3.9857143,23 2.9206349,23 Z m 0,-2.793651 c -0.4888889,0 -0.8730159,0.384127 -0.8730159,0.873016 0,0.488889 0.384127,0.873016 0.8730159,0.873016 0.4888889,0 0.8730159,-0.384127 0.8730159,-0.873016 0,-0.488889 -0.384127,-0.873016 -0.8730159,-0.873016 z"
|
|
93
|
+
id="path155"
|
|
94
|
+
style="stroke-width:0.174603" />
|
|
95
|
+
<circle
|
|
96
|
+
cx="8.8571424"
|
|
97
|
+
cy="13.396826"
|
|
98
|
+
fill="#ffffff"
|
|
99
|
+
id="circle157"
|
|
100
|
+
style="stroke-width:0.174603"
|
|
101
|
+
r="1.3968254" />
|
|
102
|
+
<path
|
|
103
|
+
fill="#71c2ff"
|
|
104
|
+
d="m 8.8571429,15.31746 c -1.0650794,0 -1.920635,-0.855555 -1.920635,-1.920635 0,-1.065079 0.8555556,-1.920635 1.920635,-1.920635 1.0650793,0 1.9206351,0.855556 1.9206351,1.920635 0,1.06508 -0.8555558,1.920635 -1.9206351,1.920635 z m 0,-2.79365 c -0.4888889,0 -0.8730159,0.384127 -0.8730159,0.873015 0,0.488889 0.384127,0.873016 0.8730159,0.873016 0.4888888,0 0.8730158,-0.384127 0.8730158,-0.873016 0,-0.488888 -0.384127,-0.873015 -0.8730158,-0.873015 z"
|
|
105
|
+
id="path159"
|
|
106
|
+
style="stroke-width:0.174603" />
|
|
107
|
+
<circle
|
|
108
|
+
cx="14.444445"
|
|
109
|
+
cy="18.111111"
|
|
110
|
+
fill="#ffffff"
|
|
111
|
+
id="circle161"
|
|
112
|
+
style="stroke-width:0.174603"
|
|
113
|
+
r="1.3968254" />
|
|
114
|
+
<path
|
|
115
|
+
fill="#71c2ff"
|
|
116
|
+
d="m 14.444444,20.031746 c -1.065079,0 -1.920634,-0.855556 -1.920634,-1.920635 0,-1.065079 0.855555,-1.920635 1.920634,-1.920635 1.06508,0 1.920635,0.855556 1.920635,1.920635 0,1.065079 -0.855555,1.920635 -1.920635,1.920635 z m 0,-2.793651 c -0.488888,0 -0.873015,0.384127 -0.873015,0.873016 0,0.488889 0.384127,0.873016 0.873015,0.873016 0.488889,0 0.873016,-0.384127 0.873016,-0.873016 0,-0.488889 -0.384127,-0.873016 -0.873016,-0.873016 z"
|
|
117
|
+
id="path163"
|
|
118
|
+
style="stroke-width:0.174603" />
|
|
119
|
+
<circle
|
|
120
|
+
cx="18.285715"
|
|
121
|
+
cy="9.9047623"
|
|
122
|
+
fill="#ffffff"
|
|
123
|
+
id="circle165"
|
|
124
|
+
style="stroke-width:0.174603"
|
|
125
|
+
r="1.3968254" />
|
|
126
|
+
<path
|
|
127
|
+
fill="#71c2ff"
|
|
128
|
+
d="m 18.285714,11.825397 c -1.065079,0 -1.920635,-0.855556 -1.920635,-1.9206351 0,-1.0650794 0.855556,-1.9206349 1.920635,-1.9206349 1.06508,0 1.920635,0.8555555 1.920635,1.9206349 0,1.0650791 -0.855555,1.9206351 -1.920635,1.9206351 z m 0,-2.793651 c -0.488889,0 -0.873016,0.384127 -0.873016,0.8730159 0,0.4888891 0.384127,0.8730161 0.873016,0.8730161 0.488889,0 0.873016,-0.384127 0.873016,-0.8730161 0,-0.4888889 -0.384127,-0.8730159 -0.873016,-0.8730159 z"
|
|
129
|
+
id="path167"
|
|
130
|
+
style="stroke-width:0.174603" /></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cronapp/framework-analytics",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "npx webpack --progress --config webpack.config.js",
|
|
6
|
+
"watch": "npx webpack -d eval-source-map --progress --watch --config webpack.config.js",
|
|
7
|
+
"prepack": "npm run build -p && cp target/browser/* ."
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@cronapp/framework-core": "1.0.4",
|
|
11
|
+
"analytics": "0.7.4"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/angular": "1.8.9",
|
|
15
|
+
"@types/angular-ui-router": "1.1.44",
|
|
16
|
+
"@uirouter/core": "6.1.1",
|
|
17
|
+
"ts-loader": "9.5.1",
|
|
18
|
+
"tslint": "6.1.3",
|
|
19
|
+
"tslint-loader": "3.5.4",
|
|
20
|
+
"typescript": "5.5.4",
|
|
21
|
+
"webpack": "5.93.0",
|
|
22
|
+
"webpack-cli": "5.1.4"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {Analytics, AnalyticsInstance} from 'analytics';
|
|
2
|
+
import IConfigurationService = cronapp.configuration.IConfigurationService;
|
|
3
|
+
import component = cronapp.ioc.component;
|
|
4
|
+
import qualifier = cronapp.ioc.qualifier;
|
|
5
|
+
import bindSingleton = cronapp.ioc.bindSingleton;
|
|
6
|
+
|
|
7
|
+
export const IAnalyticsPluginFactory = 'analyticsPluginFactory';
|
|
8
|
+
export const IAnalyticsService = 'analyticsService';
|
|
9
|
+
|
|
10
|
+
export interface IAnalyticsPluginFactory<T = any> {
|
|
11
|
+
createAnalyticsPlugin(): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IAnalyticsPage {
|
|
15
|
+
title?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
search?: string;
|
|
19
|
+
width?: string;
|
|
20
|
+
height?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IAnalyticsService {
|
|
24
|
+
identify(userId: string, traits?: any): Promise<void>;
|
|
25
|
+
|
|
26
|
+
track(eventName: string, payload?: any): Promise<void>;
|
|
27
|
+
|
|
28
|
+
page(data?: IAnalyticsPage): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@component()
|
|
32
|
+
class AnalyticsService implements IAnalyticsService {
|
|
33
|
+
private analytics: AnalyticsInstance;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
@qualifier(IAnalyticsPluginFactory, true) private plugins: IAnalyticsPluginFactory[],
|
|
37
|
+
@qualifier(IConfigurationService) private configurationService: IConfigurationService
|
|
38
|
+
) {
|
|
39
|
+
const onEnablementChange = cronapp.event.filterEvent(configurationService.onDidChangeConfiguration, e => e.keys.includes('analytics.enabled'));
|
|
40
|
+
onEnablementChange(this.updateEnablement);
|
|
41
|
+
this.updateEnablement()
|
|
42
|
+
.catch(reason => console.error(reason));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async identify(userId: string, traits?: any): Promise<void> {
|
|
46
|
+
if (this.analytics) {
|
|
47
|
+
return await this.analytics.identify(userId, traits);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async track(eventName: string, payload?: any): Promise<void> {
|
|
52
|
+
if (this.analytics) {
|
|
53
|
+
return await this.analytics.track(eventName, payload);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async page(data?: IAnalyticsPage): Promise<void> {
|
|
58
|
+
if (this.analytics) {
|
|
59
|
+
return await this.analytics.page({...data});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private async updateEnablement(): Promise<void> {
|
|
64
|
+
const enabled = await this.configurationService.getValue<boolean>('cronapp.framework.analytics.enabled', true);
|
|
65
|
+
|
|
66
|
+
if (enabled) {
|
|
67
|
+
const app = await this.configurationService.getValue<string>('cronapp.framework.analytics.application.name', 'cronapp-application');
|
|
68
|
+
const version = await this.configurationService.getValue<string>('cronapp.framework.analytics.application.version', '1.0.0');
|
|
69
|
+
const plugins = await Promise.all(this.plugins.map(p => {
|
|
70
|
+
return p.createAnalyticsPlugin();
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
this.analytics = Analytics({app, version, plugins});
|
|
74
|
+
} else {
|
|
75
|
+
this.analytics = null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
bindSingleton(IAnalyticsService, AnalyticsService);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as analytics from 'analyticsService';
|
|
2
|
+
import * as angular from 'angular';
|
|
3
|
+
import {
|
|
4
|
+
IAttributes,
|
|
5
|
+
IDirective,
|
|
6
|
+
ILocationService, ILogService,
|
|
7
|
+
Injectable,
|
|
8
|
+
IRootScopeService,
|
|
9
|
+
IScope,
|
|
10
|
+
ITimeoutService
|
|
11
|
+
} from 'angular';
|
|
12
|
+
import {TransitionService} from '@uirouter/core';
|
|
13
|
+
import IAngularJsPlugin = cronapp.angularJs.IAngularJsPlugin;
|
|
14
|
+
import bindSingleton = cronapp.ioc.bindSingleton;
|
|
15
|
+
import component = cronapp.ioc.component;
|
|
16
|
+
import getInstance = cronapp.ioc.getInstance;
|
|
17
|
+
|
|
18
|
+
class AnalyticsOnDirective implements IDirective {
|
|
19
|
+
static readonly NAME: string = 'crnAnalyticsOn';
|
|
20
|
+
private readonly logService: ILogService;
|
|
21
|
+
|
|
22
|
+
restrict: string = 'A';
|
|
23
|
+
|
|
24
|
+
constructor(logService: ILogService) {
|
|
25
|
+
this.logService = logService;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static factory() {
|
|
29
|
+
const factory = (logService) => new AnalyticsOnDirective(logService);
|
|
30
|
+
factory.$inject = ['$log'];
|
|
31
|
+
return factory;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
link(scope: IScope, instanceElement: JQLite, instanceAttributes: IAttributes): void {
|
|
35
|
+
const eventType = instanceAttributes[AnalyticsOnDirective.NAME];
|
|
36
|
+
const eventData = {};
|
|
37
|
+
|
|
38
|
+
const attributePrefix = 'crnAnalytics';
|
|
39
|
+
const attributeEventKey = attributePrefix + 'Event';
|
|
40
|
+
|
|
41
|
+
for (const instanceAttribute in instanceAttributes.$attr) {
|
|
42
|
+
if (instanceAttribute.startsWith('crnAnalytics') && instanceAttribute !== AnalyticsOnDirective.NAME && instanceAttribute !== attributeEventKey) {
|
|
43
|
+
const eventDataKey = instanceAttribute.substr(attributePrefix.length).toLowerCase();
|
|
44
|
+
eventData[eventDataKey] = instanceAttributes[instanceAttribute];
|
|
45
|
+
instanceAttributes.$observe(instanceAttribute, (value) => {
|
|
46
|
+
eventData[eventDataKey] = value;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
instanceElement.on(eventType, async () => {
|
|
52
|
+
const analyticsService = getInstance<analytics.IAnalyticsService>(analytics.IAnalyticsService);
|
|
53
|
+
await analyticsService.track(instanceAttributes[attributeEventKey], eventData);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@component()
|
|
59
|
+
class AnalyticsAngularJsPlugin implements IAngularJsPlugin {
|
|
60
|
+
activate(): Promise<angular.IModule> {
|
|
61
|
+
const module = angular.module('cronapp.analytics', ['ui.router']);
|
|
62
|
+
|
|
63
|
+
module.directive(AnalyticsOnDirective.NAME, AnalyticsOnDirective.factory());
|
|
64
|
+
|
|
65
|
+
const initializationFunction: Injectable<Function> = ($rootScope: IRootScopeService, $location: ILocationService, $transitions: TransitionService, $timeout: ITimeoutService) => {
|
|
66
|
+
const analyticsService = getInstance<analytics.IAnalyticsService>(analytics.IAnalyticsService);
|
|
67
|
+
|
|
68
|
+
$transitions.onSuccess({}, transition => {
|
|
69
|
+
$timeout(async () => {
|
|
70
|
+
await analyticsService.page({
|
|
71
|
+
title: $rootScope['viewTitleOnly']
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const credentials = localStorage.getItem('_u');
|
|
77
|
+
|
|
78
|
+
if (credentials) {
|
|
79
|
+
$timeout(async () => {
|
|
80
|
+
await analyticsService.identify(JSON.parse(credentials).user.username);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const hookedSetItem = window.localStorage.setItem.bind(localStorage);
|
|
85
|
+
const hookedRemoveItem = window.localStorage.removeItem.bind(localStorage);
|
|
86
|
+
|
|
87
|
+
localStorage.setItem = (key, value) => {
|
|
88
|
+
if (key === '_u') {
|
|
89
|
+
$timeout(async () => {
|
|
90
|
+
await analyticsService.identify(JSON.parse(value).user.username);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
hookedSetItem(key, value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
localStorage.removeItem = key => {
|
|
98
|
+
if (key === '_u') {
|
|
99
|
+
$timeout(async () => {
|
|
100
|
+
await analyticsService.identify(null);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
hookedRemoveItem(key);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
initializationFunction.$inject = ['$rootScope', '$location', '$transitions', '$timeout'];
|
|
110
|
+
|
|
111
|
+
module.run(initializationFunction);
|
|
112
|
+
|
|
113
|
+
return Promise.resolve(module);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
bindSingleton(IAngularJsPlugin, AnalyticsAngularJsPlugin);
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
analytics
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var t={305:function(t){t.exports=function(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}}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{analytics:()=>t});var t={};n.r(t),n.d(t,{IAnalyticsPluginFactory:()=>mn,IAnalyticsService:()=>bn});var e=n(305),o=n.n(e),i="undefined",a="object",u="undefined"!=typeof process?process:{},c=(u.env&&u.env.NODE_ENV,"undefined"!=typeof document);function s(t,e){return e.charAt(0)[t]()+e.slice(1)}c&&window.location.hostname,null!=u.versions&&u.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,c&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var l=s.bind(null,"toUpperCase"),f=s.bind(null,"toLowerCase");function p(t,e){void 0===e&&(e=!0);var n=function(t){return h(t)?l("null"):"object"==typeof t?function(t){return g(t.constructor)?t.constructor.name:null}(t):Object.prototype.toString.call(t).slice(8,-1)}(t);return e?f(n):n}function d(t,e){return typeof e===t}var g=d.bind(null,"function"),y=d.bind(null,"string");function h(t){return null===t}function v(t,e){if("object"!=typeof e||h(e))return!1;if(e instanceof t)return!0;var n=p(new t(""));if(function(t){return t instanceof Error||y(t.message)&&t.constructor&&function(t){return"number"===p(t)&&!isNaN(t)}(t.constructor.stackTraceLimit)}(e))for(;e;){if(p(e)===n)return!0;e=Object.getPrototypeOf(e)}return!1}function m(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function b(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}function w(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function x(t,e,n){for(var r=e.length-1,o=0;o<r;++o){var i=e[o];if("__proto__"===i||"constructor"===i)break;i in t||(t[i]={}),t=t[i]}t[e[r]]=n}function O(){for(var t="",e=0,n=4294967295*Math.random()|0;e++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],o=15&n;t+="-"==r||"4"==r?r:("x"==r?o:3&o|8).toString(16),n=e%8==0?4294967295*Math.random()|0:n>>4}return t}d.bind(null,"undefined"),d.bind(null,"boolean"),d.bind(null,"symbol"),v.bind(null,TypeError),v.bind(null,SyntaxError),b(m,"form"),b(m,"button"),b(m,"input"),b(m,"select");var S="global",E="__global__",I=typeof self===a&&self.self===self&&self||typeof n.g===a&&n.g.global===n.g&&n.g||void 0;function j(t){return I[E][t]}function P(t,e){return I[E][t]=e}function k(t){delete I[E][t]}function _(t,e,n){var r;try{if(N(t)){var o=window[t];r=o[e].bind(o)}}catch(t){}return r||n}I[E]||(I[E]={});var A={};function N(t){if(typeof A[t]!==i)return A[t];try{var e=window[t];e.setItem(i,i),e.removeItem(i)}catch(e){return A[t]=!1}return A[t]=!0}var T,L="undefined"!=typeof process?process:{},M=(null==(T=L.env)||T.NODE_ENV,"undefined"!=typeof window);function D(t,e){return typeof e===t}M&&window.location.hostname,null!=L.versions&&L.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,M&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var C=D.bind(null,"function"),z=D.bind(null,"string"),R=(D.bind(null,"undefined"),D.bind(null,"boolean"));function U(t){if(!function(t){return t&&("object"==typeof t||null!==t)}(t))return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function $(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function V(t){return function(){return t.apply(void 0,[].slice.call(arguments).concat([].slice.call(arguments,1)))}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function F(t,e){if(t){if("string"==typeof t)return q(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(t,e):void 0}}function J(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||F(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t){return G="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},G(t)}function B(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function H(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){B(i,r,o,a,u,"next",t)}function u(t){B(i,r,o,a,u,"throw",t)}a(void 0)}))}}function W(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?X(Object(n),!0).forEach((function(e){W(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}V($),V($),V($),V($);var Z={exports:{}};!function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new k(r||[]);return i._invoke=function(t,e,n){var r=f;return function(o,i){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw i;return A()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var u=I(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=l(t,e,n);if("normal"===c.type){if(r=n.done?g:p,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=g,n.method="throw",n.arg=c.arg)}}}(t,n,a),i}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",g="completed",y={};function h(){}function v(){}function m(){}var b={};c(b,i,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(_([])));x&&x!==n&&r.call(x,i)&&(b=x);var O=m.prototype=h.prototype=Object.create(b);function S(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function I(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,I(t,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function j(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function _(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}return{next:A}}function A(){return{value:e,done:!0}}return v.prototype=m,c(O,"constructor",m),c(m,"constructor",v),v.displayName=c(m,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,c(t,u,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},S(E.prototype),c(E.prototype,a,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new E(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(O),c(O,u,"Generator"),c(O,i,(function(){return this})),c(O,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=_,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.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;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(Z);var K=Z.exports,Q="function",tt="undefined",et="reducer",nt="@@redux/",rt=nt+"INIT",ot=nt+Math.random().toString(36),it=function(){return("undefined"==typeof Symbol?"undefined":G(Symbol))===Q&&Symbol.observable||"@@observable"}(),at=" != "+Q;function ut(t,e,n){if(G(e)===Q&&G(n)===tt&&(n=e,e=void 0),G(n)!==tt){if(G(n)!==Q)throw new Error("enhancer"+at);return n(ut)(t,e)}if(G(t)!==Q)throw new Error(et+at);var r=t,o=e,i=[],a=i,u=!1;function c(){a===i&&(a=i.slice())}function s(){return o}function l(t){if(G(t)!==Q)throw new Error("Listener"+at);var e=!0;return c(),a.push(t),function(){if(e){e=!1,c();var n=a.indexOf(t);a.splice(n,1)}}}function f(t){if(!U(t))throw new Error("Act != obj");if(G(t.type)===tt)throw new Error("ActType "+tt);if(u)throw new Error("Dispatch in "+et);try{u=!0,o=r(o,t)}finally{u=!1}for(var e=i=a,n=0;n<e.length;n++)(0,e[n])();return t}return f({type:rt}),W({dispatch:f,subscribe:l,getState:s,replaceReducer:function(t){if(G(t)!==Q)throw new Error("next "+et+at);r=t,f({type:rt})}},it,(function(){var t=l;return W({subscribe:function(e){if("object"!==G(e))throw new TypeError("Observer != obj");function n(){e.next&&e.next(s())}return n(),{unsubscribe:t(n)}}},it,(function(){return this}))}))}function ct(t,e){var n=e&&e.type;return"action "+(n&&n.toString()||"?")+et+" "+t+" returns "+tt}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))}}))}function lt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return function(n,r,o){var i,a=t(n,r,o),u=a.dispatch,c={getState:a.getState,dispatch:function(t){return u(t)}};return i=e.map((function(t){return t(c)})),u=st.apply(void 0,J(i))(a.dispatch),Y(Y({},a),{},{dispatch:u})}}}var ft="__anon_id",pt="__user_id",dt="__user_traits",gt="analytics",yt="userId",ht="anonymousId",vt=["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","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],mt=["name","EVENTS","config","loaded"],bt=vt.reduce((function(t,e){return t[e]=e,t}),{registerPluginType:function(t){return"registerPlugin:".concat(t)},pluginReadyType:function(t){return"ready:".concat(t)}}),wt=/^utm_/,xt=/^an_prop_/,Ot=/^an_trait_/;function St(t){var e=t.storage.setItem;return function(n){return function(r){return function(o){if(o.type===bt.bootstrap){var i=o.params,a=o.user,u=o.persistedUser,c=o.initialUser,s=u.userId===a.userId;u.anonymousId!==a.anonymousId&&e(ft,a.anonymousId),s||e(pt,a.userId),c.traits&&e(dt,Y(Y({},s&&u.traits?u.traits:{}),c.traits));var l=Object.keys(o.params);if(l.length){var f=i.an_uid,p=i.an_event,d=l.reduce((function(t,e){if(e.match(wt)||e.match(/^(d|g)clid/)){var n=e.replace(wt,""),r="campaign"===n?"name":n;t.campaign[r]=i[e]}return e.match(xt)&&(t.props[e.replace(xt,"")]=i[e]),e.match(Ot)&&(t.traits[e.replace(Ot,"")]=i[e]),t}),{campaign:{},props:{},traits:{}});n.dispatch(Y(Y({type:bt.params,raw:i},d),f?{userId:f}:{})),f&&setTimeout((function(){return t.identify(f,d.traits)}),0),p&&setTimeout((function(){return t.track(p,d.props)}),0),Object.keys(d.campaign).length&&n.dispatch({type:bt.campaign,campaign:d.campaign})}}return r(o)}}}}function Et(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.type===bt.setItemEnd){if(n.key===ft)return Y(Y({},e),{anonymousId:n.value});if(n.key===pt)return Y(Y({},e),{userId:n.value})}switch(n.type){case bt.identify:return Object.assign({},e,{userId:n.userId,traits:Y(Y({},e.traits),n.traits)});case bt.reset:return[pt,ft,dt].forEach((function(e){t.removeItem(e)})),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function It(t){return{userId:t.getItem(pt),anonymousId:t.getItem(ft),traits:t.getItem(dt)}}var jt=function(t){return"__TEMP__"+t};function Pt(t){var e=t.storage,n=e.setItem,r=e.removeItem,o=e.getItem;return function(t){return function(e){return function(i){var a=i.userId,u=i.traits,c=i.options;if(i.type===bt.reset&&([pt,dt,ft].forEach((function(t){r(t)})),[yt,ht,"traits"].forEach((function(t){k(jt(t))}))),i.type===bt.identify){o(ft)||n(ft,O());var s=o(pt),l=o(dt)||{};s&&s!==a&&t.dispatch({type:bt.userIdChanged,old:{userId:s,traits:l},new:{userId:a,traits:u},options:c}),a&&n(pt,a),u&&n(dt,Y(Y({},l),u))}return e(i)}}}}var kt={};function _t(t,e){kt[t]&&C(kt[t])&&(kt[t](e),delete kt[t])}function At(t,e,n){return new Promise((function(r,o){return e()?r(t):n<1?o(Y(Y({},t),{},{queue:!0})):new Promise((function(t){return setTimeout(t,10)})).then((function(i){return At(t,e,n-10).then(r,o)}))}))}function Nt(t,e,n){var r=e(),o=t.getState(),i=o.plugins,a=o.context,u=o.queue,c=o.user;if(!a.offline&&u&&u.actions&&u.actions.length){var s=u.actions.reduce((function(t,e,n){return i[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(s.processIndex&&s.processIndex.length){s.processIndex.forEach((function(e){var o=u.actions[e],a=o.plugin,s=o.payload.type,l=r[a][s];if(l&&C(l)){var f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[yt,ht].reduce((function(n,r){return t.hasOwnProperty(r)&&e[r]&&e[r]!==t[r]&&(n[r]=e[r]),n}),t)}(o.payload,c);l({payload:f,config:i[a].config,instance:n});var p="".concat(s,":").concat(a);t.dispatch(Y(Y({},f),{},{type:p,_:{called:p,from:"queueDrain"}}))}}));var l=u.actions.filter((function(t,e){return!~s.processIndex.indexOf(e)}));u.actions=l}}}function Tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(t).filter((function(t){var r=n.plugins||{};return R(r[t])?r[t]:!1!==r.all&&(!e[t]||!1!==e[t].enabled)})).map((function(e){return t[e]}))}var Lt=/Start$/,Mt=/^bootstrap/,Dt=/^ready/;function Ct(t,e,n,r,o){return zt.apply(this,arguments)}function zt(){return(zt=H(K.mark((function t(e,n,r,o,i){var a,u,c,s,l,f,p,d,g,y,h;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=C(n)?n():n,u=e.type,c=u.replace(Lt,""),!e._||!e._.called){t.next=5;break}return t.abrupt("return",e);case 5:return s=r.getState(),l=Tt(a,s.plugins,e.options),u===bt.initializeStart&&e.fromEnable&&(l=Object.keys(s.plugins).filter((function(t){var n=s.plugins[t];return e.plugins.includes(t)&&!n.initialized})).map((function(t){return a[t]}))),f=l.map((function(t){return t.name})),p=Jt(u,l),t.next=12,Rt({action:e,data:{exact:p.before,namespaced:p.beforeNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 12:if(!Bt(d=t.sent,f.length)){t.next=15;break}return t.abrupt("return",d);case 15:if(u!==c){t.next=19;break}g=d,t.next=22;break;case 19:return t.next=21,Rt({action:Y(Y({},d),{},{type:c}),data:{exact:p.during,namespaced:p.duringNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 21:g=t.sent;case 22:if(!u.match(Lt)){t.next=28;break}return y="".concat(c,"End"),t.next=26,Rt({action:Y(Y({},g),{},{type:y}),data:{exact:p.after,namespaced:p.afterNS},state:s,allPlugins:a,allMatches:p,instance:r,store:o,EVENTS:i});case 26:(h=t.sent).meta&&h.meta.hasCallback&&_t(h.meta.rid,{payload:h});case 28:return t.abrupt("return",d);case 29:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rt(t){return Ut.apply(this,arguments)}function Ut(){return Ut=H(K.mark((function t(e){var n,r,o,i,a,u,c,s,l,f,p,d,g,y,h,v,m,b;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.data,r=e.action,o=e.instance,i=e.state,a=e.allPlugins,u=e.allMatches,c=e.store,s=e.EVENTS,l=i.plugins,f=i.context,p=r.type,d=p.match(Lt),g=n.exact.map((function(t){return t.pluginName})),d&&(g=u.during.map((function(t){return t.pluginName}))),y=Xt(o,g),h=n.exact.reduce((function(t,e){var n=e.pluginName,r=e.methodName,o=!1;return r.match(/^initialize/)||r.match(/^reset/)||(o=!l[n].loaded),f.offline&&r.match(/^(page|track|identify)/)&&(o=!0),t["".concat(n)]=o,t}),{}),t.next=10,n.exact.reduce(function(){var t=H(K.mark((function t(e,i,u){var c,s,f;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=i.pluginName,t.next=3,e;case 3:if(s=t.sent,!n.namespaced||!n.namespaced[c]){t.next=11;break}return t.next=7,n.namespaced[c].reduce(function(){var t=H(K.mark((function t(e,n,r){var i,u,s,f;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=function(t,e,n){return function(r,o){var i=n||e;return Y(Y({},t),{},{abort:{reason:r,plugins:o||[e],caller:p,from:i}})}},t.next=3,e;case 3:if(i=t.sent,n.method&&C(n.method)){t.next=6;break}return t.abrupt("return",i);case 6:return Yt(n.methodName,n.pluginName),t.next=9,n.method({payload:i,instance:o,abort:u(i,c,n.pluginName),config:Vt(n.pluginName,l,a),plugins:l});case 9:return s=t.sent,f=U(s)?s:{},t.abrupt("return",Promise.resolve(Y(Y({},i),f)));case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve(r));case 7:f=t.sent,s[c]=f,t.next=12;break;case 11:s[c]=r;case 12:return t.abrupt("return",Promise.resolve(s));case 13:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve({}));case 10:return v=t.sent,t.next=13,n.exact.reduce(function(){var t=H(K.mark((function t(e,r,i){var u,s,f,g,m,b,w,x,O,S,E,I;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.exact.length===i+1,s=r.pluginName,f=a[s],t.next=5,e;case 5:if(g=t.sent,m=v[s]?v[s]:{},d&&(m=g),!Gt(m,s)){t.next=11;break}return $t({data:m,method:p,instance:o,pluginName:s,store:c}),t.abrupt("return",Promise.resolve(g));case 11:if(!Gt(g,s)){t.next=14;break}return u&&$t({data:g,method:p,instance:o,store:c}),t.abrupt("return",Promise.resolve(g));case 14:if(!h.hasOwnProperty(s)||!0!==h[s]){t.next=17;break}return c.dispatch({type:"queue",plugin:s,payload:m,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(g));case 17:return b=y(v[s],a[s]),t.next=20,f[p]({abort:b.abort,payload:m,instance:o,config:Vt(s,l,a),plugins:l});case 20:return w=t.sent,x=U(w)?w:{},O=Y(Y({},g),x),Gt(S=v[s],s)?$t({data:S,method:p,instance:o,pluginName:s,store:c}):((E="".concat(p,":").concat(s)).match(/:/g)||[]).length<2&&!p.match(Mt)&&!p.match(Dt)&&(I=d?O:m,o.dispatch(Y(Y({},I),{},{type:E,_:{called:E,from:"submethod"}}))),t.abrupt("return",Promise.resolve(O));case 26:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Promise.resolve(r));case 13:if(m=t.sent,p.match(Lt)||p.match(/^registerPlugin/)||p.match(Dt)||p.match(Mt)||p.match(/^params/)||p.match(/^userIdChanged/)){t.next=21;break}if(s.plugins.includes(p),!m._||m._.originalAction!==p){t.next=18;break}return t.abrupt("return",m);case 18:b=Y(Y({},m),{_:{originalAction:m.type,called:m.type,from:"engineEnd"}}),Bt(m,n.exact.length)&&!p.match(/End$/)&&(b=Y(Y({},b),{type:m.type+"Aborted"})),c.dispatch(b);case 21:return t.abrupt("return",m);case 22:case"end":return t.stop()}}),t)}))),Ut.apply(this,arguments)}function $t(t){var e=t.data,n=t.method;t.instance;var r=t.pluginName,o=n+"Aborted"+(r?":"+r:"");t.store.dispatch(Y(Y({},e),{},{type:o,_:{called:o,from:"abort"}}))}function Vt(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function qt(t,e){return e.reduce((function(e,n){return n[t]?e.concat({methodName:t,pluginName:n.name,method:n[t]}):e}),[])}function Ft(t,e){var n=t.replace(Lt,""),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function Jt(t,e,n){var r=Ft(t).map((function(t){return qt(t,e)}));return e.reduce((function(n,r){var o=r.name,i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||F(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Ft(t,o).map((function(t){return qt(t,e)})),3),a=i[0],u=i[1],c=i[2];return a.length&&(n.beforeNS[o]=a),u.length&&(n.duringNS[o]=u),c.length&&(n.afterNS[o]=c),n}),{before:r[0],beforeNS:{},during:r[1],duringNS:{},after:r[2],afterNS:{}})}function Gt(t,e){var n=t.abort;return!!n&&(!0===n||Wt(n,e)||n&&Wt(n.plugins,e))}function Bt(t,e){var n=t.abort;if(!n)return!1;if(!0===n||z(n))return!0;var r=n.plugins;return Ht(n)&&n.length===e||Ht(r)&&r.length===e}function Ht(t){return Array.isArray(t)}function Wt(t,e){return!(!t||!Ht(t))&&t.includes(e)}function Xt(t,e){return function(n,r,o){var i=r.config,a=r.name,u="".concat(a,".").concat(n.type);o&&(u=o.event);var c=n.type.match(Lt)?function(t,e,n,r,o){return function(i,a){var u=r?r.name:t,c=a&&Ht(a)?a:n;if(r&&(!(c=a&&Ht(a)?a:[t]).includes(t)||1!==c.length))throw new Error("Method ".concat(e," can only abort ").concat(t," plugin. ").concat(JSON.stringify(c)," input valid"));return Y(Y({},o),{},{abort:{reason:i,plugins:c,caller:e,_:u}})}}(a,u,e,o,n):function(t,e){return function(){throw new Error(t.type+" action not cancellable. Remove abort in "+e)}}(n,u);return{payload:Kt(n),instance:t,config:i||{},abort:c}}}function Yt(t,e){var n=Zt(t);if(n&&n.name===e){var r=Zt(n.method),o=r?"or "+r.method:"";throw new Error([e+" plugin is calling method "+t,"Plugins cant call self","Use ".concat(n.method," ").concat(o," in ").concat(e," plugin insteadof ").concat(t)].join("\n"))}}function Zt(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Kt(t){return Object.keys(t).reduce((function(e,n){return"type"===n||(U(t[n])?e[n]=Object.assign({},t[n]):e[n]=t[n]),e}),{})}function Qt(t,e,n){var r={};return function(o){return function(i){return function(){var a=H(K.mark((function a(u){var c,s,l,f,p,d,g,y,h,v,m,b;return K.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(c=u.type,s=u.abort,l=u.plugins,f=u,!s){a.next=4;break}return a.abrupt("return",i(u));case 4:if(c===bt.enablePlugin&&o.dispatch({type:bt.initializeStart,plugins:l,disabled:[],fromEnable:!0,meta:u.meta}),c===bt.disablePlugin&&setTimeout((function(){return _t(u.meta.rid,{payload:u})}),0),c===bt.initializeEnd&&(p=e(),d=Object.keys(p),g=d.filter((function(t){return l.includes(t)})).map((function(t){return p[t]})),y=[],h=[],v=u.disabled,m=g.map((function(t){var e=t.loaded,n=t.name;return At(t,e,1e4).then((function(e){return r[n]||(o.dispatch({type:bt.pluginReadyType(n),name:n,events:Object.keys(t).filter((function(t){return!mt.includes(t)}))}),r[n]=!0),y=y.concat(n),t})).catch((function(t){if(t instanceof Error)throw new Error(t);return h=h.concat(t.name),t}))})),Promise.all(m).then((function(t){var e={plugins:y,failed:h,disabled:v};setTimeout((function(){d.length===m.length+v.length&&o.dispatch(Y(Y({},{type:bt.ready}),e))}),0)}))),c===bt.bootstrap){a.next=13;break}return/^ready:([^:]*)$/.test(c)&&setTimeout((function(){return Nt(o,e,t)}),0),a.next=11,Ct(u,e,t,o,n);case 11:return b=a.sent,a.abrupt("return",i(b));case 13:return a.abrupt("return",i(f));case 14:case"end":return a.stop()}}),a)})));return function(t){return a.apply(this,arguments)}}()}}}function te(t){return function(e){return function(e){return function(n){var r=n.type,o=n.key,i=n.value,a=n.options;if(r===bt.setItem||r===bt.removeItem){if(n.abort)return e(n);r===bt.setItem?t.setItem(o,i,a):t.removeItem(o,a)}return e(n)}}}}function ee(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ne(t,e,n){return e&&ee(t.prototype,e),n&&ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var re=ne((function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),W(this,"before",[]),W(this,"after",[]),W(this,"addMiddleware",(function(t,n){e[n]=e[n].concat(t)})),W(this,"removeMiddleware",(function(t,n){var r=e[n].findIndex((function(e){return e===t}));-1!==r&&(e[n]=[].concat(J(e[n].slice(0,r)),J(e[n].slice(r+1))))})),W(this,"dynamicMiddlewares",(function(t){return function(n){return function(r){return function(o){var i={getState:n.getState,dispatch:function(t){return n.dispatch(t)}},a=e[t].map((function(t){return t(i)}));return st.apply(void 0,J(a))(r)(o)}}}}))}));function oe(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r={};if("initialize:aborted"===n.type)return e;if(/^registerPlugin:([^:]*)$/.test(n.type)){var o=ie(n.type,"registerPlugin"),i=t()[o];if(!i||!o)return e;var a=n.enabled;return r[o]={enabled:a,initialized:!!a&&Boolean(!i.initialize),loaded:!!a&&Boolean(i.loaded()),config:i.config||{}},Y(Y({},e),r)}if(/^initialize:([^:]*)$/.test(n.type)){var u=ie(n.type,bt.initialize),c=t()[u];return c&&u?(r[u]=Y(Y({},e[u]),{initialized:!0,loaded:Boolean(c.loaded())}),Y(Y({},e),r)):e}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=Y(Y({},e[n.name]),{loaded:!0}),Y(Y({},e),r);switch(n.type){case bt.disablePlugin:return Y(Y({},e),ae(n.plugins,!1,e));case bt.enablePlugin:return Y(Y({},e),ae(n.plugins,!0,e));default:return e}}}function ie(t,e){return t.substring(e.length+1,t.length)}function ae(t,e,n){return t.reduce((function(t,r){return t[r]=Y(Y({},n[r]),{enabled:e}),t}),n)}function ue(t){try{return JSON.parse(JSON.stringify(t))}catch(t){}return t}var ce={last:{},history:[]};function se(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ce,e=arguments.length>1?arguments[1]:void 0,n=e.type,r=e.event,o=e.properties,i=e.options,a=e.meta;if(n===bt.track){var u=ue(Y(Y({event:r,properties:o},Object.keys(i).length&&{options:i}),{},{meta:a}));return Y(Y({},t),{last:u,history:t.history.concat(u)})}return t}var le={actions:[]};function fe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le,e=arguments.length>1?arguments[1]:void 0,n=e.type,r=e.payload;switch(n){case"queue":var o;return o=r&&r.type&&r.type===bt.identify?[e].concat(t.actions):t.actions.concat(e),Y(Y({},t),{},{actions:o});case"dequeue":return[];default:return t}}var pe=/#.*$/;function de(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(pe,""):"")}var ge,ye,he,ve,me=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!M)return t;var e=document,n=e.title,r=e.referrer,o=window,i=o.location,a=o.innerWidth,u=o.innerHeight,c=i.hash,s=i.search,l=function(t){var e=function(){if(M)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(pe,"")}(s),f={title:n,url:l,path:de(l),hash:c,search:s,width:a,height:u};return r&&""!==r&&(f.referrer=r),Y(Y({},f),t)},be={last:{},history:[]};function we(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:be,e=arguments.length>1?arguments[1]:void 0,n=e.properties,r=e.options,o=e.meta;if(e.type===bt.page){var i=ue(Y({properties:n,meta:o},Object.keys(r).length&&{options:r}));return Y(Y({},t),{last:i,history:t.history.concat(i)})}return t}ge=function(){if(!M)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"}(),ye=M?document.referrer:null,he=function(){if(c){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}(),ve=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){}}();var xe={initialized:!1,sessionId:O(),app:null,version:null,debug:!1,offline:!!M&&!navigator.onLine,os:{name:ge},userAgent:M?navigator.userAgent:"node",library:{name:gt,version:"0.10.22"},timezone:ve,locale:he,campaign:{},referrer:ye};function Oe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xe,e=arguments.length>1?arguments[1]:void 0,n=t.initialized,r=e.type,o=e.campaign;switch(r){case bt.campaign:return Y(Y({},t),{campaign:o});case bt.offline:return Y(Y({},t),{offline:!0});case bt.online:return Y(Y({},t),{offline:!1});default:return n?t:Y(Y(Y({},xe),t),{initialized:!0})}}var Se=["plugins","reducers","storage"];function Ee(t,e,n){if(M){var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach((function(t){r(t,e)}))}}function Ie(t){var e=Ee.bind(null,"online offline",(function(e){return Promise.resolve(!navigator.onLine).then(t)}));return e(!0),function(t){return e(!1)}}function je(){return P(gt,[]),function(t){return function(e,n,r){var o=t(e,n,r),i=o.dispatch;return Object.assign(o,{dispatch:function(t){var e=t.action||t;return I[E][gt].push(e),i(t)}})}}}function Pe(t){return function(){return st(st.apply(null,arguments),je())}}function ke(t){return t?(e=t,"[object Array]"===Object.prototype.toString.call(e)?t:[t]):[];var e}function _e(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=O();return r&&(kt[i]=(t=r,e=function(t){for(var e,n=t||Array.prototype.slice.call(arguments),r=0;r<n.length;r++)if(C(n[r])){e=n[r];break}return e}(o),function(n){e&&e(n),t(n)})),Y(Y({},n),{},{rid:i,ts:(new Date).getTime()},r?{hasCallback:!0}:{})}function Ae(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.reducers||{},r=e.initialUser||{},i=(e.plugins||[]).reduce((function(t,e){if(C(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=!(!1===e.enabled),o=!(e.config&&!1===e.config.enabled);t.pluginEnabled[e.name]=r&&o,delete e.enabled,e.methods&&(t.methods[e.name]=Object.keys(e.methods).reduce((function(t,n){return t[n]=(r=e.methods[n],function(){for(var t=Array.prototype.slice.call(arguments),e=new Array(r.length),n=0;n<t.length;n++)e[n]=t[n];return e[e.length]=T,r.apply({instance:T},e)}),t;var r}),{}),delete e.methods);var i=Object.keys(e).concat(n),a=new Set(t.events.concat(i));if(t.events=Array.from(a),t.pluginsArray=t.pluginsArray.concat(e),t.plugins[e.name])throw new Error(e.name+"AlreadyLoaded");return t.plugins[e.name]=e,t.plugins[e.name].loaded||(t.plugins[e.name].loaded=function(){return!0}),t}),{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),a=e.storage?e.storage:{getItem:j,setItem:P,removeItem:k},u=function(t){return function(e,n,r){return n.getState("user")[e]||(r&&U(r)&&r[e]?r[e]:It(t)[e]||j(jt(e))||null)}}(a),s=i.plugins,l=i.events.filter((function(t){return!mt.includes(t)})).sort(),f=new Set(l.concat(vt).filter((function(t){return!mt.includes(t)}))),p=Array.from(f).sort(),d=function(){return s},g=new re,y=g.addMiddleware,h=g.removeMiddleware,v=g.dynamicMiddlewares,m=function(){throw new Error("Abort disabled inListener")},b=function(t){for(var e,n=Object.create(null),r=/([^&=]+)=?([^&]*)/g;e=r.exec(t);){var o=w(e[1]),i=w(e[2]);if(o)if("[]"===o.substring(o.length-2)){var a=n[o=o.substring(0,o.length-2)]||(n[o]=[]);n[o]=Array.isArray(a)?a:[],n[o].push(i)}else n[o]=""===i||i}for(var u in n){var c=u.split("[");c.length>1&&(x(n,c.map((function(t){return t.replace(/[?[\]\\ ]/g,"")})),n[u]),delete n[u])}return n}(function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return c&&window.location.search.substring(1)}(t)),S=It(a),E=Y(Y(Y(Y({},S),r),b.an_uid?{userId:b.an_uid}:{}),b.an_aid?{anonymousId:b.an_aid}:{});E.anonymousId||(E.anonymousId=O());var I,_,A,N=Y({enable:function(t,e){return new Promise((function(n){X.dispatch({type:bt.enablePlugin,plugins:ke(t),_:{originalAction:bt.enablePlugin}},n,[e])}))},disable:function(t,e){return new Promise((function(n){X.dispatch({type:bt.disablePlugin,plugins:ke(t),_:{originalAction:bt.disablePlugin}},n,[e])}))}},i.methods),T={identify:(A=H(K.mark((function t(e,n,r,o){var i,a,c,s,l;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=z(e)?e:null,a=U(e)?e:n,c=r||{},s=T.user(),P(jt(yt),i),l=i||a.userId||u(yt,T,a),t.abrupt("return",new Promise((function(t){X.dispatch(Y({type:bt.identifyStart,userId:l,traits:a||{},options:c,anonymousId:s.anonymousId},s.id&&s.id!==i&&{previousId:s.id}),t,[n,r,o])})));case 7:case"end":return t.stop()}}),t)}))),function(t,e,n,r){return A.apply(this,arguments)}),track:(_=H(K.mark((function t(e,n,r,o){var i,a,c;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((i=U(e)?e.event:e)&&z(i)){t.next=3;break}throw new Error("EventMissing");case 3:return a=U(e)?e:n||{},c=U(r)?r:{},t.abrupt("return",new Promise((function(t){X.dispatch({type:bt.trackStart,event:i,properties:a,options:c,userId:u(yt,T,n),anonymousId:u(ht,T,n)},t,[n,r,o])})));case 6:case"end":return t.stop()}}),t)}))),function(t,e,n,r){return _.apply(this,arguments)}),page:(I=H(K.mark((function t(e,n,r){var o,i;return K.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=U(e)?e:{},i=U(n)?n:{},t.abrupt("return",new Promise((function(t){X.dispatch({type:bt.pageStart,properties:me(o),options:i,userId:u(yt,T,o),anonymousId:u(ht,T,o)},t,[e,n,r])})));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return I.apply(this,arguments)}),user:function(t){if(t===yt||"id"===t)return u(yt,T);if(t===ht||"anonId"===t)return u(ht,T);var e=T.getState("user");return t?o()(e,t):e},reset:function(t){return new Promise((function(e){X.dispatch({type:bt.resetStart},e,t)}))},ready:function(t){return T.on(bt.ready,t)},on:function(t,e){if(!t||!C(e))return!1;if(t===bt.bootstrap)throw new Error(".on disabled for "+t);var n=/Start$|Start:/;if("*"===t){var r=function(t){return function(t){return function(r){return r.type.match(n)&&e({payload:r,instance:T,plugins:s}),t(r)}}},o=function(t){return function(t){return function(r){return r.type.match(n)||e({payload:r,instance:T,plugins:s}),t(r)}}};return y(r,Ne),y(o,Te),function(){h(r,Ne),h(o,Te)}}var i=t.match(n)?Ne:Te,a=function(n){return function(n){return function(r){return r.type===t&&e({payload:r,instance:T,plugins:s,abort:m}),n(r)}}};return y(a,i),function(){return h(a,i)}},once:function(t,e){if(!t||!C(e))return!1;if(t===bt.bootstrap)throw new Error(".once disabled for "+t);var n=T.on(t,(function(t){var r=t.payload;e({payload:r,instance:T,plugins:s,abort:m}),n()}));return n},getState:function(t){var e=X.getState();return t?o()(e,t):Object.assign({},e)},dispatch:function(t){var e,n=z(t)?{type:t}:t;if(e=n.type,vt.includes(e))throw new Error("reserved action "+n.type);var r=t._||{},o=Y(Y({},n),{},{_:Y({originalAction:n.type},r)});X.dispatch(o)},enablePlugin:N.enable,disablePlugin:N.disable,plugins:N,storage:{getItem:a.getItem,setItem:function(t,e,n){X.dispatch({type:bt.setItemStart,key:t,value:e,options:n})},removeItem:function(t,e){X.dispatch({type:bt.removeItemStart,key:t,options:e})}},setAnonymousId:function(t,e){T.storage.setItem(ft,t,e)},events:{all:p,core:vt,plugins:l}},L=i.middlewares.concat([function(t){return function(t){return function(e){return e.meta||(e.meta=_e()),t(e)}}},v(Ne),Qt(T,d,{all:p,plugins:l}),te(a),St(T),Pt(T),v(Te)]),D={context:Oe,user:Et(a),page:we,track:se,plugins:oe(d),queue:fe},R=st,$=st;if(M&&e.debug){var V=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;V&&(R=V({trace:!0,traceLimit:25})),$=function(){return 0===arguments.length?je():U(G(arguments[0]))?Pe():Pe().apply(null,arguments)}}var q,F=function(t){return Object.keys(t).reduce((function(e,n){return Se.includes(n)||(e[n]=t[n]),e}),{})}(e),B=i.pluginsArray.reduce((function(t,e){var n=e.name,r=e.config,o=e.loaded,a=i.pluginEnabled[n];return t[n]={enabled:a,initialized:!!a&&Boolean(!e.initialize),loaded:Boolean(o()),config:r||{}},t}),{}),W={context:F,user:E,plugins:B},X=ut(function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var o=e[r];G(t[o])===Q&&(n[o]=t[o])}var i,a=Object.keys(n);try{!function(t){Object.keys(t).forEach((function(e){var n=t[e];if(G(n(void 0,{type:rt}))===tt||G(n(void 0,{type:ot}))===tt)throw new Error(et+" "+e+" "+tt)}))}(n)}catch(t){i=t}return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;if(i)throw i;for(var r=!1,o={},u=0;u<a.length;u++){var c=a[u],s=n[c],l=t[c],f=s(l,e);if(G(f)===tt){var p=ct(c,e);throw new Error(p)}o[c]=f,r=r||f!==l}return r?o:t}}(Y(Y({},D),n)),W,$(R(lt.apply(void 0,J(L)))));X.dispatch=(q=X.dispatch,function(t,e,n){var r=_e(t.meta,e,ke(n)),o=Y(Y({},t),{meta:r});return q.apply(null,[o])});var Z=Object.keys(s);X.dispatch({type:bt.bootstrap,plugins:Z,config:F,params:b,user:E,initialUser:r,persistedUser:S});var nt=Z.filter((function(t){return i.pluginEnabled[t]})),it=Z.filter((function(t){return!i.pluginEnabled[t]}));return X.dispatch({type:bt.registerPlugins,plugins:Z,enabled:i.pluginEnabled}),i.pluginsArray.map((function(t,e){var n=t.bootstrap,r=t.config,o=t.name;n&&C(n)&&n({instance:T,config:r,payload:t}),X.dispatch({type:bt.registerPluginType(o),name:o,enabled:i.pluginEnabled[o],plugin:t}),i.pluginsArray.length===e+1&&X.dispatch({type:bt.initializeStart,plugins:nt,disabled:it})})),Ie((function(t){X.dispatch({type:t?bt.offline:bt.online})})),function(t,e,n){setInterval((function(){return Nt(t,e,n)}),3e3)}(X,d,T),T}var Ne="before",Te="after",Le="cookie",Me=Re(),De=Ue,Ce=Ue;function ze(t){return Me?Ue(t,"",-1):k(t)}function Re(){if(void 0!==Me)return Me;var t="cookiecookie";try{Ue(t,t),Me=-1!==document.cookie.indexOf(t),ze(t)}catch(t){Me=!1}return Me}function Ue(t,e,n,r,o,i){if("undefined"!=typeof window){var a=arguments.length>1;return!1===Me&&(a?P(t,e):j(t)),a?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(o?"; domain="+o:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var $e,Ve="localStorage",qe=N.bind(null,"localStorage"),Fe=(_("localStorage","getItem",j),_("localStorage","setItem",P),_("localStorage","removeItem",k),"undefined"!=typeof process?process:{}),Je=(null==($e=Fe.env)||$e.NODE_ENV,"undefined"!=typeof window);function Ge(t,e){return typeof e===t}Je&&window.location.hostname,null!=Fe.versions&&Fe.versions.node,"undefined"!=typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,Je&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Ge.bind(null,"function");var Be=Ge.bind(null,"string"),He=Ge.bind(null,"undefined");function We(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?function(t,e){return void 0===e&&(e=""),t&&t.nodeName===e.toUpperCase()}(t,e):n}function Xe(t){return function(){return t.apply(void 0,[].slice.call(arguments).concat([].slice.call(arguments,1)))}}function Ye(t){var e=t;try{if("true"===(e=JSON.parse(t)))return!0;if("false"===e)return!1;if(function(t){if(!function(t){return t&&("object"==typeof t||null!==t)}(t))return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch(t){}if(null!==e&&""!==e)return e}Ge.bind(null,"boolean"),Xe(We),Xe(We),Xe(We),Xe(We);var Ze=qe(),Ke=Re();function Qe(t,e){if(t){var n=tn(e),r=!rn(n),o=en(n)?Ye(localStorage.getItem(t)):void 0;if(r&&!He(o))return o;var i=nn(n)?Ye(De(t)):void 0;if(r&&i)return i;var a=j(t);return r?a:{localStorage:o,cookie:i,global:a}}}function tn(t){return t?Be(t)?t:t.storage:"any"}function en(t){return Ze&&on(t,Ve)}function nn(t){return Ke&&on(t,Le)}function rn(t){return"*"===t||"all"===t}function on(t,e){return"any"===t||t===e||rn(t)}function an(t,e,n){return{location:t,current:e,previous:n}}var un={setItem:function(t,e,n){if(t&&!He(e)){var r={},o=tn(n),i=JSON.stringify(e),a=!rn(o);return en(o)&&(r[Ve]=an(Ve,e,Ye(localStorage.getItem(t))),localStorage.setItem(t,i),a)?r[Ve]:nn(o)&&(r[Le]=an(Le,e,Ye(De(t))),Ce(t,i),a)?r[Le]:(r[S]=an(S,e,j(t)),P(t,e),a?r[S]:r)}},getItem:Qe,removeItem:function(t,e){if(t){var n=tn(e),r=Qe(t,"*"),o={};return!He(r.localStorage)&&en(n)&&(localStorage.removeItem(t),o[Ve]=r.localStorage),!He(r.cookie)&&nn(n)&&(ze(t),o[Le]=r.cookie),!He(r.global)&&on(n,S)&&(k(t),o[S]=r.global),o}}};const cn=un;var sn=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 ln(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var fn=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ln(n,!0).forEach((function(e){sn(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ln(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t};var pn=function(t,e){return function(n,r){e(n,r,t)}},dn=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))},gn=cronapp.configuration.IConfigurationService,yn=cronapp.ioc.component,hn=cronapp.ioc.qualifier,vn=cronapp.ioc.bindSingleton;const mn="analyticsPluginFactory",bn="analyticsService";let wn=class{constructor(t,e){this.plugins=t,this.configurationService=e,cronapp.event.filterEvent(e.onDidChangeConfiguration,(t=>t.keys.includes("analytics.enabled")))(this.updateEnablement),this.updateEnablement().catch((t=>console.error(t)))}identify(t,e){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.identify(t,e)}))}track(t,e){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.track(t,e)}))}page(t){return dn(this,void 0,void 0,(function*(){if(this.analytics)return yield this.analytics.page(Object.assign({},t))}))}updateEnablement(){return dn(this,void 0,void 0,(function*(){if(yield this.configurationService.getValue("cronapp.framework.analytics.enabled",!0)){const t=yield this.configurationService.getValue("cronapp.framework.analytics.application.name","cronapp-application"),e=yield this.configurationService.getValue("cronapp.framework.analytics.application.version","1.0.0"),n=yield Promise.all(this.plugins.map((t=>t.createAnalyticsPlugin())));this.analytics=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ae(fn(fn({},{storage:cn}),t))}({app:t,version:e,plugins:n})}else this.analytics=null}))}};wn=function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}([yn(),pn(0,hn(mn,!0)),pn(1,hn(gn)),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Array,Object])],wn),vn(bn,wn);const xn=angular;var On=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))},Sn=cronapp.angularJs.IAngularJsPlugin,En=cronapp.ioc.bindSingleton,In=cronapp.ioc.component,jn=cronapp.ioc.getInstance;class Pn{constructor(t){this.restrict="A",this.logService=t}static factory(){const t=t=>new Pn(t);return t.$inject=["$log"],t}link(t,e,n){const r=n[Pn.NAME],o={},i="crnAnalyticsEvent";for(const t in n.$attr)if(t.startsWith("crnAnalytics")&&t!==Pn.NAME&&t!==i){const e=t.substr(12).toLowerCase();o[e]=n[t],n.$observe(t,(t=>{o[e]=t}))}e.on(r,(()=>On(this,void 0,void 0,(function*(){const t=jn(bn);yield t.track(n[i],o)}))))}}Pn.NAME="crnAnalyticsOn";let kn=class{activate(){const t=xn.module("cronapp.analytics",["ui.router"]);t.directive(Pn.NAME,Pn.factory());const e=(t,e,n,r)=>{const o=jn(bn);n.onSuccess({},(e=>{r((()=>On(this,void 0,void 0,(function*(){yield o.page({title:t.viewTitleOnly})}))))}));const i=localStorage.getItem("_u");i&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(JSON.parse(i).user.username)}))));const a=window.localStorage.setItem.bind(localStorage),u=window.localStorage.removeItem.bind(localStorage);localStorage.setItem=(t,e)=>{"_u"===t&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(JSON.parse(e).user.username)})))),a(t,e)},localStorage.removeItem=t=>{"_u"===t&&r((()=>On(this,void 0,void 0,(function*(){yield o.identify(null)})))),u(t)}};return e.$inject=["$rootScope","$location","$transitions","$timeout"],t.run(e),Promise.resolve(t)}};kn=function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}([In()],kn),En(Sn,kn)})();var o=cronapp="undefined"==typeof cronapp?{}:cronapp;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.packages.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "src/main/browser",
|
|
5
|
+
"outDir": "target/browser",
|
|
6
|
+
"baseUrl": "src/main/browser"
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"../typings/@cronapp/framework-core.d.ts",
|
|
10
|
+
"src/main/browser"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const createConfig = require('../webpack.config.js');
|
|
3
|
+
const packageName = 'cronapp.framework.analytics';
|
|
4
|
+
|
|
5
|
+
module.exports = (env, options) => {
|
|
6
|
+
const ROOT = path.resolve(__dirname, 'src/main/browser');
|
|
7
|
+
const DESTINATION = path.resolve(__dirname, 'target/browser');
|
|
8
|
+
return createConfig(env, options, packageName, ROOT, DESTINATION);
|
|
9
|
+
};
|