: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (!("length" in radioGroup))
const activeElement = getActiveElement(element);
if (activeElement === element)
if (!("form" in activeElement))
if (activeElement.form !== element.form)
if (activeElement.name !== element.name)
function getAllFocusableIn(container, includeContainer) {
const elements = Array.from(
container.querySelectorAll(selector)
elements.unshift(container);
const focusableElements = elements.filter(isFocusable);
focusableElements.forEach((element, i) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
return focusableElements;
function getAllFocusable(includeBody) {
return getAllFocusableIn(document.body, includeBody);
function getFirstFocusableIn(container, includeContainer) {
const [first] = getAllFocusableIn(container, includeContainer);
function getFirstFocusable(includeBody) {
return getFirstFocusableIn(document.body, includeBody);
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
const elements = Array.from(
container.querySelectorAll(selector)
const tabbableElements = elements.filter(isTabbable);
if (includeContainer && isTabbable(container)) {
tabbableElements.unshift(container);
tabbableElements.forEach((element, i) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
const allFrameTabbable = getAllTabbableIn(
tabbableElements.splice(i, 1, ...allFrameTabbable);
if (!tabbableElements.length && fallbackToFocusable) {
function getAllTabbable(fallbackToFocusable) {
return getAllTabbableIn(document.body, false, fallbackToFocusable);
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
const [first] = getAllTabbableIn(
function getFirstTabbable(fallbackToFocusable) {
return getFirstTabbableIn(document.body, false, fallbackToFocusable);
function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
const allTabbable = getAllTabbableIn(
return allTabbable[allTabbable.length - 1] || null;
function getLastTabbable(fallbackToFocusable) {
return getLastTabbableIn(document.body, false, fallbackToFocusable);
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer);
const activeIndex = allFocusable.indexOf(activeElement);
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
return getNextTabbableIn(
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
const activeIndex = allFocusable.indexOf(activeElement);
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
return getPreviousTabbableIn(
function getClosestFocusable(element) {
while (element && !isFocusable(element)) {
element = closest(element, selector);
function hasFocus(element) {
const activeElement = getActiveElement(element);
if (activeElement === element)
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
return activeDescendant === element.id;
function hasFocusWithin(element) {
const activeElement = getActiveElement(element);
if (contains(element, activeElement))
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (activeDescendant === element.id)
return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
function focusIfNeeded(element) {
if (!hasFocusWithin(element) && isFocusable(element)) {
function disableFocus(element) {
const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
element.setAttribute("data-tabindex", currentTabindex);
element.setAttribute("tabindex", "-1");
function disableFocusIn(container, includeContainer) {
const tabbableElements = getAllTabbableIn(container, includeContainer);
tabbableElements.forEach(disableFocus);
function restoreFocusIn(container) {
const elements = container.querySelectorAll("[data-tabindex]");
const restoreTabIndex = (element) => {
const tabindex = element.getAttribute("data-tabindex");
element.removeAttribute("data-tabindex");
element.setAttribute("tabindex", tabindex);
element.removeAttribute("tabindex");
if (container.hasAttribute("data-tabindex")) {
restoreTabIndex(container);
elements.forEach(restoreTabIndex);
function focusIntoView(element, options) {
if (!("scrollIntoView" in element)) {
element.focus({ preventScroll: true });
element.scrollIntoView(_chunks_4R3V3JGP_spreadValues({ block: "nearest", inline: "nearest" }, options));
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KK7H3W2B.js
// src/focusable/focusable.ts
var isSafariBrowser = isSafari();
var alwaysFocusVisibleInputTypes = [
function isAlwaysFocusVisible(element) {
const { tagName, readOnly, type } = element;
if (tagName === "TEXTAREA" && !readOnly)
if (tagName === "SELECT" && !readOnly)
if (tagName === "INPUT" && !readOnly) {
return alwaysFocusVisibleInputTypes.includes(type);
if (element.isContentEditable)
function isAlwaysFocusVisibleDelayed(element) {
const role = element.getAttribute("role");
return !!element.dataset.name;
function getLabels(element) {
if ("labels" in element) {
function isNativeCheckboxOrRadio(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "input" && element.type) {
return element.type === "radio" || element.type === "checkbox";
function isNativeTabbable(tagName) {
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
function supportsDisabledAttribute(tagName) {
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
if (nativeTabbable && !supportsDisabled) {
return tabIndexProp || 0;
function useDisableEvent(onEvent, disabled) {
return useEvent((event) => {
onEvent == null ? void 0 : onEvent(event);
if (event.defaultPrevented)
var isKeyboardModality = true;
function onGlobalMouseDown(event) {
const target = event.target;
if (target && "hasAttribute" in target) {
if (!target.hasAttribute("data-focus-visible")) {
isKeyboardModality = false;
function onGlobalKeyDown(event) {
isKeyboardModality = true;
var useFocusable = createHook(
} = _b, props = __objRest(_b, [
"accessibleWhenDisabled",
const ref = (0,external_React_.useRef)(null);
(0,external_React_.useEffect)(() => {
addGlobalEventListener("mousedown", onGlobalMouseDown, true);
addGlobalEventListener("keydown", onGlobalKeyDown, true);
(0,external_React_.useEffect)(() => {
const element = ref.current;
if (!isNativeCheckboxOrRadio(element))
const labels = getLabels(element);
const onMouseUp = () => queueMicrotask(() => element.focus());
labels.forEach((label) => label.addEventListener("mouseup", onMouseUp));
(label) => label.removeEventListener("mouseup", onMouseUp)
const disabled = focusable && disabledFromProps(props);
const trulyDisabled = !!disabled && !accessibleWhenDisabled;
const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false);
(0,external_React_.useEffect)(() => {
if (trulyDisabled && focusVisible) {
}, [focusable, trulyDisabled, focusVisible]);
(0,external_React_.useEffect)(() => {
const element = ref.current;
if (typeof IntersectionObserver === "undefined")
const observer = new IntersectionObserver(() => {
if (!isFocusable(element)) {
observer.observe(element);
return () => observer.disconnect();
}, [focusable, focusVisible]);
const onKeyPressCapture = useDisableEvent(
const onMouseDownCapture = useDisableEvent(
props.onMouseDownCapture,
const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
const onMouseDownProp = props.onMouseDown;
const onMouseDown = useEvent((event) => {
onMouseDownProp == null ? void 0 : onMouseDownProp(event);
if (event.defaultPrevented)
const element = event.currentTarget;
if (isPortalEvent(event))
if (!isButton(element) && !isNativeCheckboxOrRadio(element))
let receivedFocus = false;
const options = { capture: true, once: true };
element.addEventListener("focusin", onFocus, options);
queueBeforeEvent(element, "mouseup", () => {
element.removeEventListener("focusin", onFocus, true);
const handleFocusVisible = (event, currentTarget) => {
event.currentTarget = currentTarget;
const element = event.currentTarget;
onFocusVisible == null ? void 0 : onFocusVisible(event);
if (event.defaultPrevented)
const onKeyDownCaptureProp = props.onKeyDownCapture;
const onKeyDownCapture = useEvent(
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
if (event.defaultPrevented)
if (!isSelfTarget(event))
const element = event.currentTarget;
queueMicrotask(() => handleFocusVisible(event, element));
const onFocusCaptureProp = props.onFocusCapture;
const onFocusCapture = useEvent((event) => {
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
if (event.defaultPrevented)
if (!isSelfTarget(event)) {
const element = event.currentTarget;
const applyFocusVisible = () => handleFocusVisible(event, element);
if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
queueMicrotask(applyFocusVisible);
} else if (isAlwaysFocusVisibleDelayed(event.target)) {
queueBeforeEvent(event.target, "focusout", applyFocusVisible);
const onBlurProp = props.onBlur;
const onBlur = useEvent((event) => {
onBlurProp == null ? void 0 : onBlurProp(event);
if (!isFocusEventOutside(event))
const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext);
const autoFocusRef = useEvent((element) => {
if (!isFocusable(element))