{"version":3,"sources":["../src/utils/tagFocusUtils.ts"],"sourcesContent":["/**\n * CSS selector used to locate focusable tag elements inside a TagPickerGroup.\n *\n * The focusgroup polyfill manages roving `tabindex` on the tags, so items carry\n * `tabindex=\"-1\"` and remain programmatically focusable without filtering by value.\n */\nconst FOCUSABLE_TAG_SELECTOR = 'button, [tabindex]';\n\n/**\n * Returns the NodeList of focusable tag elements within `container`, or an empty\n * NodeList when the container has no matching children.\n */\nfunction getFocusableTags(container: HTMLElement): NodeListOf<HTMLElement> {\n  return container.querySelectorAll<HTMLElement>(FOCUSABLE_TAG_SELECTOR);\n}\n\n/**\n * Moves focus to the last focusable element within the tag group container.\n * Does nothing when the container is empty or contains no focusable tags.\n */\nexport function focusLastTag(container: HTMLElement): void {\n  const focusable = getFocusableTags(container);\n  focusable[focusable.length - 1]?.focus();\n}\n\n/**\n * Returns `true` when `target` is the last focusable element within the tag\n * group container; `false` otherwise (including when the container is empty).\n */\nexport function isLastFocusableTag(container: HTMLElement, target: HTMLElement): boolean {\n  const focusable = getFocusableTags(container);\n  return focusable.length > 0 && focusable[focusable.length - 1] === target;\n}\n"],"names":["focusLastTag","isLastFocusableTag","FOCUSABLE_TAG_SELECTOR","getFocusableTags","container","querySelectorAll","focusable","length","focus","target"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAeeA,YAAY;eAAZA;;IASAC,kBAAkB;eAAlBA;;;AAvBhB,MAAMC,yBAAyB;AAE/B;;;CAGC,GACD,SAASC,iBAAiBC,SAAsB;IAC9C,OAAOA,UAAUC,gBAAgB,CAAcH;AACjD;AAMO,SAASF,aAAaI,SAAsB;IACjD,MAAME,YAAYH,iBAAiBC;IACnCE,SAAS,CAACA,UAAUC,MAAM,GAAG,EAAE,EAAEC;AACnC;AAMO,SAASP,mBAAmBG,SAAsB,EAAEK,MAAmB;IAC5E,MAAMH,YAAYH,iBAAiBC;IACnC,OAAOE,UAAUC,MAAM,GAAG,KAAKD,SAAS,CAACA,UAAUC,MAAM,GAAG,EAAE,KAAKE;AACrE"}