<?php
namespace NeoRename\NeoSettings; if (!defined("ABSPATH")) { die("neoWP direct access not allowed"); }

\NeoRename\NeoGlobal\val("neo_settings__sections", []);
function interface_add_neo_settings_section_20260411($id, $module_id_prefixes, $icon, $icon_animated, $title, $description, $coming_soon_url = null, $section_group = null, $render_callback_setting_slot = null) {
    \NeoRename\NeoGlobal\val("neo_settings__sections")[] = ["id" => $id, "module_id_prefixes" => $module_id_prefixes, "icon" => $icon, "icon_animated" => $icon_animated, "title" => $title, "description" => $description, "coming_soon_url" => $coming_soon_url, "section_group" => $section_group, "render_callback_setting_slot" => $render_callback_setting_slot];
}
function interface_get_neo_settings_section_url_20260613($section_id) { return admin_url("admin.php?page=" . \NeoRename\NeoGlobal\plugin_settings_page_slug() . "#neo-settings--section-" . $section_id); }

\NeoRename\NeoGlobal\val("neo_settings__settings", []);
function interface_add_neo_setting_20260326($module_id, $render_callback, $show_to_editor = false) {
    \NeoRename\NeoGlobal\val("neo_settings__settings")[] = ["module_id" => $module_id, "render_callback" => $render_callback, "show_to_editor" => $show_to_editor];
}

\NeoRename\NeoGlobal\val("neo_settings__asset_loading_callbacks", []);
function interface_add_neo_settings_asset_loading_callback_20250918($callback) { \NeoRename\NeoGlobal\val("neo_settings__asset_loading_callbacks")[] = $callback; }

\NeoRename\NeoGlobal\add_action_hook("neo_init", function () {
    $settings_render_callback = function () {
        ?><neo-setting-neo-rename>
            <div slot="left">
                <h3><?php \NeoRename\NeoGlobal\echo_neo__("Move neoWP from menu to Settings", "neoWP vom Menü in die Einstellungen verschieben") ?></h3>
                <p id="neo-settings--menu-location-description" data-neo-settings--menu-location-notice="<?php \NeoRename\NeoGlobal\echo_neo_attr__("The menu item will be hidden when you leave this page.", "Der Menüpunkt wird beim Verlassen dieser Seite ausgeblendet.") ?>"><?php \NeoRename\NeoGlobal\echo_neo__("Move neoWP into the WordPress Settings menu and hide the large sidebar entry.", "NeoWP in das WordPress-Menü Einstellungen verschieben und den großen Sidebar-Eintrag ausblenden.") ?></p>
            </div>
            <div slot="right">
                <?php \NeoRename\NeoGlobal\echo_switch_for_option("neo_settings__hide_top_level_menu_enabled", \NeoRename\NeoGlobal\neo__("Settings menu", "Einstellungen-Menü"), js_function_on_change: "window.neoSettingsMenuLocationNoticeDispatchChange") ?> 
            </div>
        </neo-setting-neo-rename><?php
    };
    interface_add_neo_setting_20260326("neo-settings--menu-location", $settings_render_callback);
});

