@jitsu/js 1.11.0-beta.10 → 1.11.0-beta.12
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/dist/jitsu-no-ext.cjs.js +1 -1
- package/dist/jitsu-no-ext.es.js +1 -1
- package/dist/jitsu.cjs.js +1 -1
- package/dist/jitsu.es.js +1 -1
- package/dist/web/p.js.txt +3488 -8
- package/package.json +2 -2
package/dist/web/p.js.txt
CHANGED
|
@@ -1,8 +1,3488 @@
|
|
|
1
|
-
"use strict";(()=>{var Sr=Object.create;var st=Object.defineProperty,Er=Object.defineProperties,Or=Object.getOwnPropertyDescriptor,xr=Object.getOwnPropertyDescriptors,_r=Object.getOwnPropertyNames,an=Object.getOwnPropertySymbols,jr=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty,Pr=Object.prototype.propertyIsEnumerable;var cn=(t,e,n)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))un.call(e,n)&&cn(t,n,e[n]);if(an)for(var n of an(e))Pr.call(e,n)&&cn(t,n,e[n]);return t},W=(t,e)=>Er(t,xr(e));var Ar=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Nr=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _r(e))!un.call(t,i)&&i!==n&&st(t,i,{get:()=>e[i],enumerable:!(r=Or(e,i))||r.enumerable});return t};var Tr=(t,e,n)=>(n=t!=null?Sr(jr(t)):{},Nr(e||!t||!t.__esModule?st(n,"default",{value:t,enumerable:!0}):n,t));var G=(t,e,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(f){i(f)}},s=l=>{try{a(n.throw(l))}catch(f){i(f)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(t,e)).next())});var ln=Ar((at,ct)=>{(function(t,e){typeof at=="object"&&typeof ct!="undefined"?ct.exports=function(n,r,i,o,s){for(r=r.split?r.split("."):r,o=0;o<r.length;o++)n=n?n[r[o]]:s;return n===s?i:n}:typeof define=="function"&&define.amd?define(function(){return function(n,r,i,o,s){for(r=r.split?r.split("."):r,o=0;o<r.length;o++)n=n?n[r[o]]:s;return n===s?i:n}}):t.dlv=function(n,r,i,o,s){for(r=r.split?r.split("."):r,o=0;o<r.length;o++)n=n?n[r[o]]:s;return n===s?i:n}})(at)});var Be=Tr(ln());var Ne="undefined";var ut="object";var lt="any",dt="*";var re="__";var Le=typeof process!="undefined"?process:{},So=Le.env&&Le.env.NODE_ENV||"";var Y=typeof document!="undefined",Eo=Y&&window.location.hostname==="localhost",Oo=Le.versions!=null&&Le.versions.node!=null,xo=typeof Deno!="undefined"&&Deno.core!==void 0,_o=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",jo=Y&&window.name==="nodejs"||typeof navigator!="undefined"&&navigator.userAgent!==void 0&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function dn(t,e){return e.charAt(0)[t]()+e.slice(1)}var zr=dn.bind(null,"toUpperCase"),Cr=dn.bind(null,"toLowerCase");function Rr(t){return gn(t)?zr("null"):typeof t=="object"?Ur(t):Object.prototype.toString.call(t).slice(8,-1)}function Fe(t,e){e===void 0&&(e=!0);var n=Rr(t);return e?Cr(n):n}function Te(t,e){return typeof e===t}var Q=Te.bind(null,"function"),ie=Te.bind(null,"string"),fe=Te.bind(null,"undefined");var fn=Te.bind(null,"boolean"),Po=Te.bind(null,"symbol");function gn(t){return t===null}function Dr(t){return Fe(t)==="number"&&!isNaN(t)}function mn(t){return Fe(t)==="array"}function q(t){if(!$r(t))return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function $r(t){return t&&(typeof t=="object"||t!==null)}function Ur(t){return Q(t.constructor)?t.constructor.name:null}function Jr(t){return t instanceof Error||ie(t.message)&&t.constructor&&Dr(t.constructor.stackTraceLimit)}function pn(t,e){if(typeof e!="object"||gn(e))return!1;if(e instanceof t)return!0;var n=Fe(new t(""));if(Jr(e))for(;e;){if(Fe(e)===n)return!0;e=Object.getPrototypeOf(e)}return!1}var Ao=pn.bind(null,TypeError),No=pn.bind(null,SyntaxError);function Ge(t,e){var n=t instanceof Element||t instanceof HTMLDocument;return n&&e?Lr(t,e):n}function Lr(t,e){return e===void 0&&(e=""),t&&t.nodeName===e.toUpperCase()}function Me(t){var e=[].slice.call(arguments,1);return function(){return t.apply(void 0,[].slice.call(arguments).concat(e))}}var To=Me(Ge,"form"),zo=Me(Ge,"button"),Co=Me(Ge,"input"),Ro=Me(Ge,"select");function hn(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function bn(){if(Y){var t=navigator,e=t.languages;return t.userLanguage||(e&&e.length?e[0]:t.language)}}function vn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){}}function yn(t){return(function(e){for(var n,r=Object.create(null),i=/([^&=]+)=?([^&]*)/g;n=i.exec(e);){var o=hn(n[1]),s=hn(n[2]);o.substring(o.length-2)==="[]"?(r[o=o.substring(0,o.length-2)]||(r[o]=[])).push(s):r[o]=s===""||s}for(var a in r){var l=a.split("[");l.length>1&&(Fr(r,l.map(function(f){return f.replace(/[?[\]\\ ]/g,"")}),r[a]),delete r[a])}return r})((function(e){if(e){var n=e.match(/\?(.*)/);return n&&n[1]?n[1].split("#")[0]:""}return Y&&window.location.search.substring(1)})(t))}function Fr(t,e,n){for(var r=e.length-1,i=0;i<r;++i){var o=e[i];if(o==="__proto__"||o==="constructor")break;o in t||(t[o]={}),t=t[o]}t[e[r]]=n}function ze(){for(var t="",e=0,n=4294967295*Math.random()|0;e++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e-1],i=15&n;t+=r=="-"||r=="4"?r:(r=="x"?i:3&i|8).toString(16),n=e%8==0?4294967295*Math.random()|0:n>>4}return t}var ve="global",ge=re+"global"+re,me=typeof self===ut&&self.self===self&&self||typeof global===ut&&global.global===global&&global||void 0;function Z(t){return me[ge][t]}function K(t,e){return me[ge][t]=e}function ee(t){delete me[ge][t]}function se(t,e,n){var r;try{if(Ce(t)){var i=window[t];r=i[e].bind(i)}}catch(o){}return r||n}me[ge]||(me[ge]={});var qe={};function Ce(t){if(typeof qe[t]!==Ne)return qe[t];try{var e=window[t];e.setItem(Ne,Ne),e.removeItem(Ne)}catch(n){return qe[t]=!1}return qe[t]=!0}function E(){return E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},E.apply(this,arguments)}var ce="function",oe="undefined",Gr="@@redux/"+Math.random().toString(36),wn=(function(){return typeof Symbol===ce&&Symbol.observable||"@@observable"})(),Ve=" != "+ce;function Un(t,e,n){var r;if(typeof e===ce&&typeof n===oe&&(n=e,e=void 0),typeof n!==oe){if(typeof n!==ce)throw new Error("enhancer"+Ve);return n(Un)(t,e)}if(typeof t!==ce)throw new Error("reducer"+Ve);var i=t,o=e,s=[],a=s,l=!1;function f(){a===s&&(a=s.slice())}function b(){return o}function m(g){if(typeof g!==ce)throw new Error("Listener"+Ve);var w=!0;return f(),a.push(g),function(){if(w){w=!1,f();var v=a.indexOf(g);a.splice(v,1)}}}function d(g){if(!q(g))throw new Error("Act != obj");if(typeof g.type===oe)throw new Error("ActType "+oe);if(l)throw new Error("Dispatch in reducer");try{l=!0,o=i(o,g)}finally{l=!1}for(var w=s=a,v=0;v<w.length;v++)(0,w[v])();return g}return d({type:"@@redux/INIT"}),(r={dispatch:d,subscribe:m,getState:b,replaceReducer:function(g){if(typeof g!==ce)throw new Error("next reducer"+Ve);i=g,d({type:"@@redux/INIT"})}})[wn]=function(){var g,w=m;return(g={subscribe:function(v){if(typeof v!="object")throw new TypeError("Observer != obj");function h(){v.next&&v.next(b())}return h(),{unsubscribe:w(h)}}})[wn]=function(){return this},g},r}function Mr(t,e){var n=e&&e.type;return"action "+(n&&n.toString()||"?")+"reducer "+t+" returns "+oe}function ke(){var t=[].slice.call(arguments);return t.length===0?function(e){return e}:t.length===1?t[0]:t.reduce(function(e,n){return function(){return e(n.apply(void 0,[].slice.call(arguments)))}})}function Br(){var t=arguments;return function(e){return function(n,r,i){var o,s=e(n,r,i),a=s.dispatch,l={getState:s.getState,dispatch:function(f){return a(f)}};return o=[].slice.call(t).map(function(f){return f(l)}),E({},s,{dispatch:a=ke.apply(void 0,o)(s.dispatch)})}}}var ue=re+"anon_id",pe=re+"user_id",we=re+"user_traits";var ae="userId",ye="anonymousId",Xe=["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"],ht=["name","EVENTS","config","loaded"],S=Xe.reduce(function(t,e){return t[e]=e,t},{registerPluginType:function(t){return"registerPlugin:"+t},pluginReadyType:function(t){return"ready:"+t}}),In=/^utm_/,kn=/^an_prop_/,Sn=/^an_trait_/;function qr(t){var e=t.storage.setItem;return function(n){return function(r){return function(i){if(i.type===S.bootstrap){var o=i.params,s=i.user,a=i.persistedUser,l=i.initialUser,f=a.userId===s.userId;a.anonymousId!==s.anonymousId&&e(ue,s.anonymousId),f||e(pe,s.userId),l.traits&&e(we,E({},f&&a.traits?a.traits:{},l.traits));var b=Object.keys(i.params);if(b.length){var m=o.an_uid,d=o.an_event,g=b.reduce(function(w,v){if(v.match(In)||v.match(/^(d|g)clid/)){var h=v.replace(In,"");w.campaign[h==="campaign"?"name":h]=o[v]}return v.match(kn)&&(w.props[v.replace(kn,"")]=o[v]),v.match(Sn)&&(w.traits[v.replace(Sn,"")]=o[v]),w},{campaign:{},props:{},traits:{}});n.dispatch(E({type:S.params,raw:o},g,m?{userId:m}:{})),m&&setTimeout(function(){return t.identify(m,g.traits)},0),d&&setTimeout(function(){return t.track(d,g.props)},0),Object.keys(g.campaign).length&&n.dispatch({type:S.campaign,campaign:g.campaign})}}return r(i)}}}}function Vr(t){return function(e,n){if(e===void 0&&(e={}),n===void 0&&(n={}),n.type===S.setItemEnd){if(n.key===ue)return E({},e,{anonymousId:n.value});if(n.key===pe)return E({},e,{userId:n.value})}switch(n.type){case S.identify:return Object.assign({},e,{userId:n.userId,traits:E({},e.traits,n.traits)});case S.reset:return[pe,ue,we].forEach(function(r){t.removeItem(r)}),Object.assign({},e,{userId:null,anonymousId:null,traits:{}});default:return e}}}function En(t){return{userId:t.getItem(pe),anonymousId:t.getItem(ue),traits:t.getItem(we)}}var bt=function(t){return re+"TEMP"+re+t};function Hr(t){var e=t.storage,n=e.setItem,r=e.removeItem,i=e.getItem;return function(o){return function(s){return function(a){var l=a.userId,f=a.traits,b=a.options;if(a.type===S.reset&&([pe,we,ue].forEach(function(g){r(g)}),[ae,ye,"traits"].forEach(function(g){ee(bt(g))})),a.type===S.identify){i(ue)||n(ue,ze());var m=i(pe),d=i(we)||{};m&&m!==l&&o.dispatch({type:S.userIdChanged,old:{userId:m,traits:d},new:{userId:l,traits:f},options:b}),l&&n(pe,l),f&&n(we,E({},d,f))}return s(a)}}}}var Re={};function On(t,e){Re[t]&&Q(Re[t])&&(Re[t](e),delete Re[t])}function Jn(t,e,n){return new Promise(function(r,i){return e()?r(t):n<1?i(E({},t,{queue:!0})):new Promise(function(o){return setTimeout(o,10)}).then(function(o){return Jn(t,e,n-10).then(r,i)})})}function Wr(t){return{abort:t}}function Ln(t,e,n){var r={},i=e(),o=t.getState(),s=o.plugins,a=o.queue,l=o.user;if(!o.context.offline&&a&&a.actions&&a.actions.length){var f=a.actions.reduce(function(m,d,g){return s[d.plugin].loaded?(m.process.push(d),m.processIndex.push(g)):(m.requeue.push(d),m.requeueIndex.push(g)),m},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(f.processIndex&&f.processIndex.length){f.processIndex.forEach(function(m){var d=a.actions[m],g=d.plugin,w=d.payload.type,v=i[g][w];if(v&&Q(v)){var h,_=(function(I,p){return I===void 0&&(I={}),p===void 0&&(p={}),[ae,ye].reduce(function(C,j){return I.hasOwnProperty(j)&&p[j]&&p[j]!==I[j]&&(C[j]=p[j]),C},I)})(d.payload,l),N=r[_.meta.rid];if(!N&&(h=v({payload:_,config:s[g].config,instance:n,abort:Wr}))&&q(h)&&h.abort)return void(r[_.meta.rid]=!0);if(!N){var x=w+":"+g;t.dispatch(E({},_,{type:x,_:{called:x,from:"queueDrain"}}))}}});var b=a.actions.filter(function(m,d){return!~f.processIndex.indexOf(d)});a.actions=b}}}var ft=function(t){var e=t.data,n=t.action,r=t.instance,i=t.state,o=t.allPlugins,s=t.allMatches,a=t.store,l=t.EVENTS;try{var f=i.plugins,b=i.context,m=n.type,d=m.match(Ie),g=e.exact.map(function(h){return h.pluginName});d&&(g=s.during.map(function(h){return h.pluginName}));var w=(function(h,_){return function(N,x,I){var p=x.config,C=x.name,j=C+"."+N.type;I&&(j=I.event);var T=N.type.match(Ie)?(function($,U,M,J,V){return function(L,O){var H=J?J.name:$,X=O&&De(O)?O:M;if(J&&(!(X=O&&De(O)?O:[$]).includes($)||X.length!==1))throw new Error("Method "+U+" can only abort "+$+" plugin. "+JSON.stringify(X)+" input valid");return E({},V,{abort:{reason:L,plugins:X,caller:U,_:H}})}})(C,j,_,I,N):(function($,U){return function(){throw new Error($.type+" action not cancellable. Remove abort in "+U)}})(N,j);return{payload:Xr(N),instance:h,config:p||{},abort:T}}})(r,g),v=e.exact.reduce(function(h,_){var N=_.pluginName,x=_.methodName,I=!1;return x.match(/^initialize/)||x.match(/^reset/)||(I=!f[N].loaded),b.offline&&x.match(/^(page|track|identify)/)&&(I=!0),h[""+N]=I,h},{});return Promise.resolve(e.exact.reduce(function(h,_,N){try{var x=_.pluginName;return Promise.resolve(h).then(function(I){function p(){return Promise.resolve(I)}var C=(function(){if(e.namespaced&&e.namespaced[x])return Promise.resolve(e.namespaced[x].reduce(function(j,T,$){try{return Promise.resolve(j).then(function(U){return T.method&&Q(T.method)?((function(L,O){var H=Tn(L);if(H&&H.name===O){var X=Tn(H.method);throw new Error([O+" plugin is calling method "+L,"Plugins cant call self","Use "+H.method+" "+(X?"or "+X.method:"")+" in "+O+" plugin insteadof "+L].join(`
|
|
2
|
-
`))}})(T.methodName,T.pluginName),Promise.resolve(T.method({payload:U,instance:r,abort:(M=U,J=x,V=T.pluginName,function(L,O){return E({},M,{abort:{reason:L,plugins:O||[J],caller:m,from:V||J}})}),config:jn(T.pluginName,f,o),plugins:f})).then(function(L){var O=q(L)?L:{};return Promise.resolve(E({},U,O))})):U;var M,J,V})}catch(U){return Promise.reject(U)}},Promise.resolve(n))).then(function(j){I[x]=j});I[x]=n})();return C&&C.then?C.then(p):p()})}catch(I){return Promise.reject(I)}},Promise.resolve({}))).then(function(h){return Promise.resolve(e.exact.reduce(function(_,N,x){try{var I=e.exact.length===x+1,p=N.pluginName,C=o[p];return Promise.resolve(_).then(function(j){var T=h[p]?h[p]:{};if(d&&(T=j),mt(T,p))return gt({data:T,method:m,instance:r,pluginName:p,store:a}),Promise.resolve(j);if(mt(j,p))return I&>({data:j,method:m,instance:r,store:a}),Promise.resolve(j);if(v.hasOwnProperty(p)&&v[p]===!0)return a.dispatch({type:"queue",plugin:p,payload:T,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(j);var $=w(h[p],o[p]);return Promise.resolve(C[m]({abort:$.abort,payload:T,instance:r,config:jn(p,f,o),plugins:f})).then(function(U){var M=q(U)?U:{},J=E({},j,M),V=h[p];if(mt(V,p))gt({data:V,method:m,instance:r,pluginName:p,store:a});else{var L=m+":"+p;(L.match(/:/g)||[]).length<2&&!m.match(xn)&&!m.match(_n)&&r.dispatch(E({},d?J:T,{type:L,_:{called:L,from:"submethod"}}))}return Promise.resolve(J)})})}catch(j){return Promise.reject(j)}},Promise.resolve(n))).then(function(_){if(!(m.match(Ie)||m.match(/^registerPlugin/)||m.match(_n)||m.match(xn)||m.match(/^params/)||m.match(/^userIdChanged/))){if(l.plugins.includes(m),_._&&_._.originalAction===m)return _;var N=E({},_,{_:{originalAction:_.type,called:_.type,from:"engineEnd"}});Fn(_,e.exact.length)&&!m.match(/End$/)&&(N=E({},N,{type:_.type+"Aborted"})),a.dispatch(N)}return _})})}catch(h){return Promise.reject(h)}},Ie=/Start$/,xn=/^bootstrap/,_n=/^ready/;function gt(t){var e=t.pluginName,n=t.method+"Aborted"+(e?":"+e:"");t.store.dispatch(E({},t.data,{type:n,_:{called:n,from:"abort"}}))}function jn(t,e,n){var r=e[t]||n[t];return r&&r.config?r.config:{}}function Pn(t,e){return e.reduce(function(n,r){return r[t]?n.concat({methodName:t,pluginName:r.name,method:r[t]}):n},[])}function An(t,e){var n=t.replace(Ie,""),r=e?":"+e:"";return[""+t+r,""+n+r,n+"End"+r]}function mt(t,e){var n=t.abort;return!!n&&(n===!0||Nn(n,e)||n&&Nn(n.plugins,e))}function Fn(t,e){var n=t.abort;if(!n)return!1;if(n===!0||ie(n))return!0;var r=n.plugins;return De(n)&&n.length===e||De(r)&&r.length===e}function De(t){return Array.isArray(t)}function Nn(t,e){return!(!t||!De(t))&&t.includes(e)}function Tn(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Xr(t){return Object.keys(t).reduce(function(e,n){return n==="type"||(e[n]=q(t[n])?Object.assign({},t[n]):t[n]),e},{})}function Yr(t,e,n){var r={};return function(i){return function(o){return function(s){try{var a,l=function(I){return a?I:o(m)},f=s.type,b=s.plugins,m=s;if(s.abort)return Promise.resolve(o(s));if(f===S.enablePlugin&&i.dispatch({type:S.initializeStart,plugins:b,disabled:[],fromEnable:!0,meta:s.meta}),f===S.disablePlugin&&setTimeout(function(){return On(s.meta.rid,{payload:s})},0),f===S.initializeEnd){var d=e(),g=Object.keys(d),w=g.filter(function(I){return b.includes(I)}).map(function(I){return d[I]}),v=[],h=[],_=s.disabled,N=w.map(function(I){var p=I.loaded,C=I.name,j=I.config;return Jn(I,function(){return p({config:j})},1e4).then(function(T){return r[C]||(i.dispatch({type:S.pluginReadyType(C),name:C,events:Object.keys(I).filter(function($){return!ht.includes($)})}),r[C]=!0),v=v.concat(C),I}).catch(function(T){if(T instanceof Error)throw new Error(T);return h=h.concat(T.name),T})});Promise.all(N).then(function(I){var p={plugins:v,failed:h,disabled:_};setTimeout(function(){g.length===N.length+_.length&&i.dispatch(E({},{type:S.ready},p))},0)})}var x=(function(){if(f!==S.bootstrap)return/^ready:([^:]*)$/.test(f)&&setTimeout(function(){return Ln(i,e,t)},0),Promise.resolve((function(I,p,C,j,T){try{var $=Q(p)?p():p,U=I.type,M=U.replace(Ie,"");if(I._&&I._.called)return Promise.resolve(I);var J=C.getState(),V=(H=$,(X=J.plugins)===void 0&&(X={}),(Pe=I.options)===void 0&&(Pe={}),Object.keys(H).filter(function(c){var u=Pe.plugins||{};return fn(u[c])?u[c]:u.all!==!1&&(!X[c]||X[c].enabled!==!1)}).map(function(c){return H[c]}));U===S.initializeStart&&I.fromEnable&&(V=Object.keys(J.plugins).filter(function(c){var u=J.plugins[c];return I.plugins.includes(c)&&!u.initialized}).map(function(c){return $[c]}));var L=V.map(function(c){return c.name}),O=(function(c,u,k){var P=An(c).map(function(A){return Pn(A,u)});return u.reduce(function(A,z){var B=z.name,D=An(c,B).map(function(Ae){return Pn(Ae,u)}),F=D[0],R=D[1],ne=D[2];return F.length&&(A.beforeNS[B]=F),R.length&&(A.duringNS[B]=R),ne.length&&(A.afterNS[B]=ne),A},{before:P[0],beforeNS:{},during:P[1],duringNS:{},after:P[2],afterNS:{}})})(U,V);return Promise.resolve(ft({action:I,data:{exact:O.before,namespaced:O.beforeNS},state:J,allPlugins:$,allMatches:O,instance:C,store:j,EVENTS:T})).then(function(c){function u(){var A=(function(){if(U.match(Ie))return Promise.resolve(ft({action:E({},k,{type:M+"End"}),data:{exact:O.after,namespaced:O.afterNS},state:J,allPlugins:$,allMatches:O,instance:C,store:j,EVENTS:T})).then(function(z){z.meta&&z.meta.hasCallback&&On(z.meta.rid,{payload:z})})})();return A&&A.then?A.then(function(){return c}):c}if(Fn(c,L.length))return c;var k,P=(function(){if(U!==M)return Promise.resolve(ft({action:E({},c,{type:M}),data:{exact:O.during,namespaced:O.duringNS},state:J,allPlugins:$,allMatches:O,instance:C,store:j,EVENTS:T})).then(function(A){k=A});k=c})();return P&&P.then?P.then(u):u()})}catch(c){return Promise.reject(c)}var H,X,Pe})(s,e,t,i,n)).then(function(I){return a=1,o(I)})})();return Promise.resolve(x&&x.then?x.then(l):l(x))}catch(I){return Promise.reject(I)}}}}}function Zr(t){return function(e){return function(n){return function(r){var i=r.type,o=r.key,s=r.value,a=r.options;if(i===S.setItem||i===S.removeItem){if(r.abort)return n(r);i===S.setItem?t.setItem(o,s,a):t.removeItem(o,a)}return n(r)}}}}var Kr=function(){var t=this;this.before=[],this.after=[],this.addMiddleware=function(e,n){t[n]=t[n].concat(e)},this.removeMiddleware=function(e,n){var r=t[n].findIndex(function(i){return i===e});r!==-1&&(t[n]=[].concat(t[n].slice(0,r),t[n].slice(r+1)))},this.dynamicMiddlewares=function(e){return function(n){return function(r){return function(i){var o={getState:n.getState,dispatch:function(a){return n.dispatch(a)}},s=t[e].map(function(a){return a(o)});return ke.apply(void 0,s)(r)(i)}}}}};function Qr(t){return function(e,n){e===void 0&&(e={});var r={};if(n.type==="initialize:aborted")return e;if(/^registerPlugin:([^:]*)$/.test(n.type)){var i=zn(n.type,"registerPlugin"),o=t()[i];if(!o||!i)return e;var s=n.enabled,a=o.config;return r[i]={enabled:s,initialized:!!s&&!o.initialize,loaded:!!s&&!!o.loaded({config:a}),config:a},E({},e,r)}if(/^initialize:([^:]*)$/.test(n.type)){var l=zn(n.type,S.initialize),f=t()[l];return f&&l?(r[l]=E({},e[l],{initialized:!0,loaded:!!f.loaded({config:f.config})}),E({},e,r)):e}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=E({},e[n.name],{loaded:!0}),E({},e,r);switch(n.type){case S.disablePlugin:return E({},e,Cn(n.plugins,!1,e));case S.enablePlugin:return E({},e,Cn(n.plugins,!0,e));default:return e}}}function zn(t,e){return t.substring(e.length+1,t.length)}function Cn(t,e,n){return t.reduce(function(r,i){return r[i]=E({},n[i],{enabled:e}),r},n)}function Gn(t){try{return JSON.parse(JSON.stringify(t))}catch(e){}return t}var ei={last:{},history:[]};function ti(t,e){t===void 0&&(t=ei);var n=e.options,r=e.meta;if(e.type===S.track){var i=Gn(E({event:e.event,properties:e.properties},Object.keys(n).length&&{options:n},{meta:r}));return E({},t,{last:i,history:t.history.concat(i)})}return t}var ni={actions:[]};function ri(t,e){t===void 0&&(t=ni);var n=e.payload;switch(e.type){case"queue":var r;return r=n&&n.type&&n.type===S.identify?[e].concat(t.actions):t.actions.concat(e),E({},t,{actions:r});case"dequeue":return[];default:return t}}var Mn=/#.*$/;function ii(t){var e=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(e&&e[3]?e[3].split("?")[0].replace(Mn,""):"")}var Bn,qn,Vn,Hn,oi=function(t){if(t===void 0&&(t={}),!Y)return t;var e=document,n=e.title,r=e.referrer,i=window,o=i.location,s=i.innerWidth,a=i.innerHeight,l=o.hash,f=o.search,b=(function(d){var g=(function(){if(Y){for(var w,v=document.getElementsByTagName("link"),h=0;w=v[h];h++)if(w.getAttribute("rel")==="canonical")return w.getAttribute("href")}})();return g?g.match(/\?/)?g:g+d:window.location.href.replace(Mn,"")})(f),m={title:n,url:b,path:ii(b),hash:l,search:f,width:s,height:a};return r&&r!==""&&(m.referrer=r),E({},m,t)},si={last:{},history:[]};function ai(t,e){t===void 0&&(t=si);var n=e.options;if(e.type===S.page){var r=Gn(E({properties:e.properties,meta:e.meta},Object.keys(n).length&&{options:n}));return E({},t,{last:r,history:t.history.concat(r)})}return t}Bn=(function(){if(!Y)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"})(),qn=Y?document.referrer:null,Vn=bn(),Hn=vn();var Rn={initialized:!1,sessionId:ze(),app:null,version:null,debug:!1,offline:!!Y&&!navigator.onLine,os:{name:Bn},userAgent:Y?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.14"},timezone:Hn,locale:Vn,campaign:{},referrer:qn};function ci(t,e){t===void 0&&(t=Rn);var n=t.initialized,r=e.campaign;switch(e.type){case S.campaign:return E({},t,{campaign:r});case S.offline:return E({},t,{offline:!0});case S.online:return E({},t,{offline:!1});default:return n?t:E({},Rn,t,{initialized:!0})}}var ui=["plugins","reducers","storage"];function li(t,e,n){if(Y){var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(i){r(i,e)})}}function di(t){var e=li.bind(null,"online offline",function(n){return Promise.resolve(!navigator.onLine).then(t)});return e(!0),function(n){return e(!1)}}function Wn(){return K("analytics",[]),function(t){return function(e,n,r){var i=t(e,n,r),o=i.dispatch;return Object.assign(i,{dispatch:function(s){return me[ge].analytics.push(s.action||s),o(s)}})}}}function Dn(t){return function(){return ke(ke.apply(null,arguments),Wn())}}function pt(t){return t?mn(t)?t:[t]:[]}function $n(t,e,n){t===void 0&&(t={});var r,i,o=ze();return e&&(Re[o]=(r=e,i=(function(s){for(var a,l=s||Array.prototype.slice.call(arguments),f=0;f<l.length;f++)if(Q(l[f])){a=l[f];break}return a})(n),function(s){i&&i(s),r(s)})),E({},t,{rid:o,ts:new Date().getTime()},e?{hasCallback:!0}:{})}function Xn(t){t===void 0&&(t={});var e=t.reducers||{},n=t.initialUser||{},r=(t.plugins||[]).reduce(function(c,u){if(Q(u))return c.middlewares=c.middlewares.concat(u),c;if(u.NAMESPACE&&(u.name=u.NAMESPACE),!u.name)throw new Error("https://lytics.dev/errors/1");u.config||(u.config={});var k=u.EVENTS?Object.keys(u.EVENTS).map(function(z){return u.EVENTS[z]}):[];c.pluginEnabled[u.name]=!(u.enabled===!1||u.config.enabled===!1),delete u.enabled,u.methods&&(c.methods[u.name]=Object.keys(u.methods).reduce(function(z,B){var D;return z[B]=(D=u.methods[B],function(){for(var F=Array.prototype.slice.call(arguments),R=new Array(D.length),ne=0;ne<F.length;ne++)R[ne]=F[ne];return R[R.length]=p,D.apply({instance:p},R)}),z},{}),delete u.methods);var P=Object.keys(u).concat(k),A=new Set(c.events.concat(P));if(c.events=Array.from(A),c.pluginsArray=c.pluginsArray.concat(u),c.plugins[u.name])throw new Error(u.name+"AlreadyLoaded");return c.plugins[u.name]=u,c.plugins[u.name].loaded||(c.plugins[u.name].loaded=function(){return!0}),c},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=t.storage?t.storage:{getItem:Z,setItem:K,removeItem:ee},o=(function(c){return function(u,k,P){return k.getState("user")[u]||(P&&q(P)&&P[u]?P[u]:En(c)[u]||Z(bt(u))||null)}})(i),s=r.plugins,a=r.events.filter(function(c){return!ht.includes(c)}).sort(),l=new Set(a.concat(Xe).filter(function(c){return!ht.includes(c)})),f=Array.from(l).sort(),b=function(){return s},m=new Kr,d=m.addMiddleware,g=m.removeMiddleware,w=m.dynamicMiddlewares,v=function(){throw new Error("Abort disabled inListener")},h=yn(),_=En(i),N=E({},_,n,h.an_uid?{userId:h.an_uid}:{},h.an_aid?{anonymousId:h.an_aid}:{});N.anonymousId||(N.anonymousId=ze());var x=E({enable:function(c,u){return new Promise(function(k){O.dispatch({type:S.enablePlugin,plugins:pt(c),_:{originalAction:S.enablePlugin}},k,[u])})},disable:function(c,u){return new Promise(function(k){O.dispatch({type:S.disablePlugin,plugins:pt(c),_:{originalAction:S.disablePlugin}},k,[u])})}},r.methods),I=!1,p={identify:function(c,u,k,P){try{var A=ie(c)?c:null,z=q(c)?c:u,B=k||{},D=p.user();K(bt(ae),A);var F=A||z.userId||o(ae,p,z);return Promise.resolve(new Promise(function(R){O.dispatch(E({type:S.identifyStart,userId:F,traits:z||{},options:B,anonymousId:D.anonymousId},D.id&&D.id!==A&&{previousId:D.id}),R,[u,k,P])}))}catch(R){return Promise.reject(R)}},track:function(c,u,k,P){try{var A=q(c)?c.event:c;if(!A||!ie(A))throw new Error("EventMissing");var z=q(c)?c:u||{},B=q(k)?k:{};return Promise.resolve(new Promise(function(D){O.dispatch({type:S.trackStart,event:A,properties:z,options:B,userId:o(ae,p,u),anonymousId:o(ye,p,u)},D,[u,k,P])}))}catch(D){return Promise.reject(D)}},page:function(c,u,k){try{var P=q(c)?c:{},A=q(u)?u:{};return Promise.resolve(new Promise(function(z){O.dispatch({type:S.pageStart,properties:oi(P),options:A,userId:o(ae,p,P),anonymousId:o(ye,p,P)},z,[c,u,k])}))}catch(z){return Promise.reject(z)}},user:function(c){if(c===ae||c==="id")return o(ae,p);if(c===ye||c==="anonId")return o(ye,p);var u=p.getState("user");return c?(0,Be.default)(u,c):u},reset:function(c){return new Promise(function(u){O.dispatch({type:S.resetStart},u,c)})},ready:function(c){return I&&c({plugins:x,instance:p}),p.on(S.ready,function(u){c(u),I=!0})},on:function(c,u){if(!c||!Q(u))return!1;if(c===S.bootstrap)throw new Error(".on disabled for "+c);var k=/Start$|Start:/;if(c==="*"){var P=function(D){return function(F){return function(R){return R.type.match(k)&&u({payload:R,instance:p,plugins:s}),F(R)}}},A=function(D){return function(F){return function(R){return R.type.match(k)||u({payload:R,instance:p,plugins:s}),F(R)}}};return d(P,He),d(A,We),function(){g(P,He),g(A,We)}}var z=c.match(k)?He:We,B=function(D){return function(F){return function(R){return R.type===c&&u({payload:R,instance:p,plugins:s,abort:v}),F(R)}}};return d(B,z),function(){return g(B,z)}},once:function(c,u){if(!c||!Q(u))return!1;if(c===S.bootstrap)throw new Error(".once disabled for "+c);var k=p.on(c,function(P){u({payload:P.payload,instance:p,plugins:s,abort:v}),k()});return k},getState:function(c){var u=O.getState();return c?(0,Be.default)(u,c):Object.assign({},u)},dispatch:function(c){var u=ie(c)?{type:c}:c;if(Xe.includes(u.type))throw new Error("reserved action "+u.type);var k=E({},u,{_:E({originalAction:u.type},c._||{})});O.dispatch(k)},enablePlugin:x.enable,disablePlugin:x.disable,plugins:x,storage:{getItem:i.getItem,setItem:function(c,u,k){O.dispatch({type:S.setItemStart,key:c,value:u,options:k})},removeItem:function(c,u){O.dispatch({type:S.removeItemStart,key:c,options:u})}},setAnonymousId:function(c,u){p.storage.setItem(ue,c,u)},events:{core:Xe,plugins:a}},C=r.middlewares.concat([function(c){return function(u){return function(k){return k.meta||(k.meta=$n()),u(k)}}},w(He),Yr(p,b,{all:f,plugins:a}),Zr(i),qr(p),Hr(p),w(We)]),j={context:ci,user:Vr(i),page:ai,track:ti,plugins:Qr(b),queue:ri},T=ke,$=ke;if(Y&&t.debug){var U=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;U&&(T=U({trace:!0,traceLimit:25})),$=function(){return arguments.length===0?Wn():q(typeof arguments[0])?Dn():Dn().apply(null,arguments)}}var M,J=(function(c){return Object.keys(c).reduce(function(u,k){return ui.includes(k)||(u[k]=c[k]),u},{})})(t),V=r.pluginsArray.reduce(function(c,u){var k=u.name,P=u.config,A=u.loaded,z=r.pluginEnabled[k];return c[k]={enabled:z,initialized:!!z&&!u.initialize,loaded:!!A({config:P}),config:P},c},{}),L={context:J,user:N,plugins:V},O=Un((function(c){for(var u=Object.keys(c),k={},P=0;P<u.length;P++){var A=u[P];typeof c[A]===ce&&(k[A]=c[A])}var z,B=Object.keys(k);try{(function(D){Object.keys(D).forEach(function(F){var R=D[F];if(typeof R(void 0,{type:"@@redux/INIT"})===oe||typeof R(void 0,{type:Gr})===oe)throw new Error("reducer "+F+" "+oe)})})(k)}catch(D){z=D}return function(D,F){if(D===void 0&&(D={}),z)throw z;for(var R=!1,ne={},Ae=0;Ae<B.length;Ae++){var Je=B[Ae],sn=D[Je],ot=(0,k[Je])(sn,F);if(typeof ot===oe){var kr=Mr(Je,F);throw new Error(kr)}ne[Je]=ot,R=R||ot!==sn}return R?ne:D}})(E({},j,e)),L,$(T(Br.apply(void 0,C))));O.dispatch=(M=O.dispatch,function(c,u,k){var P=E({},c,{meta:$n(c.meta,u,pt(k))});return M.apply(null,[P])});var H=Object.keys(s);O.dispatch({type:S.bootstrap,plugins:H,config:J,params:h,user:N,initialUser:n,persistedUser:_});var X=H.filter(function(c){return r.pluginEnabled[c]}),Pe=H.filter(function(c){return!r.pluginEnabled[c]});return O.dispatch({type:S.registerPlugins,plugins:H,enabled:r.pluginEnabled}),r.pluginsArray.map(function(c,u){var k=c.bootstrap,P=c.config,A=c.name;k&&Q(k)&&k({instance:p,config:P,payload:c}),O.dispatch({type:S.registerPluginType(A),name:A,enabled:r.pluginEnabled[A],plugin:c}),r.pluginsArray.length===u+1&&O.dispatch({type:S.initializeStart,plugins:X,disabled:Pe})}),di(function(c){O.dispatch({type:c?S.offline:S.online})}),(function(c,u,k){setInterval(function(){return Ln(c,u,k)},3e3)})(O,b,p),p}var He="before",We="after";var Se="cookie",he=wt(),vt=Ye,Yn=Ye;function yt(t){return he?Ye(t,"",-1):ee(t)}function wt(){if(he!==void 0)return he;var t="cookiecookie";try{Ye(t,t),he=document.cookie.indexOf(t)!==-1,yt(t)}catch(e){he=!1}return he}function Ye(t,e,n,r,i,o){if(typeof window!="undefined"){var s=arguments.length>1;return he===!1&&(s?K(t,e):Z(t)),s?document.cookie=t+"="+encodeURIComponent(e)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}}var Ee="localStorage",Zn=Ce.bind(null,"localStorage"),Xo=se("localStorage","getItem",Z),Yo=se("localStorage","setItem",K),Zo=se("localStorage","removeItem",ee);var Oe="sessionStorage",Kn=Ce.bind(null,"sessionStorage"),es=se("sessionStorage","getItem",Z),ts=se("sessionStorage","setItem",K),ns=se("sessionStorage","removeItem",ee);function xe(t){var e=t;try{if((e=JSON.parse(t))==="true")return!0;if(e==="false")return!1;if(q(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch(n){}if(e!==null&&e!=="")return e}var fi=Zn(),gi=Kn(),mi=wt();function Qn(t,e){if(t){var n=It(e),r=!Ot(n),i=kt(n)?xe(localStorage.getItem(t)):void 0;if(r&&!fe(i))return i;var o=St(n)?xe(vt(t)):void 0;if(r&&o)return o;var s=Et(n)?xe(sessionStorage.getItem(t)):void 0;if(r&&s)return s;var a=Z(t);return r?a:{localStorage:i,sessionStorage:s,cookie:o,global:a}}}function pi(t,e,n){if(t&&!fe(e)){var r={},i=It(n),o=JSON.stringify(e),s=!Ot(i);return kt(i)&&(r[Ee]=Ze(Ee,e,xe(localStorage.getItem(t))),localStorage.setItem(t,o),s)?r[Ee]:St(i)&&(r[Se]=Ze(Se,e,xe(vt(t))),Yn(t,o),s)?r[Se]:Et(i)&&(r[Oe]=Ze(Oe,e,xe(sessionStorage.getItem(t))),sessionStorage.setItem(t,o),s)?r[Oe]:(r[ve]=Ze(ve,e,Z(t)),K(t,e),s?r[ve]:r)}}function hi(t,e){if(t){var n=It(e),r=Qn(t,dt),i={};return!fe(r.localStorage)&&kt(n)&&(localStorage.removeItem(t),i[Ee]=r.localStorage),!fe(r.cookie)&&St(n)&&(yt(t),i[Se]=r.cookie),!fe(r.sessionStorage)&&Et(n)&&(sessionStorage.removeItem(t),i[Oe]=r.sessionStorage),!fe(r.global)&&Ke(n,ve)&&(ee(t),i[ve]=r.global),i}}function It(t){return t?ie(t)?t:t.storage:lt}function kt(t){return fi&&Ke(t,Ee)}function St(t){return mi&&Ke(t,Se)}function Et(t){return gi&&Ke(t,Oe)}function Ot(t){return t===dt||t==="all"}function Ke(t,e){return t===lt||t===e||Ot(t)}function Ze(t,e,n){return{location:t,current:e,previous:n}}var er={setItem:pi,getItem:Qn,removeItem:hi};function bi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function nr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tr(Object(n),!0).forEach(function(r){bi(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e={storage:er};return Xn(nr(nr({},e),t))}function vi(t){return Array.prototype.slice.call(window.document.querySelectorAll("script")).find(n=>n.src===t)}function yi(t,e){let n=t;return n.startsWith("http")||(n=`https://${e!=null&&e.www?"www.":""}${n}`),e!=null&&e.min?n=n+".min.js":e!=null&&e.js&&(n=n+".js"),e!=null&&e.query&&(n+="?"+e.query),n}function le(t,e){let n=vi(t);if(n!==void 0){let r=n==null?void 0:n.getAttribute("status");if(r==="loaded")return Promise.resolve(n);if(r==="loading")return new Promise((i,o)=>{n.addEventListener("load",()=>i(n)),n.addEventListener("error",s=>o(s))})}return new Promise((r,i)=>{var a,l;let o=window.document.createElement("script");o.type="text/javascript",o.src=yi(t,e),o.async=!0,o.setAttribute("status","loading");for(let[f,b]of Object.entries((a=e==null?void 0:e.attributes)!=null?a:{}))o.setAttribute(f,b);o.onload=()=>{o.onerror=o.onload=null,o.setAttribute("status","loaded"),r(o)},o.onerror=()=>{o.onerror=o.onload=null,o.setAttribute("status","error"),i(new Error(`Failed to load ${t}`))};let s=window.document.getElementsByTagName("script")[0];(l=s.parentElement)==null||l.insertBefore(o,s)})}var xt={id:"tag",handle(t,e){return G(this,null,function*(){de(e,t)&&wi(t.code,e)})}};function wi(t,e,n={}){let r;try{r=JSON.parse(t)}catch(o){r={code:t,lang:"javascript"}}let i=n.debug||!1;if(te())if(r.lang==="javascript")Ei(r.code,e);else{let o=document.createElement("span");o.innerHTML=Oi(r.code,e),document.body.insertAdjacentElement("beforeend",o),o.querySelectorAll("script").forEach(a=>{let l=document.createElement("script");l.type=l.type||"text/javascript",a.hasAttribute("src")&&(l.src=a.src),l.text=a.text,i&&console.log(`[JITSU] Executing script${a.hasAttribute("src")?` ${a.src}`:""}`,l.text),document.head.appendChild(l),document.head.removeChild(l)})}else i&&console.log("[JITSU] insertTags(): cannot insert tags in non-browser environment")}var Ii="al",ki="ve".split("").reverse().join(""),Si=globalThis[ki+Ii];function Ei(t,e){let n=`jitsu_event_${_t()}`;window[n]=e;let r=`(function(){
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`)).find(s=>{var a,l;return Di(s,(l=(a=t.context)==null?void 0:a.page)==null?void 0:l.host)})&&(!!i.find(s=>ar(s,t.type))||!!i.find(s=>ar(s,t.event)))}catch(i){throw console.warn(`Failed to apply filters: ${i.message}. Typeof events: ${typeof r}, typeof hosts: ${typeof n}. Values`,r,n),new Error(`Failed to apply filters: ${i.message}. Typeof events: ${typeof r}, typeof hosts: ${typeof n}`)}}var cr={[xt.id]:xt,[At.id]:At,[Tt.id]:Tt,[jt.id]:jt};var zt={name:"@jitsu/js",version:"1.11.0-beta.10",description:"",author:"Jitsu Dev Team <dev@jitsu.com>",main:"src/index.ts",types:"src/index.ts",files:["dist","compiled"],publishConfig:{main:"dist/jitsu.cjs.js",module:"dist/jitsu.es.js",types:"dist/index.d.ts",access:"public"},license:"MIT",private:!1,scripts:{clean:"rm -rf ./dist ./compiled","test:node":"vitest run","test:playwright":"playwright test ./__tests__/playwright",test:"pnpm run test:node",typecheck:"tsc --noEmit",build:"tsc && tsx bundle.mts",prepublishOnly:"pnpm run build","//build-deps":"Required by turbo ^build-deps - builds dist/ for workspace packages that import this","build-deps":"pnpm run build"},devDependencies:{"@jitsu/common-config":"workspace:*",tslib:"catalog:","@playwright/test":"^1.57.0",esbuild:"catalog:",tsx:"catalog:","@segment/analytics-next":"^1.75.0","@types/chalk":"^2.2.0","@types/node":"catalog:","@vitest/ui":"catalog:",chalk:"^4.1.2","cookie-parser":"^1.4.7",ejs:"^3.1.8",express:"^4.21.2","node-forge":"^1.3.2","raw-loader":"^4.0.2",typescript:"catalog:",vitest:"catalog:",jsondiffpatch:"workspace:*"},peerDependencies:{"@jitsu/protocols":"workspace:*"},dependencies:{analytics:"0.8.9"}};var ur=zt.version!=="0.0.0"?zt.version:"2.0.0",lr="@jitsu/js";var Ui="webflow.io,vercel.app,myshopify.com,ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,a\xE9roport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,m\u0101ori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(","),dr={};Ui.forEach(t=>{dr[t]=!0});var Ji=dr;function Ct(t){let[e]=t.split(":"),n=e.split(".");if(n[n.length-1]==="localhost"||n.length<2)return n[n.length-1];{let r=n[n.length-2]+"."+n[n.length-1];return n.length>2&&Ji[r]?n[n.length-3]+"."+r:r}}var Rt=class{constructor(e){this.selfOptions=e||{},this.pipes={}}options(e){return e&&(this.selfOptions=e),this.selfOptions}pipe(e,n){let r=n;if(typeof e=="string"){if(typeof r=="undefined")return this.pipes[e];this.pipes[e]=r}if(e&&e.name){if(r=e,r.processor===this)return r;this.pipes[r.name]=r}return r.processor=this,r}process(e,n){let r=e;r.options=this.options();let i=n||e.pipe||"default",o;for(;i;)typeof r.nextAfterChildren!="undefined"&&(r.next=r.nextAfterChildren,r.nextAfterChildren=null),typeof i=="string"&&(i=this.pipe(i)),i.process(r),o=i,i=null,r&&r.next&&(r=r.next,i=r.pipe||o);return r.hasResult?r.result:void 0}},fr=Rt;var Dt=class{constructor(e){this.name=e,this.filters=[]}process(e){if(!this.processor)throw new Error("add this pipe to a processor before using it");let n=this.debug,r=this.filters.length,i=e;for(let o=0;o<r;o++){let s=this.filters[o];if(n&&this.log(`filter: ${s.filterName}`),s(i),typeof i=="object"&&i.exiting){i.exiting=!1;break}}!i.next&&this.resultCheck&&this.resultCheck(i)}log(e){console.log(`[jsondiffpatch] ${this.name} pipe, ${e}`)}append(...e){return this.filters.push(...e),this}prepend(...e){return this.filters.unshift(...e),this}indexOf(e){if(!e)throw new Error("a filter name is required");for(let n=0;n<this.filters.length;n++)if(this.filters[n].filterName===e)return n;throw new Error(`filter not found: ${e}`)}list(){return this.filters.map(e=>e.filterName)}after(e,...n){let r=this.indexOf(e);return this.filters.splice(r+1,0,...n),this}before(e,...n){let r=this.indexOf(e);return this.filters.splice(r,0,...n),this}replace(e,...n){let r=this.indexOf(e);return this.filters.splice(r,1,...n),this}remove(e){let n=this.indexOf(e);return this.filters.splice(n,1),this}clear(){return this.filters.length=0,this}shouldHaveResult(e){if(e===!1){this.resultCheck=null;return}if(!this.resultCheck)return this.resultCheck=n=>{if(!n.hasResult){console.log(n);let r=new Error(`${this.name} failed`);throw r.noResult=!0,r}},this}},$t=Dt;var be=class{setResult(e){return this.result=e,this.hasResult=!0,this}exit(){return this.exiting=!0,this}push(e,n){return e.parent=this,typeof n!="undefined"&&(e.childName=n),e.root=this.root||this,e.options=e.options||this.options,this.children?(this.children[this.children.length-1].next=e,this.children.push(e)):(this.children=[e],this.nextAfterChildren=this.next||null,this.next=e),e.next=this,this}};var Ut=class extends be{constructor(e,n){super(),this.left=e,this.right=n,this.pipe="diff"}setResult(e){return super.setResult(e)}},$e=Ut;var Jt=class extends be{constructor(e,n){super(),this.left=e,this.delta=n,this.pipe="patch"}},et=Jt;function Li(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}var Lt=function(e){if(e.left===e.right){e.setResult(void 0).exit();return}if(typeof e.left=="undefined"){if(typeof e.right=="function")throw new Error("functions are not supported");e.setResult([e.right]).exit();return}if(typeof e.right=="undefined"){e.setResult([e.left,0,0]).exit();return}if(typeof e.left=="function"||typeof e.right=="function")throw new Error("functions are not supported");if(e.leftType=e.left===null?"null":typeof e.left,e.rightType=e.right===null?"null":typeof e.right,e.leftType!==e.rightType){e.setResult([e.left,e.right]).exit();return}if(e.leftType==="boolean"||e.leftType==="number"||e.leftType==="string"){e.setResult([e.left,e.right]).exit();return}if(e.leftType==="object"&&(e.leftIsArray=Array.isArray(e.left)),e.rightType==="object"&&(e.rightIsArray=Array.isArray(e.right)),e.leftIsArray!==e.rightIsArray){e.setResult([e.left,e.right]).exit();return}if(e.leftIsArray&&e.rightIsArray)if(Li(e.left,e.right)){e.setResult(void 0).exit();return}else{e.setResult([e.left,e.right]).exit();return}e.left instanceof RegExp&&(e.right instanceof RegExp?e.setResult([e.left.toString(),e.right.toString()]).exit():e.setResult([e.left,e.right]).exit())};Lt.filterName="trivial";var Ft=function(e){if(typeof e.delta=="undefined"){e.setResult(e.left).exit();return}if(e.nested=!Array.isArray(e.delta),e.nested)return;let n=e.delta;if(n.length===1){e.setResult(n[0]).exit();return}if(n.length===2){if(e.left instanceof RegExp){let r=/^\/(.*)\/([gimyu]+)$/.exec(n[1]);if(r){e.setResult(new RegExp(r[1],r[2])).exit();return}}e.setResult(n[1]).exit();return}n.length===3&&n[2]===0&&e.setResult(void 0).exit()};Ft.filterName="trivial";var Gt=t=>{if(!t||!t.children)return;let e=t.children.length,n,r=t.result;for(let i=0;i<e;i++)n=t.children[i],typeof n.result!="undefined"&&(r=r||{},r[n.childName]=n.result);r&&t.leftIsArray&&(r._t="a"),t.setResult(r).exit()};Gt.filterName="collectChildren";var Mt=t=>{if(t.leftIsArray||t.leftType!=="object")return;let e=t.left,n=t.right,r,i,o=t.options.propertyFilter;for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(o&&!o(r,t)||(i=new $e(e[r],n[r]),t.push(i,r)));for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(o&&!o(r,t)||typeof e[r]=="undefined"&&(i=new $e(void 0,n[r]),t.push(i,r)));if(!t.children||t.children.length===0){t.setResult(void 0).exit();return}t.exit()};Mt.filterName="objects";var Bt=function(e){if(!e.nested)return;let n=e.delta;if(n._t)return;let r=n,i,o;for(i in r)o=new et(e.left[i],r[i]),e.push(o,i);e.exit()};Bt.filterName="objects";var qt=function(e){if(!e||!e.children||e.delta._t)return;let r=e.left,i=e.children.length,o;for(let s=0;s<i;s++){o=e.children[s];let a=o.childName;Object.prototype.hasOwnProperty.call(e.left,a)&&o.result===void 0?delete r[a]:r[a]!==o.result&&(r[a]=o.result)}e.setResult(r).exit()};qt.filterName="collectChildren";var Vt=function(e){e.left instanceof Date?(e.right instanceof Date?e.left.getTime()!==e.right.getTime()?e.setResult([e.left,e.right]):e.setResult(void 0):e.setResult([e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};Vt.filterName="dates";var Ht=class{constructor(e){this.processor=new fr(e),this.processor.pipe(new $t("diff").append(Gt,Lt,Vt,Mt).shouldHaveResult()),this.processor.pipe(new $t("patch").append(qt,Ft,Bt).shouldHaveResult())}options(e){return this.processor.options(e)}diff(e,n){return this.processor.process(new $e(e,n))}patch(e,n){return this.processor.process(new et(e,n))}},gr=Ht;function mr(t){return new gr(t)}var qi=mr(),_e={writeKey:void 0,host:void 0,debug:!1,fetch:void 0,echoEvents:!1,cookieDomain:void 0,cookieNames:{},cookieCapture:{},runtime:void 0,fetchTimeoutMs:void 0,s2s:void 0,idEndpoint:void 0,errorPolicy:"log",defaultPayloadContext:{},privacy:{dontSend:!1,disableUserIds:!1,ipPolicy:"keep",consentCategories:{}}},pr=(t,e)=>{for(let n of Object.keys(_e)){let r=e[n];n==="privacy"?typeof r=="object"?t.privacy=y(y(W(y({},_e.privacy),{consentCategories:y({},_e.privacy.consentCategories)}),t.privacy),r):typeof r=="undefined"&&(e.hasOwnProperty("privacy")||!t.hasOwnProperty("privacy"))&&(t.privacy=W(y({},_e.privacy),{consentCategories:y({},_e.privacy.consentCategories)})):typeof r=="undefined"?(e.hasOwnProperty(n)||!t.hasOwnProperty(n))&&(t[n]=_e[n]):t[n]=r}},Vi=t=>{if(!t)return{};let e=t.length>0&&t.charAt(0)==="?"?t.substring(1):t,n={},r=(e[0]==="?"?e.substr(1):e).split("&");for(let i=0;i<r.length;i++){let o=r[i].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1]||"")}return n};function Hi(t){let e=t.substring(4);return e==="campaign"?"name":e}function Wi(t){return Object.entries(t).filter(([e])=>e.indexOf("utm_")===0).reduce((e,[n,r])=>W(y({},e),{[Hi(n)]:r}),{})}function nt(t,e){try{return t()}catch(n){return e}}function Xi(t){let e=t.getItem("__user_traits");typeof e=="string"&&(e=nt(()=>JSON.parse(e),{})),(typeof e!="object"||e===null||Array.isArray(e))&&(e={});let n=t.getItem("__group_traits");return typeof n=="string"&&(n=nt(()=>JSON.parse(n),{})),(typeof n!="object"||n===null||Array.isArray(n))&&(n={}),y(y({},n||{}),e||{})}function hr(t){var r;let n=`; ${document.cookie}`.split(`; ${t}=`);return n.length===2?(r=n.pop())==null?void 0:r.split(";").shift():void 0}function Yi(t,e){let n=y({fbc:"_fbc",fbp:"_fbp"},e),r=Object.entries(n).reduce((i,[o,s])=>(i[o]=t.getCookie(s),i),{});return y(y({},r),Ki(t))}function Zi(t){if(typeof t=="string"){if(t.startsWith("GA1")||t.startsWith("GS1"))return t.split(".")[2];{let e=t.match(/^GS\d+\.\d+\.(?:[\w_-]+[$])*s(\d+)(?:$|[$])/);return e?e[1]:void 0}}}function Ki(t){var o;let e=t.getCookies(),n=(o=e._ga)==null?void 0:o.split(".").slice(-2).join("."),r=Object.entries(e).filter(([s])=>s.startsWith("_ga_")),i=r.length>0?Object.fromEntries(r.map(([s,a])=>{let l=Zi(a);return l?[s.substring(4),l]:null}).filter(s=>s!==null)):void 0;if(n||i)return{ga4:{clientId:n,sessionIds:i}}}function Wt(t,{domain:e,secure:n}){document.cookie=t+"=;domain="+e+";path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite="+(n?"None":"Lax")+(n?";secure":"")}function Qi(t,e,{domain:n,secure:r}){document.cookie=t+"="+e+";domain="+n+";path=/;expires="+new Date(new Date().getTime()+1e3*60*60*24*365*5).toUTCString()+";SameSite="+(r?"None":"Lax")+(r?";secure":"")}var je={__anon_id:"__eventn_id",__user_id:"__eventn_uid",__user_traits:"__eventn_id_usr",__group_id:"__group_id",__group_traits:"__group_traits"},eo=(t,e)=>({setItem(n,r){let i=e(n)||n;if(typeof r=="undefined"){Wt(i,{domain:t,secure:window.location.protocol==="https:"});return}let o=typeof r=="object"&&r!==null?encodeURIComponent(JSON.stringify(r)):r;Qi(i,o,{domain:t,secure:window.location.protocol==="https:"})},getItem(n){let r=e(n)||n,i=hr(r);if(n==="__anon_id")return i;if(typeof i=="undefined"&&n==="__user_id"){let o=rt(hr(e("__user_traits")||"__eventn_id_usr"))||{};return o.internal_id||o.user_id||o.id||o.userId}return rt(i)},removeItem(n){Wt(e(n)||n,{domain:t,secure:window.location.protocol==="https:"})},reset(){for(let n of Object.keys(je))Wt(e(n)||n,{domain:t,secure:window.location.protocol==="https:"})}});function Qt(t){let e=n=>{var r,i,o,s,a;switch(n){case"__anon_id":return((r=t.cookieNames)==null?void 0:r.anonymousId)||je.__anon_id;case"__user_id":return((i=t.cookieNames)==null?void 0:i.userId)||je.__user_id;case"__user_traits":return((o=t.cookieNames)==null?void 0:o.userTraits)||je.__user_traits;case"__group_id":return((s=t.cookieNames)==null?void 0:s.groupId)||je.__group_id;case"__group_traits":return((a=t.cookieNames)==null?void 0:a.groupTraits)||je.__group_traits;default:return n}};return{getCookie(n){var o;let i=`; ${document.cookie}`.split(`; ${n}=`);return i.length===2?(o=i.pop())==null?void 0:o.split(";").shift():void 0},getCookies(){let n=`; ${document.cookie}`,r={},i=n.matchAll(/(\w+)=([^;]+)/g);for(let o of i)r[o[1]]=o[2];return r},documentEncoding(){return window.document.characterSet},timezoneOffset(){return new Date().getTimezoneOffset()},store(){return eo(t.cookieDomain||Ct(window.location.hostname),e)},language(){return window.navigator.language},pageTitle(){return window.document.title},pageUrl(){return window.location.href},referrer(){return window.document.referrer},screen(){return{width:window.screen.width,height:window.screen.height,innerWidth:window.innerWidth,innerHeight:window.innerHeight,density:Math.floor(window.devicePixelRatio)}},userAgent(){return window.navigator.userAgent}}}function en(t){let e={};return{reset(){Object.keys(e).forEach(n=>delete e[n])},setItem(n,r){t&&console.log(`[JITSU EMPTY RUNTIME] Set storage item ${n}=${JSON.stringify(r)}`),typeof r=="undefined"?delete e[n]:e[n]=r},getItem(n){let r=e[n];return t&&console.log(`[JITSU EMPTY RUNTIME] Get storage item ${n}=${JSON.stringify(r)}`),r},removeItem(n){t&&console.log(`[JITSU EMPTY RUNTIME] Get storage item ${n}=${e[n]}`),delete e[n]}}}var tn=t=>({documentEncoding(){},timezoneOffset(){},getCookie(e){},getCookies(){return{}},store(){return en(t.debug)},language(){},pageTitle(){},pageUrl(){},referrer(){},screen(){},userAgent(){}});function Xt(t){return typeof t!="object"||!t?t:JSON.parse(JSON.stringify(t))}function Kt(t,e){return typeof e!="object"||e===null||Array.isArray(e)||e instanceof Date||typeof t!="object"||t===null||Array.isArray(t)||t instanceof Date?e:Object.entries(e).reduce((n,[r,i])=>(n[r]=Kt(t[r],i),n),t)}function te(){return typeof document!="undefined"&&typeof window!="undefined"}function to(t){return t.indexOf("//")===0&&t.lastIndexOf("/")===1?"/":t}var nn=/#.*$/;function no(t){let n=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);return"/"+(n&&n[3]?n[3].split("?")[0].replace(nn,""):"")}function ro(){if(!te())return;let t=document.getElementsByTagName("link");for(var e=0,n;n=t[e];e++)if(n.getAttribute("rel")==="canonical")return n.getAttribute("href")}function io(){if(!te())return;let t=ro();return t?t.match(/\?/)?t:t+window.location.search:window.location.href.replace(nn,"")}function oo(t,e,n,r){var g,w,v,h,_,N,x,I,p,C,j,T,$,U,M;let i=e.runtime||(te()?Qt(e):tn(e)),o=i.pageUrl(),s=o?nt(()=>new URL(o),void 0):void 0,a=s?Vi(s.search):{},l=t.properties||{};if(t.type==="page"&&(l.url||o)){let J=o||l.url;l.url&&l.url!==io()&&(J=l.url),l.url=J.replace(nn,""),l.path=to(no(J))}let f=Kt(e.defaultPayloadContext,((g=t.properties)==null?void 0:g.context)||((w=t.options)==null?void 0:w.context)||{});(v=t.properties)==null||delete v.context;let b=i.referrer(),m={library:{name:lr,version:ur,env:te()?"browser":"node"},consent:typeof((h=e.privacy)==null?void 0:h.consentCategories)=="object"&&Object.keys((_=e.privacy)==null?void 0:_.consentCategories).length?{categoryPreferences:e.privacy.consentCategories}:void 0,userAgent:(N=i.userAgent)==null?void 0:N.call(i),locale:(x=i.language)==null?void 0:x.call(i),screen:(I=i.screen)==null?void 0:I.call(i),ip:(p=i==null?void 0:i.ip)==null?void 0:p.call(i),traits:t.type!="identify"&&t.type!="group"?y(y({},Xi(n)||{}),((C=t==null?void 0:t.options)==null?void 0:C.traits)||{}):void 0,page:{path:l.path||s&&s.pathname,referrer:b,referring_domain:nt(()=>b&&new URL(b).hostname),host:s&&s.host,search:l.search||s&&s.search,title:l.title||i.pageTitle(),url:l.url||o,encoding:l.encoding||i.documentEncoding()},clientIds:(j=e.privacy)!=null&&j.disableUserIds?void 0:Yi(i,e.cookieCapture||{}),campaign:Wi(a)},d=W(y({},t),{userId:((T=t==null?void 0:t.options)==null?void 0:T.userId)||(t==null?void 0:t.userId),anonymousId:(($=t==null?void 0:t.options)==null?void 0:$.anonymousId)||(t==null?void 0:t.anonymousId),groupId:((U=t==null?void 0:t.options)==null?void 0:U.groupId)||n.getItem("__group_id"),timestamp:new Date().toISOString(),sentAt:new Date().toISOString(),messageId:_t(l.path||s&&s.pathname),writeKey:lo(e.writeKey),context:Kt(m,f)});return delete d.meta,delete d.options,(M=e.privacy)!=null&&M.disableUserIds&&(delete d.userId,delete d.anonymousId,delete d.context.traits,delete d.groupId),d}function so(t){let e=Object.keys(t);return e.length===1&&e[0]==="__diff"}function ao(t,e,n,r,i){return G(this,null,function*(){let o=[];for(let s of t){let a=[];if(s.newEvents)try{a=s.newEvents.map(f=>f==="same"?Xt(n):so(f)?qi.patch(Xt(n),f.__diff):f)}catch(f){console.error(`[JITSU] Error applying '${s.id}' changes to event: ${f==null?void 0:f.message}`,f)}else a=[Xt(n)];let l=y(y({},s.credentials),s.options);if(s.deviceOptions.type==="internal-plugin"){let f=cr[s.deviceOptions.name];if(f)for(let b of a)try{o.push(f.handle(W(y({},l),{debug:r}),b))}catch(m){console.warn(`[JITSU] Error processing event with internal plugin '${s.deviceOptions.name}': ${m==null?void 0:m.message}`,m)}else console.warn(`[JITSU] Unknown internal plugin '${s.deviceOptions.name}' for destination '${s.id}'`)}else if(s.deviceOptions.type==="analytics-plugin"){yield le(s.deviceOptions.packageCdn);let f=window[s.deviceOptions.moduleVarName];if(!f)console.warn(`[JITSU] Broken plugin '${s.deviceOptions.packageCdn}' for destination '${s.id}' - it doesn't export '${s.deviceOptions.moduleVarName}' variable`);else{let b;try{b=(typeof f=="function"?f:f.init)(l)}catch(m){console.warn(`[JITSU] Error creating plugin '${s.deviceOptions.moduleVarName}@${s.deviceOptions.packageCdn}' for destination '${s.id}': ${m==null?void 0:m.message}`,m)}try{r&&console.log(`[JITSU] Plugin '${s.deviceOptions.moduleVarName}@${s.deviceOptions.packageCdn}' for destination '${s.id}' initialized with config:`,b.config),b.initialize({config:b.config,instance:i})}catch(m){console.warn(`[JITSU] Error initializing plugin '${s.deviceOptions.moduleVarName}@${s.deviceOptions.packageCdn}' for destination '${s.id}': ${m==null?void 0:m.message}. Config: ${JSON.stringify(b.config)}`,m);continue}if(b[e])for(let m of a)try{b[e]({payload:m,config:b.config,instance:i})}catch(d){console.warn(`[JITSU] Error processing ${e}() with plugin '${s.deviceOptions.moduleVarName}@${s.deviceOptions.packageCdn}' for destination '${s.id}': ${d==null?void 0:d.message}`,d)}}}}})}function co(t){return t.length===25&&t.charAt(0)==="c"}function uo(t){if(t){let[,e]=t.split(":",2);if(!e&&!co(t))throw new Error(`Legacy write key detected - ${t}! This format doesn't work anymore, it should be 'key:secret'. Please download a new key from Jitsu UI`)}return t}function lo(t){if(t){let[e,n]=t.split(":",2);return n?`${e}:***`:"***"}return t}function Yt(t){let e=t.errorPolicy||"log";return typeof e=="function"?e:e==="rethrow"?(n,...r)=>{throw new Error(n)}:(n,...r)=>{console.error(n,...r)}}function tt(t,e,n,r,i){return G(this,null,function*(){var _,N;let o=!!n.s2s,s=n.debug?{"X-Enable-Debug":"true"}:{},a=oo(e,n,i,o);if(n.echoEvents){console.log(`[JITSU DEBUG] sending '${t}' event:`,a);return}let l=o?`${n.host}/api/s/s2s/${t}`:`${n.host}/api/s/${t}`,f=n.fetch||globalThis.fetch;if(!f)throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");let b=n.fetchTimeoutMs?new AbortController:void 0,m=n.fetchTimeoutMs?setTimeout(()=>{b==null||b.abort()},n.fetchTimeoutMs):void 0,d=n.writeKey?{"X-Write-Key":n.writeKey}:{},g=typeof((_=n.privacy)==null?void 0:_.ipPolicy)=="undefined"||((N=n.privacy)==null?void 0:N.ipPolicy)==="keep"?{}:{"X-IP-Policy":n.privacy.ipPolicy},w;try{w=yield f(l,{method:"POST",headers:y(y(y({"Content-Type":"application/json"},d),s),g),body:JSON.stringify(a),signal:b==null?void 0:b.signal}),m&&clearTimeout(m)}catch(x){return Yt(n)(`Call to ${l} failed with error ${x.message}`),Promise.resolve()}let v;try{v=yield w.text()}catch(x){console.warn(`Can't read response text from ${l} (status - ${w.status} ${w.statusText}): ${x==null?void 0:x.message}`)}if(n.debug&&console.log(`[JITSU DEBUG] ${l} replied ${w.status}: ${v}. Original payload:
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a5, b5) => {
|
|
15
|
+
for (var prop in b5 || (b5 = {}))
|
|
16
|
+
if (__hasOwnProp.call(b5, prop))
|
|
17
|
+
__defNormalProp(a5, prop, b5[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b5)) {
|
|
20
|
+
if (__propIsEnum.call(b5, prop))
|
|
21
|
+
__defNormalProp(a5, prop, b5[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a5;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a5, b5) => __defProps(a5, __getOwnPropDescs(b5));
|
|
26
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
27
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(from))
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __async = (__this, __arguments, generator) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
var fulfilled = (value) => {
|
|
48
|
+
try {
|
|
49
|
+
step(generator.next(value));
|
|
50
|
+
} catch (e2) {
|
|
51
|
+
reject(e2);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var rejected = (value) => {
|
|
55
|
+
try {
|
|
56
|
+
step(generator.throw(value));
|
|
57
|
+
} catch (e2) {
|
|
58
|
+
reject(e2);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var step = (x3) => x3.done ? resolve(x3.value) : Promise.resolve(x3.value).then(fulfilled, rejected);
|
|
62
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// ../../node_modules/.pnpm/dlv@1.1.3/node_modules/dlv/dist/dlv.umd.js
|
|
67
|
+
var require_dlv_umd = __commonJS({
|
|
68
|
+
"../../node_modules/.pnpm/dlv@1.1.3/node_modules/dlv/dist/dlv.umd.js"(exports, module) {
|
|
69
|
+
!(function(t2, n4) {
|
|
70
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = function(t3, n5, e2, i4, o4) {
|
|
71
|
+
for (n5 = n5.split ? n5.split(".") : n5, i4 = 0; i4 < n5.length; i4++) t3 = t3 ? t3[n5[i4]] : o4;
|
|
72
|
+
return t3 === o4 ? e2 : t3;
|
|
73
|
+
} : "function" == typeof define && define.amd ? define(function() {
|
|
74
|
+
return function(t3, n5, e2, i4, o4) {
|
|
75
|
+
for (n5 = n5.split ? n5.split(".") : n5, i4 = 0; i4 < n5.length; i4++) t3 = t3 ? t3[n5[i4]] : o4;
|
|
76
|
+
return t3 === o4 ? e2 : t3;
|
|
77
|
+
};
|
|
78
|
+
}) : t2.dlv = function(t3, n5, e2, i4, o4) {
|
|
79
|
+
for (n5 = n5.split ? n5.split(".") : n5, i4 = 0; i4 < n5.length; i4++) t3 = t3 ? t3[n5[i4]] : o4;
|
|
80
|
+
return t3 === o4 ? e2 : t3;
|
|
81
|
+
};
|
|
82
|
+
})(exports);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// ../../node_modules/.pnpm/analytics-utils@1.0.12_@types+dlv@1.1.4/node_modules/analytics-utils/dist/analytics-utils.module.js
|
|
87
|
+
var import_dlv = __toESM(require_dlv_umd());
|
|
88
|
+
|
|
89
|
+
// ../../node_modules/.pnpm/@analytics+type-utils@0.6.2/node_modules/@analytics/type-utils/dist/analytics-util-types.module.js
|
|
90
|
+
var e = "undefined";
|
|
91
|
+
var o = "object";
|
|
92
|
+
var b = "any";
|
|
93
|
+
var m = "*";
|
|
94
|
+
var j = "__";
|
|
95
|
+
var F = "undefined" != typeof process ? process : {};
|
|
96
|
+
var P = F.env && F.env.NODE_ENV || "";
|
|
97
|
+
var $ = "undefined" != typeof document;
|
|
98
|
+
var T = $ && "localhost" === window.location.hostname;
|
|
99
|
+
var _ = null != F.versions && null != F.versions.node;
|
|
100
|
+
var k = "undefined" != typeof Deno && void 0 !== Deno.core;
|
|
101
|
+
var B = "object" == typeof self && self.constructor && "DedicatedWorkerGlobalScope" === self.constructor.name;
|
|
102
|
+
var G = $ && "nodejs" === window.name || "undefined" != typeof navigator && void 0 !== navigator.userAgent && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
103
|
+
function M(n4, t2) {
|
|
104
|
+
return t2.charAt(0)[n4]() + t2.slice(1);
|
|
105
|
+
}
|
|
106
|
+
var U = M.bind(null, "toUpperCase");
|
|
107
|
+
var H = M.bind(null, "toLowerCase");
|
|
108
|
+
function J(n4) {
|
|
109
|
+
return Y(n4) ? U("null") : "object" == typeof n4 ? yn(n4) : Object.prototype.toString.call(n4).slice(8, -1);
|
|
110
|
+
}
|
|
111
|
+
function R(n4, t2) {
|
|
112
|
+
void 0 === t2 && (t2 = true);
|
|
113
|
+
var e2 = J(n4);
|
|
114
|
+
return t2 ? H(e2) : e2;
|
|
115
|
+
}
|
|
116
|
+
function V(n4, t2) {
|
|
117
|
+
return typeof t2 === n4;
|
|
118
|
+
}
|
|
119
|
+
var W = V.bind(null, "function");
|
|
120
|
+
var q = V.bind(null, "string");
|
|
121
|
+
var I = V.bind(null, "undefined");
|
|
122
|
+
var Q = V.bind(null, "boolean");
|
|
123
|
+
var X = V.bind(null, "symbol");
|
|
124
|
+
function Y(n4) {
|
|
125
|
+
return null === n4;
|
|
126
|
+
}
|
|
127
|
+
function nn(n4) {
|
|
128
|
+
return "number" === R(n4) && !isNaN(n4);
|
|
129
|
+
}
|
|
130
|
+
function rn(n4) {
|
|
131
|
+
return "array" === R(n4);
|
|
132
|
+
}
|
|
133
|
+
function on(n4) {
|
|
134
|
+
if (!un(n4)) return false;
|
|
135
|
+
for (var t2 = n4; null !== Object.getPrototypeOf(t2); ) t2 = Object.getPrototypeOf(t2);
|
|
136
|
+
return Object.getPrototypeOf(n4) === t2;
|
|
137
|
+
}
|
|
138
|
+
function un(n4) {
|
|
139
|
+
return n4 && ("object" == typeof n4 || null !== n4);
|
|
140
|
+
}
|
|
141
|
+
function yn(n4) {
|
|
142
|
+
return W(n4.constructor) ? n4.constructor.name : null;
|
|
143
|
+
}
|
|
144
|
+
function hn(n4) {
|
|
145
|
+
return n4 instanceof Error || q(n4.message) && n4.constructor && nn(n4.constructor.stackTraceLimit);
|
|
146
|
+
}
|
|
147
|
+
function On(n4, t2) {
|
|
148
|
+
if ("object" != typeof t2 || Y(t2)) return false;
|
|
149
|
+
if (t2 instanceof n4) return true;
|
|
150
|
+
var e2 = R(new n4(""));
|
|
151
|
+
if (hn(t2)) for (; t2; ) {
|
|
152
|
+
if (R(t2) === e2) return true;
|
|
153
|
+
t2 = Object.getPrototypeOf(t2);
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
var Sn = On.bind(null, TypeError);
|
|
158
|
+
var An = On.bind(null, SyntaxError);
|
|
159
|
+
function $n(n4, t2) {
|
|
160
|
+
var e2 = n4 instanceof Element || n4 instanceof HTMLDocument;
|
|
161
|
+
return e2 && t2 ? Tn(n4, t2) : e2;
|
|
162
|
+
}
|
|
163
|
+
function Tn(n4, t2) {
|
|
164
|
+
return void 0 === t2 && (t2 = ""), n4 && n4.nodeName === t2.toUpperCase();
|
|
165
|
+
}
|
|
166
|
+
function _n(n4) {
|
|
167
|
+
var t2 = [].slice.call(arguments, 1);
|
|
168
|
+
return function() {
|
|
169
|
+
return n4.apply(void 0, [].slice.call(arguments).concat(t2));
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
var kn = _n($n, "form");
|
|
173
|
+
var Bn = _n($n, "button");
|
|
174
|
+
var Gn = _n($n, "input");
|
|
175
|
+
var Mn = _n($n, "select");
|
|
176
|
+
|
|
177
|
+
// ../../node_modules/.pnpm/analytics-utils@1.0.12_@types+dlv@1.1.4/node_modules/analytics-utils/dist/analytics-utils.module.js
|
|
178
|
+
function n(e2) {
|
|
179
|
+
try {
|
|
180
|
+
return decodeURIComponent(e2.replace(/\+/g, " "));
|
|
181
|
+
} catch (e3) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function o2() {
|
|
186
|
+
if ($) {
|
|
187
|
+
var r3 = navigator, t2 = r3.languages;
|
|
188
|
+
return r3.userLanguage || (t2 && t2.length ? t2[0] : r3.language);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function a() {
|
|
192
|
+
try {
|
|
193
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
194
|
+
} catch (e2) {
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function s(r3) {
|
|
198
|
+
return (function(e2) {
|
|
199
|
+
for (var r4, t2 = /* @__PURE__ */ Object.create(null), o4 = /([^&=]+)=?([^&]*)/g; r4 = o4.exec(e2); ) {
|
|
200
|
+
var a5 = n(r4[1]), i4 = n(r4[2]);
|
|
201
|
+
"[]" === a5.substring(a5.length - 2) ? (t2[a5 = a5.substring(0, a5.length - 2)] || (t2[a5] = [])).push(i4) : t2[a5] = "" === i4 || i4;
|
|
202
|
+
}
|
|
203
|
+
for (var u3 in t2) {
|
|
204
|
+
var c4 = u3.split("[");
|
|
205
|
+
c4.length > 1 && (m2(t2, c4.map(function(e3) {
|
|
206
|
+
return e3.replace(/[?[\]\\ ]/g, "");
|
|
207
|
+
}), t2[u3]), delete t2[u3]);
|
|
208
|
+
}
|
|
209
|
+
return t2;
|
|
210
|
+
})((function(r4) {
|
|
211
|
+
if (r4) {
|
|
212
|
+
var t2 = r4.match(/\?(.*)/);
|
|
213
|
+
return t2 && t2[1] ? t2[1].split("#")[0] : "";
|
|
214
|
+
}
|
|
215
|
+
return $ && window.location.search.substring(1);
|
|
216
|
+
})(r3));
|
|
217
|
+
}
|
|
218
|
+
function m2(e2, r3, t2) {
|
|
219
|
+
for (var n4 = r3.length - 1, o4 = 0; o4 < n4; ++o4) {
|
|
220
|
+
var a5 = r3[o4];
|
|
221
|
+
if ("__proto__" === a5 || "constructor" === a5) break;
|
|
222
|
+
a5 in e2 || (e2[a5] = {}), e2 = e2[a5];
|
|
223
|
+
}
|
|
224
|
+
e2[r3[n4]] = t2;
|
|
225
|
+
}
|
|
226
|
+
function y() {
|
|
227
|
+
for (var e2 = "", r3 = 0, t2 = 4294967295 * Math.random() | 0; r3++ < 36; ) {
|
|
228
|
+
var n4 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[r3 - 1], o4 = 15 & t2;
|
|
229
|
+
e2 += "-" == n4 || "4" == n4 ? n4 : ("x" == n4 ? o4 : 3 & o4 | 8).toString(16), t2 = r3 % 8 == 0 ? 4294967295 * Math.random() | 0 : t2 >> 4;
|
|
230
|
+
}
|
|
231
|
+
return e2;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ../../node_modules/.pnpm/@analytics+global-storage-utils@0.1.7/node_modules/@analytics/global-storage-utils/dist/analytics-util-global-storage.module.js
|
|
235
|
+
var l = "global";
|
|
236
|
+
var o3 = j + "global" + j;
|
|
237
|
+
var n2 = typeof self === o && self.self === self && self || typeof global === o && global.global === global && global || void 0;
|
|
238
|
+
function a2(t2) {
|
|
239
|
+
return n2[o3][t2];
|
|
240
|
+
}
|
|
241
|
+
function f(t2, e2) {
|
|
242
|
+
return n2[o3][t2] = e2;
|
|
243
|
+
}
|
|
244
|
+
function i(t2) {
|
|
245
|
+
delete n2[o3][t2];
|
|
246
|
+
}
|
|
247
|
+
function u(t2, e2, r3) {
|
|
248
|
+
var l3;
|
|
249
|
+
try {
|
|
250
|
+
if (b2(t2)) {
|
|
251
|
+
var o4 = window[t2];
|
|
252
|
+
l3 = o4[e2].bind(o4);
|
|
253
|
+
}
|
|
254
|
+
} catch (t3) {
|
|
255
|
+
}
|
|
256
|
+
return l3 || r3;
|
|
257
|
+
}
|
|
258
|
+
n2[o3] || (n2[o3] = {});
|
|
259
|
+
var c = {};
|
|
260
|
+
function b2(t2) {
|
|
261
|
+
if (typeof c[t2] !== e) return c[t2];
|
|
262
|
+
try {
|
|
263
|
+
var e2 = window[t2];
|
|
264
|
+
e2.setItem(e, e), e2.removeItem(e);
|
|
265
|
+
} catch (e3) {
|
|
266
|
+
return c[t2] = false;
|
|
267
|
+
}
|
|
268
|
+
return c[t2] = true;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ../../node_modules/.pnpm/@analytics+core@0.12.15_@types+dlv@1.1.4/node_modules/@analytics/core/dist/client/analytics-core.module.js
|
|
272
|
+
function v() {
|
|
273
|
+
return v = Object.assign || function(e2) {
|
|
274
|
+
for (var n4 = 1; n4 < arguments.length; n4++) {
|
|
275
|
+
var t2 = arguments[n4];
|
|
276
|
+
for (var r3 in t2) Object.prototype.hasOwnProperty.call(t2, r3) && (e2[r3] = t2[r3]);
|
|
277
|
+
}
|
|
278
|
+
return e2;
|
|
279
|
+
}, v.apply(this, arguments);
|
|
280
|
+
}
|
|
281
|
+
var y2 = "function";
|
|
282
|
+
var b3 = "undefined";
|
|
283
|
+
var I2 = "@@redux/" + Math.random().toString(36);
|
|
284
|
+
var w = /* @__PURE__ */ (function() {
|
|
285
|
+
return typeof Symbol === y2 && Symbol.observable || "@@observable";
|
|
286
|
+
})();
|
|
287
|
+
var E = " != " + y2;
|
|
288
|
+
function P2(e2, n4, t2) {
|
|
289
|
+
var r3;
|
|
290
|
+
if (typeof n4 === y2 && typeof t2 === b3 && (t2 = n4, n4 = void 0), typeof t2 !== b3) {
|
|
291
|
+
if (typeof t2 !== y2) throw new Error("enhancer" + E);
|
|
292
|
+
return t2(P2)(e2, n4);
|
|
293
|
+
}
|
|
294
|
+
if (typeof e2 !== y2) throw new Error("reducer" + E);
|
|
295
|
+
var i4 = e2, a5 = n4, o4 = [], u3 = o4, c4 = false;
|
|
296
|
+
function s2() {
|
|
297
|
+
u3 === o4 && (u3 = o4.slice());
|
|
298
|
+
}
|
|
299
|
+
function f2() {
|
|
300
|
+
return a5;
|
|
301
|
+
}
|
|
302
|
+
function d3(e3) {
|
|
303
|
+
if (typeof e3 !== y2) throw new Error("Listener" + E);
|
|
304
|
+
var n5 = true;
|
|
305
|
+
return s2(), u3.push(e3), function() {
|
|
306
|
+
if (n5) {
|
|
307
|
+
n5 = false, s2();
|
|
308
|
+
var t3 = u3.indexOf(e3);
|
|
309
|
+
u3.splice(t3, 1);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function p(e3) {
|
|
314
|
+
if (!on(e3)) throw new Error("Act != obj");
|
|
315
|
+
if (typeof e3.type === b3) throw new Error("ActType " + b3);
|
|
316
|
+
if (c4) throw new Error("Dispatch in reducer");
|
|
317
|
+
try {
|
|
318
|
+
c4 = true, a5 = i4(a5, e3);
|
|
319
|
+
} finally {
|
|
320
|
+
c4 = false;
|
|
321
|
+
}
|
|
322
|
+
for (var n5 = o4 = u3, t3 = 0; t3 < n5.length; t3++) (0, n5[t3])();
|
|
323
|
+
return e3;
|
|
324
|
+
}
|
|
325
|
+
return p({ type: "@@redux/INIT" }), (r3 = { dispatch: p, subscribe: d3, getState: f2, replaceReducer: function(e3) {
|
|
326
|
+
if (typeof e3 !== y2) throw new Error("next reducer" + E);
|
|
327
|
+
i4 = e3, p({ type: "@@redux/INIT" });
|
|
328
|
+
} })[w] = function() {
|
|
329
|
+
var e3, n5 = d3;
|
|
330
|
+
return (e3 = { subscribe: function(e4) {
|
|
331
|
+
if ("object" != typeof e4) throw new TypeError("Observer != obj");
|
|
332
|
+
function t3() {
|
|
333
|
+
e4.next && e4.next(f2());
|
|
334
|
+
}
|
|
335
|
+
return t3(), { unsubscribe: n5(t3) };
|
|
336
|
+
} })[w] = function() {
|
|
337
|
+
return this;
|
|
338
|
+
}, e3;
|
|
339
|
+
}, r3;
|
|
340
|
+
}
|
|
341
|
+
function S(e2, n4) {
|
|
342
|
+
var t2 = n4 && n4.type;
|
|
343
|
+
return "action " + (t2 && t2.toString() || "?") + "reducer " + e2 + " returns " + b3;
|
|
344
|
+
}
|
|
345
|
+
function N() {
|
|
346
|
+
var e2 = [].slice.call(arguments);
|
|
347
|
+
return 0 === e2.length ? function(e3) {
|
|
348
|
+
return e3;
|
|
349
|
+
} : 1 === e2.length ? e2[0] : e2.reduce(function(e3, n4) {
|
|
350
|
+
return function() {
|
|
351
|
+
return e3(n4.apply(void 0, [].slice.call(arguments)));
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function O() {
|
|
356
|
+
var e2 = arguments;
|
|
357
|
+
return function(n4) {
|
|
358
|
+
return function(t2, r3, i4) {
|
|
359
|
+
var a5, o4 = n4(t2, r3, i4), u3 = o4.dispatch, c4 = { getState: o4.getState, dispatch: function(e3) {
|
|
360
|
+
return u3(e3);
|
|
361
|
+
} };
|
|
362
|
+
return a5 = [].slice.call(e2).map(function(e3) {
|
|
363
|
+
return e3(c4);
|
|
364
|
+
}), v({}, o4, { dispatch: u3 = N.apply(void 0, a5)(o4.dispatch) });
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
var A = j + "anon_id";
|
|
369
|
+
var _2 = j + "user_id";
|
|
370
|
+
var x = j + "user_traits";
|
|
371
|
+
var k2 = "userId";
|
|
372
|
+
var T2 = "anonymousId";
|
|
373
|
+
var z = ["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"];
|
|
374
|
+
var M2 = ["name", "EVENTS", "config", "loaded"];
|
|
375
|
+
var q2 = z.reduce(function(e2, n4) {
|
|
376
|
+
return e2[n4] = n4, e2;
|
|
377
|
+
}, { registerPluginType: function(e2) {
|
|
378
|
+
return "registerPlugin:" + e2;
|
|
379
|
+
}, pluginReadyType: function(e2) {
|
|
380
|
+
return "ready:" + e2;
|
|
381
|
+
} });
|
|
382
|
+
var U2 = /^utm_/;
|
|
383
|
+
var V2 = /^an_prop_/;
|
|
384
|
+
var L = /^an_trait_/;
|
|
385
|
+
function C(e2) {
|
|
386
|
+
var n4 = e2.storage.setItem;
|
|
387
|
+
return function(t2) {
|
|
388
|
+
return function(r3) {
|
|
389
|
+
return function(i4) {
|
|
390
|
+
if (i4.type === q2.bootstrap) {
|
|
391
|
+
var a5 = i4.params, o4 = i4.user, u3 = i4.persistedUser, c4 = i4.initialUser, s2 = u3.userId === o4.userId;
|
|
392
|
+
u3.anonymousId !== o4.anonymousId && n4(A, o4.anonymousId), s2 || n4(_2, o4.userId), c4.traits && n4(x, v({}, s2 && u3.traits ? u3.traits : {}, c4.traits));
|
|
393
|
+
var l3 = Object.keys(i4.params);
|
|
394
|
+
if (l3.length) {
|
|
395
|
+
var f2 = a5.an_uid, d3 = a5.an_event, p = l3.reduce(function(e3, n5) {
|
|
396
|
+
if (n5.match(U2) || n5.match(/^(d|g)clid/)) {
|
|
397
|
+
var t3 = n5.replace(U2, "");
|
|
398
|
+
e3.campaign["campaign" === t3 ? "name" : t3] = a5[n5];
|
|
399
|
+
}
|
|
400
|
+
return n5.match(V2) && (e3.props[n5.replace(V2, "")] = a5[n5]), n5.match(L) && (e3.traits[n5.replace(L, "")] = a5[n5]), e3;
|
|
401
|
+
}, { campaign: {}, props: {}, traits: {} });
|
|
402
|
+
t2.dispatch(v({ type: q2.params, raw: a5 }, p, f2 ? { userId: f2 } : {})), f2 && setTimeout(function() {
|
|
403
|
+
return e2.identify(f2, p.traits);
|
|
404
|
+
}, 0), d3 && setTimeout(function() {
|
|
405
|
+
return e2.track(d3, p.props);
|
|
406
|
+
}, 0), Object.keys(p.campaign).length && t2.dispatch({ type: q2.campaign, campaign: p.campaign });
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return r3(i4);
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function R2(e2) {
|
|
415
|
+
return function(n4, t2) {
|
|
416
|
+
if (void 0 === n4 && (n4 = {}), void 0 === t2 && (t2 = {}), t2.type === q2.setItemEnd) {
|
|
417
|
+
if (t2.key === A) return v({}, n4, { anonymousId: t2.value });
|
|
418
|
+
if (t2.key === _2) return v({}, n4, { userId: t2.value });
|
|
419
|
+
}
|
|
420
|
+
switch (t2.type) {
|
|
421
|
+
case q2.identify:
|
|
422
|
+
return Object.assign({}, n4, { userId: t2.userId, traits: v({}, n4.traits, t2.traits) });
|
|
423
|
+
case q2.reset:
|
|
424
|
+
return [_2, A, x].forEach(function(n5) {
|
|
425
|
+
e2.removeItem(n5);
|
|
426
|
+
}), Object.assign({}, n4, { userId: null, anonymousId: null, traits: {} });
|
|
427
|
+
default:
|
|
428
|
+
return n4;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function $2(e2) {
|
|
433
|
+
return { userId: e2.getItem(_2), anonymousId: e2.getItem(A), traits: e2.getItem(x) };
|
|
434
|
+
}
|
|
435
|
+
var D = function(e2) {
|
|
436
|
+
return j + "TEMP" + j + e2;
|
|
437
|
+
};
|
|
438
|
+
function B2(n4) {
|
|
439
|
+
var t2 = n4.storage, r3 = t2.setItem, i4 = t2.removeItem, a5 = t2.getItem;
|
|
440
|
+
return function(n5) {
|
|
441
|
+
return function(t3) {
|
|
442
|
+
return function(u3) {
|
|
443
|
+
var c4 = u3.userId, s2 = u3.traits, l3 = u3.options;
|
|
444
|
+
if (u3.type === q2.reset && ([_2, x, A].forEach(function(e2) {
|
|
445
|
+
i4(e2);
|
|
446
|
+
}), [k2, T2, "traits"].forEach(function(e2) {
|
|
447
|
+
i(D(e2));
|
|
448
|
+
})), u3.type === q2.identify) {
|
|
449
|
+
a5(A) || r3(A, y());
|
|
450
|
+
var f2 = a5(_2), d3 = a5(x) || {};
|
|
451
|
+
f2 && f2 !== c4 && n5.dispatch({ type: q2.userIdChanged, old: { userId: f2, traits: d3 }, new: { userId: c4, traits: s2 }, options: l3 }), c4 && r3(_2, c4), s2 && r3(x, v({}, d3, s2));
|
|
452
|
+
}
|
|
453
|
+
return t3(u3);
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
var X2 = {};
|
|
459
|
+
function J2(e2, n4) {
|
|
460
|
+
X2[e2] && W(X2[e2]) && (X2[e2](n4), delete X2[e2]);
|
|
461
|
+
}
|
|
462
|
+
function W2(e2, n4, t2) {
|
|
463
|
+
return new Promise(function(r3, i4) {
|
|
464
|
+
return n4() ? r3(e2) : t2 < 1 ? i4(v({}, e2, { queue: true })) : new Promise(function(e3) {
|
|
465
|
+
return setTimeout(e3, 10);
|
|
466
|
+
}).then(function(a5) {
|
|
467
|
+
return W2(e2, n4, t2 - 10).then(r3, i4);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function H2(e2) {
|
|
472
|
+
return { abort: e2 };
|
|
473
|
+
}
|
|
474
|
+
function F2(e2, n4, t2) {
|
|
475
|
+
var r3 = {}, i4 = n4(), a5 = e2.getState(), o4 = a5.plugins, u3 = a5.queue, c4 = a5.user;
|
|
476
|
+
if (!a5.context.offline && u3 && u3.actions && u3.actions.length) {
|
|
477
|
+
var s2 = u3.actions.reduce(function(e3, n5, t3) {
|
|
478
|
+
return o4[n5.plugin].loaded ? (e3.process.push(n5), e3.processIndex.push(t3)) : (e3.requeue.push(n5), e3.requeueIndex.push(t3)), e3;
|
|
479
|
+
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
480
|
+
if (s2.processIndex && s2.processIndex.length) {
|
|
481
|
+
s2.processIndex.forEach(function(n5) {
|
|
482
|
+
var a6 = u3.actions[n5], s3 = a6.plugin, f3 = a6.payload.type, p = i4[s3][f3];
|
|
483
|
+
if (p && W(p)) {
|
|
484
|
+
var m4, g3 = (function(e3, n6) {
|
|
485
|
+
return void 0 === e3 && (e3 = {}), void 0 === n6 && (n6 = {}), [k2, T2].reduce(function(t3, r4) {
|
|
486
|
+
return e3.hasOwnProperty(r4) && n6[r4] && n6[r4] !== e3[r4] && (t3[r4] = n6[r4]), t3;
|
|
487
|
+
}, e3);
|
|
488
|
+
})(a6.payload, c4), h2 = r3[g3.meta.rid];
|
|
489
|
+
if (!h2 && (m4 = p({ payload: g3, config: o4[s3].config, instance: t2, abort: H2 })) && on(m4) && m4.abort) return void (r3[g3.meta.rid] = true);
|
|
490
|
+
if (!h2) {
|
|
491
|
+
var y3 = f3 + ":" + s3;
|
|
492
|
+
e2.dispatch(v({}, g3, { type: y3, _: { called: y3, from: "queueDrain" } }));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
var f2 = u3.actions.filter(function(e3, n5) {
|
|
497
|
+
return !~s2.processIndex.indexOf(n5);
|
|
498
|
+
});
|
|
499
|
+
u3.actions = f2;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
var G2 = function(e2) {
|
|
504
|
+
var n4 = e2.data, t2 = e2.action, r3 = e2.instance, i4 = e2.state, a5 = e2.allPlugins, o4 = e2.allMatches, u3 = e2.store, c4 = e2.EVENTS;
|
|
505
|
+
try {
|
|
506
|
+
var s2 = i4.plugins, f2 = i4.context, p = t2.type, m4 = p.match(K), g3 = n4.exact.map(function(e3) {
|
|
507
|
+
return e3.pluginName;
|
|
508
|
+
});
|
|
509
|
+
m4 && (g3 = o4.during.map(function(e3) {
|
|
510
|
+
return e3.pluginName;
|
|
511
|
+
}));
|
|
512
|
+
var h2 = /* @__PURE__ */ (function(e3, n5) {
|
|
513
|
+
return function(t3, r4, i5) {
|
|
514
|
+
var a6 = r4.config, o5 = r4.name, u4 = o5 + "." + t3.type;
|
|
515
|
+
i5 && (u4 = i5.event);
|
|
516
|
+
var c5 = t3.type.match(K) ? /* @__PURE__ */ (function(e4, n6, t4, r5, i6) {
|
|
517
|
+
return function(a7, o6) {
|
|
518
|
+
var u5 = r5 ? r5.name : e4, c6 = o6 && ae(o6) ? o6 : t4;
|
|
519
|
+
if (r5 && (!(c6 = o6 && ae(o6) ? o6 : [e4]).includes(e4) || 1 !== c6.length)) throw new Error("Method " + n6 + " can only abort " + e4 + " plugin. " + JSON.stringify(c6) + " input valid");
|
|
520
|
+
return v({}, i6, { abort: { reason: a7, plugins: c6, caller: n6, _: u5 } });
|
|
521
|
+
};
|
|
522
|
+
})(o5, u4, n5, i5, t3) : /* @__PURE__ */ (function(e4, n6) {
|
|
523
|
+
return function() {
|
|
524
|
+
throw new Error(e4.type + " action not cancellable. Remove abort in " + n6);
|
|
525
|
+
};
|
|
526
|
+
})(t3, u4);
|
|
527
|
+
return { payload: ce(t3), instance: e3, config: a6 || {}, abort: c5 };
|
|
528
|
+
};
|
|
529
|
+
})(r3, g3), y3 = n4.exact.reduce(function(e3, n5) {
|
|
530
|
+
var t3 = n5.pluginName, r4 = n5.methodName, i5 = false;
|
|
531
|
+
return r4.match(/^initialize/) || r4.match(/^reset/) || (i5 = !s2[t3].loaded), f2.offline && r4.match(/^(page|track|identify)/) && (i5 = true), e3["" + t3] = i5, e3;
|
|
532
|
+
}, {});
|
|
533
|
+
return Promise.resolve(n4.exact.reduce(function(e3, i5, o5) {
|
|
534
|
+
try {
|
|
535
|
+
var u4 = i5.pluginName;
|
|
536
|
+
return Promise.resolve(e3).then(function(e4) {
|
|
537
|
+
function i6() {
|
|
538
|
+
return Promise.resolve(e4);
|
|
539
|
+
}
|
|
540
|
+
var o6 = (function() {
|
|
541
|
+
if (n4.namespaced && n4.namespaced[u4]) return Promise.resolve(n4.namespaced[u4].reduce(function(e5, n5, t3) {
|
|
542
|
+
try {
|
|
543
|
+
return Promise.resolve(e5).then(function(e6) {
|
|
544
|
+
return n5.method && W(n5.method) ? ((function(e7, n6) {
|
|
545
|
+
var t5 = ue(e7);
|
|
546
|
+
if (t5 && t5.name === n6) {
|
|
547
|
+
var r4 = ue(t5.method);
|
|
548
|
+
throw new Error([n6 + " plugin is calling method " + e7, "Plugins cant call self", "Use " + t5.method + " " + (r4 ? "or " + r4.method : "") + " in " + n6 + " plugin insteadof " + e7].join("\n"));
|
|
549
|
+
}
|
|
550
|
+
})(n5.methodName, n5.pluginName), Promise.resolve(n5.method({ payload: e6, instance: r3, abort: (t4 = e6, i7 = u4, o7 = n5.pluginName, function(e7, n6) {
|
|
551
|
+
return v({}, t4, { abort: { reason: e7, plugins: n6 || [i7], caller: p, from: o7 || i7 } });
|
|
552
|
+
}), config: ee(n5.pluginName, s2, a5), plugins: s2 })).then(function(n6) {
|
|
553
|
+
var t5 = on(n6) ? n6 : {};
|
|
554
|
+
return Promise.resolve(v({}, e6, t5));
|
|
555
|
+
})) : e6;
|
|
556
|
+
var t4, i7, o7;
|
|
557
|
+
});
|
|
558
|
+
} catch (e6) {
|
|
559
|
+
return Promise.reject(e6);
|
|
560
|
+
}
|
|
561
|
+
}, Promise.resolve(t2))).then(function(n5) {
|
|
562
|
+
e4[u4] = n5;
|
|
563
|
+
});
|
|
564
|
+
e4[u4] = t2;
|
|
565
|
+
})();
|
|
566
|
+
return o6 && o6.then ? o6.then(i6) : i6();
|
|
567
|
+
});
|
|
568
|
+
} catch (e4) {
|
|
569
|
+
return Promise.reject(e4);
|
|
570
|
+
}
|
|
571
|
+
}, Promise.resolve({}))).then(function(e3) {
|
|
572
|
+
return Promise.resolve(n4.exact.reduce(function(t3, i5, o5) {
|
|
573
|
+
try {
|
|
574
|
+
var c5 = n4.exact.length === o5 + 1, f3 = i5.pluginName, d3 = a5[f3];
|
|
575
|
+
return Promise.resolve(t3).then(function(n5) {
|
|
576
|
+
var t4 = e3[f3] ? e3[f3] : {};
|
|
577
|
+
if (m4 && (t4 = n5), re(t4, f3)) return Z({ data: t4, method: p, instance: r3, pluginName: f3, store: u3 }), Promise.resolve(n5);
|
|
578
|
+
if (re(n5, f3)) return c5 && Z({ data: n5, method: p, instance: r3, store: u3 }), Promise.resolve(n5);
|
|
579
|
+
if (y3.hasOwnProperty(f3) && true === y3[f3]) return u3.dispatch({ type: "queue", plugin: f3, payload: t4, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(n5);
|
|
580
|
+
var i6 = h2(e3[f3], a5[f3]);
|
|
581
|
+
return Promise.resolve(d3[p]({ abort: i6.abort, payload: t4, instance: r3, config: ee(f3, s2, a5), plugins: s2 })).then(function(i7) {
|
|
582
|
+
var a6 = on(i7) ? i7 : {}, o6 = v({}, n5, a6), c6 = e3[f3];
|
|
583
|
+
if (re(c6, f3)) Z({ data: c6, method: p, instance: r3, pluginName: f3, store: u3 });
|
|
584
|
+
else {
|
|
585
|
+
var s3 = p + ":" + f3;
|
|
586
|
+
(s3.match(/:/g) || []).length < 2 && !p.match(Q2) && !p.match(Y2) && r3.dispatch(v({}, m4 ? o6 : t4, { type: s3, _: { called: s3, from: "submethod" } }));
|
|
587
|
+
}
|
|
588
|
+
return Promise.resolve(o6);
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
} catch (e4) {
|
|
592
|
+
return Promise.reject(e4);
|
|
593
|
+
}
|
|
594
|
+
}, Promise.resolve(t2))).then(function(e4) {
|
|
595
|
+
if (!(p.match(K) || p.match(/^registerPlugin/) || p.match(Y2) || p.match(Q2) || p.match(/^params/) || p.match(/^userIdChanged/))) {
|
|
596
|
+
if (c4.plugins.includes(p), e4._ && e4._.originalAction === p) return e4;
|
|
597
|
+
var t3 = v({}, e4, { _: { originalAction: e4.type, called: e4.type, from: "engineEnd" } });
|
|
598
|
+
ie(e4, n4.exact.length) && !p.match(/End$/) && (t3 = v({}, t3, { type: e4.type + "Aborted" })), u3.dispatch(t3);
|
|
599
|
+
}
|
|
600
|
+
return e4;
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
} catch (e3) {
|
|
604
|
+
return Promise.reject(e3);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
var K = /Start$/;
|
|
608
|
+
var Q2 = /^bootstrap/;
|
|
609
|
+
var Y2 = /^ready/;
|
|
610
|
+
function Z(e2) {
|
|
611
|
+
var n4 = e2.pluginName, t2 = e2.method + "Aborted" + (n4 ? ":" + n4 : "");
|
|
612
|
+
e2.store.dispatch(v({}, e2.data, { type: t2, _: { called: t2, from: "abort" } }));
|
|
613
|
+
}
|
|
614
|
+
function ee(e2, n4, t2) {
|
|
615
|
+
var r3 = n4[e2] || t2[e2];
|
|
616
|
+
return r3 && r3.config ? r3.config : {};
|
|
617
|
+
}
|
|
618
|
+
function ne(e2, n4) {
|
|
619
|
+
return n4.reduce(function(n5, t2) {
|
|
620
|
+
return t2[e2] ? n5.concat({ methodName: e2, pluginName: t2.name, method: t2[e2] }) : n5;
|
|
621
|
+
}, []);
|
|
622
|
+
}
|
|
623
|
+
function te(e2, n4) {
|
|
624
|
+
var t2 = e2.replace(K, ""), r3 = n4 ? ":" + n4 : "";
|
|
625
|
+
return ["" + e2 + r3, "" + t2 + r3, t2 + "End" + r3];
|
|
626
|
+
}
|
|
627
|
+
function re(e2, n4) {
|
|
628
|
+
var t2 = e2.abort;
|
|
629
|
+
return !!t2 && (true === t2 || oe(t2, n4) || t2 && oe(t2.plugins, n4));
|
|
630
|
+
}
|
|
631
|
+
function ie(e2, n4) {
|
|
632
|
+
var t2 = e2.abort;
|
|
633
|
+
if (!t2) return false;
|
|
634
|
+
if (true === t2 || q(t2)) return true;
|
|
635
|
+
var r3 = t2.plugins;
|
|
636
|
+
return ae(t2) && t2.length === n4 || ae(r3) && r3.length === n4;
|
|
637
|
+
}
|
|
638
|
+
function ae(e2) {
|
|
639
|
+
return Array.isArray(e2);
|
|
640
|
+
}
|
|
641
|
+
function oe(e2, n4) {
|
|
642
|
+
return !(!e2 || !ae(e2)) && e2.includes(n4);
|
|
643
|
+
}
|
|
644
|
+
function ue(e2) {
|
|
645
|
+
var n4 = e2.match(/(.*):(.*)/);
|
|
646
|
+
return !!n4 && { method: n4[1], name: n4[2] };
|
|
647
|
+
}
|
|
648
|
+
function ce(e2) {
|
|
649
|
+
return Object.keys(e2).reduce(function(n4, t2) {
|
|
650
|
+
return "type" === t2 || (n4[t2] = on(e2[t2]) ? Object.assign({}, e2[t2]) : e2[t2]), n4;
|
|
651
|
+
}, {});
|
|
652
|
+
}
|
|
653
|
+
function se(e2, n4, t2) {
|
|
654
|
+
var r3 = {};
|
|
655
|
+
return function(i4) {
|
|
656
|
+
return function(a5) {
|
|
657
|
+
return function(o4) {
|
|
658
|
+
try {
|
|
659
|
+
var u3, c4 = function(e3) {
|
|
660
|
+
return u3 ? e3 : a5(f2);
|
|
661
|
+
}, s2 = o4.type, l3 = o4.plugins, f2 = o4;
|
|
662
|
+
if (o4.abort) return Promise.resolve(a5(o4));
|
|
663
|
+
if (s2 === q2.enablePlugin && i4.dispatch({ type: q2.initializeStart, plugins: l3, disabled: [], fromEnable: true, meta: o4.meta }), s2 === q2.disablePlugin && setTimeout(function() {
|
|
664
|
+
return J2(o4.meta.rid, { payload: o4 });
|
|
665
|
+
}, 0), s2 === q2.initializeEnd) {
|
|
666
|
+
var m4 = n4(), g3 = Object.keys(m4), h2 = g3.filter(function(e3) {
|
|
667
|
+
return l3.includes(e3);
|
|
668
|
+
}).map(function(e3) {
|
|
669
|
+
return m4[e3];
|
|
670
|
+
}), y3 = [], b5 = [], I4 = o4.disabled, w2 = h2.map(function(e3) {
|
|
671
|
+
var n5 = e3.loaded, t3 = e3.name, a6 = e3.config;
|
|
672
|
+
return W2(e3, function() {
|
|
673
|
+
return n5({ config: a6 });
|
|
674
|
+
}, 1e4).then(function(n6) {
|
|
675
|
+
return r3[t3] || (i4.dispatch({ type: q2.pluginReadyType(t3), name: t3, events: Object.keys(e3).filter(function(e4) {
|
|
676
|
+
return !M2.includes(e4);
|
|
677
|
+
}) }), r3[t3] = true), y3 = y3.concat(t3), e3;
|
|
678
|
+
}).catch(function(e4) {
|
|
679
|
+
if (e4 instanceof Error) throw new Error(e4);
|
|
680
|
+
return b5 = b5.concat(e4.name), e4;
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
Promise.all(w2).then(function(e3) {
|
|
684
|
+
var n5 = { plugins: y3, failed: b5, disabled: I4 };
|
|
685
|
+
setTimeout(function() {
|
|
686
|
+
g3.length === w2.length + I4.length && i4.dispatch(v({}, { type: q2.ready }, n5));
|
|
687
|
+
}, 0);
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
var E3 = (function() {
|
|
691
|
+
if (s2 !== q2.bootstrap) return /^ready:([^:]*)$/.test(s2) && setTimeout(function() {
|
|
692
|
+
return F2(i4, n4, e2);
|
|
693
|
+
}, 0), Promise.resolve((function(e3, n5, t3, r4, i5) {
|
|
694
|
+
try {
|
|
695
|
+
var a6 = W(n5) ? n5() : n5, o5 = e3.type, u4 = o5.replace(K, "");
|
|
696
|
+
if (e3._ && e3._.called) return Promise.resolve(e3);
|
|
697
|
+
var c5 = t3.getState(), s3 = (m5 = a6, void 0 === (g4 = c5.plugins) && (g4 = {}), void 0 === (h3 = e3.options) && (h3 = {}), Object.keys(m5).filter(function(e4) {
|
|
698
|
+
var n6 = h3.plugins || {};
|
|
699
|
+
return Q(n6[e4]) ? n6[e4] : false !== n6.all && (!g4[e4] || false !== g4[e4].enabled);
|
|
700
|
+
}).map(function(e4) {
|
|
701
|
+
return m5[e4];
|
|
702
|
+
}));
|
|
703
|
+
o5 === q2.initializeStart && e3.fromEnable && (s3 = Object.keys(c5.plugins).filter(function(n6) {
|
|
704
|
+
var t4 = c5.plugins[n6];
|
|
705
|
+
return e3.plugins.includes(n6) && !t4.initialized;
|
|
706
|
+
}).map(function(e4) {
|
|
707
|
+
return a6[e4];
|
|
708
|
+
}));
|
|
709
|
+
var l4 = s3.map(function(e4) {
|
|
710
|
+
return e4.name;
|
|
711
|
+
}), f3 = (function(e4, n6, t4) {
|
|
712
|
+
var r5 = te(e4).map(function(e5) {
|
|
713
|
+
return ne(e5, n6);
|
|
714
|
+
});
|
|
715
|
+
return n6.reduce(function(t5, r6) {
|
|
716
|
+
var i6 = r6.name, a7 = te(e4, i6).map(function(e5) {
|
|
717
|
+
return ne(e5, n6);
|
|
718
|
+
}), o6 = a7[0], u5 = a7[1], c6 = a7[2];
|
|
719
|
+
return o6.length && (t5.beforeNS[i6] = o6), u5.length && (t5.duringNS[i6] = u5), c6.length && (t5.afterNS[i6] = c6), t5;
|
|
720
|
+
}, { before: r5[0], beforeNS: {}, during: r5[1], duringNS: {}, after: r5[2], afterNS: {} });
|
|
721
|
+
})(o5, s3);
|
|
722
|
+
return Promise.resolve(G2({ action: e3, data: { exact: f3.before, namespaced: f3.beforeNS }, state: c5, allPlugins: a6, allMatches: f3, instance: t3, store: r4, EVENTS: i5 })).then(function(e4) {
|
|
723
|
+
function n6() {
|
|
724
|
+
var n7 = (function() {
|
|
725
|
+
if (o5.match(K)) return Promise.resolve(G2({ action: v({}, s4, { type: u4 + "End" }), data: { exact: f3.after, namespaced: f3.afterNS }, state: c5, allPlugins: a6, allMatches: f3, instance: t3, store: r4, EVENTS: i5 })).then(function(e5) {
|
|
726
|
+
e5.meta && e5.meta.hasCallback && J2(e5.meta.rid, { payload: e5 });
|
|
727
|
+
});
|
|
728
|
+
})();
|
|
729
|
+
return n7 && n7.then ? n7.then(function() {
|
|
730
|
+
return e4;
|
|
731
|
+
}) : e4;
|
|
732
|
+
}
|
|
733
|
+
if (ie(e4, l4.length)) return e4;
|
|
734
|
+
var s4, d3 = (function() {
|
|
735
|
+
if (o5 !== u4) return Promise.resolve(G2({ action: v({}, e4, { type: u4 }), data: { exact: f3.during, namespaced: f3.duringNS }, state: c5, allPlugins: a6, allMatches: f3, instance: t3, store: r4, EVENTS: i5 })).then(function(e5) {
|
|
736
|
+
s4 = e5;
|
|
737
|
+
});
|
|
738
|
+
s4 = e4;
|
|
739
|
+
})();
|
|
740
|
+
return d3 && d3.then ? d3.then(n6) : n6();
|
|
741
|
+
});
|
|
742
|
+
} catch (e4) {
|
|
743
|
+
return Promise.reject(e4);
|
|
744
|
+
}
|
|
745
|
+
var m5, g4, h3;
|
|
746
|
+
})(o4, n4, e2, i4, t2)).then(function(e3) {
|
|
747
|
+
return u3 = 1, a5(e3);
|
|
748
|
+
});
|
|
749
|
+
})();
|
|
750
|
+
return Promise.resolve(E3 && E3.then ? E3.then(c4) : c4(E3));
|
|
751
|
+
} catch (e3) {
|
|
752
|
+
return Promise.reject(e3);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
function le(e2) {
|
|
759
|
+
return function(n4) {
|
|
760
|
+
return function(n5) {
|
|
761
|
+
return function(t2) {
|
|
762
|
+
var r3 = t2.type, i4 = t2.key, a5 = t2.value, o4 = t2.options;
|
|
763
|
+
if (r3 === q2.setItem || r3 === q2.removeItem) {
|
|
764
|
+
if (t2.abort) return n5(t2);
|
|
765
|
+
r3 === q2.setItem ? e2.setItem(i4, a5, o4) : e2.removeItem(i4, o4);
|
|
766
|
+
}
|
|
767
|
+
return n5(t2);
|
|
768
|
+
};
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
var fe = function() {
|
|
773
|
+
var e2 = this;
|
|
774
|
+
this.before = [], this.after = [], this.addMiddleware = function(n4, t2) {
|
|
775
|
+
e2[t2] = e2[t2].concat(n4);
|
|
776
|
+
}, this.removeMiddleware = function(n4, t2) {
|
|
777
|
+
var r3 = e2[t2].findIndex(function(e3) {
|
|
778
|
+
return e3 === n4;
|
|
779
|
+
});
|
|
780
|
+
-1 !== r3 && (e2[t2] = [].concat(e2[t2].slice(0, r3), e2[t2].slice(r3 + 1)));
|
|
781
|
+
}, this.dynamicMiddlewares = function(n4) {
|
|
782
|
+
return function(t2) {
|
|
783
|
+
return function(r3) {
|
|
784
|
+
return function(i4) {
|
|
785
|
+
var a5 = { getState: t2.getState, dispatch: function(e3) {
|
|
786
|
+
return t2.dispatch(e3);
|
|
787
|
+
} }, o4 = e2[n4].map(function(e3) {
|
|
788
|
+
return e3(a5);
|
|
789
|
+
});
|
|
790
|
+
return N.apply(void 0, o4)(r3)(i4);
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
function de(e2) {
|
|
797
|
+
return function(n4, t2) {
|
|
798
|
+
void 0 === n4 && (n4 = {});
|
|
799
|
+
var r3 = {};
|
|
800
|
+
if ("initialize:aborted" === t2.type) return n4;
|
|
801
|
+
if (/^registerPlugin:([^:]*)$/.test(t2.type)) {
|
|
802
|
+
var i4 = pe(t2.type, "registerPlugin"), a5 = e2()[i4];
|
|
803
|
+
if (!a5 || !i4) return n4;
|
|
804
|
+
var o4 = t2.enabled, u3 = a5.config;
|
|
805
|
+
return r3[i4] = { enabled: o4, initialized: !!o4 && Boolean(!a5.initialize), loaded: !!o4 && Boolean(a5.loaded({ config: u3 })), config: u3 }, v({}, n4, r3);
|
|
806
|
+
}
|
|
807
|
+
if (/^initialize:([^:]*)$/.test(t2.type)) {
|
|
808
|
+
var c4 = pe(t2.type, q2.initialize), s2 = e2()[c4];
|
|
809
|
+
return s2 && c4 ? (r3[c4] = v({}, n4[c4], { initialized: true, loaded: Boolean(s2.loaded({ config: s2.config })) }), v({}, n4, r3)) : n4;
|
|
810
|
+
}
|
|
811
|
+
if (/^ready:([^:]*)$/.test(t2.type)) return r3[t2.name] = v({}, n4[t2.name], { loaded: true }), v({}, n4, r3);
|
|
812
|
+
switch (t2.type) {
|
|
813
|
+
case q2.disablePlugin:
|
|
814
|
+
return v({}, n4, me(t2.plugins, false, n4));
|
|
815
|
+
case q2.enablePlugin:
|
|
816
|
+
return v({}, n4, me(t2.plugins, true, n4));
|
|
817
|
+
default:
|
|
818
|
+
return n4;
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function pe(e2, n4) {
|
|
823
|
+
return e2.substring(n4.length + 1, e2.length);
|
|
824
|
+
}
|
|
825
|
+
function me(e2, n4, t2) {
|
|
826
|
+
return e2.reduce(function(e3, r3) {
|
|
827
|
+
return e3[r3] = v({}, t2[r3], { enabled: n4 }), e3;
|
|
828
|
+
}, t2);
|
|
829
|
+
}
|
|
830
|
+
function ge(e2) {
|
|
831
|
+
try {
|
|
832
|
+
return JSON.parse(JSON.stringify(e2));
|
|
833
|
+
} catch (e3) {
|
|
834
|
+
}
|
|
835
|
+
return e2;
|
|
836
|
+
}
|
|
837
|
+
var he = { last: {}, history: [] };
|
|
838
|
+
function ve(e2, n4) {
|
|
839
|
+
void 0 === e2 && (e2 = he);
|
|
840
|
+
var t2 = n4.options, r3 = n4.meta;
|
|
841
|
+
if (n4.type === q2.track) {
|
|
842
|
+
var i4 = ge(v({ event: n4.event, properties: n4.properties }, Object.keys(t2).length && { options: t2 }, { meta: r3 }));
|
|
843
|
+
return v({}, e2, { last: i4, history: e2.history.concat(i4) });
|
|
844
|
+
}
|
|
845
|
+
return e2;
|
|
846
|
+
}
|
|
847
|
+
var ye = { actions: [] };
|
|
848
|
+
function be(e2, n4) {
|
|
849
|
+
void 0 === e2 && (e2 = ye);
|
|
850
|
+
var t2 = n4.payload;
|
|
851
|
+
switch (n4.type) {
|
|
852
|
+
case "queue":
|
|
853
|
+
var r3;
|
|
854
|
+
return r3 = t2 && t2.type && t2.type === q2.identify ? [n4].concat(e2.actions) : e2.actions.concat(n4), v({}, e2, { actions: r3 });
|
|
855
|
+
case "dequeue":
|
|
856
|
+
return [];
|
|
857
|
+
default:
|
|
858
|
+
return e2;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
var Ie = /#.*$/;
|
|
862
|
+
function we(e2) {
|
|
863
|
+
var n4 = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e2);
|
|
864
|
+
return "/" + (n4 && n4[3] ? n4[3].split("?")[0].replace(Ie, "") : "");
|
|
865
|
+
}
|
|
866
|
+
var Ee;
|
|
867
|
+
var Pe;
|
|
868
|
+
var Se;
|
|
869
|
+
var Ne;
|
|
870
|
+
var Oe = function(e2) {
|
|
871
|
+
if (void 0 === e2 && (e2 = {}), !$) return e2;
|
|
872
|
+
var n4 = document, t2 = n4.title, r3 = n4.referrer, i4 = window, a5 = i4.location, o4 = i4.innerWidth, u3 = i4.innerHeight, c4 = a5.hash, s2 = a5.search, l3 = (function(e3) {
|
|
873
|
+
var n5 = (function() {
|
|
874
|
+
if ($) {
|
|
875
|
+
for (var e4, n6 = document.getElementsByTagName("link"), t3 = 0; e4 = n6[t3]; t3++) if ("canonical" === e4.getAttribute("rel")) return e4.getAttribute("href");
|
|
876
|
+
}
|
|
877
|
+
})();
|
|
878
|
+
return n5 ? n5.match(/\?/) ? n5 : n5 + e3 : window.location.href.replace(Ie, "");
|
|
879
|
+
})(s2), f2 = { title: t2, url: l3, path: we(l3), hash: c4, search: s2, width: o4, height: u3 };
|
|
880
|
+
return r3 && "" !== r3 && (f2.referrer = r3), v({}, f2, e2);
|
|
881
|
+
};
|
|
882
|
+
var Ae = { last: {}, history: [] };
|
|
883
|
+
function _e(e2, n4) {
|
|
884
|
+
void 0 === e2 && (e2 = Ae);
|
|
885
|
+
var t2 = n4.options;
|
|
886
|
+
if (n4.type === q2.page) {
|
|
887
|
+
var r3 = ge(v({ properties: n4.properties, meta: n4.meta }, Object.keys(t2).length && { options: t2 }));
|
|
888
|
+
return v({}, e2, { last: r3, history: e2.history.concat(r3) });
|
|
889
|
+
}
|
|
890
|
+
return e2;
|
|
891
|
+
}
|
|
892
|
+
Ee = (function() {
|
|
893
|
+
if (!$) return false;
|
|
894
|
+
var e2 = navigator.appVersion;
|
|
895
|
+
return ~e2.indexOf("Win") ? "Windows" : ~e2.indexOf("Mac") ? "MacOS" : ~e2.indexOf("X11") ? "UNIX" : ~e2.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
896
|
+
})(), Pe = $ ? document.referrer : null, Se = o2(), Ne = a();
|
|
897
|
+
var xe = { initialized: false, sessionId: y(), app: null, version: null, debug: false, offline: !!$ && !navigator.onLine, os: { name: Ee }, userAgent: $ ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.14" }, timezone: Ne, locale: Se, campaign: {}, referrer: Pe };
|
|
898
|
+
function je(e2, n4) {
|
|
899
|
+
void 0 === e2 && (e2 = xe);
|
|
900
|
+
var t2 = e2.initialized, r3 = n4.campaign;
|
|
901
|
+
switch (n4.type) {
|
|
902
|
+
case q2.campaign:
|
|
903
|
+
return v({}, e2, { campaign: r3 });
|
|
904
|
+
case q2.offline:
|
|
905
|
+
return v({}, e2, { offline: true });
|
|
906
|
+
case q2.online:
|
|
907
|
+
return v({}, e2, { offline: false });
|
|
908
|
+
default:
|
|
909
|
+
return t2 ? e2 : v({}, xe, e2, { initialized: true });
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
var ke = ["plugins", "reducers", "storage"];
|
|
913
|
+
function Te(e2, n4, t2) {
|
|
914
|
+
if ($) {
|
|
915
|
+
var r3 = window[(t2 ? "add" : "remove") + "EventListener"];
|
|
916
|
+
e2.split(" ").forEach(function(e3) {
|
|
917
|
+
r3(e3, n4);
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function ze(e2) {
|
|
922
|
+
var n4 = Te.bind(null, "online offline", function(n5) {
|
|
923
|
+
return Promise.resolve(!navigator.onLine).then(e2);
|
|
924
|
+
});
|
|
925
|
+
return n4(true), function(e3) {
|
|
926
|
+
return n4(false);
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
function Me() {
|
|
930
|
+
return f("analytics", []), function(e2) {
|
|
931
|
+
return function(n4, t2, r3) {
|
|
932
|
+
var i4 = e2(n4, t2, r3), a5 = i4.dispatch;
|
|
933
|
+
return Object.assign(i4, { dispatch: function(e3) {
|
|
934
|
+
return n2[o3].analytics.push(e3.action || e3), a5(e3);
|
|
935
|
+
} });
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function qe(e2) {
|
|
940
|
+
return function() {
|
|
941
|
+
return N(N.apply(null, arguments), Me());
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
function Ue(e2) {
|
|
945
|
+
return e2 ? rn(e2) ? e2 : [e2] : [];
|
|
946
|
+
}
|
|
947
|
+
function Ve(n4, t2, r3) {
|
|
948
|
+
void 0 === n4 && (n4 = {});
|
|
949
|
+
var i4, a5, o4 = y();
|
|
950
|
+
return t2 && (X2[o4] = (i4 = t2, a5 = (function(e2) {
|
|
951
|
+
for (var n5, t3 = e2 || Array.prototype.slice.call(arguments), r4 = 0; r4 < t3.length; r4++) if (W(t3[r4])) {
|
|
952
|
+
n5 = t3[r4];
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
return n5;
|
|
956
|
+
})(r3), function(e2) {
|
|
957
|
+
a5 && a5(e2), i4(e2);
|
|
958
|
+
})), v({}, n4, { rid: o4, ts: (/* @__PURE__ */ new Date()).getTime() }, t2 ? { hasCallback: true } : {});
|
|
959
|
+
}
|
|
960
|
+
function Le(n4) {
|
|
961
|
+
void 0 === n4 && (n4 = {});
|
|
962
|
+
var t2 = n4.reducers || {}, c4 = n4.initialUser || {}, s2 = (n4.plugins || []).reduce(function(e2, n5) {
|
|
963
|
+
if (W(n5)) return e2.middlewares = e2.middlewares.concat(n5), e2;
|
|
964
|
+
if (n5.NAMESPACE && (n5.name = n5.NAMESPACE), !n5.name) throw new Error("https://lytics.dev/errors/1");
|
|
965
|
+
n5.config || (n5.config = {});
|
|
966
|
+
var t3 = n5.EVENTS ? Object.keys(n5.EVENTS).map(function(e3) {
|
|
967
|
+
return n5.EVENTS[e3];
|
|
968
|
+
}) : [];
|
|
969
|
+
e2.pluginEnabled[n5.name] = !(false === n5.enabled || false === n5.config.enabled), delete n5.enabled, n5.methods && (e2.methods[n5.name] = Object.keys(n5.methods).reduce(function(e3, t4) {
|
|
970
|
+
var r4;
|
|
971
|
+
return e3[t4] = (r4 = n5.methods[t4], function() {
|
|
972
|
+
for (var e4 = Array.prototype.slice.call(arguments), n6 = new Array(r4.length), t5 = 0; t5 < e4.length; t5++) n6[t5] = e4[t5];
|
|
973
|
+
return n6[n6.length] = Q3, r4.apply({ instance: Q3 }, n6);
|
|
974
|
+
}), e3;
|
|
975
|
+
}, {}), delete n5.methods);
|
|
976
|
+
var r3 = Object.keys(n5).concat(t3), i4 = new Set(e2.events.concat(r3));
|
|
977
|
+
if (e2.events = Array.from(i4), e2.pluginsArray = e2.pluginsArray.concat(n5), e2.plugins[n5.name]) throw new Error(n5.name + "AlreadyLoaded");
|
|
978
|
+
return e2.plugins[n5.name] = n5, e2.plugins[n5.name].loaded || (e2.plugins[n5.name].loaded = function() {
|
|
979
|
+
return true;
|
|
980
|
+
}), e2;
|
|
981
|
+
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), f2 = n4.storage ? n4.storage : { getItem: a2, setItem: f, removeItem: i }, p = /* @__PURE__ */ (function(e2) {
|
|
982
|
+
return function(n5, t3, r3) {
|
|
983
|
+
return t3.getState("user")[n5] || (r3 && on(r3) && r3[n5] ? r3[n5] : $2(e2)[n5] || a2(D(n5)) || null);
|
|
984
|
+
};
|
|
985
|
+
})(f2), h2 = s2.plugins, w2 = s2.events.filter(function(e2) {
|
|
986
|
+
return !M2.includes(e2);
|
|
987
|
+
}).sort(), E3 = new Set(w2.concat(z).filter(function(e2) {
|
|
988
|
+
return !M2.includes(e2);
|
|
989
|
+
})), _3 = Array.from(E3).sort(), x3 = function() {
|
|
990
|
+
return h2;
|
|
991
|
+
}, j2 = new fe(), U3 = j2.addMiddleware, V3 = j2.removeMiddleware, L3 = j2.dynamicMiddlewares, X3 = function() {
|
|
992
|
+
throw new Error("Abort disabled inListener");
|
|
993
|
+
}, J4 = s(), W3 = $2(f2), H3 = v({}, W3, c4, J4.an_uid ? { userId: J4.an_uid } : {}, J4.an_aid ? { anonymousId: J4.an_aid } : {});
|
|
994
|
+
H3.anonymousId || (H3.anonymousId = y());
|
|
995
|
+
var G4 = v({ enable: function(e2, n5) {
|
|
996
|
+
return new Promise(function(t3) {
|
|
997
|
+
ue2.dispatch({ type: q2.enablePlugin, plugins: Ue(e2), _: { originalAction: q2.enablePlugin } }, t3, [n5]);
|
|
998
|
+
});
|
|
999
|
+
}, disable: function(e2, n5) {
|
|
1000
|
+
return new Promise(function(t3) {
|
|
1001
|
+
ue2.dispatch({ type: q2.disablePlugin, plugins: Ue(e2), _: { originalAction: q2.disablePlugin } }, t3, [n5]);
|
|
1002
|
+
});
|
|
1003
|
+
} }, s2.methods), K2 = false, Q3 = { identify: function(e2, n5, t3, r3) {
|
|
1004
|
+
try {
|
|
1005
|
+
var i4 = q(e2) ? e2 : null, a5 = on(e2) ? e2 : n5, o4 = t3 || {}, c5 = Q3.user();
|
|
1006
|
+
f(D(k2), i4);
|
|
1007
|
+
var s3 = i4 || a5.userId || p(k2, Q3, a5);
|
|
1008
|
+
return Promise.resolve(new Promise(function(e3) {
|
|
1009
|
+
ue2.dispatch(v({ type: q2.identifyStart, userId: s3, traits: a5 || {}, options: o4, anonymousId: c5.anonymousId }, c5.id && c5.id !== i4 && { previousId: c5.id }), e3, [n5, t3, r3]);
|
|
1010
|
+
}));
|
|
1011
|
+
} catch (e3) {
|
|
1012
|
+
return Promise.reject(e3);
|
|
1013
|
+
}
|
|
1014
|
+
}, track: function(e2, n5, t3, r3) {
|
|
1015
|
+
try {
|
|
1016
|
+
var i4 = on(e2) ? e2.event : e2;
|
|
1017
|
+
if (!i4 || !q(i4)) throw new Error("EventMissing");
|
|
1018
|
+
var a5 = on(e2) ? e2 : n5 || {}, o4 = on(t3) ? t3 : {};
|
|
1019
|
+
return Promise.resolve(new Promise(function(e3) {
|
|
1020
|
+
ue2.dispatch({ type: q2.trackStart, event: i4, properties: a5, options: o4, userId: p(k2, Q3, n5), anonymousId: p(T2, Q3, n5) }, e3, [n5, t3, r3]);
|
|
1021
|
+
}));
|
|
1022
|
+
} catch (e3) {
|
|
1023
|
+
return Promise.reject(e3);
|
|
1024
|
+
}
|
|
1025
|
+
}, page: function(e2, n5, t3) {
|
|
1026
|
+
try {
|
|
1027
|
+
var r3 = on(e2) ? e2 : {}, i4 = on(n5) ? n5 : {};
|
|
1028
|
+
return Promise.resolve(new Promise(function(a5) {
|
|
1029
|
+
ue2.dispatch({ type: q2.pageStart, properties: Oe(r3), options: i4, userId: p(k2, Q3, r3), anonymousId: p(T2, Q3, r3) }, a5, [e2, n5, t3]);
|
|
1030
|
+
}));
|
|
1031
|
+
} catch (e3) {
|
|
1032
|
+
return Promise.reject(e3);
|
|
1033
|
+
}
|
|
1034
|
+
}, user: function(e2) {
|
|
1035
|
+
if (e2 === k2 || "id" === e2) return p(k2, Q3);
|
|
1036
|
+
if (e2 === T2 || "anonId" === e2) return p(T2, Q3);
|
|
1037
|
+
var n5 = Q3.getState("user");
|
|
1038
|
+
return e2 ? (0, import_dlv.default)(n5, e2) : n5;
|
|
1039
|
+
}, reset: function(e2) {
|
|
1040
|
+
return new Promise(function(n5) {
|
|
1041
|
+
ue2.dispatch({ type: q2.resetStart }, n5, e2);
|
|
1042
|
+
});
|
|
1043
|
+
}, ready: function(e2) {
|
|
1044
|
+
return K2 && e2({ plugins: G4, instance: Q3 }), Q3.on(q2.ready, function(n5) {
|
|
1045
|
+
e2(n5), K2 = true;
|
|
1046
|
+
});
|
|
1047
|
+
}, on: function(e2, n5) {
|
|
1048
|
+
if (!e2 || !W(n5)) return false;
|
|
1049
|
+
if (e2 === q2.bootstrap) throw new Error(".on disabled for " + e2);
|
|
1050
|
+
var t3 = /Start$|Start:/;
|
|
1051
|
+
if ("*" === e2) {
|
|
1052
|
+
var r3 = function(e3) {
|
|
1053
|
+
return function(e4) {
|
|
1054
|
+
return function(r4) {
|
|
1055
|
+
return r4.type.match(t3) && n5({ payload: r4, instance: Q3, plugins: h2 }), e4(r4);
|
|
1056
|
+
};
|
|
1057
|
+
};
|
|
1058
|
+
}, i4 = function(e3) {
|
|
1059
|
+
return function(e4) {
|
|
1060
|
+
return function(r4) {
|
|
1061
|
+
return r4.type.match(t3) || n5({ payload: r4, instance: Q3, plugins: h2 }), e4(r4);
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
return U3(r3, Ce), U3(i4, Re), function() {
|
|
1066
|
+
V3(r3, Ce), V3(i4, Re);
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
var a5 = e2.match(t3) ? Ce : Re, o4 = function(t4) {
|
|
1070
|
+
return function(t5) {
|
|
1071
|
+
return function(r4) {
|
|
1072
|
+
return r4.type === e2 && n5({ payload: r4, instance: Q3, plugins: h2, abort: X3 }), t5(r4);
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
|
+
return U3(o4, a5), function() {
|
|
1077
|
+
return V3(o4, a5);
|
|
1078
|
+
};
|
|
1079
|
+
}, once: function(e2, n5) {
|
|
1080
|
+
if (!e2 || !W(n5)) return false;
|
|
1081
|
+
if (e2 === q2.bootstrap) throw new Error(".once disabled for " + e2);
|
|
1082
|
+
var t3 = Q3.on(e2, function(e3) {
|
|
1083
|
+
n5({ payload: e3.payload, instance: Q3, plugins: h2, abort: X3 }), t3();
|
|
1084
|
+
});
|
|
1085
|
+
return t3;
|
|
1086
|
+
}, getState: function(e2) {
|
|
1087
|
+
var n5 = ue2.getState();
|
|
1088
|
+
return e2 ? (0, import_dlv.default)(n5, e2) : Object.assign({}, n5);
|
|
1089
|
+
}, dispatch: function(e2) {
|
|
1090
|
+
var n5 = q(e2) ? { type: e2 } : e2;
|
|
1091
|
+
if (z.includes(n5.type)) throw new Error("reserved action " + n5.type);
|
|
1092
|
+
var t3 = v({}, n5, { _: v({ originalAction: n5.type }, e2._ || {}) });
|
|
1093
|
+
ue2.dispatch(t3);
|
|
1094
|
+
}, enablePlugin: G4.enable, disablePlugin: G4.disable, plugins: G4, storage: { getItem: f2.getItem, setItem: function(e2, n5, t3) {
|
|
1095
|
+
ue2.dispatch({ type: q2.setItemStart, key: e2, value: n5, options: t3 });
|
|
1096
|
+
}, removeItem: function(e2, n5) {
|
|
1097
|
+
ue2.dispatch({ type: q2.removeItemStart, key: e2, options: n5 });
|
|
1098
|
+
} }, setAnonymousId: function(e2, n5) {
|
|
1099
|
+
Q3.storage.setItem(A, e2, n5);
|
|
1100
|
+
}, events: { core: z, plugins: w2 } }, Y3 = s2.middlewares.concat([function(e2) {
|
|
1101
|
+
return function(e3) {
|
|
1102
|
+
return function(n5) {
|
|
1103
|
+
return n5.meta || (n5.meta = Ve()), e3(n5);
|
|
1104
|
+
};
|
|
1105
|
+
};
|
|
1106
|
+
}, L3(Ce), se(Q3, x3, { all: _3, plugins: w2 }), le(f2), C(Q3), B2(Q3), L3(Re)]), Z2 = { context: je, user: R2(f2), page: _e, track: ve, plugins: de(x3), queue: be }, ee2 = N, ne2 = N;
|
|
1107
|
+
if ($ && n4.debug) {
|
|
1108
|
+
var te2 = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
1109
|
+
te2 && (ee2 = te2({ trace: true, traceLimit: 25 })), ne2 = function() {
|
|
1110
|
+
return 0 === arguments.length ? Me() : on(typeof arguments[0]) ? qe() : qe().apply(null, arguments);
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
var re2, ie2 = (function(e2) {
|
|
1114
|
+
return Object.keys(e2).reduce(function(n5, t3) {
|
|
1115
|
+
return ke.includes(t3) || (n5[t3] = e2[t3]), n5;
|
|
1116
|
+
}, {});
|
|
1117
|
+
})(n4), ae2 = s2.pluginsArray.reduce(function(e2, n5) {
|
|
1118
|
+
var t3 = n5.name, r3 = n5.config, i4 = n5.loaded, a5 = s2.pluginEnabled[t3];
|
|
1119
|
+
return e2[t3] = { enabled: a5, initialized: !!a5 && Boolean(!n5.initialize), loaded: Boolean(i4({ config: r3 })), config: r3 }, e2;
|
|
1120
|
+
}, {}), oe2 = { context: ie2, user: H3, plugins: ae2 }, ue2 = P2((function(e2) {
|
|
1121
|
+
for (var n5 = Object.keys(e2), t3 = {}, r3 = 0; r3 < n5.length; r3++) {
|
|
1122
|
+
var i4 = n5[r3];
|
|
1123
|
+
typeof e2[i4] === y2 && (t3[i4] = e2[i4]);
|
|
1124
|
+
}
|
|
1125
|
+
var a5, o4 = Object.keys(t3);
|
|
1126
|
+
try {
|
|
1127
|
+
!(function(e3) {
|
|
1128
|
+
Object.keys(e3).forEach(function(n6) {
|
|
1129
|
+
var t4 = e3[n6];
|
|
1130
|
+
if (typeof t4(void 0, { type: "@@redux/INIT" }) === b3 || typeof t4(void 0, { type: I2 }) === b3) throw new Error("reducer " + n6 + " " + b3);
|
|
1131
|
+
});
|
|
1132
|
+
})(t3);
|
|
1133
|
+
} catch (e3) {
|
|
1134
|
+
a5 = e3;
|
|
1135
|
+
}
|
|
1136
|
+
return function(e3, n6) {
|
|
1137
|
+
if (void 0 === e3 && (e3 = {}), a5) throw a5;
|
|
1138
|
+
for (var r4 = false, i5 = {}, u3 = 0; u3 < o4.length; u3++) {
|
|
1139
|
+
var c5 = o4[u3], s3 = e3[c5], l3 = (0, t3[c5])(s3, n6);
|
|
1140
|
+
if (typeof l3 === b3) {
|
|
1141
|
+
var f3 = S(c5, n6);
|
|
1142
|
+
throw new Error(f3);
|
|
1143
|
+
}
|
|
1144
|
+
i5[c5] = l3, r4 = r4 || l3 !== s3;
|
|
1145
|
+
}
|
|
1146
|
+
return r4 ? i5 : e3;
|
|
1147
|
+
};
|
|
1148
|
+
})(v({}, Z2, t2)), oe2, ne2(ee2(O.apply(void 0, Y3))));
|
|
1149
|
+
ue2.dispatch = (re2 = ue2.dispatch, function(e2, n5, t3) {
|
|
1150
|
+
var r3 = v({}, e2, { meta: Ve(e2.meta, n5, Ue(t3)) });
|
|
1151
|
+
return re2.apply(null, [r3]);
|
|
1152
|
+
});
|
|
1153
|
+
var ce2 = Object.keys(h2);
|
|
1154
|
+
ue2.dispatch({ type: q2.bootstrap, plugins: ce2, config: ie2, params: J4, user: H3, initialUser: c4, persistedUser: W3 });
|
|
1155
|
+
var pe2 = ce2.filter(function(e2) {
|
|
1156
|
+
return s2.pluginEnabled[e2];
|
|
1157
|
+
}), me2 = ce2.filter(function(e2) {
|
|
1158
|
+
return !s2.pluginEnabled[e2];
|
|
1159
|
+
});
|
|
1160
|
+
return ue2.dispatch({ type: q2.registerPlugins, plugins: ce2, enabled: s2.pluginEnabled }), s2.pluginsArray.map(function(e2, n5) {
|
|
1161
|
+
var t3 = e2.bootstrap, r3 = e2.config, i4 = e2.name;
|
|
1162
|
+
t3 && W(t3) && t3({ instance: Q3, config: r3, payload: e2 }), ue2.dispatch({ type: q2.registerPluginType(i4), name: i4, enabled: s2.pluginEnabled[i4], plugin: e2 }), s2.pluginsArray.length === n5 + 1 && ue2.dispatch({ type: q2.initializeStart, plugins: pe2, disabled: me2 });
|
|
1163
|
+
}), ze(function(e2) {
|
|
1164
|
+
ue2.dispatch({ type: e2 ? q2.offline : q2.online });
|
|
1165
|
+
}), (function(e2, n5, t3) {
|
|
1166
|
+
setInterval(function() {
|
|
1167
|
+
return F2(e2, n5, t3);
|
|
1168
|
+
}, 3e3);
|
|
1169
|
+
})(ue2, x3, Q3), Q3;
|
|
1170
|
+
}
|
|
1171
|
+
var Ce = "before";
|
|
1172
|
+
var Re = "after";
|
|
1173
|
+
|
|
1174
|
+
// ../../node_modules/.pnpm/@analytics+cookie-utils@0.2.12/node_modules/@analytics/cookie-utils/dist/analytics-util-cookie.module.js
|
|
1175
|
+
var t = "cookie";
|
|
1176
|
+
var i2 = a3();
|
|
1177
|
+
var r = d;
|
|
1178
|
+
var c2 = d;
|
|
1179
|
+
function u2(o4) {
|
|
1180
|
+
return i2 ? d(o4, "", -1) : i(o4);
|
|
1181
|
+
}
|
|
1182
|
+
function a3() {
|
|
1183
|
+
if (void 0 !== i2) return i2;
|
|
1184
|
+
var e2 = "cookiecookie";
|
|
1185
|
+
try {
|
|
1186
|
+
d(e2, e2), i2 = -1 !== document.cookie.indexOf(e2), u2(e2);
|
|
1187
|
+
} catch (e3) {
|
|
1188
|
+
i2 = false;
|
|
1189
|
+
}
|
|
1190
|
+
return i2;
|
|
1191
|
+
}
|
|
1192
|
+
function d(e2, t2, r3, c4, u3, a5) {
|
|
1193
|
+
if ("undefined" != typeof window) {
|
|
1194
|
+
var d3 = arguments.length > 1;
|
|
1195
|
+
return false === i2 && (d3 ? f(e2, t2) : a2(e2)), d3 ? document.cookie = e2 + "=" + encodeURIComponent(t2) + (r3 ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * r3).toUTCString() + (c4 ? "; path=" + c4 : "") + (u3 ? "; domain=" + u3 : "") + (a5 ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e2 + "=")[1] || "").split(";")[0]);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// ../../node_modules/.pnpm/@analytics+localstorage-utils@0.1.10/node_modules/@analytics/localstorage-utils/dist/analytics-util-localstorage.module.js
|
|
1200
|
+
var r2 = "localStorage";
|
|
1201
|
+
var g = b2.bind(null, "localStorage");
|
|
1202
|
+
var c3 = u("localStorage", "getItem", a2);
|
|
1203
|
+
var m3 = u("localStorage", "setItem", f);
|
|
1204
|
+
var S2 = u("localStorage", "removeItem", i);
|
|
1205
|
+
|
|
1206
|
+
// ../../node_modules/.pnpm/@analytics+session-storage-utils@0.0.7/node_modules/@analytics/session-storage-utils/dist/analytics-util-session-storage.module.js
|
|
1207
|
+
var a4 = "sessionStorage";
|
|
1208
|
+
var i3 = b2.bind(null, "sessionStorage");
|
|
1209
|
+
var g2 = u("sessionStorage", "getItem", a2);
|
|
1210
|
+
var n3 = u("sessionStorage", "setItem", f);
|
|
1211
|
+
var l2 = u("sessionStorage", "removeItem", i);
|
|
1212
|
+
|
|
1213
|
+
// ../../node_modules/.pnpm/@analytics+storage-utils@0.4.2/node_modules/@analytics/storage-utils/dist/analytics-util-storage.module.js
|
|
1214
|
+
function I3(t2) {
|
|
1215
|
+
var o4 = t2;
|
|
1216
|
+
try {
|
|
1217
|
+
if ("true" === (o4 = JSON.parse(t2))) return true;
|
|
1218
|
+
if ("false" === o4) return false;
|
|
1219
|
+
if (on(o4)) return o4;
|
|
1220
|
+
parseFloat(o4) === o4 && (o4 = parseFloat(o4));
|
|
1221
|
+
} catch (t3) {
|
|
1222
|
+
}
|
|
1223
|
+
if (null !== o4 && "" !== o4) return o4;
|
|
1224
|
+
}
|
|
1225
|
+
var k3 = g();
|
|
1226
|
+
var O2 = i3();
|
|
1227
|
+
var x2 = a3();
|
|
1228
|
+
function C2(o4, e2) {
|
|
1229
|
+
if (o4) {
|
|
1230
|
+
var r3 = A2(e2), a5 = !N2(r3), i4 = d2(r3) ? I3(localStorage.getItem(o4)) : void 0;
|
|
1231
|
+
if (a5 && !I(i4)) return i4;
|
|
1232
|
+
var n4 = h(r3) ? I3(r(o4)) : void 0;
|
|
1233
|
+
if (a5 && n4) return n4;
|
|
1234
|
+
var l3 = E2(r3) ? I3(sessionStorage.getItem(o4)) : void 0;
|
|
1235
|
+
if (a5 && l3) return l3;
|
|
1236
|
+
var u3 = a2(o4);
|
|
1237
|
+
return a5 ? u3 : { localStorage: i4, sessionStorage: l3, cookie: n4, global: u3 };
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
function L2(r3, a5, l3) {
|
|
1241
|
+
if (r3 && !I(a5)) {
|
|
1242
|
+
var u3 = {}, g3 = A2(l3), m4 = JSON.stringify(a5), S3 = !N2(g3);
|
|
1243
|
+
return d2(g3) && (u3[r2] = F3(r2, a5, I3(localStorage.getItem(r3))), localStorage.setItem(r3, m4), S3) ? u3[r2] : h(g3) && (u3[t] = F3(t, a5, I3(r(r3))), c2(r3, m4), S3) ? u3[t] : E2(g3) && (u3[a4] = F3(a4, a5, I3(sessionStorage.getItem(r3))), sessionStorage.setItem(r3, m4), S3) ? u3[a4] : (u3[l] = F3(l, a5, a2(r3)), f(r3, a5), S3 ? u3[l] : u3);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
function b4(t2, e2) {
|
|
1247
|
+
if (t2) {
|
|
1248
|
+
var a5 = A2(e2), s2 = C2(t2, m), n4 = {};
|
|
1249
|
+
return !I(s2.localStorage) && d2(a5) && (localStorage.removeItem(t2), n4[r2] = s2.localStorage), !I(s2.cookie) && h(a5) && (u2(t2), n4[t] = s2.cookie), !I(s2.sessionStorage) && E2(a5) && (sessionStorage.removeItem(t2), n4[a4] = s2.sessionStorage), !I(s2.global) && G3(a5, l) && (i(t2), n4[l] = s2.global), n4;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
function A2(t2) {
|
|
1253
|
+
return t2 ? q(t2) ? t2 : t2.storage : b;
|
|
1254
|
+
}
|
|
1255
|
+
function d2(t2) {
|
|
1256
|
+
return k3 && G3(t2, r2);
|
|
1257
|
+
}
|
|
1258
|
+
function h(t2) {
|
|
1259
|
+
return x2 && G3(t2, t);
|
|
1260
|
+
}
|
|
1261
|
+
function E2(t2) {
|
|
1262
|
+
return O2 && G3(t2, a4);
|
|
1263
|
+
}
|
|
1264
|
+
function N2(t2) {
|
|
1265
|
+
return t2 === m || "all" === t2;
|
|
1266
|
+
}
|
|
1267
|
+
function G3(t2, o4) {
|
|
1268
|
+
return t2 === b || t2 === o4 || N2(t2);
|
|
1269
|
+
}
|
|
1270
|
+
function F3(t2, o4, e2) {
|
|
1271
|
+
return { location: t2, current: o4, previous: e2 };
|
|
1272
|
+
}
|
|
1273
|
+
var J3 = { setItem: L2, getItem: C2, removeItem: b4 };
|
|
1274
|
+
|
|
1275
|
+
// ../../node_modules/.pnpm/analytics@0.8.9_@types+dlv@1.1.4/node_modules/analytics/lib/analytics.browser.es.js
|
|
1276
|
+
function _defineProperty(obj, key, value) {
|
|
1277
|
+
if (key in obj) {
|
|
1278
|
+
Object.defineProperty(obj, key, {
|
|
1279
|
+
value,
|
|
1280
|
+
enumerable: true,
|
|
1281
|
+
configurable: true,
|
|
1282
|
+
writable: true
|
|
1283
|
+
});
|
|
1284
|
+
} else {
|
|
1285
|
+
obj[key] = value;
|
|
1286
|
+
}
|
|
1287
|
+
return obj;
|
|
1288
|
+
}
|
|
1289
|
+
function ownKeys(object, enumerableOnly) {
|
|
1290
|
+
var keys = Object.keys(object);
|
|
1291
|
+
if (Object.getOwnPropertySymbols) {
|
|
1292
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1293
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
1294
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1295
|
+
})), keys.push.apply(keys, symbols);
|
|
1296
|
+
}
|
|
1297
|
+
return keys;
|
|
1298
|
+
}
|
|
1299
|
+
function _objectSpread2(target) {
|
|
1300
|
+
for (var i4 = 1; i4 < arguments.length; i4++) {
|
|
1301
|
+
var source = null != arguments[i4] ? arguments[i4] : {};
|
|
1302
|
+
i4 % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
1303
|
+
_defineProperty(target, key, source[key]);
|
|
1304
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
1305
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
return target;
|
|
1309
|
+
}
|
|
1310
|
+
function analyticsLib() {
|
|
1311
|
+
var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1312
|
+
var defaultSettings = {
|
|
1313
|
+
storage: J3
|
|
1314
|
+
};
|
|
1315
|
+
return Le(_objectSpread2(_objectSpread2({}, defaultSettings), opts));
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
// src/script-loader.ts
|
|
1319
|
+
function findScript(src) {
|
|
1320
|
+
const scripts = Array.prototype.slice.call(window.document.querySelectorAll("script"));
|
|
1321
|
+
return scripts.find((s2) => s2.src === src);
|
|
1322
|
+
}
|
|
1323
|
+
function buildScriptSrc(src, options) {
|
|
1324
|
+
let result = src;
|
|
1325
|
+
if (!result.startsWith("http")) {
|
|
1326
|
+
result = `https://${(options == null ? void 0 : options.www) ? "www." : ""}${result}`;
|
|
1327
|
+
}
|
|
1328
|
+
if (options == null ? void 0 : options.min) {
|
|
1329
|
+
result = result + ".min.js";
|
|
1330
|
+
} else if (options == null ? void 0 : options.js) {
|
|
1331
|
+
result = result + ".js";
|
|
1332
|
+
}
|
|
1333
|
+
if (options == null ? void 0 : options.query) {
|
|
1334
|
+
result += "?" + options.query;
|
|
1335
|
+
}
|
|
1336
|
+
return result;
|
|
1337
|
+
}
|
|
1338
|
+
function loadScript(src, options) {
|
|
1339
|
+
const found = findScript(src);
|
|
1340
|
+
if (found !== void 0) {
|
|
1341
|
+
const status = found == null ? void 0 : found.getAttribute("status");
|
|
1342
|
+
if (status === "loaded") {
|
|
1343
|
+
return Promise.resolve(found);
|
|
1344
|
+
}
|
|
1345
|
+
if (status === "loading") {
|
|
1346
|
+
return new Promise((resolve, reject) => {
|
|
1347
|
+
found.addEventListener("load", () => resolve(found));
|
|
1348
|
+
found.addEventListener("error", (err) => reject(err));
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
return new Promise((resolve, reject) => {
|
|
1353
|
+
var _a, _b;
|
|
1354
|
+
const script = window.document.createElement("script");
|
|
1355
|
+
script.type = "text/javascript";
|
|
1356
|
+
script.src = buildScriptSrc(src, options);
|
|
1357
|
+
script.async = true;
|
|
1358
|
+
script.setAttribute("status", "loading");
|
|
1359
|
+
for (const [k4, v2] of Object.entries((_a = options == null ? void 0 : options.attributes) != null ? _a : {})) {
|
|
1360
|
+
script.setAttribute(k4, v2);
|
|
1361
|
+
}
|
|
1362
|
+
script.onload = () => {
|
|
1363
|
+
script.onerror = script.onload = null;
|
|
1364
|
+
script.setAttribute("status", "loaded");
|
|
1365
|
+
resolve(script);
|
|
1366
|
+
};
|
|
1367
|
+
script.onerror = () => {
|
|
1368
|
+
script.onerror = script.onload = null;
|
|
1369
|
+
script.setAttribute("status", "error");
|
|
1370
|
+
reject(new Error(`Failed to load ${src}`));
|
|
1371
|
+
};
|
|
1372
|
+
const tag = window.document.getElementsByTagName("script")[0];
|
|
1373
|
+
(_b = tag.parentElement) == null ? void 0 : _b.insertBefore(script, tag);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// src/destination-plugins/tag.ts
|
|
1378
|
+
var tagPlugin = {
|
|
1379
|
+
id: "tag",
|
|
1380
|
+
handle(config, payload) {
|
|
1381
|
+
return __async(this, null, function* () {
|
|
1382
|
+
if (!applyFilters(payload, config)) {
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
insertTags(config.code, payload);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
function insertTags(code, event, opts = {}) {
|
|
1390
|
+
let tag;
|
|
1391
|
+
try {
|
|
1392
|
+
tag = JSON.parse(code);
|
|
1393
|
+
} catch (e2) {
|
|
1394
|
+
tag = { code, lang: "javascript" };
|
|
1395
|
+
}
|
|
1396
|
+
const debug = opts.debug || false;
|
|
1397
|
+
if (isInBrowser()) {
|
|
1398
|
+
if (tag.lang === "javascript") {
|
|
1399
|
+
execJs(tag.code, event);
|
|
1400
|
+
} else {
|
|
1401
|
+
const codeHolder = document.createElement("span");
|
|
1402
|
+
codeHolder.innerHTML = replaceMacro(tag.code, event);
|
|
1403
|
+
document.body.insertAdjacentElement("beforeend", codeHolder);
|
|
1404
|
+
const scripts = codeHolder.querySelectorAll("script");
|
|
1405
|
+
scripts.forEach((script) => {
|
|
1406
|
+
const scriptClone = document.createElement("script");
|
|
1407
|
+
scriptClone.type = scriptClone.type || "text/javascript";
|
|
1408
|
+
if (script.hasAttribute("src")) {
|
|
1409
|
+
scriptClone.src = script.src;
|
|
1410
|
+
}
|
|
1411
|
+
scriptClone.text = script.text;
|
|
1412
|
+
if (debug) {
|
|
1413
|
+
console.log(
|
|
1414
|
+
`[JITSU] Executing script${script.hasAttribute("src") ? ` ${script.src}` : ""}`,
|
|
1415
|
+
scriptClone.text
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
document.head.appendChild(scriptClone);
|
|
1419
|
+
document.head.removeChild(scriptClone);
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
} else {
|
|
1423
|
+
if (debug) {
|
|
1424
|
+
console.log(`[JITSU] insertTags(): cannot insert tags in non-browser environment`);
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
var al = "al";
|
|
1429
|
+
var ev = "ve".split("").reverse().join("");
|
|
1430
|
+
var execF = globalThis[ev + al];
|
|
1431
|
+
function execJs(code, event) {
|
|
1432
|
+
const varName = `jitsu_event_${randomId()}`;
|
|
1433
|
+
window[varName] = event;
|
|
1434
|
+
const iif = `(function(){
|
|
1435
|
+
const event = ${varName};
|
|
1436
|
+
${code}
|
|
1437
|
+
})()`;
|
|
1438
|
+
try {
|
|
1439
|
+
execF(iif);
|
|
1440
|
+
} catch (e2) {
|
|
1441
|
+
console.error(`[JITSU] Error executing JS code: ${e2.message}. Code: `, iif);
|
|
1442
|
+
} finally {
|
|
1443
|
+
delete window[varName];
|
|
1444
|
+
}
|
|
1445
|
+
return iif;
|
|
1446
|
+
}
|
|
1447
|
+
function replaceMacro(code, event) {
|
|
1448
|
+
return code.replace(/{{\s*event\s*}}/g, JSON.stringify(event));
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
// src/destination-plugins/logrocket.ts
|
|
1452
|
+
var cdn = "cdn.lr-ingest.io/";
|
|
1453
|
+
var logrocketPlugin = {
|
|
1454
|
+
id: "logrocket",
|
|
1455
|
+
handle(config, payload) {
|
|
1456
|
+
return __async(this, null, function* () {
|
|
1457
|
+
if (!applyFilters(payload, config)) {
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
initLogrocketIfNeeded(config.appId);
|
|
1461
|
+
const action = (logRocket) => {
|
|
1462
|
+
if (payload.type === "identify" && payload.userId) {
|
|
1463
|
+
logRocket.identify(payload.userId, payload.traits || {});
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
getLogRocketQueue().push(action);
|
|
1467
|
+
if (getLogRocketState() === "loaded") {
|
|
1468
|
+
flushLogRocketQueue(window["LogRocket"]);
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
function getLogRocketState() {
|
|
1474
|
+
return window["__jitsuLrState"] || "fresh";
|
|
1475
|
+
}
|
|
1476
|
+
function setLogRocketState(s2) {
|
|
1477
|
+
window["__jitsuLrState"] = s2;
|
|
1478
|
+
}
|
|
1479
|
+
function getLogRocketQueue() {
|
|
1480
|
+
return window["__jitsuLrQueue"] || (window["__jitsuLrQueue"] = []);
|
|
1481
|
+
}
|
|
1482
|
+
function flushLogRocketQueue(lr) {
|
|
1483
|
+
const queue = getLogRocketQueue();
|
|
1484
|
+
while (queue.length > 0) {
|
|
1485
|
+
const method = queue.shift();
|
|
1486
|
+
if (method) {
|
|
1487
|
+
try {
|
|
1488
|
+
const res = method(lr);
|
|
1489
|
+
if (res) {
|
|
1490
|
+
res.catch((e2) => console.warn(`Async LogRocket method failed: ${e2.message}`, e2));
|
|
1491
|
+
}
|
|
1492
|
+
} catch (e2) {
|
|
1493
|
+
console.warn(`LogRocket method failed: ${e2.message}`, e2);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
function initLogrocketIfNeeded(appId) {
|
|
1499
|
+
return __async(this, null, function* () {
|
|
1500
|
+
if (getLogRocketState() !== "fresh") {
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
setLogRocketState("loading");
|
|
1504
|
+
loadScript(`${cdn}LogRocket`, { min: true, attributes: { crossOrigin: "anonymous" } }).then(() => {
|
|
1505
|
+
if (window["LogRocket"]) {
|
|
1506
|
+
try {
|
|
1507
|
+
window["LogRocket"].init(appId);
|
|
1508
|
+
} catch (e2) {
|
|
1509
|
+
console.warn(`LogRocket (id=${appId}) init failed: ${e2.message}`, e2);
|
|
1510
|
+
setLogRocketState("failed");
|
|
1511
|
+
}
|
|
1512
|
+
setLogRocketState("loaded");
|
|
1513
|
+
flushLogRocketQueue(window["LogRocket"]);
|
|
1514
|
+
}
|
|
1515
|
+
}).catch((e2) => {
|
|
1516
|
+
console.warn(`LogRocket (id=${appId}) init failed: ${e2.message}`, e2);
|
|
1517
|
+
setLogRocketState("failed");
|
|
1518
|
+
});
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
// src/destination-plugins/gtm.ts
|
|
1523
|
+
function omit(obj, ...keys) {
|
|
1524
|
+
return Object.fromEntries(Object.entries(obj).filter(([k4]) => !keys.includes(k4)));
|
|
1525
|
+
}
|
|
1526
|
+
var gtmPlugin = {
|
|
1527
|
+
id: "gtm",
|
|
1528
|
+
handle(config, payload) {
|
|
1529
|
+
return __async(this, null, function* () {
|
|
1530
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
|
|
1531
|
+
const debug = !!config.debug;
|
|
1532
|
+
if (!applyFilters(payload, config)) {
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
yield initGtmIfNeeded(config, payload);
|
|
1536
|
+
const dataLayer = window[config.dataLayerName || "dataLayer"];
|
|
1537
|
+
const traits = __spreadValues(__spreadValues({}, (payload == null ? void 0 : payload.traits) || {}), ((_a = payload == null ? void 0 : payload.context) == null ? void 0 : _a.traits) || {});
|
|
1538
|
+
const idsFromTraits = omit(traits, "id", "userId", "user_id", "anonymousId", "userId");
|
|
1539
|
+
if (debug) {
|
|
1540
|
+
console.debug("GTM plugin will be applied to following payload", payload);
|
|
1541
|
+
}
|
|
1542
|
+
const userData = {
|
|
1543
|
+
email_address: traits.email
|
|
1544
|
+
};
|
|
1545
|
+
const ids = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, payload.userId ? { user_id: payload.userId, userId: payload.userId } : {}), payload.anonymousId ? { anonymousId: payload.anonymousId } : {}), idsFromTraits), {
|
|
1546
|
+
user_data: Object.keys(userData).length > 0 ? userData : void 0
|
|
1547
|
+
});
|
|
1548
|
+
if (debug) {
|
|
1549
|
+
console.debug("GTM plugin will set following user-related data layer vars", ids);
|
|
1550
|
+
}
|
|
1551
|
+
const pageProperties = payload.properties || {};
|
|
1552
|
+
const pageVariables = {
|
|
1553
|
+
page_location: pageProperties.url || ((_c = (_b = payload.context) == null ? void 0 : _b.page) == null ? void 0 : _c.url),
|
|
1554
|
+
page_title: pageProperties.title || ((_e2 = (_d = payload.context) == null ? void 0 : _d.page) == null ? void 0 : _e2.title),
|
|
1555
|
+
page_path: pageProperties.path || ((_g = (_f = payload.context) == null ? void 0 : _f.page) == null ? void 0 : _g.path),
|
|
1556
|
+
page_hash: pageProperties.hash || ((_i = (_h = payload.context) == null ? void 0 : _h.page) == null ? void 0 : _i.hash),
|
|
1557
|
+
page_search: pageProperties.search || ((_k = (_j = payload.context) == null ? void 0 : _j.page) == null ? void 0 : _k.search),
|
|
1558
|
+
page_referrer: (_n2 = (_m = (_l = payload == null ? void 0 : payload.context) == null ? void 0 : _l.page) == null ? void 0 : _m.referrer) != null ? _n2 : ""
|
|
1559
|
+
};
|
|
1560
|
+
if (debug) {
|
|
1561
|
+
console.debug("GTM plugin will set following context (page) related data layer vars", ids);
|
|
1562
|
+
}
|
|
1563
|
+
const pushToDataLayer = (data) => {
|
|
1564
|
+
dataLayer.push(data);
|
|
1565
|
+
if (debug) {
|
|
1566
|
+
console.debug("GTM plugin will push following data to dataLayer", data);
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
switch (payload.type) {
|
|
1570
|
+
case "page":
|
|
1571
|
+
const { properties: pageProperties2, context } = payload;
|
|
1572
|
+
const pageEvent = __spreadValues(__spreadValues({
|
|
1573
|
+
event: "page_view"
|
|
1574
|
+
}, pageVariables), ids);
|
|
1575
|
+
pushToDataLayer(pageEvent);
|
|
1576
|
+
break;
|
|
1577
|
+
case "track":
|
|
1578
|
+
const { properties: trackProperties } = payload;
|
|
1579
|
+
const trackEvent = __spreadValues(__spreadValues(__spreadValues({
|
|
1580
|
+
event: payload.event
|
|
1581
|
+
}, pageVariables), trackProperties), ids);
|
|
1582
|
+
pushToDataLayer(trackEvent);
|
|
1583
|
+
break;
|
|
1584
|
+
case "identify":
|
|
1585
|
+
const { traits: traits2 } = payload;
|
|
1586
|
+
const identifyEvent = __spreadValues(__spreadValues(__spreadValues({
|
|
1587
|
+
event: "identify"
|
|
1588
|
+
}, pageVariables), traits2), ids);
|
|
1589
|
+
pushToDataLayer(identifyEvent);
|
|
1590
|
+
break;
|
|
1591
|
+
}
|
|
1592
|
+
dataLayer.push(function() {
|
|
1593
|
+
this.reset();
|
|
1594
|
+
});
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
function getGtmState() {
|
|
1599
|
+
return window["__jitsuGtmState"] || "fresh";
|
|
1600
|
+
}
|
|
1601
|
+
function setGtmState(s2) {
|
|
1602
|
+
window["__jitsuGtmState"] = s2;
|
|
1603
|
+
}
|
|
1604
|
+
function initGtmIfNeeded(config, payload) {
|
|
1605
|
+
return __async(this, null, function* () {
|
|
1606
|
+
if (getGtmState() !== "fresh") {
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
setGtmState("loading");
|
|
1610
|
+
const dlName = config.dataLayerName || "dataLayer";
|
|
1611
|
+
const tagId = config.containerId;
|
|
1612
|
+
(function(w2, l3, i4) {
|
|
1613
|
+
w2[l3] = w2[l3] || [];
|
|
1614
|
+
w2[l3].push({
|
|
1615
|
+
user_id: payload.userId
|
|
1616
|
+
});
|
|
1617
|
+
w2[l3].push({
|
|
1618
|
+
"gtm.start": (/* @__PURE__ */ new Date()).getTime(),
|
|
1619
|
+
event: "gtm.js"
|
|
1620
|
+
});
|
|
1621
|
+
const dl = l3 != "dataLayer" ? "&l=" + l3 : "";
|
|
1622
|
+
const scriptSrc = "googletagmanager.com/gtm";
|
|
1623
|
+
loadScript(scriptSrc, { www: true, js: true, query: "id=" + i4 + dl }).then(() => {
|
|
1624
|
+
setGtmState("loaded");
|
|
1625
|
+
}).catch((e2) => {
|
|
1626
|
+
console.warn(`GTM (containerId=${tagId}) init failed: ${e2.message}`, e2);
|
|
1627
|
+
setGtmState("failed");
|
|
1628
|
+
});
|
|
1629
|
+
})(window, dlName, tagId);
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
// src/destination-plugins/ga4.ts
|
|
1634
|
+
var urlData = [
|
|
1635
|
+
new Uint8Array([109, 111, 99, 46, 114, 101, 103, 97, 110, 97, 109, 103, 97, 116, 101, 108, 103, 111, 111, 103]),
|
|
1636
|
+
new Uint8Array([103, 97, 116, 103]),
|
|
1637
|
+
new Uint8Array([115, 106])
|
|
1638
|
+
];
|
|
1639
|
+
function byteArrayToString(byteArray) {
|
|
1640
|
+
const decoder = new TextDecoder();
|
|
1641
|
+
return decoder.decode(byteArray);
|
|
1642
|
+
}
|
|
1643
|
+
function buildTagUrl() {
|
|
1644
|
+
return urlData.map((d3) => d3.reverse()).map(byteArrayToString).join("/");
|
|
1645
|
+
}
|
|
1646
|
+
var ga4Plugin = {
|
|
1647
|
+
id: "ga4-tag",
|
|
1648
|
+
handle(config, payload) {
|
|
1649
|
+
return __async(this, null, function* () {
|
|
1650
|
+
var _a, _b;
|
|
1651
|
+
if (!applyFilters(payload, config)) {
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
yield initGa4IfNeeded(config, payload);
|
|
1655
|
+
const dataLayer = window[config.dataLayerName || "dataLayer"];
|
|
1656
|
+
const gtag = function() {
|
|
1657
|
+
dataLayer.push(arguments);
|
|
1658
|
+
};
|
|
1659
|
+
const ids = __spreadValues(__spreadValues({}, payload.userId ? { user_id: payload.userId, userId: payload.userId } : {}), payload.anonymousId ? { anonymousId: payload.anonymousId } : {});
|
|
1660
|
+
if (payload.userId) {
|
|
1661
|
+
gtag("set", { user_id: payload.userId });
|
|
1662
|
+
}
|
|
1663
|
+
switch (payload.type) {
|
|
1664
|
+
case "page":
|
|
1665
|
+
if (config.autoPageView) {
|
|
1666
|
+
console.log("autoPageView");
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
const { properties: pageProperties, context } = payload;
|
|
1670
|
+
if (pageProperties) {
|
|
1671
|
+
const pageEvent = __spreadValues({
|
|
1672
|
+
page_location: pageProperties.url,
|
|
1673
|
+
page_title: pageProperties.title,
|
|
1674
|
+
page_path: pageProperties.path,
|
|
1675
|
+
page_hash: pageProperties.hash,
|
|
1676
|
+
page_search: pageProperties.search,
|
|
1677
|
+
page_referrer: (_b = (_a = context == null ? void 0 : context.page) == null ? void 0 : _a.referrer) != null ? _b : ""
|
|
1678
|
+
}, ids);
|
|
1679
|
+
gtag("event", "page_view", pageEvent);
|
|
1680
|
+
}
|
|
1681
|
+
break;
|
|
1682
|
+
case "track":
|
|
1683
|
+
const { properties: trackProperties } = payload;
|
|
1684
|
+
const trackEvent = __spreadValues(__spreadValues({}, trackProperties), ids);
|
|
1685
|
+
gtag("event", payload.event, trackEvent);
|
|
1686
|
+
break;
|
|
1687
|
+
case "identify":
|
|
1688
|
+
const { traits } = payload;
|
|
1689
|
+
const identifyEvent = __spreadValues(__spreadValues({}, traits), ids);
|
|
1690
|
+
gtag("event", "identify", identifyEvent);
|
|
1691
|
+
break;
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
function getGa4State() {
|
|
1697
|
+
return window["__jitsuGa4State"] || "fresh";
|
|
1698
|
+
}
|
|
1699
|
+
function setGa4State(s2) {
|
|
1700
|
+
window["__jitsuGa4State"] = s2;
|
|
1701
|
+
}
|
|
1702
|
+
function initGa4IfNeeded(config, payload) {
|
|
1703
|
+
return __async(this, null, function* () {
|
|
1704
|
+
if (getGa4State() !== "fresh") {
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
setGa4State("loading");
|
|
1708
|
+
const dlName = config.dataLayerName || "dataLayer";
|
|
1709
|
+
const dlParam = dlName !== "dataLayer" ? "&l=" + dlName : "";
|
|
1710
|
+
const tagId = config.measurementIds;
|
|
1711
|
+
window[dlName] = window[dlName] || [];
|
|
1712
|
+
const gtag = function() {
|
|
1713
|
+
window[dlName].push(arguments);
|
|
1714
|
+
};
|
|
1715
|
+
gtag("js", /* @__PURE__ */ new Date());
|
|
1716
|
+
gtag(
|
|
1717
|
+
// @ts-ignore
|
|
1718
|
+
"config",
|
|
1719
|
+
tagId,
|
|
1720
|
+
__spreadValues(__spreadValues({}, payload.userId ? { user_id: payload.userId } : {}), !config.autoPageView ? { send_page_view: false } : {})
|
|
1721
|
+
);
|
|
1722
|
+
loadScript(buildTagUrl(), { query: `id=${tagId}${dlParam}`, www: true }).then(() => {
|
|
1723
|
+
setGa4State("loaded");
|
|
1724
|
+
}).catch((e2) => {
|
|
1725
|
+
console.warn(`GA4 (containerId=${config.measurementIds}) init failed: ${e2.message}`, e2);
|
|
1726
|
+
setGa4State("failed");
|
|
1727
|
+
});
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
// src/destination-plugins/index.ts
|
|
1732
|
+
function satisfyFilter(filter, subject) {
|
|
1733
|
+
return filter === "*" || filter.toLowerCase().trim() === (subject || "").trim().toLowerCase();
|
|
1734
|
+
}
|
|
1735
|
+
function satisfyDomainFilter(filter, subject) {
|
|
1736
|
+
if (filter === "*") {
|
|
1737
|
+
return true;
|
|
1738
|
+
}
|
|
1739
|
+
subject = subject || "";
|
|
1740
|
+
if (filter.startsWith("*.")) {
|
|
1741
|
+
return subject.endsWith(filter.substring(1));
|
|
1742
|
+
} else {
|
|
1743
|
+
return filter === subject;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
function applyFilters(event, creds) {
|
|
1747
|
+
const { hosts = "*", events = "*" } = creds;
|
|
1748
|
+
try {
|
|
1749
|
+
const eventsArray = Array.isArray(events) ? events : events.split("\n");
|
|
1750
|
+
const hostsArray = Array.isArray(hosts) ? hosts : hosts.split("\n");
|
|
1751
|
+
return !!hostsArray.find((hostFilter) => {
|
|
1752
|
+
var _a, _b;
|
|
1753
|
+
return satisfyDomainFilter(hostFilter, (_b = (_a = event.context) == null ? void 0 : _a.page) == null ? void 0 : _b.host);
|
|
1754
|
+
}) && (!!eventsArray.find((eventFilter) => satisfyFilter(eventFilter, event.type)) || !!eventsArray.find((eventFilter) => satisfyFilter(eventFilter, event.event)));
|
|
1755
|
+
} catch (e2) {
|
|
1756
|
+
console.warn(
|
|
1757
|
+
`Failed to apply filters: ${e2.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}. Values`,
|
|
1758
|
+
events,
|
|
1759
|
+
hosts
|
|
1760
|
+
);
|
|
1761
|
+
throw new Error(
|
|
1762
|
+
`Failed to apply filters: ${e2.message}. Typeof events: ${typeof events}, typeof hosts: ${typeof hosts}`
|
|
1763
|
+
);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
var internalDestinationPlugins = {
|
|
1767
|
+
[tagPlugin.id]: tagPlugin,
|
|
1768
|
+
[gtmPlugin.id]: gtmPlugin,
|
|
1769
|
+
[ga4Plugin.id]: ga4Plugin,
|
|
1770
|
+
[logrocketPlugin.id]: logrocketPlugin
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
// package.json
|
|
1774
|
+
var package_default = {
|
|
1775
|
+
name: "@jitsu/js",
|
|
1776
|
+
version: "1.11.0-beta.12",
|
|
1777
|
+
description: "",
|
|
1778
|
+
author: "Jitsu Dev Team <dev@jitsu.com>",
|
|
1779
|
+
main: "src/index.ts",
|
|
1780
|
+
types: "src/index.ts",
|
|
1781
|
+
files: [
|
|
1782
|
+
"dist",
|
|
1783
|
+
"compiled"
|
|
1784
|
+
],
|
|
1785
|
+
publishConfig: {
|
|
1786
|
+
main: "dist/jitsu.cjs.js",
|
|
1787
|
+
module: "dist/jitsu.es.js",
|
|
1788
|
+
types: "dist/index.d.ts",
|
|
1789
|
+
access: "public"
|
|
1790
|
+
},
|
|
1791
|
+
license: "MIT",
|
|
1792
|
+
private: false,
|
|
1793
|
+
scripts: {
|
|
1794
|
+
clean: "rm -rf ./dist ./compiled",
|
|
1795
|
+
"test:node": "vitest run",
|
|
1796
|
+
"test:playwright": "playwright test ./__tests__/playwright",
|
|
1797
|
+
test: "pnpm run test:node",
|
|
1798
|
+
typecheck: "tsc --noEmit",
|
|
1799
|
+
build: "tsc && tsx bundle.mts",
|
|
1800
|
+
prepublishOnly: "pnpm run build",
|
|
1801
|
+
"//build-deps": "Required by turbo ^build-deps - builds dist/ for workspace packages that import this",
|
|
1802
|
+
"build-deps": "pnpm run build"
|
|
1803
|
+
},
|
|
1804
|
+
devDependencies: {
|
|
1805
|
+
"@jitsu/common-config": "workspace:*",
|
|
1806
|
+
tslib: "catalog:",
|
|
1807
|
+
"@playwright/test": "^1.57.0",
|
|
1808
|
+
esbuild: "catalog:",
|
|
1809
|
+
tsx: "catalog:",
|
|
1810
|
+
"@segment/analytics-next": "^1.75.0",
|
|
1811
|
+
"@types/chalk": "^2.2.0",
|
|
1812
|
+
"@types/node": "catalog:",
|
|
1813
|
+
"@vitest/ui": "catalog:",
|
|
1814
|
+
chalk: "^4.1.2",
|
|
1815
|
+
"cookie-parser": "^1.4.7",
|
|
1816
|
+
ejs: "^3.1.8",
|
|
1817
|
+
express: "^4.21.2",
|
|
1818
|
+
"node-forge": "^1.3.2",
|
|
1819
|
+
"raw-loader": "^4.0.2",
|
|
1820
|
+
typescript: "catalog:",
|
|
1821
|
+
vitest: "catalog:",
|
|
1822
|
+
jsondiffpatch: "workspace:*"
|
|
1823
|
+
},
|
|
1824
|
+
peerDependencies: {
|
|
1825
|
+
"@jitsu/protocols": "workspace:*"
|
|
1826
|
+
},
|
|
1827
|
+
dependencies: {
|
|
1828
|
+
analytics: "0.8.9"
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
// src/version.ts
|
|
1833
|
+
var jitsuVersion = package_default.version !== "0.0.0" ? package_default.version : "2.0.0";
|
|
1834
|
+
var jitsuLibraryName = "@jitsu/js";
|
|
1835
|
+
|
|
1836
|
+
// src/tlds.ts
|
|
1837
|
+
var publicSuffixes = "webflow.io,vercel.app,myshopify.com,ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,a\xE9roport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,m\u0101ori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(
|
|
1838
|
+
","
|
|
1839
|
+
);
|
|
1840
|
+
var _publicSuffixesMap = {};
|
|
1841
|
+
publicSuffixes.forEach((tld) => {
|
|
1842
|
+
_publicSuffixesMap[tld] = true;
|
|
1843
|
+
});
|
|
1844
|
+
var publicSuffixesMap = _publicSuffixesMap;
|
|
1845
|
+
function getTopLevelDomain(hostname) {
|
|
1846
|
+
const [domain] = hostname.split(":");
|
|
1847
|
+
const parts = domain.split(".");
|
|
1848
|
+
if (parts[parts.length - 1] === "localhost" || parts.length < 2) {
|
|
1849
|
+
return parts[parts.length - 1];
|
|
1850
|
+
} else {
|
|
1851
|
+
const d3 = parts[parts.length - 2] + "." + parts[parts.length - 1];
|
|
1852
|
+
if (parts.length > 2 && publicSuffixesMap[d3]) {
|
|
1853
|
+
return parts[parts.length - 3] + "." + d3;
|
|
1854
|
+
} else {
|
|
1855
|
+
return d3;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
// ../jsondiffpatch/dist/processor.js
|
|
1861
|
+
var Processor = class {
|
|
1862
|
+
constructor(options) {
|
|
1863
|
+
this.selfOptions = options || {};
|
|
1864
|
+
this.pipes = {};
|
|
1865
|
+
}
|
|
1866
|
+
options(options) {
|
|
1867
|
+
if (options) {
|
|
1868
|
+
this.selfOptions = options;
|
|
1869
|
+
}
|
|
1870
|
+
return this.selfOptions;
|
|
1871
|
+
}
|
|
1872
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1873
|
+
pipe(name, pipeArg) {
|
|
1874
|
+
let pipe = pipeArg;
|
|
1875
|
+
if (typeof name === "string") {
|
|
1876
|
+
if (typeof pipe === "undefined") {
|
|
1877
|
+
return this.pipes[name];
|
|
1878
|
+
} else {
|
|
1879
|
+
this.pipes[name] = pipe;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
if (name && name.name) {
|
|
1883
|
+
pipe = name;
|
|
1884
|
+
if (pipe.processor === this) {
|
|
1885
|
+
return pipe;
|
|
1886
|
+
}
|
|
1887
|
+
this.pipes[pipe.name] = pipe;
|
|
1888
|
+
}
|
|
1889
|
+
pipe.processor = this;
|
|
1890
|
+
return pipe;
|
|
1891
|
+
}
|
|
1892
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1893
|
+
process(input, pipe) {
|
|
1894
|
+
let context = input;
|
|
1895
|
+
context.options = this.options();
|
|
1896
|
+
let nextPipe = pipe || input.pipe || "default";
|
|
1897
|
+
let lastPipe;
|
|
1898
|
+
while (nextPipe) {
|
|
1899
|
+
if (typeof context.nextAfterChildren !== "undefined") {
|
|
1900
|
+
context.next = context.nextAfterChildren;
|
|
1901
|
+
context.nextAfterChildren = null;
|
|
1902
|
+
}
|
|
1903
|
+
if (typeof nextPipe === "string") {
|
|
1904
|
+
nextPipe = this.pipe(nextPipe);
|
|
1905
|
+
}
|
|
1906
|
+
nextPipe.process(context);
|
|
1907
|
+
lastPipe = nextPipe;
|
|
1908
|
+
nextPipe = null;
|
|
1909
|
+
if (context) {
|
|
1910
|
+
if (context.next) {
|
|
1911
|
+
context = context.next;
|
|
1912
|
+
nextPipe = context.pipe || lastPipe;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
return context.hasResult ? context.result : void 0;
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
var processor_default = Processor;
|
|
1920
|
+
|
|
1921
|
+
// ../jsondiffpatch/dist/pipe.js
|
|
1922
|
+
var Pipe = class {
|
|
1923
|
+
constructor(name) {
|
|
1924
|
+
this.name = name;
|
|
1925
|
+
this.filters = [];
|
|
1926
|
+
}
|
|
1927
|
+
process(input) {
|
|
1928
|
+
if (!this.processor) {
|
|
1929
|
+
throw new Error("add this pipe to a processor before using it");
|
|
1930
|
+
}
|
|
1931
|
+
const debug = this.debug;
|
|
1932
|
+
const length = this.filters.length;
|
|
1933
|
+
const context = input;
|
|
1934
|
+
for (let index = 0; index < length; index++) {
|
|
1935
|
+
const filter = this.filters[index];
|
|
1936
|
+
if (debug) {
|
|
1937
|
+
this.log(`filter: ${filter.filterName}`);
|
|
1938
|
+
}
|
|
1939
|
+
filter(context);
|
|
1940
|
+
if (typeof context === "object" && context.exiting) {
|
|
1941
|
+
context.exiting = false;
|
|
1942
|
+
break;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
if (!context.next && this.resultCheck) {
|
|
1946
|
+
this.resultCheck(context);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
log(msg) {
|
|
1950
|
+
console.log(`[jsondiffpatch] ${this.name} pipe, ${msg}`);
|
|
1951
|
+
}
|
|
1952
|
+
append(...args) {
|
|
1953
|
+
this.filters.push(...args);
|
|
1954
|
+
return this;
|
|
1955
|
+
}
|
|
1956
|
+
prepend(...args) {
|
|
1957
|
+
this.filters.unshift(...args);
|
|
1958
|
+
return this;
|
|
1959
|
+
}
|
|
1960
|
+
indexOf(filterName) {
|
|
1961
|
+
if (!filterName) {
|
|
1962
|
+
throw new Error("a filter name is required");
|
|
1963
|
+
}
|
|
1964
|
+
for (let index = 0; index < this.filters.length; index++) {
|
|
1965
|
+
const filter = this.filters[index];
|
|
1966
|
+
if (filter.filterName === filterName) {
|
|
1967
|
+
return index;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
throw new Error(`filter not found: ${filterName}`);
|
|
1971
|
+
}
|
|
1972
|
+
list() {
|
|
1973
|
+
return this.filters.map((f2) => f2.filterName);
|
|
1974
|
+
}
|
|
1975
|
+
after(filterName, ...params) {
|
|
1976
|
+
const index = this.indexOf(filterName);
|
|
1977
|
+
this.filters.splice(index + 1, 0, ...params);
|
|
1978
|
+
return this;
|
|
1979
|
+
}
|
|
1980
|
+
before(filterName, ...params) {
|
|
1981
|
+
const index = this.indexOf(filterName);
|
|
1982
|
+
this.filters.splice(index, 0, ...params);
|
|
1983
|
+
return this;
|
|
1984
|
+
}
|
|
1985
|
+
replace(filterName, ...params) {
|
|
1986
|
+
const index = this.indexOf(filterName);
|
|
1987
|
+
this.filters.splice(index, 1, ...params);
|
|
1988
|
+
return this;
|
|
1989
|
+
}
|
|
1990
|
+
remove(filterName) {
|
|
1991
|
+
const index = this.indexOf(filterName);
|
|
1992
|
+
this.filters.splice(index, 1);
|
|
1993
|
+
return this;
|
|
1994
|
+
}
|
|
1995
|
+
clear() {
|
|
1996
|
+
this.filters.length = 0;
|
|
1997
|
+
return this;
|
|
1998
|
+
}
|
|
1999
|
+
shouldHaveResult(should) {
|
|
2000
|
+
if (should === false) {
|
|
2001
|
+
this.resultCheck = null;
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
if (this.resultCheck) {
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
this.resultCheck = (context) => {
|
|
2008
|
+
if (!context.hasResult) {
|
|
2009
|
+
console.log(context);
|
|
2010
|
+
const error = new Error(`${this.name} failed`);
|
|
2011
|
+
error.noResult = true;
|
|
2012
|
+
throw error;
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
return this;
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
var pipe_default = Pipe;
|
|
2019
|
+
|
|
2020
|
+
// ../jsondiffpatch/dist/contexts/context.js
|
|
2021
|
+
var Context = class {
|
|
2022
|
+
setResult(result) {
|
|
2023
|
+
this.result = result;
|
|
2024
|
+
this.hasResult = true;
|
|
2025
|
+
return this;
|
|
2026
|
+
}
|
|
2027
|
+
exit() {
|
|
2028
|
+
this.exiting = true;
|
|
2029
|
+
return this;
|
|
2030
|
+
}
|
|
2031
|
+
push(child, name) {
|
|
2032
|
+
child.parent = this;
|
|
2033
|
+
if (typeof name !== "undefined") {
|
|
2034
|
+
child.childName = name;
|
|
2035
|
+
}
|
|
2036
|
+
child.root = this.root || this;
|
|
2037
|
+
child.options = child.options || this.options;
|
|
2038
|
+
if (!this.children) {
|
|
2039
|
+
this.children = [child];
|
|
2040
|
+
this.nextAfterChildren = this.next || null;
|
|
2041
|
+
this.next = child;
|
|
2042
|
+
} else {
|
|
2043
|
+
this.children[this.children.length - 1].next = child;
|
|
2044
|
+
this.children.push(child);
|
|
2045
|
+
}
|
|
2046
|
+
child.next = this;
|
|
2047
|
+
return this;
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
2050
|
+
|
|
2051
|
+
// ../jsondiffpatch/dist/contexts/diff.js
|
|
2052
|
+
var DiffContext = class extends Context {
|
|
2053
|
+
constructor(left, right) {
|
|
2054
|
+
super();
|
|
2055
|
+
this.left = left;
|
|
2056
|
+
this.right = right;
|
|
2057
|
+
this.pipe = "diff";
|
|
2058
|
+
}
|
|
2059
|
+
setResult(result) {
|
|
2060
|
+
return super.setResult(result);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
var diff_default = DiffContext;
|
|
2064
|
+
|
|
2065
|
+
// ../jsondiffpatch/dist/contexts/patch.js
|
|
2066
|
+
var PatchContext = class extends Context {
|
|
2067
|
+
constructor(left, delta) {
|
|
2068
|
+
super();
|
|
2069
|
+
this.left = left;
|
|
2070
|
+
this.delta = delta;
|
|
2071
|
+
this.pipe = "patch";
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
var patch_default = PatchContext;
|
|
2075
|
+
|
|
2076
|
+
// ../jsondiffpatch/dist/filters/trivial.js
|
|
2077
|
+
function arrayEquals(a5, b5) {
|
|
2078
|
+
if (a5.length !== b5.length) {
|
|
2079
|
+
return false;
|
|
2080
|
+
}
|
|
2081
|
+
for (let i4 = 0; i4 < a5.length; i4++) {
|
|
2082
|
+
if (a5[i4] !== b5[i4]) {
|
|
2083
|
+
return false;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
return true;
|
|
2087
|
+
}
|
|
2088
|
+
var diffFilter = function trivialMatchesDiffFilter(context) {
|
|
2089
|
+
if (context.left === context.right) {
|
|
2090
|
+
context.setResult(void 0).exit();
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
if (typeof context.left === "undefined") {
|
|
2094
|
+
if (typeof context.right === "function") {
|
|
2095
|
+
throw new Error("functions are not supported");
|
|
2096
|
+
}
|
|
2097
|
+
context.setResult([context.right]).exit();
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
if (typeof context.right === "undefined") {
|
|
2101
|
+
context.setResult([context.left, 0, 0]).exit();
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (typeof context.left === "function" || typeof context.right === "function") {
|
|
2105
|
+
throw new Error("functions are not supported");
|
|
2106
|
+
}
|
|
2107
|
+
context.leftType = context.left === null ? "null" : typeof context.left;
|
|
2108
|
+
context.rightType = context.right === null ? "null" : typeof context.right;
|
|
2109
|
+
if (context.leftType !== context.rightType) {
|
|
2110
|
+
context.setResult([context.left, context.right]).exit();
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
if (context.leftType === "boolean" || context.leftType === "number" || context.leftType === "string") {
|
|
2114
|
+
context.setResult([context.left, context.right]).exit();
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
if (context.leftType === "object") {
|
|
2118
|
+
context.leftIsArray = Array.isArray(context.left);
|
|
2119
|
+
}
|
|
2120
|
+
if (context.rightType === "object") {
|
|
2121
|
+
context.rightIsArray = Array.isArray(context.right);
|
|
2122
|
+
}
|
|
2123
|
+
if (context.leftIsArray !== context.rightIsArray) {
|
|
2124
|
+
context.setResult([context.left, context.right]).exit();
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
if (context.leftIsArray && context.rightIsArray) {
|
|
2128
|
+
if (arrayEquals(context.left, context.right)) {
|
|
2129
|
+
context.setResult(void 0).exit();
|
|
2130
|
+
return;
|
|
2131
|
+
} else {
|
|
2132
|
+
context.setResult([context.left, context.right]).exit();
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
if (context.left instanceof RegExp) {
|
|
2137
|
+
if (context.right instanceof RegExp) {
|
|
2138
|
+
context.setResult([context.left.toString(), context.right.toString()]).exit();
|
|
2139
|
+
} else {
|
|
2140
|
+
context.setResult([context.left, context.right]).exit();
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
};
|
|
2144
|
+
diffFilter.filterName = "trivial";
|
|
2145
|
+
var patchFilter = function trivialMatchesPatchFilter(context) {
|
|
2146
|
+
if (typeof context.delta === "undefined") {
|
|
2147
|
+
context.setResult(context.left).exit();
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
context.nested = !Array.isArray(context.delta);
|
|
2151
|
+
if (context.nested) {
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
const nonNestedDelta = context.delta;
|
|
2155
|
+
if (nonNestedDelta.length === 1) {
|
|
2156
|
+
context.setResult(nonNestedDelta[0]).exit();
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
if (nonNestedDelta.length === 2) {
|
|
2160
|
+
if (context.left instanceof RegExp) {
|
|
2161
|
+
const regexArgs = /^\/(.*)\/([gimyu]+)$/.exec(nonNestedDelta[1]);
|
|
2162
|
+
if (regexArgs) {
|
|
2163
|
+
context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
context.setResult(nonNestedDelta[1]).exit();
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
if (nonNestedDelta.length === 3 && nonNestedDelta[2] === 0) {
|
|
2171
|
+
context.setResult(void 0).exit();
|
|
2172
|
+
}
|
|
2173
|
+
};
|
|
2174
|
+
patchFilter.filterName = "trivial";
|
|
2175
|
+
|
|
2176
|
+
// ../jsondiffpatch/dist/filters/nested.js
|
|
2177
|
+
var collectChildrenDiffFilter = (context) => {
|
|
2178
|
+
if (!context || !context.children) {
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
const length = context.children.length;
|
|
2182
|
+
let child;
|
|
2183
|
+
let result = context.result;
|
|
2184
|
+
for (let index = 0; index < length; index++) {
|
|
2185
|
+
child = context.children[index];
|
|
2186
|
+
if (typeof child.result === "undefined") {
|
|
2187
|
+
continue;
|
|
2188
|
+
}
|
|
2189
|
+
result = result || {};
|
|
2190
|
+
result[child.childName] = child.result;
|
|
2191
|
+
}
|
|
2192
|
+
if (result && context.leftIsArray) {
|
|
2193
|
+
result._t = "a";
|
|
2194
|
+
}
|
|
2195
|
+
context.setResult(result).exit();
|
|
2196
|
+
};
|
|
2197
|
+
collectChildrenDiffFilter.filterName = "collectChildren";
|
|
2198
|
+
var objectsDiffFilter = (context) => {
|
|
2199
|
+
if (context.leftIsArray || context.leftType !== "object") {
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2202
|
+
const left = context.left;
|
|
2203
|
+
const right = context.right;
|
|
2204
|
+
let name;
|
|
2205
|
+
let child;
|
|
2206
|
+
const propertyFilter = context.options.propertyFilter;
|
|
2207
|
+
for (name in left) {
|
|
2208
|
+
if (!Object.prototype.hasOwnProperty.call(left, name)) {
|
|
2209
|
+
continue;
|
|
2210
|
+
}
|
|
2211
|
+
if (propertyFilter && !propertyFilter(name, context)) {
|
|
2212
|
+
continue;
|
|
2213
|
+
}
|
|
2214
|
+
child = new diff_default(left[name], right[name]);
|
|
2215
|
+
context.push(child, name);
|
|
2216
|
+
}
|
|
2217
|
+
for (name in right) {
|
|
2218
|
+
if (!Object.prototype.hasOwnProperty.call(right, name)) {
|
|
2219
|
+
continue;
|
|
2220
|
+
}
|
|
2221
|
+
if (propertyFilter && !propertyFilter(name, context)) {
|
|
2222
|
+
continue;
|
|
2223
|
+
}
|
|
2224
|
+
if (typeof left[name] === "undefined") {
|
|
2225
|
+
child = new diff_default(void 0, right[name]);
|
|
2226
|
+
context.push(child, name);
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
if (!context.children || context.children.length === 0) {
|
|
2230
|
+
context.setResult(void 0).exit();
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
context.exit();
|
|
2234
|
+
};
|
|
2235
|
+
objectsDiffFilter.filterName = "objects";
|
|
2236
|
+
var patchFilter2 = function nestedPatchFilter(context) {
|
|
2237
|
+
if (!context.nested) {
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
const nestedDelta = context.delta;
|
|
2241
|
+
if (nestedDelta._t) {
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
const objectDelta = nestedDelta;
|
|
2245
|
+
let name;
|
|
2246
|
+
let child;
|
|
2247
|
+
for (name in objectDelta) {
|
|
2248
|
+
child = new patch_default(context.left[name], objectDelta[name]);
|
|
2249
|
+
context.push(child, name);
|
|
2250
|
+
}
|
|
2251
|
+
context.exit();
|
|
2252
|
+
};
|
|
2253
|
+
patchFilter2.filterName = "objects";
|
|
2254
|
+
var collectChildrenPatchFilter = function collectChildrenPatchFilter2(context) {
|
|
2255
|
+
if (!context || !context.children) {
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
const deltaWithChildren = context.delta;
|
|
2259
|
+
if (deltaWithChildren._t) {
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
const object = context.left;
|
|
2263
|
+
const length = context.children.length;
|
|
2264
|
+
let child;
|
|
2265
|
+
for (let index = 0; index < length; index++) {
|
|
2266
|
+
child = context.children[index];
|
|
2267
|
+
const property = child.childName;
|
|
2268
|
+
if (Object.prototype.hasOwnProperty.call(context.left, property) && child.result === void 0) {
|
|
2269
|
+
delete object[property];
|
|
2270
|
+
} else if (object[property] !== child.result) {
|
|
2271
|
+
object[property] = child.result;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
context.setResult(object).exit();
|
|
2275
|
+
};
|
|
2276
|
+
collectChildrenPatchFilter.filterName = "collectChildren";
|
|
2277
|
+
|
|
2278
|
+
// ../jsondiffpatch/dist/filters/dates.js
|
|
2279
|
+
var diffFilter2 = function datesDiffFilter(context) {
|
|
2280
|
+
if (context.left instanceof Date) {
|
|
2281
|
+
if (context.right instanceof Date) {
|
|
2282
|
+
if (context.left.getTime() !== context.right.getTime()) {
|
|
2283
|
+
context.setResult([context.left, context.right]);
|
|
2284
|
+
} else {
|
|
2285
|
+
context.setResult(void 0);
|
|
2286
|
+
}
|
|
2287
|
+
} else {
|
|
2288
|
+
context.setResult([context.left, context.right]);
|
|
2289
|
+
}
|
|
2290
|
+
context.exit();
|
|
2291
|
+
} else if (context.right instanceof Date) {
|
|
2292
|
+
context.setResult([context.left, context.right]).exit();
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
diffFilter2.filterName = "dates";
|
|
2296
|
+
|
|
2297
|
+
// ../jsondiffpatch/dist/diffpatcher.js
|
|
2298
|
+
var DiffPatcher = class {
|
|
2299
|
+
constructor(options) {
|
|
2300
|
+
this.processor = new processor_default(options);
|
|
2301
|
+
this.processor.pipe(new pipe_default("diff").append(collectChildrenDiffFilter, diffFilter, diffFilter2, objectsDiffFilter).shouldHaveResult());
|
|
2302
|
+
this.processor.pipe(new pipe_default("patch").append(collectChildrenPatchFilter, patchFilter, patchFilter2).shouldHaveResult());
|
|
2303
|
+
}
|
|
2304
|
+
options(options) {
|
|
2305
|
+
return this.processor.options(options);
|
|
2306
|
+
}
|
|
2307
|
+
diff(left, right) {
|
|
2308
|
+
return this.processor.process(new diff_default(left, right));
|
|
2309
|
+
}
|
|
2310
|
+
patch(left, delta) {
|
|
2311
|
+
return this.processor.process(new patch_default(left, delta));
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
var diffpatcher_default = DiffPatcher;
|
|
2315
|
+
|
|
2316
|
+
// ../jsondiffpatch/dist/index.js
|
|
2317
|
+
function create(options) {
|
|
2318
|
+
return new diffpatcher_default(options);
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
// src/analytics-plugin.ts
|
|
2322
|
+
var diff = create();
|
|
2323
|
+
var defaultConfig = {
|
|
2324
|
+
/* Your segment writeKey */
|
|
2325
|
+
writeKey: void 0,
|
|
2326
|
+
/* Disable anonymous MTU */
|
|
2327
|
+
host: void 0,
|
|
2328
|
+
debug: false,
|
|
2329
|
+
fetch: void 0,
|
|
2330
|
+
echoEvents: false,
|
|
2331
|
+
cookieDomain: void 0,
|
|
2332
|
+
cookieNames: {},
|
|
2333
|
+
cookieCapture: {},
|
|
2334
|
+
runtime: void 0,
|
|
2335
|
+
fetchTimeoutMs: void 0,
|
|
2336
|
+
s2s: void 0,
|
|
2337
|
+
idEndpoint: void 0,
|
|
2338
|
+
errorPolicy: "log",
|
|
2339
|
+
defaultPayloadContext: {},
|
|
2340
|
+
privacy: {
|
|
2341
|
+
dontSend: false,
|
|
2342
|
+
disableUserIds: false,
|
|
2343
|
+
ipPolicy: "keep",
|
|
2344
|
+
consentCategories: {}
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
var mergeConfig = (current, newConfig) => {
|
|
2348
|
+
for (const key of Object.keys(defaultConfig)) {
|
|
2349
|
+
const value = newConfig[key];
|
|
2350
|
+
if (key === "privacy") {
|
|
2351
|
+
if (typeof value === "object") {
|
|
2352
|
+
current.privacy = __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, defaultConfig.privacy), {
|
|
2353
|
+
consentCategories: __spreadValues({}, defaultConfig.privacy.consentCategories)
|
|
2354
|
+
}), current.privacy), value);
|
|
2355
|
+
} else if (typeof value === "undefined") {
|
|
2356
|
+
if (newConfig.hasOwnProperty("privacy") || !current.hasOwnProperty("privacy")) {
|
|
2357
|
+
current.privacy = __spreadProps(__spreadValues({}, defaultConfig.privacy), {
|
|
2358
|
+
consentCategories: __spreadValues({}, defaultConfig.privacy.consentCategories)
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
} else if (typeof value === "undefined") {
|
|
2363
|
+
if (newConfig.hasOwnProperty(key) || !current.hasOwnProperty(key)) {
|
|
2364
|
+
current[key] = defaultConfig[key];
|
|
2365
|
+
}
|
|
2366
|
+
} else {
|
|
2367
|
+
current[key] = value;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
var parseQuery = (qs) => {
|
|
2372
|
+
if (!qs) {
|
|
2373
|
+
return {};
|
|
2374
|
+
}
|
|
2375
|
+
let queryString = qs.length > 0 && qs.charAt(0) === "?" ? qs.substring(1) : qs;
|
|
2376
|
+
let query = {};
|
|
2377
|
+
let pairs = (queryString[0] === "?" ? queryString.substr(1) : queryString).split("&");
|
|
2378
|
+
for (let i4 = 0; i4 < pairs.length; i4++) {
|
|
2379
|
+
let pair = pairs[i4].split("=");
|
|
2380
|
+
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || "");
|
|
2381
|
+
}
|
|
2382
|
+
return query;
|
|
2383
|
+
};
|
|
2384
|
+
function utmToKey(key) {
|
|
2385
|
+
const name = key.substring("utm_".length);
|
|
2386
|
+
return name === "campaign" ? "name" : name;
|
|
2387
|
+
}
|
|
2388
|
+
function parseUtms(query) {
|
|
2389
|
+
return Object.entries(query).filter(([key]) => key.indexOf("utm_") === 0).reduce(
|
|
2390
|
+
(acc, [key, value]) => __spreadProps(__spreadValues({}, acc), {
|
|
2391
|
+
[utmToKey(key)]: value
|
|
2392
|
+
}),
|
|
2393
|
+
{}
|
|
2394
|
+
);
|
|
2395
|
+
}
|
|
2396
|
+
function safeCall(f2, defaultVal) {
|
|
2397
|
+
try {
|
|
2398
|
+
return f2();
|
|
2399
|
+
} catch (e2) {
|
|
2400
|
+
return defaultVal;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
function restoreTraits(storage) {
|
|
2404
|
+
let val = storage.getItem("__user_traits");
|
|
2405
|
+
if (typeof val === "string") {
|
|
2406
|
+
val = safeCall(() => JSON.parse(val), {});
|
|
2407
|
+
}
|
|
2408
|
+
if (typeof val !== "object" || val === null || Array.isArray(val)) {
|
|
2409
|
+
val = {};
|
|
2410
|
+
}
|
|
2411
|
+
let groupVal = storage.getItem("__group_traits");
|
|
2412
|
+
if (typeof groupVal === "string") {
|
|
2413
|
+
groupVal = safeCall(() => JSON.parse(groupVal), {});
|
|
2414
|
+
}
|
|
2415
|
+
if (typeof groupVal !== "object" || groupVal === null || Array.isArray(groupVal)) {
|
|
2416
|
+
groupVal = {};
|
|
2417
|
+
}
|
|
2418
|
+
return __spreadValues(__spreadValues({}, groupVal || {}), val || {});
|
|
2419
|
+
}
|
|
2420
|
+
function getCookie(name) {
|
|
2421
|
+
var _a;
|
|
2422
|
+
const value = `; ${document.cookie}`;
|
|
2423
|
+
const parts = value.split(`; ${name}=`);
|
|
2424
|
+
return parts.length === 2 ? (_a = parts.pop()) == null ? void 0 : _a.split(";").shift() : void 0;
|
|
2425
|
+
}
|
|
2426
|
+
function getClientIds(runtime, customCookieCapture) {
|
|
2427
|
+
const cookieCapture = __spreadValues({
|
|
2428
|
+
fbc: "_fbc",
|
|
2429
|
+
fbp: "_fbp"
|
|
2430
|
+
}, customCookieCapture);
|
|
2431
|
+
const clientIds = Object.entries(cookieCapture).reduce((acc, [key, cookieName]) => {
|
|
2432
|
+
acc[key] = runtime.getCookie(cookieName);
|
|
2433
|
+
return acc;
|
|
2434
|
+
}, {});
|
|
2435
|
+
return __spreadValues(__spreadValues({}, clientIds), getGa4Ids(runtime));
|
|
2436
|
+
}
|
|
2437
|
+
function parseGa4SessionId(cookieValue) {
|
|
2438
|
+
if (typeof cookieValue !== "string") {
|
|
2439
|
+
return void 0;
|
|
2440
|
+
}
|
|
2441
|
+
if (cookieValue.startsWith("GA1") || cookieValue.startsWith("GS1")) {
|
|
2442
|
+
return cookieValue.split(".")[2];
|
|
2443
|
+
} else {
|
|
2444
|
+
const match = cookieValue.match(/^GS\d+\.\d+\.(?:[\w_-]+[$])*s(\d+)(?:$|[$])/);
|
|
2445
|
+
return match ? match[1] : void 0;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
function getGa4Ids(runtime) {
|
|
2449
|
+
var _a;
|
|
2450
|
+
const allCookies = runtime.getCookies();
|
|
2451
|
+
const clientId = (_a = allCookies["_ga"]) == null ? void 0 : _a.split(".").slice(-2).join(".");
|
|
2452
|
+
const gaSessionCookies = Object.entries(allCookies).filter(([key]) => key.startsWith("_ga_"));
|
|
2453
|
+
const sessionIds = gaSessionCookies.length > 0 ? Object.fromEntries(
|
|
2454
|
+
gaSessionCookies.map(([key, value]) => {
|
|
2455
|
+
const sessionId = parseGa4SessionId(value);
|
|
2456
|
+
if (!sessionId) {
|
|
2457
|
+
return null;
|
|
2458
|
+
}
|
|
2459
|
+
return [key.substring("_ga_".length), sessionId];
|
|
2460
|
+
}).filter((v2) => v2 !== null)
|
|
2461
|
+
) : void 0;
|
|
2462
|
+
if (clientId || sessionIds) {
|
|
2463
|
+
return { ga4: { clientId, sessionIds } };
|
|
2464
|
+
} else {
|
|
2465
|
+
return void 0;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
function removeCookie(name, { domain, secure }) {
|
|
2469
|
+
document.cookie = name + "=;domain=" + domain + ";path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite=" + (secure ? "None" : "Lax") + (secure ? ";secure" : "");
|
|
2470
|
+
}
|
|
2471
|
+
function setCookie(name, val, { domain, secure }) {
|
|
2472
|
+
document.cookie = name + "=" + val + ";domain=" + domain + ";path=/;expires=" + new Date((/* @__PURE__ */ new Date()).getTime() + 1e3 * 60 * 60 * 24 * 365 * 5).toUTCString() + ";SameSite=" + (secure ? "None" : "Lax") + (secure ? ";secure" : "");
|
|
2473
|
+
}
|
|
2474
|
+
var defaultCookie2Key = {
|
|
2475
|
+
__anon_id: "__eventn_id",
|
|
2476
|
+
__user_id: "__eventn_uid",
|
|
2477
|
+
__user_traits: "__eventn_id_usr",
|
|
2478
|
+
__group_id: "__group_id",
|
|
2479
|
+
__group_traits: "__group_traits"
|
|
2480
|
+
};
|
|
2481
|
+
var cookieStorage = (cookieDomain, key2cookie) => {
|
|
2482
|
+
return {
|
|
2483
|
+
setItem(key, val) {
|
|
2484
|
+
const cookieName = key2cookie(key) || key;
|
|
2485
|
+
if (typeof val === "undefined") {
|
|
2486
|
+
removeCookie(cookieName, {
|
|
2487
|
+
domain: cookieDomain,
|
|
2488
|
+
secure: window.location.protocol === "https:"
|
|
2489
|
+
});
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const strVal = typeof val === "object" && val !== null ? encodeURIComponent(JSON.stringify(val)) : val;
|
|
2493
|
+
setCookie(cookieName, strVal, {
|
|
2494
|
+
domain: cookieDomain,
|
|
2495
|
+
secure: window.location.protocol === "https:"
|
|
2496
|
+
});
|
|
2497
|
+
},
|
|
2498
|
+
getItem(key) {
|
|
2499
|
+
const cookieName = key2cookie(key) || key;
|
|
2500
|
+
const result = getCookie(cookieName);
|
|
2501
|
+
if (key === "__anon_id") {
|
|
2502
|
+
return result;
|
|
2503
|
+
}
|
|
2504
|
+
if (typeof result === "undefined" && key === "__user_id") {
|
|
2505
|
+
const traits = parse(getCookie(key2cookie("__user_traits") || "__eventn_id_usr")) || {};
|
|
2506
|
+
return traits.internal_id || traits.user_id || traits.id || traits.userId;
|
|
2507
|
+
}
|
|
2508
|
+
return parse(result);
|
|
2509
|
+
},
|
|
2510
|
+
removeItem(key) {
|
|
2511
|
+
removeCookie(key2cookie(key) || key, {
|
|
2512
|
+
domain: cookieDomain,
|
|
2513
|
+
secure: window.location.protocol === "https:"
|
|
2514
|
+
});
|
|
2515
|
+
},
|
|
2516
|
+
reset() {
|
|
2517
|
+
for (const key of Object.keys(defaultCookie2Key)) {
|
|
2518
|
+
removeCookie(key2cookie(key) || key, {
|
|
2519
|
+
domain: cookieDomain,
|
|
2520
|
+
secure: window.location.protocol === "https:"
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
};
|
|
2526
|
+
function windowRuntime(opts) {
|
|
2527
|
+
const key2Cookie = (key) => {
|
|
2528
|
+
var _a, _b, _c, _d, _e2;
|
|
2529
|
+
switch (key) {
|
|
2530
|
+
case "__anon_id":
|
|
2531
|
+
return ((_a = opts.cookieNames) == null ? void 0 : _a.anonymousId) || defaultCookie2Key.__anon_id;
|
|
2532
|
+
case "__user_id":
|
|
2533
|
+
return ((_b = opts.cookieNames) == null ? void 0 : _b.userId) || defaultCookie2Key.__user_id;
|
|
2534
|
+
case "__user_traits":
|
|
2535
|
+
return ((_c = opts.cookieNames) == null ? void 0 : _c.userTraits) || defaultCookie2Key.__user_traits;
|
|
2536
|
+
case "__group_id":
|
|
2537
|
+
return ((_d = opts.cookieNames) == null ? void 0 : _d.groupId) || defaultCookie2Key.__group_id;
|
|
2538
|
+
case "__group_traits":
|
|
2539
|
+
return ((_e2 = opts.cookieNames) == null ? void 0 : _e2.groupTraits) || defaultCookie2Key.__group_traits;
|
|
2540
|
+
default:
|
|
2541
|
+
return key;
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
return {
|
|
2545
|
+
getCookie(name) {
|
|
2546
|
+
var _a;
|
|
2547
|
+
const value = `; ${document.cookie}`;
|
|
2548
|
+
const parts = value.split(`; ${name}=`);
|
|
2549
|
+
return parts.length === 2 ? (_a = parts.pop()) == null ? void 0 : _a.split(";").shift() : void 0;
|
|
2550
|
+
},
|
|
2551
|
+
getCookies() {
|
|
2552
|
+
const value = `; ${document.cookie}`;
|
|
2553
|
+
const cookies = {};
|
|
2554
|
+
const matches = value.matchAll(/(\w+)=([^;]+)/g);
|
|
2555
|
+
for (const match of matches) {
|
|
2556
|
+
cookies[match[1]] = match[2];
|
|
2557
|
+
}
|
|
2558
|
+
return cookies;
|
|
2559
|
+
},
|
|
2560
|
+
documentEncoding() {
|
|
2561
|
+
return window.document.characterSet;
|
|
2562
|
+
},
|
|
2563
|
+
timezoneOffset() {
|
|
2564
|
+
return (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
2565
|
+
},
|
|
2566
|
+
store() {
|
|
2567
|
+
return cookieStorage(opts.cookieDomain || getTopLevelDomain(window.location.hostname), key2Cookie);
|
|
2568
|
+
},
|
|
2569
|
+
language() {
|
|
2570
|
+
return window.navigator.language;
|
|
2571
|
+
},
|
|
2572
|
+
pageTitle() {
|
|
2573
|
+
return window.document.title;
|
|
2574
|
+
},
|
|
2575
|
+
pageUrl() {
|
|
2576
|
+
return window.location.href;
|
|
2577
|
+
},
|
|
2578
|
+
referrer() {
|
|
2579
|
+
return window.document.referrer;
|
|
2580
|
+
},
|
|
2581
|
+
screen() {
|
|
2582
|
+
return {
|
|
2583
|
+
width: window.screen.width,
|
|
2584
|
+
height: window.screen.height,
|
|
2585
|
+
innerWidth: window.innerWidth,
|
|
2586
|
+
innerHeight: window.innerHeight,
|
|
2587
|
+
density: Math.floor(window.devicePixelRatio)
|
|
2588
|
+
};
|
|
2589
|
+
},
|
|
2590
|
+
userAgent() {
|
|
2591
|
+
return window.navigator.userAgent;
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
}
|
|
2595
|
+
function createInMemoryStorage(debug) {
|
|
2596
|
+
const storage = {};
|
|
2597
|
+
return {
|
|
2598
|
+
reset() {
|
|
2599
|
+
Object.keys(storage).forEach((key) => delete storage[key]);
|
|
2600
|
+
},
|
|
2601
|
+
setItem(key, val) {
|
|
2602
|
+
if (debug) {
|
|
2603
|
+
console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
|
|
2604
|
+
}
|
|
2605
|
+
if (typeof val === "undefined") {
|
|
2606
|
+
delete storage[key];
|
|
2607
|
+
} else {
|
|
2608
|
+
storage[key] = val;
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
getItem(key) {
|
|
2612
|
+
const val = storage[key];
|
|
2613
|
+
if (debug) {
|
|
2614
|
+
console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
|
|
2615
|
+
}
|
|
2616
|
+
return val;
|
|
2617
|
+
},
|
|
2618
|
+
removeItem(key) {
|
|
2619
|
+
if (debug) {
|
|
2620
|
+
console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
|
|
2621
|
+
}
|
|
2622
|
+
delete storage[key];
|
|
2623
|
+
}
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
var emptyRuntime = (config) => ({
|
|
2627
|
+
documentEncoding() {
|
|
2628
|
+
return void 0;
|
|
2629
|
+
},
|
|
2630
|
+
timezoneOffset() {
|
|
2631
|
+
return void 0;
|
|
2632
|
+
},
|
|
2633
|
+
getCookie(name) {
|
|
2634
|
+
return void 0;
|
|
2635
|
+
},
|
|
2636
|
+
getCookies() {
|
|
2637
|
+
return {};
|
|
2638
|
+
},
|
|
2639
|
+
store() {
|
|
2640
|
+
return createInMemoryStorage(config.debug);
|
|
2641
|
+
},
|
|
2642
|
+
language() {
|
|
2643
|
+
return void 0;
|
|
2644
|
+
},
|
|
2645
|
+
pageTitle() {
|
|
2646
|
+
return void 0;
|
|
2647
|
+
},
|
|
2648
|
+
pageUrl() {
|
|
2649
|
+
return void 0;
|
|
2650
|
+
},
|
|
2651
|
+
referrer() {
|
|
2652
|
+
return void 0;
|
|
2653
|
+
},
|
|
2654
|
+
screen() {
|
|
2655
|
+
return void 0;
|
|
2656
|
+
},
|
|
2657
|
+
userAgent() {
|
|
2658
|
+
return void 0;
|
|
2659
|
+
}
|
|
2660
|
+
});
|
|
2661
|
+
function deepCopy(o4) {
|
|
2662
|
+
if (typeof o4 !== "object") {
|
|
2663
|
+
return o4;
|
|
2664
|
+
}
|
|
2665
|
+
if (!o4) {
|
|
2666
|
+
return o4;
|
|
2667
|
+
}
|
|
2668
|
+
return JSON.parse(JSON.stringify(o4));
|
|
2669
|
+
}
|
|
2670
|
+
function deepMerge(target, source) {
|
|
2671
|
+
if (typeof source !== "object" || source === null || Array.isArray(source) || source instanceof Date) {
|
|
2672
|
+
return source;
|
|
2673
|
+
}
|
|
2674
|
+
if (typeof target !== "object" || target === null || Array.isArray(target) || target instanceof Date) {
|
|
2675
|
+
return source;
|
|
2676
|
+
}
|
|
2677
|
+
return Object.entries(source).reduce((acc, [key, value]) => {
|
|
2678
|
+
acc[key] = deepMerge(target[key], value);
|
|
2679
|
+
return acc;
|
|
2680
|
+
}, target);
|
|
2681
|
+
}
|
|
2682
|
+
function isInBrowser() {
|
|
2683
|
+
return typeof document !== "undefined" && typeof window !== "undefined";
|
|
2684
|
+
}
|
|
2685
|
+
function fixPath(path) {
|
|
2686
|
+
if (path.indexOf("//") === 0 && path.lastIndexOf("/") === 1) {
|
|
2687
|
+
return "/";
|
|
2688
|
+
}
|
|
2689
|
+
return path;
|
|
2690
|
+
}
|
|
2691
|
+
var hashRegex = /#.*$/;
|
|
2692
|
+
function urlPath(url) {
|
|
2693
|
+
const regex = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g;
|
|
2694
|
+
const matches = regex.exec(url);
|
|
2695
|
+
const pathMatch = matches && matches[3] ? matches[3].split("?")[0].replace(hashRegex, "") : "";
|
|
2696
|
+
return "/" + pathMatch;
|
|
2697
|
+
}
|
|
2698
|
+
function canonicalUrl() {
|
|
2699
|
+
if (!isInBrowser()) return;
|
|
2700
|
+
const tags = document.getElementsByTagName("link");
|
|
2701
|
+
for (var i4 = 0, tag; tag = tags[i4]; i4++) {
|
|
2702
|
+
if (tag.getAttribute("rel") === "canonical") {
|
|
2703
|
+
return tag.getAttribute("href");
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
function analyticsJsUrl() {
|
|
2708
|
+
if (!isInBrowser()) return;
|
|
2709
|
+
const canonical = canonicalUrl();
|
|
2710
|
+
if (!canonical) return window.location.href.replace(hashRegex, "");
|
|
2711
|
+
return canonical.match(/\?/) ? canonical : canonical + window.location.search;
|
|
2712
|
+
}
|
|
2713
|
+
function adjustPayload(payload, config, storage, s2s) {
|
|
2714
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o;
|
|
2715
|
+
const runtime = config.runtime || (isInBrowser() ? windowRuntime(config) : emptyRuntime(config));
|
|
2716
|
+
const url = runtime.pageUrl();
|
|
2717
|
+
const parsedUrl = url ? safeCall(() => new URL(url), void 0) : void 0;
|
|
2718
|
+
const query = parsedUrl ? parseQuery(parsedUrl.search) : {};
|
|
2719
|
+
const properties = payload.properties || {};
|
|
2720
|
+
if (payload.type === "page" && (properties.url || url)) {
|
|
2721
|
+
let targetUrl = url || properties.url;
|
|
2722
|
+
if (properties.url && properties.url !== analyticsJsUrl()) {
|
|
2723
|
+
targetUrl = properties.url;
|
|
2724
|
+
}
|
|
2725
|
+
properties.url = targetUrl.replace(hashRegex, "");
|
|
2726
|
+
properties.path = fixPath(urlPath(targetUrl));
|
|
2727
|
+
}
|
|
2728
|
+
const customContext = deepMerge(
|
|
2729
|
+
config.defaultPayloadContext,
|
|
2730
|
+
((_a = payload.properties) == null ? void 0 : _a.context) || ((_b = payload.options) == null ? void 0 : _b.context) || {}
|
|
2731
|
+
);
|
|
2732
|
+
(_c = payload.properties) == null ? true : delete _c.context;
|
|
2733
|
+
const referrer = runtime.referrer();
|
|
2734
|
+
const context = {
|
|
2735
|
+
library: {
|
|
2736
|
+
name: jitsuLibraryName,
|
|
2737
|
+
version: jitsuVersion,
|
|
2738
|
+
env: isInBrowser() ? "browser" : "node"
|
|
2739
|
+
},
|
|
2740
|
+
consent: typeof ((_d = config.privacy) == null ? void 0 : _d.consentCategories) === "object" && Object.keys((_e2 = config.privacy) == null ? void 0 : _e2.consentCategories).length ? {
|
|
2741
|
+
categoryPreferences: config.privacy.consentCategories
|
|
2742
|
+
} : void 0,
|
|
2743
|
+
userAgent: (_f = runtime.userAgent) == null ? void 0 : _f.call(runtime),
|
|
2744
|
+
locale: (_g = runtime.language) == null ? void 0 : _g.call(runtime),
|
|
2745
|
+
screen: (_h = runtime.screen) == null ? void 0 : _h.call(runtime),
|
|
2746
|
+
ip: (_i = runtime == null ? void 0 : runtime.ip) == null ? void 0 : _i.call(runtime),
|
|
2747
|
+
traits: payload.type != "identify" && payload.type != "group" ? __spreadValues(__spreadValues({}, restoreTraits(storage) || {}), ((_j = payload == null ? void 0 : payload.options) == null ? void 0 : _j.traits) || {}) : void 0,
|
|
2748
|
+
page: {
|
|
2749
|
+
path: properties.path || parsedUrl && parsedUrl.pathname,
|
|
2750
|
+
referrer,
|
|
2751
|
+
referring_domain: safeCall(() => referrer && new URL(referrer).hostname),
|
|
2752
|
+
host: parsedUrl && parsedUrl.host,
|
|
2753
|
+
search: properties.search || parsedUrl && parsedUrl.search,
|
|
2754
|
+
title: properties.title || runtime.pageTitle(),
|
|
2755
|
+
url: properties.url || url,
|
|
2756
|
+
encoding: properties.encoding || runtime.documentEncoding()
|
|
2757
|
+
},
|
|
2758
|
+
clientIds: !((_k = config.privacy) == null ? void 0 : _k.disableUserIds) ? getClientIds(runtime, config.cookieCapture || {}) : void 0,
|
|
2759
|
+
campaign: parseUtms(query)
|
|
2760
|
+
};
|
|
2761
|
+
const withContext = __spreadProps(__spreadValues({}, payload), {
|
|
2762
|
+
userId: ((_l = payload == null ? void 0 : payload.options) == null ? void 0 : _l.userId) || (payload == null ? void 0 : payload.userId),
|
|
2763
|
+
anonymousId: ((_m = payload == null ? void 0 : payload.options) == null ? void 0 : _m.anonymousId) || (payload == null ? void 0 : payload.anonymousId),
|
|
2764
|
+
groupId: ((_n2 = payload == null ? void 0 : payload.options) == null ? void 0 : _n2.groupId) || storage.getItem("__group_id"),
|
|
2765
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2766
|
+
sentAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2767
|
+
messageId: randomId(properties.path || parsedUrl && parsedUrl.pathname),
|
|
2768
|
+
writeKey: maskWriteKey(config.writeKey),
|
|
2769
|
+
context: deepMerge(context, customContext)
|
|
2770
|
+
});
|
|
2771
|
+
delete withContext.meta;
|
|
2772
|
+
delete withContext.options;
|
|
2773
|
+
if ((_o = config.privacy) == null ? void 0 : _o.disableUserIds) {
|
|
2774
|
+
delete withContext.userId;
|
|
2775
|
+
delete withContext.anonymousId;
|
|
2776
|
+
delete withContext.context.traits;
|
|
2777
|
+
delete withContext.groupId;
|
|
2778
|
+
}
|
|
2779
|
+
return withContext;
|
|
2780
|
+
}
|
|
2781
|
+
function isDiff(obj) {
|
|
2782
|
+
const keys = Object.keys(obj);
|
|
2783
|
+
return keys.length === 1 && keys[0] === "__diff";
|
|
2784
|
+
}
|
|
2785
|
+
function processDestinations(destinations, method, originalEvent, debug, analyticsInstance) {
|
|
2786
|
+
return __async(this, null, function* () {
|
|
2787
|
+
const promises = [];
|
|
2788
|
+
for (const destination of destinations) {
|
|
2789
|
+
let newEvents = [];
|
|
2790
|
+
if (destination.newEvents) {
|
|
2791
|
+
try {
|
|
2792
|
+
newEvents = destination.newEvents.map(
|
|
2793
|
+
(e2) => e2 === "same" ? deepCopy(originalEvent) : isDiff(e2) ? diff.patch(deepCopy(originalEvent), e2.__diff) : e2
|
|
2794
|
+
);
|
|
2795
|
+
} catch (e2) {
|
|
2796
|
+
console.error(`[JITSU] Error applying '${destination.id}' changes to event: ${e2 == null ? void 0 : e2.message}`, e2);
|
|
2797
|
+
}
|
|
2798
|
+
} else {
|
|
2799
|
+
newEvents = [deepCopy(originalEvent)];
|
|
2800
|
+
}
|
|
2801
|
+
const credentials = __spreadValues(__spreadValues({}, destination.credentials), destination.options);
|
|
2802
|
+
if (destination.deviceOptions.type === "internal-plugin") {
|
|
2803
|
+
const plugin = internalDestinationPlugins[destination.deviceOptions.name];
|
|
2804
|
+
if (plugin) {
|
|
2805
|
+
for (const event of newEvents) {
|
|
2806
|
+
try {
|
|
2807
|
+
promises.push(plugin.handle(__spreadProps(__spreadValues({}, credentials), { debug }), event));
|
|
2808
|
+
} catch (e2) {
|
|
2809
|
+
console.warn(
|
|
2810
|
+
`[JITSU] Error processing event with internal plugin '${destination.deviceOptions.name}': ${e2 == null ? void 0 : e2.message}`,
|
|
2811
|
+
e2
|
|
2812
|
+
);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
} else {
|
|
2816
|
+
console.warn(
|
|
2817
|
+
`[JITSU] Unknown internal plugin '${destination.deviceOptions.name}' for destination '${destination.id}'`
|
|
2818
|
+
);
|
|
2819
|
+
}
|
|
2820
|
+
} else if (destination.deviceOptions.type === "analytics-plugin") {
|
|
2821
|
+
yield loadScript(destination.deviceOptions.packageCdn);
|
|
2822
|
+
const plugin = window[destination.deviceOptions.moduleVarName];
|
|
2823
|
+
if (!plugin) {
|
|
2824
|
+
console.warn(
|
|
2825
|
+
`[JITSU] Broken plugin '${destination.deviceOptions.packageCdn}' for destination '${destination.id}' - it doesn't export '${destination.deviceOptions.moduleVarName}' variable`
|
|
2826
|
+
);
|
|
2827
|
+
} else {
|
|
2828
|
+
let pluginInstance;
|
|
2829
|
+
try {
|
|
2830
|
+
pluginInstance = (typeof plugin === "function" ? plugin : plugin.init)(credentials);
|
|
2831
|
+
} catch (e2) {
|
|
2832
|
+
console.warn(
|
|
2833
|
+
`[JITSU] Error creating plugin '${destination.deviceOptions.moduleVarName}@${destination.deviceOptions.packageCdn}' for destination '${destination.id}': ${e2 == null ? void 0 : e2.message}`,
|
|
2834
|
+
e2
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
try {
|
|
2838
|
+
if (debug) {
|
|
2839
|
+
console.log(
|
|
2840
|
+
`[JITSU] Plugin '${destination.deviceOptions.moduleVarName}@${destination.deviceOptions.packageCdn}' for destination '${destination.id}' initialized with config:`,
|
|
2841
|
+
pluginInstance.config
|
|
2842
|
+
);
|
|
2843
|
+
}
|
|
2844
|
+
pluginInstance.initialize({ config: pluginInstance.config, instance: analyticsInstance });
|
|
2845
|
+
} catch (e2) {
|
|
2846
|
+
console.warn(
|
|
2847
|
+
`[JITSU] Error initializing plugin '${destination.deviceOptions.moduleVarName}@${destination.deviceOptions.packageCdn}' for destination '${destination.id}': ${e2 == null ? void 0 : e2.message}. Config: ${JSON.stringify(pluginInstance.config)}`,
|
|
2848
|
+
e2
|
|
2849
|
+
);
|
|
2850
|
+
continue;
|
|
2851
|
+
}
|
|
2852
|
+
if (pluginInstance[method]) {
|
|
2853
|
+
for (const event of newEvents) {
|
|
2854
|
+
try {
|
|
2855
|
+
pluginInstance[method]({
|
|
2856
|
+
payload: event,
|
|
2857
|
+
config: pluginInstance.config,
|
|
2858
|
+
instance: analyticsInstance
|
|
2859
|
+
});
|
|
2860
|
+
} catch (e2) {
|
|
2861
|
+
console.warn(
|
|
2862
|
+
`[JITSU] Error processing ${method}() with plugin '${destination.deviceOptions.moduleVarName}@${destination.deviceOptions.packageCdn}' for destination '${destination.id}': ${e2 == null ? void 0 : e2.message}`,
|
|
2863
|
+
e2
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
function looksLikeCuid(id) {
|
|
2874
|
+
return id.length === 25 && id.charAt(0) === "c";
|
|
2875
|
+
}
|
|
2876
|
+
function validateWriteKey(writeKey) {
|
|
2877
|
+
if (writeKey) {
|
|
2878
|
+
const [, secret] = writeKey.split(":", 2);
|
|
2879
|
+
if (!secret && !looksLikeCuid(writeKey)) {
|
|
2880
|
+
throw new Error(
|
|
2881
|
+
`Legacy write key detected - ${writeKey}! This format doesn't work anymore, it should be 'key:secret'. Please download a new key from Jitsu UI`
|
|
2882
|
+
);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
return writeKey;
|
|
2886
|
+
}
|
|
2887
|
+
function maskWriteKey(writeKey) {
|
|
2888
|
+
if (writeKey) {
|
|
2889
|
+
const [id, secret] = writeKey.split(":", 2);
|
|
2890
|
+
if (secret) {
|
|
2891
|
+
return `${id}:***`;
|
|
2892
|
+
} else {
|
|
2893
|
+
return "***";
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
return writeKey;
|
|
2897
|
+
}
|
|
2898
|
+
function getErrorHandler(opts) {
|
|
2899
|
+
const configuredHandler = opts.errorPolicy || "log";
|
|
2900
|
+
if (typeof configuredHandler === "function") {
|
|
2901
|
+
return configuredHandler;
|
|
2902
|
+
} else if (configuredHandler === "rethrow") {
|
|
2903
|
+
return (msg, ...args) => {
|
|
2904
|
+
throw new Error(msg);
|
|
2905
|
+
};
|
|
2906
|
+
} else {
|
|
2907
|
+
return (msg, ...args) => {
|
|
2908
|
+
console.error(msg, ...args);
|
|
2909
|
+
};
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
function send(method, payload, jitsuConfig, instance, store) {
|
|
2913
|
+
return __async(this, null, function* () {
|
|
2914
|
+
var _a, _b;
|
|
2915
|
+
const s2s = !!jitsuConfig.s2s;
|
|
2916
|
+
const debugHeader = jitsuConfig.debug ? { "X-Enable-Debug": "true" } : {};
|
|
2917
|
+
const adjustedPayload = adjustPayload(payload, jitsuConfig, store, s2s);
|
|
2918
|
+
if (jitsuConfig.echoEvents) {
|
|
2919
|
+
console.log(`[JITSU DEBUG] sending '${method}' event:`, adjustedPayload);
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
const url = s2s ? `${jitsuConfig.host}/api/s/s2s/${method}` : `${jitsuConfig.host}/api/s/${method}`;
|
|
2923
|
+
const fetch = jitsuConfig.fetch || globalThis.fetch;
|
|
2924
|
+
if (!fetch) {
|
|
2925
|
+
throw new Error(
|
|
2926
|
+
"Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope"
|
|
2927
|
+
);
|
|
2928
|
+
}
|
|
2929
|
+
const abortController = jitsuConfig.fetchTimeoutMs ? new AbortController() : void 0;
|
|
2930
|
+
const abortTimeout = jitsuConfig.fetchTimeoutMs ? setTimeout(() => {
|
|
2931
|
+
abortController == null ? void 0 : abortController.abort();
|
|
2932
|
+
}, jitsuConfig.fetchTimeoutMs) : void 0;
|
|
2933
|
+
const authHeader = jitsuConfig.writeKey ? { "X-Write-Key": jitsuConfig.writeKey } : {};
|
|
2934
|
+
const ipHeader = typeof ((_a = jitsuConfig.privacy) == null ? void 0 : _a.ipPolicy) === "undefined" || ((_b = jitsuConfig.privacy) == null ? void 0 : _b.ipPolicy) === "keep" ? {} : { "X-IP-Policy": jitsuConfig.privacy.ipPolicy };
|
|
2935
|
+
let fetchResult;
|
|
2936
|
+
try {
|
|
2937
|
+
fetchResult = yield fetch(url, {
|
|
2938
|
+
method: "POST",
|
|
2939
|
+
headers: __spreadValues(__spreadValues(__spreadValues({
|
|
2940
|
+
"Content-Type": "application/json"
|
|
2941
|
+
}, authHeader), debugHeader), ipHeader),
|
|
2942
|
+
body: JSON.stringify(adjustedPayload),
|
|
2943
|
+
signal: abortController == null ? void 0 : abortController.signal
|
|
2944
|
+
});
|
|
2945
|
+
if (abortTimeout) {
|
|
2946
|
+
clearTimeout(abortTimeout);
|
|
2947
|
+
}
|
|
2948
|
+
} catch (e2) {
|
|
2949
|
+
getErrorHandler(jitsuConfig)(`Call to ${url} failed with error ${e2.message}`);
|
|
2950
|
+
return Promise.resolve();
|
|
2951
|
+
}
|
|
2952
|
+
let responseText;
|
|
2953
|
+
try {
|
|
2954
|
+
responseText = yield fetchResult.text();
|
|
2955
|
+
} catch (e2) {
|
|
2956
|
+
console.warn(
|
|
2957
|
+
`Can't read response text from ${url} (status - ${fetchResult.status} ${fetchResult.statusText}): ${e2 == null ? void 0 : e2.message}`
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
if (jitsuConfig.debug) {
|
|
2961
|
+
console.log(
|
|
2962
|
+
`[JITSU DEBUG] ${url} replied ${fetchResult.status}: ${responseText}. Original payload:
|
|
2963
|
+
${JSON.stringify(
|
|
2964
|
+
adjustedPayload,
|
|
2965
|
+
null,
|
|
2966
|
+
2
|
|
2967
|
+
)}`
|
|
2968
|
+
);
|
|
2969
|
+
}
|
|
2970
|
+
if (!fetchResult.ok) {
|
|
2971
|
+
getErrorHandler(jitsuConfig)(
|
|
2972
|
+
`Call to ${url} failed with error: ${fetchResult.status} - ${fetchResult.statusText}: ${responseText}`
|
|
2973
|
+
);
|
|
2974
|
+
return Promise.resolve();
|
|
2975
|
+
}
|
|
2976
|
+
let responseJson;
|
|
2977
|
+
try {
|
|
2978
|
+
responseJson = JSON.parse(responseText);
|
|
2979
|
+
} catch (e2) {
|
|
2980
|
+
getErrorHandler(jitsuConfig)(`Can't parse JSON: ${responseText}: ${e2 == null ? void 0 : e2.message}`);
|
|
2981
|
+
return Promise.resolve();
|
|
2982
|
+
}
|
|
2983
|
+
if (responseJson.destinations && responseJson.destinations.length > 0) {
|
|
2984
|
+
if (jitsuConfig.s2s) {
|
|
2985
|
+
console.warn(
|
|
2986
|
+
`[JITSU] ${payload.type} responded with list of ${responseJson.destinations.length} destinations. However, this code is running in server-to-server mode, so destinations will be ignored`,
|
|
2987
|
+
jitsuConfig.debug ? JSON.stringify(responseJson.destinations, null, 2) : void 0
|
|
2988
|
+
);
|
|
2989
|
+
} else {
|
|
2990
|
+
if (isInBrowser()) {
|
|
2991
|
+
if (jitsuConfig.debug) {
|
|
2992
|
+
console.log(`[JITSU] Processing device destinations: `, JSON.stringify(responseJson.destinations, null, 2));
|
|
2993
|
+
}
|
|
2994
|
+
return processDestinations(responseJson.destinations, method, adjustedPayload, !!jitsuConfig.debug, instance);
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
return adjustedPayload;
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
var controllingTraits = ["$doNotSend"];
|
|
3002
|
+
function stripControllingTraits(traits) {
|
|
3003
|
+
const res = __spreadValues({}, traits);
|
|
3004
|
+
for (const key of controllingTraits) {
|
|
3005
|
+
delete res[key];
|
|
3006
|
+
}
|
|
3007
|
+
return res;
|
|
3008
|
+
}
|
|
3009
|
+
var jitsuAnalyticsPlugin = (jitsuOptions = {}, storage) => {
|
|
3010
|
+
mergeConfig(jitsuOptions, jitsuOptions);
|
|
3011
|
+
return {
|
|
3012
|
+
name: "jitsu",
|
|
3013
|
+
config: jitsuOptions,
|
|
3014
|
+
initialize: (args) => __async(null, null, function* () {
|
|
3015
|
+
const { config } = args;
|
|
3016
|
+
if (config.debug) {
|
|
3017
|
+
console.debug("[JITSU DEBUG] Initializing Jitsu plugin with config: ", JSON.stringify(config, null, 2));
|
|
3018
|
+
}
|
|
3019
|
+
if (!config.host && !config.echoEvents) {
|
|
3020
|
+
throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true");
|
|
3021
|
+
}
|
|
3022
|
+
validateWriteKey(config.writeKey);
|
|
3023
|
+
if (config.idEndpoint) {
|
|
3024
|
+
if (!isInBrowser()) {
|
|
3025
|
+
console.error(`[JITSU] 'idEndpoint' option can be used only in browser environment`);
|
|
3026
|
+
return;
|
|
3027
|
+
}
|
|
3028
|
+
try {
|
|
3029
|
+
const fetch = config.fetch || globalThis.fetch;
|
|
3030
|
+
const controller = new AbortController();
|
|
3031
|
+
setTimeout(() => controller.abort(), 1e3);
|
|
3032
|
+
const domain = config.cookieDomain || getTopLevelDomain(window.location.hostname);
|
|
3033
|
+
const res = yield fetch(config.idEndpoint + "?domain=" + encodeURIComponent(domain), {
|
|
3034
|
+
credentials: "include",
|
|
3035
|
+
signal: controller.signal
|
|
3036
|
+
});
|
|
3037
|
+
if (!res.ok) {
|
|
3038
|
+
console.error(`[JITSU] Can't fetch idEndpoint: ${res.status} - ${res.statusText}`);
|
|
3039
|
+
} else if (config.debug) {
|
|
3040
|
+
console.log(`[JITSU DEBUG] Fetch idEndpoint: ${res.status}`);
|
|
3041
|
+
}
|
|
3042
|
+
} catch (e2) {
|
|
3043
|
+
console.error(`[JITSU] Can't fetch idEndpoint: ${e2.message}`);
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
}),
|
|
3047
|
+
page: (args) => {
|
|
3048
|
+
var _a;
|
|
3049
|
+
const { payload, config, instance } = args;
|
|
3050
|
+
if ((_a = config.privacy) == null ? void 0 : _a.dontSend) {
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
return send("page", payload, config, instance, storage);
|
|
3054
|
+
},
|
|
3055
|
+
track: (args) => {
|
|
3056
|
+
var _a;
|
|
3057
|
+
const { payload, config, instance } = args;
|
|
3058
|
+
if ((_a = config.privacy) == null ? void 0 : _a.dontSend) {
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3061
|
+
return send("track", payload, config, instance, storage);
|
|
3062
|
+
},
|
|
3063
|
+
identify: (args) => {
|
|
3064
|
+
var _a, _b, _c;
|
|
3065
|
+
const { payload, config, instance } = args;
|
|
3066
|
+
if (((_a = config.privacy) == null ? void 0 : _a.dontSend) || ((_b = config.privacy) == null ? void 0 : _b.disableUserIds)) {
|
|
3067
|
+
return;
|
|
3068
|
+
}
|
|
3069
|
+
storage.setItem("__user_id", payload.userId);
|
|
3070
|
+
const doNotSend = (_c = payload.traits) == null ? void 0 : _c.$doNotSend;
|
|
3071
|
+
if (payload.traits && typeof payload.traits === "object") {
|
|
3072
|
+
payload.traits = stripControllingTraits(payload.traits);
|
|
3073
|
+
storage.setItem("__user_traits", payload.traits);
|
|
3074
|
+
}
|
|
3075
|
+
if (doNotSend) {
|
|
3076
|
+
return Promise.resolve();
|
|
3077
|
+
}
|
|
3078
|
+
return send("identify", payload, config, instance, storage);
|
|
3079
|
+
},
|
|
3080
|
+
reset: (args) => {
|
|
3081
|
+
const { config, instance } = args;
|
|
3082
|
+
storage.reset();
|
|
3083
|
+
if (config.debug) {
|
|
3084
|
+
console.log("[JITSU DEBUG] Resetting Jitsu plugin storage");
|
|
3085
|
+
}
|
|
3086
|
+
},
|
|
3087
|
+
methods: {
|
|
3088
|
+
//analytics doesn't support group as a base method, so we need to add it manually
|
|
3089
|
+
configure(newOptions) {
|
|
3090
|
+
var _a, _b, _c, _d;
|
|
3091
|
+
const idsWasDisabled = ((_a = jitsuOptions.privacy) == null ? void 0 : _a.disableUserIds) || ((_b = jitsuOptions.privacy) == null ? void 0 : _b.dontSend);
|
|
3092
|
+
mergeConfig(jitsuOptions, newOptions);
|
|
3093
|
+
const idsDisabledNow = ((_c = jitsuOptions.privacy) == null ? void 0 : _c.disableUserIds) || ((_d = jitsuOptions.privacy) == null ? void 0 : _d.dontSend);
|
|
3094
|
+
if (!idsDisabledNow && idsWasDisabled) {
|
|
3095
|
+
if (jitsuOptions.debug) {
|
|
3096
|
+
console.log("[JITSU] Enabling Anonymous ID. Generating new Id.");
|
|
3097
|
+
}
|
|
3098
|
+
const instance = this.instance;
|
|
3099
|
+
const newAnonymousId = uuid();
|
|
3100
|
+
const userState = instance.user();
|
|
3101
|
+
if (userState) {
|
|
3102
|
+
userState.anonymousId = newAnonymousId;
|
|
3103
|
+
}
|
|
3104
|
+
storage.setItem("__anon_id", newAnonymousId);
|
|
3105
|
+
instance.setAnonymousId(newAnonymousId);
|
|
3106
|
+
}
|
|
3107
|
+
},
|
|
3108
|
+
group(groupId, traits, options, callback) {
|
|
3109
|
+
var _a, _b;
|
|
3110
|
+
if (((_a = jitsuOptions.privacy) == null ? void 0 : _a.dontSend) || ((_b = jitsuOptions.privacy) == null ? void 0 : _b.disableUserIds)) {
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
if (typeof groupId === "number") {
|
|
3114
|
+
groupId = groupId + "";
|
|
3115
|
+
}
|
|
3116
|
+
const instance = this.instance;
|
|
3117
|
+
const user = instance.user();
|
|
3118
|
+
const userId = (options == null ? void 0 : options.userId) || (user == null ? void 0 : user.userId);
|
|
3119
|
+
const anonymousId = (options == null ? void 0 : options.anonymousId) || (user == null ? void 0 : user.anonymousId) || storage.getItem("__anon_id");
|
|
3120
|
+
storage.setItem("__group_id", groupId);
|
|
3121
|
+
const doNotSend = traits == null ? void 0 : traits.$doNotSend;
|
|
3122
|
+
if (traits && typeof traits === "object") {
|
|
3123
|
+
traits = stripControllingTraits(traits);
|
|
3124
|
+
storage.setItem("__group_traits", traits);
|
|
3125
|
+
}
|
|
3126
|
+
if (doNotSend) {
|
|
3127
|
+
return Promise.resolve();
|
|
3128
|
+
}
|
|
3129
|
+
return send(
|
|
3130
|
+
"group",
|
|
3131
|
+
__spreadValues(__spreadValues({ type: "group", groupId, traits }, anonymousId ? { anonymousId } : {}), userId ? { userId } : {}),
|
|
3132
|
+
jitsuOptions,
|
|
3133
|
+
instance,
|
|
3134
|
+
storage
|
|
3135
|
+
);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
};
|
|
3139
|
+
};
|
|
3140
|
+
var seedCounter = 0;
|
|
3141
|
+
function getSeed() {
|
|
3142
|
+
var _a;
|
|
3143
|
+
seedCounter = (seedCounter + 1) % Number.MAX_SAFE_INTEGER;
|
|
3144
|
+
const defaultSeed = Date.now() % 2147483647;
|
|
3145
|
+
const seed = isInBrowser() ? ((_a = window == null ? void 0 : window.performance) == null ? void 0 : _a.now()) || defaultSeed : defaultSeed;
|
|
3146
|
+
return seed + seedCounter;
|
|
3147
|
+
}
|
|
3148
|
+
function randomId(hashString = "") {
|
|
3149
|
+
const d3 = Date.now();
|
|
3150
|
+
return (Math.random() * d3 * hash(hashString != null ? hashString : "", getSeed()) % Number.MAX_SAFE_INTEGER).toString(36) + (Math.random() * d3 * hash(hashString != null ? hashString : "", getSeed()) % Number.MAX_SAFE_INTEGER).toString(36);
|
|
3151
|
+
}
|
|
3152
|
+
function uuid() {
|
|
3153
|
+
var u3 = "", m4 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", i4 = 0, rb = Math.random() * 4294967295 | 0;
|
|
3154
|
+
while (i4++ < 36) {
|
|
3155
|
+
var c4 = m4[i4 - 1], r3 = rb & 15, v2 = c4 == "x" ? r3 : r3 & 3 | 8;
|
|
3156
|
+
u3 += c4 == "-" || c4 == "4" ? c4 : v2.toString(16);
|
|
3157
|
+
rb = i4 % 8 == 0 ? Math.random() * 4294967295 | 0 : rb >> 4;
|
|
3158
|
+
}
|
|
3159
|
+
return u3;
|
|
3160
|
+
}
|
|
3161
|
+
function hash(str, seed = 0) {
|
|
3162
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
3163
|
+
for (let i4 = 0, ch; i4 < str.length; i4++) {
|
|
3164
|
+
ch = str.charCodeAt(i4);
|
|
3165
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
3166
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
3167
|
+
}
|
|
3168
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
3169
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
3170
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
// src/index.ts
|
|
3174
|
+
function parse(input) {
|
|
3175
|
+
let value = input;
|
|
3176
|
+
if ((input == null ? void 0 : input.indexOf("%7B%22")) === 0) {
|
|
3177
|
+
value = decodeURIComponent(input);
|
|
3178
|
+
}
|
|
3179
|
+
try {
|
|
3180
|
+
value = JSON.parse(value);
|
|
3181
|
+
if (value === "true") return true;
|
|
3182
|
+
if (value === "false") return false;
|
|
3183
|
+
if (typeof value === "object") return value;
|
|
3184
|
+
if (parseFloat(value) === value) {
|
|
3185
|
+
value = parseFloat(value);
|
|
3186
|
+
}
|
|
3187
|
+
} catch (e2) {
|
|
3188
|
+
}
|
|
3189
|
+
if (value === null || value === "") {
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
return value;
|
|
3193
|
+
}
|
|
3194
|
+
function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
|
|
3195
|
+
var _a, _c, _d;
|
|
3196
|
+
const storageCache = {};
|
|
3197
|
+
const cachingStorageWrapper = (persistentStorage) => ({
|
|
3198
|
+
setItem(key, val) {
|
|
3199
|
+
var _a2, _b2;
|
|
3200
|
+
if (((_a2 = opts.privacy) == null ? void 0 : _a2.dontSend) || ((_b2 = opts.privacy) == null ? void 0 : _b2.disableUserIds)) {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
if (opts.debug) {
|
|
3204
|
+
console.log(`[JITSU DEBUG] Caching storage setItem: ${key}=${val}`);
|
|
3205
|
+
}
|
|
3206
|
+
storageCache[key] = val;
|
|
3207
|
+
persistentStorage.setItem(key, val);
|
|
3208
|
+
},
|
|
3209
|
+
getItem(key) {
|
|
3210
|
+
var _a2, _b2;
|
|
3211
|
+
if (((_a2 = opts.privacy) == null ? void 0 : _a2.dontSend) || ((_b2 = opts.privacy) == null ? void 0 : _b2.disableUserIds)) {
|
|
3212
|
+
return;
|
|
3213
|
+
}
|
|
3214
|
+
const value = storageCache[key] || persistentStorage.getItem(key);
|
|
3215
|
+
if (opts.debug) {
|
|
3216
|
+
console.log(
|
|
3217
|
+
`[JITSU DEBUG] Caching storage getItem: ${key}=${value}. Evicted from cache: ${!storageCache[key]}`
|
|
3218
|
+
);
|
|
3219
|
+
}
|
|
3220
|
+
return value;
|
|
3221
|
+
},
|
|
3222
|
+
reset() {
|
|
3223
|
+
for (const key of [...Object.keys(storageCache)]) {
|
|
3224
|
+
delete storageCache[key];
|
|
3225
|
+
}
|
|
3226
|
+
persistentStorage.reset();
|
|
3227
|
+
},
|
|
3228
|
+
removeItem(key) {
|
|
3229
|
+
if (opts.debug) {
|
|
3230
|
+
console.log(`[JITSU DEBUG] Caching storage removeItem: ${key}`);
|
|
3231
|
+
}
|
|
3232
|
+
delete storageCache[key];
|
|
3233
|
+
persistentStorage.removeItem(key);
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
const storage = cachingStorageWrapper(((_a = rt.store) == null ? void 0 : _a.call(rt)) || createInMemoryStorage(opts.debug));
|
|
3237
|
+
const analytics = analyticsLib({
|
|
3238
|
+
debug: !!opts.debug,
|
|
3239
|
+
storage,
|
|
3240
|
+
plugins: [jitsuAnalyticsPlugin(opts, storage), ...plugins]
|
|
3241
|
+
});
|
|
3242
|
+
const a5 = __spreadProps(__spreadValues({}, analytics), {
|
|
3243
|
+
page: (...args) => {
|
|
3244
|
+
if (args.length === 2 && typeof args[0] === "string" && typeof args[1] === "object") {
|
|
3245
|
+
return analytics.page(__spreadValues({
|
|
3246
|
+
name: args[0]
|
|
3247
|
+
}, args[1]));
|
|
3248
|
+
} else {
|
|
3249
|
+
return analytics.page(...args);
|
|
3250
|
+
}
|
|
3251
|
+
},
|
|
3252
|
+
identify: (...args) => {
|
|
3253
|
+
if (args[0] && typeof args[0] !== "object" && typeof args[0] !== "string") {
|
|
3254
|
+
args[0] = args[0] + "";
|
|
3255
|
+
}
|
|
3256
|
+
const storage2 = analytics.storage;
|
|
3257
|
+
const storageWrapper = cachingStorageWrapper(storage2);
|
|
3258
|
+
if (typeof args[0] === "string") {
|
|
3259
|
+
storageWrapper.setItem("__user_id", args[0]);
|
|
3260
|
+
} else if (typeof args[0] === "object") {
|
|
3261
|
+
storageWrapper.setItem("__user_traits", args[0]);
|
|
3262
|
+
}
|
|
3263
|
+
if (args.length === 2 && typeof args[1] === "object") {
|
|
3264
|
+
storageWrapper.setItem("__user_traits", args[1]);
|
|
3265
|
+
}
|
|
3266
|
+
return analytics.identify(...args);
|
|
3267
|
+
},
|
|
3268
|
+
setContextProperty(name, value) {
|
|
3269
|
+
if (opts.debug) {
|
|
3270
|
+
console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
|
|
3271
|
+
}
|
|
3272
|
+
if (!opts.defaultPayloadContext) {
|
|
3273
|
+
opts.defaultPayloadContext = {
|
|
3274
|
+
[name]: value
|
|
3275
|
+
};
|
|
3276
|
+
} else {
|
|
3277
|
+
opts.defaultPayloadContext[name] = value;
|
|
3278
|
+
}
|
|
3279
|
+
},
|
|
3280
|
+
getContextProperty(name) {
|
|
3281
|
+
var _a2;
|
|
3282
|
+
if (opts.debug) {
|
|
3283
|
+
console.log(`[JITSU DEBUG] Getting context property '${name}'`);
|
|
3284
|
+
}
|
|
3285
|
+
return (_a2 = opts.defaultPayloadContext) == null ? void 0 : _a2[name];
|
|
3286
|
+
},
|
|
3287
|
+
setAnonymousId: (id) => {
|
|
3288
|
+
if (opts.debug) {
|
|
3289
|
+
console.log("[JITSU DEBUG] Setting anonymous id to " + id);
|
|
3290
|
+
}
|
|
3291
|
+
storage.setItem("__anon_id", id);
|
|
3292
|
+
const userState = analytics.user();
|
|
3293
|
+
if (userState) {
|
|
3294
|
+
userState.anonymousId = id;
|
|
3295
|
+
}
|
|
3296
|
+
analytics.setAnonymousId(id);
|
|
3297
|
+
},
|
|
3298
|
+
reset() {
|
|
3299
|
+
return __async(this, null, function* () {
|
|
3300
|
+
if (opts.debug) {
|
|
3301
|
+
console.log("[JITSU DEBUG] Called reset(). Storage state", JSON.stringify(analytics.user()));
|
|
3302
|
+
}
|
|
3303
|
+
storage.reset();
|
|
3304
|
+
yield analytics.reset();
|
|
3305
|
+
this.setAnonymousId(uuid());
|
|
3306
|
+
if (opts.debug) {
|
|
3307
|
+
console.log("[JITSU DEBUG] User state after reset", JSON.stringify(analytics.user()));
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
},
|
|
3311
|
+
configure(options) {
|
|
3312
|
+
return __async(this, null, function* () {
|
|
3313
|
+
var _a2, _b2;
|
|
3314
|
+
if (opts.debug) {
|
|
3315
|
+
console.log("[JITSU DEBUG] Update Jitsu config with", JSON.stringify(options));
|
|
3316
|
+
}
|
|
3317
|
+
if (((_a2 = options.privacy) == null ? void 0 : _a2.disableUserIds) || ((_b2 = options.privacy) == null ? void 0 : _b2.dontSend)) {
|
|
3318
|
+
storage.reset();
|
|
3319
|
+
}
|
|
3320
|
+
for (const plugin of Object.values(analytics.plugins)) {
|
|
3321
|
+
if (typeof plugin["configure"] === "function") {
|
|
3322
|
+
plugin["configure"](options);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
});
|
|
3326
|
+
},
|
|
3327
|
+
group(groupId, traits, options, callback) {
|
|
3328
|
+
return __async(this, null, function* () {
|
|
3329
|
+
const results = [];
|
|
3330
|
+
for (const plugin of Object.values(analytics.plugins)) {
|
|
3331
|
+
if (plugin["group"]) {
|
|
3332
|
+
results.push(yield plugin["group"](groupId, traits, options, callback));
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
return results[0];
|
|
3336
|
+
});
|
|
3337
|
+
},
|
|
3338
|
+
getConfiguration() {
|
|
3339
|
+
return opts;
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
if (((_c = opts.privacy) == null ? void 0 : _c.disableUserIds) || ((_d = opts.privacy) == null ? void 0 : _d.dontSend)) {
|
|
3343
|
+
storage.reset();
|
|
3344
|
+
}
|
|
3345
|
+
return a5;
|
|
3346
|
+
}
|
|
3347
|
+
function fixOptions(opts) {
|
|
3348
|
+
var _a, _b;
|
|
3349
|
+
return __spreadProps(__spreadValues({}, opts), {
|
|
3350
|
+
host: ((_a = opts.host) != null ? _a : "").indexOf("https://") !== 0 && ((_b = opts.host) != null ? _b : "").indexOf("http://") !== 0 ? `https://${opts.host}` : opts.host
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
function jitsuAnalytics(_opts) {
|
|
3354
|
+
const opts = fixOptions(_opts);
|
|
3355
|
+
const inBrowser = isInBrowser();
|
|
3356
|
+
const rt = opts.runtime || (inBrowser ? windowRuntime(opts) : emptyRuntime(opts));
|
|
3357
|
+
return createUnderlyingAnalyticsInstance(opts, rt);
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
// src/browser.ts
|
|
3361
|
+
function snakeToCamel(s2) {
|
|
3362
|
+
return s2.replace(/([-_][a-z])/gi, ($1) => {
|
|
3363
|
+
return $1.toUpperCase().replace("-", "").replace("_", "");
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
var trimPrefix = (s2, prefix) => s2.replace(new RegExp(`^${prefix}`), "");
|
|
3367
|
+
var defaultParser = (nestedPath = []) => ({
|
|
3368
|
+
path: (name) => [
|
|
3369
|
+
...nestedPath,
|
|
3370
|
+
snakeToCamel(nestedPath.length > 0 ? trimPrefix(name, nestedPath.join("-") + "-") : name)
|
|
3371
|
+
],
|
|
3372
|
+
parse: (arg) => arg
|
|
3373
|
+
});
|
|
3374
|
+
var booleanParser = (nestedPath = []) => __spreadProps(__spreadValues({}, defaultParser(nestedPath)), {
|
|
3375
|
+
parse: (arg) => arg === "true" || arg === "1" || arg === "yes"
|
|
3376
|
+
});
|
|
3377
|
+
var jsonParser = (nestedPath = []) => __spreadProps(__spreadValues({}, defaultParser(nestedPath)), {
|
|
3378
|
+
parse: (arg) => {
|
|
3379
|
+
try {
|
|
3380
|
+
return JSON.parse(arg);
|
|
3381
|
+
} catch (e2) {
|
|
3382
|
+
console.error(`Can't parse Jitsu Option as JSON: ${arg}`);
|
|
3383
|
+
return {};
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3387
|
+
var parsers = {
|
|
3388
|
+
debug: booleanParser(),
|
|
3389
|
+
"privacy-disable-user-ids": booleanParser(["privacy"]),
|
|
3390
|
+
"privacy-dont-send": booleanParser(["privacy"]),
|
|
3391
|
+
"privacy-ip-policy": defaultParser(["privacy"]),
|
|
3392
|
+
"echo-events": booleanParser(),
|
|
3393
|
+
"init-only": booleanParser(),
|
|
3394
|
+
"cookie-names": jsonParser(),
|
|
3395
|
+
"cookie-capture": jsonParser(),
|
|
3396
|
+
"default-payload-context": jsonParser()
|
|
3397
|
+
};
|
|
3398
|
+
function getParser(name) {
|
|
3399
|
+
return parsers[name] || defaultParser();
|
|
3400
|
+
}
|
|
3401
|
+
function setPath(obj, path, value) {
|
|
3402
|
+
let current = obj;
|
|
3403
|
+
let i4 = 0;
|
|
3404
|
+
for (; i4 < path.length - 1; i4++) {
|
|
3405
|
+
const key = path[i4];
|
|
3406
|
+
current[key] = current[key] || {};
|
|
3407
|
+
current = current[key];
|
|
3408
|
+
}
|
|
3409
|
+
current[path[i4]] = value;
|
|
3410
|
+
}
|
|
3411
|
+
function getScriptAttributes(scriptElement) {
|
|
3412
|
+
return scriptElement.getAttributeNames().filter((name) => name.indexOf("data-") === 0).map((name) => name.substring("data-".length)).reduce((res, name) => {
|
|
3413
|
+
var _a;
|
|
3414
|
+
const parser = getParser(name);
|
|
3415
|
+
const path = ((_a = parser.path) == null ? void 0 : _a.call(parser, name)) || [name];
|
|
3416
|
+
const attrValue = scriptElement.getAttribute(`data-${name}`);
|
|
3417
|
+
if (attrValue !== null) {
|
|
3418
|
+
setPath(res, path, parser.parse(attrValue));
|
|
3419
|
+
}
|
|
3420
|
+
return res;
|
|
3421
|
+
}, {});
|
|
3422
|
+
}
|
|
3423
|
+
function runCallback(callback, jitsu) {
|
|
3424
|
+
if (typeof callback === "function") {
|
|
3425
|
+
callback(jitsu);
|
|
3426
|
+
} else if (Array.isArray(callback) && typeof callback[0] === "string") {
|
|
3427
|
+
const [method, ...args] = callback;
|
|
3428
|
+
if (typeof jitsu[method] === "function") {
|
|
3429
|
+
jitsu[method](...args);
|
|
3430
|
+
} else {
|
|
3431
|
+
console.warn(`Method ${method} is not supported, ignoring callback`);
|
|
3432
|
+
}
|
|
3433
|
+
} else {
|
|
3434
|
+
console.warn(`Invalid jitsu queue callback`, callback);
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
(function() {
|
|
3438
|
+
function readJitsuOptions() {
|
|
3439
|
+
const scriptElement = window.document.currentScript;
|
|
3440
|
+
if (!scriptElement) {
|
|
3441
|
+
throw new Error(`Can't find script element`);
|
|
3442
|
+
}
|
|
3443
|
+
const host = new URL(scriptElement.src).origin;
|
|
3444
|
+
return __spreadProps(__spreadValues(__spreadValues({}, (window == null ? void 0 : window.jitsuConfig) || {}), getScriptAttributes(scriptElement)), { host });
|
|
3445
|
+
}
|
|
3446
|
+
const options = readJitsuOptions();
|
|
3447
|
+
const JITSU_V2_ID = options.namespace || "jitsu";
|
|
3448
|
+
if (options.debug) {
|
|
3449
|
+
console.log(`Jitsu options: `, JSON.stringify(options));
|
|
3450
|
+
}
|
|
3451
|
+
const jitsu = jitsuAnalytics(options);
|
|
3452
|
+
if (options.onload) {
|
|
3453
|
+
const onloadFunction = window[options.onload];
|
|
3454
|
+
if (!onloadFunction) {
|
|
3455
|
+
console.warn(`onload function ${options.onload} is not found in window`);
|
|
3456
|
+
}
|
|
3457
|
+
if (typeof onloadFunction === "function") {
|
|
3458
|
+
onloadFunction(jitsu);
|
|
3459
|
+
} else {
|
|
3460
|
+
console.warn(`onload function ${options.onload} is not callable: ${typeof onloadFunction}`);
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
window[JITSU_V2_ID] = jitsu;
|
|
3464
|
+
const callbackQueue = window[JITSU_V2_ID + "Q"] && window[JITSU_V2_ID + "Q"].length ? [...window[JITSU_V2_ID + "Q"]] : [];
|
|
3465
|
+
window[JITSU_V2_ID + "Q"] = {
|
|
3466
|
+
push: (callback) => {
|
|
3467
|
+
if (typeof callback === "function") {
|
|
3468
|
+
callback(jitsu);
|
|
3469
|
+
} else {
|
|
3470
|
+
console.warn(`${JITSU_V2_ID}Q.push() accepts only function, ${typeof callback} given`);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3474
|
+
if (options.debug) {
|
|
3475
|
+
console.log(`[JITSU DEBUG] Jitsu callback queue size: ${callbackQueue.length}`, callbackQueue);
|
|
3476
|
+
}
|
|
3477
|
+
callbackQueue.forEach((callback) => {
|
|
3478
|
+
try {
|
|
3479
|
+
runCallback(callback, jitsu);
|
|
3480
|
+
} catch (e2) {
|
|
3481
|
+
console.warn(`Error processing callback from Jitsu queue`, e2);
|
|
3482
|
+
}
|
|
3483
|
+
});
|
|
3484
|
+
if (!options.initOnly) {
|
|
3485
|
+
jitsu.page();
|
|
3486
|
+
}
|
|
3487
|
+
})();
|
|
3488
|
+
})();
|