import{d as c}from"./delegate.89c887b8.js";import{p as h,t as l,a as p,b as n,g as u,c as f}from"./usage.9e37022f.js";class b{constructor(t,e){if(l(t,p.EVENT_TRACKER),!window.addEventListener)return;const s={events:["click"],fieldsObj:{},attributePrefix:"ga-"};this.opts=n(s,e),this.tracker=t,this.handleEvents=this.handleEvents.bind(this);const r="["+this.opts.attributePrefix+"on]";this.delegates={},this.opts.events.forEach(i=>{this.delegates[i]=c(document,i,r,this.handleEvents,{composed:!0,useCapture:!0})})}handleEvents(t,e){const s=this.opts.attributePrefix;if(e.getAttribute(s+"on").split(/\s*,\s*/).indexOf(t.type)<0)return;const i={transport:"beacon"},a=u(e,s),o=n({},this.opts.fieldsObj,a),d=a.hitType||"event";this.tracker.send(d,f(i,o,this.tracker,this.opts.hitFilter,e,t))}remove(){Object.keys(this.delegates).forEach(t=>{this.delegates[t].destroy()})}}h("eventTracker",b);
