{"version":3,"sources":["src/utils/select-elements.utils.ts"],"names":["getParentElement","el","parentElement","rootNodeEl","getRootNode","host","fromShadowRoot","Error","closestElement","selector","this","document","window","closest","getHostFromEvent","e","composedPath","target","targetRootNode"],"mappings":"MAAaA,EAAoBC,IAC/B,IAAKA,EAAGC,cAAe,CACrB,MAAMC,EAAaF,EAAGG,cAEtB,GAAKD,EAA0BE,KAAM,CAEnC,MAAO,CAAEJ,GAAKE,EAA0BE,KAAMC,eAAgB,MAEhE,MAAM,IAAIC,MAAM,6BAElB,MAAO,CAAEN,GAAIA,EAAGC,sBAGLM,EAAiB,CAACC,EAAkBR,EAAUS,aACzD,IAAKT,EAAI,OAAO,KAEhB,OACGA,GAAMA,IAAOU,UAAYV,IAAOW,QAAUX,EAAGY,QAAQJ,IAAcD,EAAeC,EAAUR,EAAGG,cAAcC,aAIrGS,EAAoBC,IAC/B,MAAMC,EAAeD,EAAEC,eACvB,MAAMC,EAASD,EAAa,GAC5B,MAAME,EAAiBD,EAAOb,cAE9B,OAAQc,EAA8Bb","sourcesContent":["export const getParentElement = (el: Element): { el: Element; fromShadowRoot?: boolean } => {\n if (!el.parentElement) {\n const rootNodeEl = el.getRootNode();\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if ((rootNodeEl as ShadowRoot).host) {\n // Shadow root is the parent\n return { el: (rootNodeEl as ShadowRoot).host, fromShadowRoot: true };\n }\n throw new Error('Parent element not found.');\n }\n return { el: el.parentElement };\n};\n\nexport const closestElement = (selector: string, el: any = this): Element | null => {\n if (!el) return null;\n\n return (\n (el && el !== document && el !== window && el.closest(selector)) || closestElement(selector, el.getRootNode().host)\n );\n};\n\nexport const getHostFromEvent = (e: Event): Element | null => {\n const composedPath = e.composedPath();\n const target = composedPath[0] as HTMLElement;\n const targetRootNode = target.getRootNode();\n\n return (targetRootNode as ShadowRoot).host;\n};\n"]}