import{r as k}from"./a-14d94dc6.js";import{i as O}from"./helpers-562b3d1f.js";import"./index-0d8158eb.js";import"./layout-9e52ad07.js";import"./use-notification-56391e62.js";import"./index-aba65090.js";import"./error-messages-d2d0bb30.js";import"./index.esm-07f1e6d3.js";import"./index-845e4de2.js";import"./index-c0b93546.js";import"./index-9af9f9f3.js";function m(a,e){return Object.keys(e).reduce(function(i,t){if(t.startsWith(a)){var r=t.substr(a.length);i[r]=e[t]}return i},{})}function z(a,e){var i=document.createElement("a");i.href=e;var t=i.search.slice(1),r=t.split("&").reduce(function(d,P){var v=P.split("="),b=v[0],S=v[1];return d[b]=k(S),d},{}),s=[],j=r.ajs_uid,f=r.ajs_event,c=r.ajs_aid,o=O(a.options.useQueryString)?a.options.useQueryString:{},n=o.aid,l=n===void 0?/.+/:n,u=o.uid,A=u===void 0?/.+/:u;if(c){var p=Array.isArray(r.ajs_aid)?r.ajs_aid[0]:r.ajs_aid;l.test(p)&&a.setAnonymousId(p)}if(j){var _=Array.isArray(r.ajs_uid)?r.ajs_uid[0]:r.ajs_uid;if(A.test(_)){var h=m("ajs_trait_",r);s.push(a.identify(_,h))}}if(f){var y=Array.isArray(r.ajs_event)?r.ajs_event[0]:r.ajs_event,g=m("ajs_prop_",r);s.push(a.track(y,g))}return Promise.all(s)}export{z as queryString};