\NeoRename\NeoGlobal\add_action_hook("admin_menu", function () {
    $menu_page_hook_suffix_id = add_menu_page(
        \NeoRename\NeoGlobal\neo__("neoWP - Media plugins", "neoWP - Media plugins"),
        \NeoRename\NeoGlobal\neo__("neoWP", "neoWP"),
        \NeoRename\NeoGlobal\capability__neo_settings(),
        \NeoRename\NeoGlobal\plugin_settings_page_slug(),
        function () {
            \NeoRename\NeoGlobal\performance_checkpoint("neo-settings menu page", is_start: true);
            \NeoRename\NeoGlobal\disallow_enqueue("Use interface_add_neo_settings_asset_loading_callback_20250918 to enqueue JS/CSS on neo-settings pages.", function () {
                [$plugin_list, $plugin_icon_list] = \NeoRename\NeoGlobal\update_and_get_plugin_list_and_icons();

                $not_installed_neoplugins = []; foreach ($plugin_list as $plugin_data) { if (!in_array(\NeoRename\NeoGlobal\get_plugin_entry_path_relative($plugin_data["plugin-slug"]), array_keys(get_plugins())) && !\NeoRename\NeoGlobal\is_module_available($plugin_data["plugin-slug"]) && !\NeoRename\NeoGlobal\is_module_available($plugin_data["plugin-slug"], include_suppressed: true)) { $not_installed_neoplugins[] = $plugin_data["plugin-slug"]; } }
                usort($plugin_list, function ($a, $b) use ($not_installed_neoplugins) {
                    $a_not_installed = in_array($a["plugin-slug"], $not_installed_neoplugins);
                    $b_not_installed = in_array($b["plugin-slug"], $not_installed_neoplugins);
                    if (!$a_not_installed && $b_not_installed) { return -1; }
                    if ($a_not_installed && !$b_not_installed) { return +1; }

                    if (!$a["plugin-is-coming-soon"] &&  $b["plugin-is-coming-soon"]) { return -1; }
                    if ( $a["plugin-is-coming-soon"] && !$b["plugin-is-coming-soon"]) { return +1; }

                    [$user_type, $interface_ok] = \NeoRename\NeoGlobal\call_interface_func_implemented('\NeoRename\NeoDomainSettings\interface_get_user_type_20260412')(); if (!$interface_ok) { $user_type = "user"; }
                    if ($user_type === "dev") {
                        if ($a["plugin-slug"] === "neo-prod") { return -1; }
                        if ($b["plugin-slug"] === "neo-prod") { return +1; }
                    }
                    return 0;
                });

                [$color_theme, $interface_ok] = \NeoRename\NeoGlobal\call_interface_func_implemented('\NeoRename\NeoProColorTheme\interface_get_color_theme_20260106')(); if (!$interface_ok) { $color_theme = "theme-neo"; }
                foreach ($plugin_list as $plugin_data) {
                    interface_add_neo_settings_section_20260411(
                        id: $plugin_data["plugin-slug"],
                        module_id_prefixes: [$plugin_data["plugin-slug"]],
                        icon: $plugin_icon_list[$plugin_data["plugin-slug"]][$color_theme]["icon"],
                        icon_animated: $plugin_icon_list[$plugin_data["plugin-slug"]][$color_theme]["icon-animated"],
                        title: $plugin_data["plugin-name"],
                        description: $plugin_data["plugin-slogan"],
                        coming_soon_url: $plugin_data["plugin-is-coming-soon"] ? $plugin_data["plugin-website-url"] : null,
                        section_group: (in_array($plugin_data["plugin-slug"], $not_installed_neoplugins) && \NeoRename\NeoGlobal\plugin_slug() !== "neo-plugins") || (\NeoRename\NeoGlobal\plugin_slug() === "neo-plugins" && $plugin_data["plugin-is-coming-soon"]) ? \NeoRename\NeoGlobal\neo__("👀 Show all neoPlugins (+" . count($not_installed_neoplugins) . ")", "👀 Alle neoPlugins anzeigen (+" . count($not_installed_neoplugins) . ")") : "",
                        render_callback_setting_slot: function ($setting_slot) use ($plugin_data) {
                            [$_, $interface_ok] = \NeoRename\NeoGlobal\call_interface_func_implemented('\NeoRename\NeoManagerInstaller\interface_neo_manager_render_settings_card_slot_20260327')($plugin_data, $setting_slot);
                            if (!$interface_ok) { \NeoRename\NeoGlobal\call_interface_func_implemented('\NeoRename\NeoManagerWporg\interface_neo_manager_render_settings_card_slot_20260327')($plugin_data, $setting_slot); }
                        }
                    );
                }

                interface_add_neo_settings_section_20260411(
                    id: "neo-pro",
                    module_id_prefixes: ["neo-pro", "neo-freemius"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-pro-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoPro", "neoPro"),
                    description: \NeoRename\NeoGlobal\neo__("Manage your neoPro license and access extended features.", "Verwalte deine neoPro-Lizenz und erhalte Zugriff auf erweiterte Funktionen.")
                );
                interface_add_neo_settings_section_20260411(
                    id: "neo-ai",
                    module_id_prefixes: ["neo-ai"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-ai-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoAI", "neoAI"),
                    description: \NeoRename\NeoGlobal\neo__("Configure AI connections for neoWP features.", "AI-Verbindungen für neoWP-Features konfigurieren.")
                );
                interface_add_neo_settings_section_20260411(
                    id: "neo-support-reset-log",
                    module_id_prefixes: ["neo-support--support", "neo-support-codes--support-codes", "neo-settings--menu-location", "neo-log", "neo-reset", "neo-support--privacy-policy"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-support-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoSupport", "neoSupport"),
                    description: \NeoRename\NeoGlobal\neo__("Access support resources, reset settings, and view logs for troubleshooting.", "Zugriff auf Support-Ressourcen, Einstellungen zurücksetzen und Logs zur Fehlerbehebung anzeigen.")
                );
                interface_add_neo_settings_section_20260411(
                    id: "neo-mail",
                    module_id_prefixes: ["neo-tool-mail-send"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-mail-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoMail", "neoMail"),
                    description: \NeoRename\NeoGlobal\neo__("File-based email jobs.", "Dateibasierte E-Mail-Jobs.")
                );
                interface_add_neo_settings_section_20260411(
                    id: "neo-website",
                    module_id_prefixes: ["neo-statistics", "neo-website-ai-connection"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-website-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoWebsite", "neoWebsite"),
                    description: \NeoRename\NeoGlobal\neo__("Website tools and statistics.", "Website-Tools und Statistiken.")
                );
                interface_add_neo_settings_section_20260411(
                    id: "neo-developer",
                    module_id_prefixes: ["neo-debug", "neo-symlink", "neo-demo-content", "neo-demo-screenshot", "neo-tool-passkey", "neo-tool-wporg-installs", "neo-tool-wporg-search-lab", "neo-license-server"],
                    icon: \NeoRename\NeoGlobal\plugin_url() . "/img/plugin-module-neo-developer-icon.svg", icon_animated: null,
                    title: \NeoRename\NeoGlobal\neo__("neoDeveloper", "neoDeveloper"),
                    description: \NeoRename\NeoGlobal\neo__("Developer tools and settings for advanced users.", "Entwicklertools und Einstellungen für fortgeschrittene Nutzer.")
                );

                ?><div class="wrap">
                    <h1 id="neo-settings--top"><?php \NeoRename\NeoGlobal\echo_neo__("neoWP - Media Plugins", "neoWP - Media Plugins"); ?></h1>
                    <?php \NeoRename\NeoGlobal\backend_page_style_tag_start([]); ?>
                        html { scroll-behavior: smooth; }
                        .wrap { --neo-settings--section-card-width: 800px; --neo-settings--section-space: 30px; --neo-settings--section-outer-width: calc(var(--neo-settings--section-card-width) + (var(--neo-settings--section-space) * 2)); }
                        #wpbody-content { overflow: hidden; }
                        #wpbody-content { padding-bottom: 40px; }
                        #wpbody-content { font-size: 16px; } #wpbody-content p { font-size: 1em; }
                        .neo-settings--sections, .neo-settings--section-group { display: flex; flex-direction: column; gap: 20px; }
                        .neo-settings--section-group-header { display: flex; justify-content: center; width: var(--neo-settings--section-outer-width); max-width: 100%; }
                        .neo-settings--section-group-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: #606060; background: transparent; border: none; font-size: 1.5em; cursor: pointer; &:focus-visible { outline: 2px solid blue; } }
                        .neo-settings--section-group-header-chevron { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; flex-shrink: 0; transition: transform 200ms ease; svg { width: 24px; } }
                        .neo-settings--section-group-toggle.neo-settings--section-group-toggle-open .neo-settings--section-group-header-chevron { transform: rotate(180deg); }
                        .neo-settings--section-group { width: fit-content; max-width: 100%; opacity: 1; transition: max-height 400ms ease, opacity 200ms linear; }
                        .neo-settings--section-group.neo-settings--section-group-collapsed { transition: max-height 200ms linear, opacity 200ms linear; }
                        .neo-settings--section-group[hidden] { display: none; }
                        .neo-settings--section-group-separator { border: 0; border-top: 1px solid rgba(0, 0, 0, 0.08); width: calc(100% - 40px); }
                        @media (max-width: 767px) { .wrap { --neo-settings--section-space: 20px; } }
                    <?php \NeoRename\NeoGlobal\backend_page_style_tag_end(); ?>
                    <?php

                    $sections_with_settings = [];
                    foreach (\NeoRename\NeoGlobal\val("neo_settings__sections") as $settings_section) {
                        $settings_for_section = [];
                        foreach ($settings_section["module_id_prefixes"] as $module_id_prefix) {
                            if ($settings_section["id"] === "neo-symlink") { break; }
                            $settings_for_section = array_merge($settings_for_section, \NeoRename\NeoGlobal\array_filter_better(\NeoRename\NeoGlobal\val("neo_settings__settings"), fn ($setting) => str_starts_with($setting["module_id"], $module_id_prefix)));
                        }
                        if (!\NeoRename\NeoGlobal\current_user_can__neo_settings__see_all_settings()) { $settings_for_section = \NeoRename\NeoGlobal\array_filter_better($settings_for_section, fn ($setting) => $setting["show_to_editor"]); }

                        if (empty($settings_for_section) && empty($settings_section["render_callback_setting_slot"])) { continue; }
                        if (!\NeoRename\NeoGlobal\current_user_can__neo_settings__see_all_settings() && empty($settings_for_section)) { continue; }

                        $settings_section["render_callbacks_settings"] = [];
                        foreach ($settings_for_section as $setting_index => $setting) { $settings_section["render_callbacks_settings"][$setting["module_id"] . "--" . $setting_index] = $setting["render_callback"]; }
                        $sections_with_settings[] = $settings_section;
                        foreach ($settings_for_section as $setting) { \NeoRename\NeoGlobal\val("neo_settings__settings", \NeoRename\NeoGlobal\array_filter_better(\NeoRename\NeoGlobal\val("neo_settings__settings"), fn ($s) => $s["module_id"] !== $setting["module_id"])); }
                    }

                    foreach (\NeoRename\NeoGlobal\val("neo_settings__settings") as $setting) {
                        if (!\NeoRename\NeoGlobal\current_user_can__neo_settings__see_all_settings() && !$setting["show_to_editor"]) { continue; }
                        $sections_with_settings[] = [
                            "id"                        => $setting["module_id"],
                            "title"                     => lcfirst(str_replace(" ", "", ucwords(str_replace("-", " ", $setting["module_id"])))),
                            "render_callbacks_settings" => [$setting["module_id"] => $setting["render_callback"]],
                        ];
                    }

                    ?><div class="neo-settings--sections" style="margin-top: 20px;"><?php 
                        $current_section_group = null;
                        foreach ($sections_with_settings as $settings_section) {
                            \NeoRename\NeoGlobal\performance_checkpoint("neo-settings section " . $settings_section["id"], is_start: true);

                            if (($settings_section["section_group"] ?? null) && $settings_section["section_group"] !== $current_section_group) {
                                if ($current_section_group) { ?></div><?php }
                                ?>
                                <div class="neo-settings--section-group-header">
                                    <button class="neo-settings--section-group-toggle">
                                        <span class="neo-settings--section-group-header-label"><?php echo esc_html($settings_section["section_group"]) ?></span>
                                        <span class="neo-settings--section-group-header-chevron"><svg viewBox="0 0 24 24" fill="none"><path d="M6 9L12 15L18 9" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"></path></svg></span>
                                    </button>
                                </div>
                                <div class="neo-settings--section-group neo-settings--section-group-collapsed" hidden><?php
                                $current_section_group = $settings_section["section_group"];
                            } else if (!($settings_section["section_group"] ?? null) && $current_section_group) {
                                ?><hr class="neo-settings--section-group-separator" /></div><?php
                                $current_section_group = null;
                            }

                            $title = \NeoRename\NeoGlobal\preg_replace_better('/(?<=[a-z])(?=[A-Z])/u', "\u{00AD}", $settings_section["title"] ?? "");
                            ?><neo-setting-section-neo-rename id="neo-settings--section-<?php echo esc_attr($settings_section["id"]) ?>" section-title="<?php echo esc_attr($title) ?>" section-description="<?php echo esc_attr($settings_section["description"] ?? "") ?>" icon="<?php echo esc_url($settings_section["icon"] ?? "") ?>" icon-animated="<?php echo ($settings_section["icon_animated"] ?? null) ? esc_url($settings_section["icon_animated"]) : ""; ?>" <?php echo ($settings_section["coming_soon_url"] ?? null) ? 'coming-soon="' . esc_attr($settings_section["coming_soon_url"]) . '"' : ""; ?>>
                                <?php if ($settings_section["render_callback_setting_slot"] ?? null) { ?> 
                                    <?php foreach (["tooltip", "switch", "install-options", "reload-button"] as $part_type) {
                                        ?><div slot="<?php echo esc_attr($part_type) ?>">
                                            <?php try { $settings_section["render_callback_setting_slot"]($part_type); } catch (\Throwable $e) { \NeoRename\NeoGlobal\echo_neo__("Error while rendering section header " . $part_type . " callback", "Fehler beim Rendern des Abschnitts-Header-" . $part_type); \NeoRename\NeoGlobal\global_warn_with_module_name("neo-settings", "Error while rendering section header " . $part_type . " callback: " . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . ":" . $e->getLine() . "\n" . $e->getTraceAsString()); } ?>
                                        </div><?php
                                    } ?>
                                <?php } ?>
                                <div slot="settings"><?php
                                    foreach ($settings_section["render_callbacks_settings"] ?? [] as $module_id => $setting) {
                                        \NeoRename\NeoGlobal\performance_checkpoint("neo-settings section " . $settings_section["id"] . " setting " . $module_id, is_start: true);
                                        try { $setting(); } catch (\Throwable $e) { \NeoRename\NeoGlobal\echo_neo__("Error while rendering setting", "Fehler beim Rendern der Einstellung"); \NeoRename\NeoGlobal\global_warn_with_module_name("neo-settings", "Error while rendering setting: " . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . ":" . $e->getLine() . "\n" . $e->getTraceAsString()); }
                                        \NeoRename\NeoGlobal\performance_checkpoint("neo-settings section " . $settings_section["id"] . " setting " . $module_id, is_end: true);
                                    }
                                ?></div>
                            </neo-setting-section-neo-rename><?php
                            \NeoRename\NeoGlobal\performance_checkpoint("neo-settings section " . $settings_section["id"], is_end: true);
                        }
                        if ($current_section_group) { ?></div><?php }
                    ?></div>

                    <div id="neo-settings--anti-scroll-glitch-spacing-element" style="width: 100%; height: 30vh;"></div>
                </div>
                <div id="neo-settings--footer-thankyou">
                    <?php \NeoRename\NeoGlobal\echo_neo__("Thank you for creating with", "Danke für dein Vertrauen in") ?> <a href="<?php echo esc_url(\NeoRename\NeoGlobal\get_plugin_download_url()) ?>" target="_blank">neo-wp.com</a>.
                    <?php \NeoRename\NeoGlobal\backend_page_script_tag_start(["type" => "speculationrules"]); ?>{ "prefetch": [{ "urls": ["<?php echo esc_url(\NeoRename\NeoGlobal\get_plugin_download_url()) ?>"] }] }<?php \NeoRename\NeoGlobal\backend_page_script_tag_end(); ?>
                    <?php \NeoRename\NeoGlobal\backend_page_script_tag_start(["type" => "module"]); ?>
                        import { observeOnce } from "<?php echo esc_url(\NeoRename\NeoGlobal\plugin_url()) ?>/_global--observer.js";
                        observeOnce("#footer-thankyou", (node) => { node.prepend(document.querySelector("#neo-settings--footer-thankyou")); });
                    <?php \NeoRename\NeoGlobal\backend_page_script_tag_end(); ?>
                </div>

                <?php \NeoRename\NeoGlobal\backend_page_script_tag_start(["type" => "module"]); ?>
                    import { domLoaded, addEventListenerWithInitialCall } from "<?php echo esc_url(\NeoRename\NeoGlobal\plugin_url()) ?>/_global--observer.js";
                    domLoaded(() => {
                        const sections = document.querySelectorAll("neo-setting-section-neo-rename");
                        addEventListenerWithInitialCall(window, "scroll", () => {
                            const scrollY = window.scrollY;
                            for (const anyLink of document.querySelectorAll("#toplevel_page_<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?> li")) { anyLink.classList.remove("current"); }

                            if (Math.ceil(document.querySelector("html").scrollTop + document.querySelector("html").clientHeight) >= document.querySelector("html").scrollHeight) {
                                [...document.querySelectorAll(`#toplevel_page_<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?> a[href*="#"]`)].pop().parentElement.classList.add("current");
                                return;
                            }

                            for (const section of [...sections].reverse()) {
                                const sectionMenuLink = document.querySelector(`#toplevel_page_<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?> a[href="admin.php?page=<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?>#${section.getAttribute('id')}"]`);
                                if (!sectionMenuLink) { continue; }
                                if (section.offsetTop < scrollY + window.innerHeight / 2) {
                                    sectionMenuLink.parentElement.classList.add("current");
                                    return;
                                }
                            }
                        });
                    });
                <?php \NeoRename\NeoGlobal\backend_page_script_tag_end(); ?>
                <?php
            });
            \NeoRename\NeoGlobal\performance_checkpoint("neo-settings menu page", is_end: true);
        },
        icon_url: "data:image/svg+xml;base64," . base64_encode(\NeoRename\NeoGlobal\fs_file_get_contents(\NeoRename\NeoGlobal\plugin_path() . "/img/neo-settings--icon.svg")),
    );

    \NeoRename\NeoGlobal\add_action_hook("load-$menu_page_hook_suffix_id", function () {
        \NeoRename\NeoGlobal\enqueue_js("neo-settings.js");
        foreach (\NeoRename\NeoGlobal\val("neo_settings__asset_loading_callbacks") as $callback) { try { $callback(); } catch (\Throwable $e) { \NeoRename\NeoGlobal\global_warn_with_module_name("neo-settings", "Error while loading menu page assets: " . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . ":" . $e->getLine() . "\n" . $e->getTraceAsString()); } }
    });

    $submenu_entries = [
        \NeoRename\NeoGlobal\neo__("neoPlugins", "neoPlugins") => "#neo-settings--top",
        \NeoRename\NeoGlobal\neo__("License", "Lizenz")        => "#neo-settings--section-neo-pro",
        \NeoRename\NeoGlobal\neo__("Support", "Support")       => "#neo-settings--section-neo-support-reset-log",
    ];
    foreach ($submenu_entries as $submenu_page_title => $section_id) {
        add_submenu_page(
            \NeoRename\NeoGlobal\plugin_settings_page_slug(),
            $submenu_page_title,
            $submenu_page_title,
            \NeoRename\NeoGlobal\capability__neo_settings(),
            \NeoRename\NeoGlobal\plugin_settings_page_slug() . $section_id,
            function () { },
        );
    }
    if (\NeoRename\NeoGlobal\option__neo_settings__hide_top_level_menu_enabled()) {
        $settings_menu_hook_suffix_id = add_submenu_page("options-general.php", \NeoRename\NeoGlobal\neo__("neoWP", "neoWP"), \NeoRename\NeoGlobal\neo__("neoWP", "neoWP"), \NeoRename\NeoGlobal\capability__neo_settings(), \NeoRename\NeoGlobal\plugin_settings_page_slug(), function () { global $pagenow; if ($pagenow !== "options-general.php") { return; } wp_safe_redirect(admin_url("admin.php?page=" . \NeoRename\NeoGlobal\plugin_settings_page_slug())); exit; });
        \NeoRename\NeoGlobal\add_action_hook("load-$settings_menu_hook_suffix_id", function () { global $pagenow; if ($pagenow !== "options-general.php") { return; } wp_safe_redirect(admin_url("admin.php?page=" . \NeoRename\NeoGlobal\plugin_settings_page_slug())); exit; });
    }
});

\NeoRename\NeoGlobal\add_action_hook("admin_footer", function () {
    ?><?php \NeoRename\NeoGlobal\backend_page_style_tag_start([]); ?>
        #toplevel_page_<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?> > .wp-submenu > .wp-first-item { display: none; }
    <?php \NeoRename\NeoGlobal\backend_page_style_tag_end(); ?><?php
});

\NeoRename\NeoGlobal\add_action_hook("admin_footer", function () {
    if (!\NeoRename\NeoGlobal\option__neo_settings__hide_top_level_menu_enabled()) { return; }
    if (\NeoRename\NeoGlobal\query_param("page") === \NeoRename\NeoGlobal\plugin_settings_page_slug()) { return; }
    ?><?php \NeoRename\NeoGlobal\backend_page_style_tag_start([]); ?>
        #toplevel_page_<?php echo esc_attr(\NeoRename\NeoGlobal\plugin_settings_page_slug()) ?> { display: none; }
    <?php \NeoRename\NeoGlobal\backend_page_style_tag_end(); ?><?php
});

\NeoRename\NeoGlobal\add_action_hook("neo_init", function () {
    foreach (\NeoRename\NeoEntrypoint\get_neo_active_plugins() as $neo_plugin) {
        \NeoRename\NeoGlobal\add_filter_hook("plugin_action_links_" . plugin_basename($neo_plugin["plugin_entry_file_path"] ?? ""), function ($links) {
            array_unshift($links, '<a href="admin.php?page=' . \NeoRename\NeoGlobal\plugin_settings_page_slug() . '">' . \NeoRename\NeoGlobal\neo__("neoSettings", "neoSettings") . '</a>');
            return $links;
        });
    }
});
