{"version":3,"file":"closest-DVOSz_PH.js","sources":["../../../app/frontend/javascript/components/tools/closest.js"],"sourcesContent":["const matchesFn =\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector ||\n function(selector) {\n const allMatches = (this.document || this.ownerDocument).querySelectorAll(selector)\n allMatches.forEach(function(match) {\n if(match == this) {\n return true\n }\n })\n }\n\nconst closestFn = Element.prototype.closest || function(selector) {\n const document = this.document || this.ownerDocument\n const allMatching = document.querySelectorAll(selector)\n let element = this\n\n while(true) {\n if (Array.from(allMatching).includes(element)) { return element }\n element = element.parentElement\n if (!element || (element.nodeType !== 1)) { return; }\n }\n}\n\n\nexport function matches (element, selector) {\n return matchesFn.apply(element, [selector])\n}\n\nexport function closest (element, selector) {\n return closestFn.apply(element, [selector])\n}\n"],"names":["matchesFn","selector","match","closestFn","allMatching","element","matches","closest"],"mappings":"AAAA,MAAMA,EACJ,QAAQ,UAAU,iBAClB,QAAQ,UAAU,oBAClB,QAAQ,UAAU,mBAClB,QAAQ,UAAU,kBAClB,QAAQ,UAAU,uBAClB,SAASC,EAAU,EACG,KAAK,UAAY,KAAK,eAAe,iBAAiBA,CAAQ,EACvE,QAAQ,SAASC,EAAO,CACjC,GAAGA,GAAS,KACV,MAAO,EAEV,CAAA,CACL,EAEMC,EAAY,QAAQ,UAAU,SAAW,SAASF,EAAU,CAEhE,MAAMG,GADW,KAAK,UAAY,KAAK,eACV,iBAAiBH,CAAQ,EACtD,IAAII,EAAU,KAEd,OAAY,CACV,GAAI,MAAM,KAAKD,CAAW,EAAE,SAASC,CAAO,EAAK,OAAOA,EAExD,GADAA,EAAUA,EAAQ,cACd,CAACA,GAAYA,EAAQ,WAAa,EAAM,MAChD,CACA,EAGO,SAASC,EAASD,EAASJ,EAAU,CAC1C,OAAOD,EAAU,MAAMK,EAAS,CAACJ,CAAQ,CAAC,CAC5C,CAEO,SAASM,EAASF,EAASJ,EAAU,CAC1C,OAAOE,EAAU,MAAME,EAAS,CAACJ,CAAQ,CAAC,CAC5C"}