{"version":3,"file":"FocusUtils.DJObOLvR.mjs","names":[],"sources":["https:/framerusercontent.com/modules/6mZD1mkIUALd1E2W5DL8/cOrZhXPvCgxix4JUXL87/FocusUtils.js"],"sourcesContent":["const FOCUSABLE_SELECTORS=[\"a\",\"button\",\"input\",\"textarea\",\"select\",\"details\",'[tabindex]:not([tabindex=\"-1\"])'];const allFocusableSelectors=FOCUSABLE_SELECTORS.map(selector=>{return`${selector}:not([disabled])`;});/**\n * Returns the first focusable element.\n * It will not target disabled elements, or elements with inert or there children\n */export const getFirstFocusableElement=element=>{const selectableItems=element&&element.querySelectorAll(String(allFocusableSelectors))||null;if(!selectableItems)return null;const filteredItems=[];[...selectableItems].forEach(item=>filterElementsRecursively(item,filteredItems));return filteredItems[0]||null;};/** Filter out selectable items whose ancestors have the \"inert\" attribute  */const filterElementsRecursively=(item,itemsArr)=>{let ancestor=item.parentElement;// Cleans items that have inert in there parents tree\nwhile(ancestor){if(ancestor.hasAttribute(\"inert\")){return;}ancestor=ancestor.parentElement;}// Cleans elements that are specifically set as `do not auto focus`\nif(item.hasAttribute(\"data-noautofocus\")){return;}if(item.getAttribute(\"tabindex\")===\"-1\"){return;}itemsArr.push(item);};\nexport const __FramerMetadata__ = {\"exports\":{\"getFirstFocusableElement\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FocusUtils.map"],"mappings":"wEAAuH,EAA7F,CAAC,IAAI,SAAS,QAAQ,WAAW,SAAS,UAAU,kCAAkC,CAAiD,IAAI,GAAiB,GAAG,EAAS,kBAAoB,CAGtM,EAAyB,GAAS,CAAC,IAAM,EAAgB,GAAS,EAAQ,iBAAiB,OAAO,EAAsB,CAAC,EAAE,KAAK,GAAG,CAAC,EAAgB,OAAO,KAAK,IAAM,EAAc,EAAE,CAAmF,MAAlF,CAAC,GAAG,EAAgB,CAAC,QAAQ,GAAM,EAA0B,EAAK,EAAc,CAAC,CAAQ,EAAc,IAAI,MAA2F,GAA2B,EAAK,IAAW,CAAC,IAAI,EAAS,EAAK,cAC3c,KAAM,GAAS,CAAC,GAAG,EAAS,aAAa,QAAQ,CAAE,OAAQ,EAAS,EAAS,cAC1E,EAAK,aAAa,mBAAmB,EAAa,EAAK,aAAa,WAAW,GAAG,MAAc,EAAS,KAAK,EAAK"}