import{g as k,i as O}from"./index-DXTs-5KJ.js";import"./index-BL19ZEBD.js";import"./inherits_browser-Dbwsx_3T.js";function p(a,t){return Object.keys(t).reduce(function(e,i){if(i.startsWith(a)){var r=i.substr(a.length);e[r]=t[i]}return e},{})}function C(a,t){var e=document.createElement("a");e.href=t;var i=e.search.slice(1),r=i.split("&").reduce(function(v,P){var j=P.split("="),b=j[0],S=j[1];return v[b]=k(S),v},{}),s=[],f=r.ajs_uid,m=r.ajs_event,c=r.ajs_aid,n=O(a.options.useQueryString)?a.options.useQueryString:{},u=n.aid,l=u===void 0?/.+/:u,_=n.uid,A=_===void 0?/.+/:_;if(c){var d=Array.isArray(r.ajs_aid)?r.ajs_aid[0]:r.ajs_aid;l.test(d)&&a.setAnonymousId(d)}if(f){var o=Array.isArray(r.ajs_uid)?r.ajs_uid[0]:r.ajs_uid;if(A.test(o)){var g=p("ajs_trait_",r);s.push(a.identify(o,g))}}if(m){var h=Array.isArray(r.ajs_event)?r.ajs_event[0]:r.ajs_event,y=p("ajs_prop_",r);s.push(a.track(h,y))}return Promise.all(s)}export{C as queryString};
