{"version":3,"names":["buildCustomEvent","name","detail","CustomEvent","bubbles","cancelable","composed","listenOnce","element","type","listener","options","_listener","evt","removeEventListener","handleEvent","call","addEventListener"],"sources":["src/utils/event-utils.ts"],"sourcesContent":["export function buildCustomEvent<T>(name: string, detail: T) {\n  return new CustomEvent(name, {\n    detail,\n    // Event will bubble up the DOM until it is caught\n    bubbles: true,\n    // Allows to verify if event is caught (cancelled). If it's not caught, it won't be initialized.\n    cancelable: true,\n    // Allows to compose Atomic components inside one another, event will go across DOM/Shadow DOM\n    composed: true,\n  });\n}\n\nexport function listenOnce<K extends keyof HTMLElementEventMap>(\n  element: HTMLElement,\n  type: K,\n  listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n  options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n  element: HTMLElement,\n  type: string,\n  listener: EventListenerOrEventListenerObject,\n  options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n  element: HTMLElement,\n  type: string,\n  listener: EventListenerOrEventListenerObject,\n  options?: boolean | AddEventListenerOptions\n): void {\n  const _listener: EventListener = (evt: Event) => {\n    element.removeEventListener(type, _listener, options);\n    typeof listener === 'object'\n      ? listener.handleEvent.call(element, evt)\n      : listener.call(element, evt);\n  };\n  element.addEventListener(type, _listener, options);\n}\n"],"mappings":"SAAgBA,EAAoBC,EAAcC,GAChD,OAAO,IAAIC,YAAYF,EAAM,CAC3BC,SAEAE,QAAS,KAETC,WAAY,KAEZC,SAAU,MAEd,C,SAcgBC,EACdC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAA4BC,IAChCL,EAAQM,oBAAoBL,EAAMG,EAAWD,UACtCD,IAAa,SAChBA,EAASK,YAAYC,KAAKR,EAASK,GACnCH,EAASM,KAAKR,EAASK,EAAI,EAEjCL,EAAQS,iBAAiBR,EAAMG,EAAWD,EAC5C,Q"}