This commit is contained in:
zbatte committed 2026-07-02 15:54:39 -06:00
commit 9883323161
17470 files changed
+4470592

No files matched your search

@@ -0,0 +1,43 @@
<?php
/**
* Main entry point for auto-generated asset registration.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
// Load script module registration.
$modules_file = __DIR__ . '/modules.php';
if ( file_exists( $modules_file ) ) {
require_once $modules_file;
}
// Load script registration.
$scripts_file = __DIR__ . '/scripts.php';
if ( file_exists( $scripts_file ) ) {
require_once $scripts_file;
}
// Load style registration.
$styles_file = __DIR__ . '/styles.php';
if ( file_exists( $styles_file ) ) {
require_once $styles_file;
}
// Load routes registration.
$routes_file = __DIR__ . '/routes.php';
if ( file_exists( $routes_file ) ) {
require_once $routes_file;
}
// Load widgets registration.
$widgets_file = __DIR__ . '/widgets.php';
if ( file_exists( $widgets_file ) ) {
require_once $widgets_file;
}
// Load pages registration.
$pages_file = __DIR__ . '/pages.php';
if ( file_exists( $pages_file ) ) {
require_once $pages_file;
}
@@ -0,0 +1,14 @@
<?php
/**
* Plugin constants - Auto-generated by build process.
* Do not edit this file manually.
*
* Returns an array of constants for use in other templates.
*
* @package jetpack_scan
*/
return array(
'version' => 'undefined',
'build_url' => plugin_dir_url( __FILE__ ),
);
@@ -0,0 +1,63 @@
<?php
/**
* Script module registration - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
/**
* Register all script modules.
*/
function jetpack_scan_register_script_modules() {
// Ensure this only runs once. wp_default_scripts can fire multiple times,
// and each wp_deregister_script_module() call also dequeues the module.
// If a module was enqueued between calls, repeated deregister/register
// cycles would lose the enqueue state.
static $already_registered = false;
if ( $already_registered ) {
return;
}
$already_registered = true;
// Load build constants
$constants_file = __DIR__ . '/constants.php';
if ( ! file_exists( $constants_file ) ) {
return;
}
$build_constants = require $constants_file;
$modules_dir = __DIR__ . '/modules';
$modules_file = $modules_dir . '/registry.php';
if ( ! file_exists( $modules_file ) ) {
return;
}
$modules = require $modules_file;
$base_url = $build_constants['build_url'] . 'modules/';
foreach ( $modules as $module ) {
// WASM-only modules (e.g., vips worker) only have .min.js; use it even when SCRIPT_DEBUG is `true`.
$extension = '.min.js';
$asset_path = $modules_dir . '/' . $module['asset'];
$asset = file_exists( $asset_path ) ? require $asset_path : array();
// Deregister first to override any previously registered version
// (e.g., Core's default modules when running as a plugin).
wp_deregister_script_module( $module['id'] );
wp_register_script_module(
$module['id'],
$base_url . $module['path'] . $extension,
$asset['module_dependencies'] ?? array(),
$asset['version'] ?? false,
array(
'fetchpriority' => 'low',
'in_footer' => true,
)
);
}
}
add_action( 'wp_default_scripts', 'jetpack_scan_register_script_modules' );
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/lazy-editor', 'import' => 'dynamic'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '188faf6c64fdd1b4');
@@ -0,0 +1,11 @@
<?php
/**
* Script module registry - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
return array(
);
@@ -0,0 +1,16 @@
<?php
/**
* Pages loader - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
foreach ( [
__DIR__ . '/pages/jetpack-scan/page.php',
__DIR__ . '/pages/jetpack-scan/page-wp-admin.php',
] as $file ) {
if ( file_exists( $file ) ) {
require_once $file;
}
}
@@ -0,0 +1 @@
// Empty module loader for page dependencies
@@ -0,0 +1,317 @@
<?php
/**
* Page: jetpack-scan (wp-admin integrated)
* Auto-generated by build process.
* Do not edit this file manually.
*
* This version integrates with the standard WordPress admin interface,
* keeping the wp-admin sidebar and scripts/styles intact.
*
* @package jetpack_scan
*/
// Global storage for jetpack-scan routes and menu items
global $jetpack_scan_jetpack_scan_wp_admin_routes, $jetpack_scan_jetpack_scan_wp_admin_menu_items;
$jetpack_scan_jetpack_scan_wp_admin_routes = array();
$jetpack_scan_jetpack_scan_wp_admin_menu_items = array();
/**
* Register a route for the jetpack-scan-wp-admin page.
*
* @param string $path Route path (e.g., '/types/$type/edit/$id').
* @param string|null $content_module Script module ID for content (stage/inspector).
* @param string|null $route_module Script module ID for route lifecycle hooks.
*/
function jetpack_scan_register_jetpack_scan_wp_admin_route( $path, $content_module = null, $route_module = null ) {
global $jetpack_scan_jetpack_scan_wp_admin_routes;
$route = array( 'path' => $path );
if ( ! empty( $content_module ) ) {
$route['content_module'] = $content_module;
}
if ( ! empty( $route_module ) ) {
$route['route_module'] = $route_module;
}
$jetpack_scan_jetpack_scan_wp_admin_routes[] = $route;
}
/**
* Register a menu item for the jetpack-scan-wp-admin page.
* Note: Menu items are registered but not displayed in single-page mode.
*
* @param string $id Menu item ID.
* @param string $label Display label.
* @param string $to Route path to navigate to.
* @param string $parent_id Optional. Parent menu item ID.
*/
function jetpack_scan_register_jetpack_scan_wp_admin_menu_item( $id, $label, $to, $parent_id = '' ) {
global $jetpack_scan_jetpack_scan_wp_admin_menu_items;
$menu_item = array(
'id' => $id,
'label' => $label,
'to' => $to,
);
if ( ! empty( $parent_id ) ) {
$menu_item['parent'] = $parent_id;
}
$jetpack_scan_jetpack_scan_wp_admin_menu_items[] = $menu_item;
}
/**
* Get all registered routes for the jetpack-scan-wp-admin page.
*
* @return array Array of route objects.
*/
function jetpack_scan_get_jetpack_scan_wp_admin_routes() {
global $jetpack_scan_jetpack_scan_wp_admin_routes;
return $jetpack_scan_jetpack_scan_wp_admin_routes ?? array();
}
/**
* Get all registered menu items for the jetpack-scan-wp-admin page.
*
* @return array Array of menu item objects.
*/
function jetpack_scan_get_jetpack_scan_wp_admin_menu_items() {
global $jetpack_scan_jetpack_scan_wp_admin_menu_items;
return $jetpack_scan_jetpack_scan_wp_admin_menu_items ?? array();
}
/**
* Preload REST API data for the jetpack-scan-wp-admin page.
* Automatically called during page rendering.
*/
function jetpack_scan_jetpack_scan_wp_admin_preload_data() {
// Define paths to preload - same for all pages
// Please also change packages/core-data/src/entities.js when changing this.
$preload_paths = array(
'/?_fields=description,gmt_offset,home,image_sizes,image_size_threshold,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front',
array( '/wp/v2/settings', 'OPTIONS' ),
);
// Use rest_preload_api_request to gather the preloaded data
$preload_data = array_reduce(
$preload_paths,
'rest_preload_api_request',
array()
);
// Register the preloading middleware with wp-api-fetch
wp_add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
wp_json_encode( $preload_data )
),
'after'
);
}
/**
* Enqueue scripts and styles for the jetpack-scan-wp-admin page.
* Hooked to admin_enqueue_scripts.
*
* @param string $hook_suffix The current admin page.
*/
function jetpack_scan_jetpack_scan_wp_admin_enqueue_scripts( $hook_suffix ) {
// Check all possible ways this page can be accessed:
// 1. Menu page via admin.php?page=jetpack-scan-wp-admin (plugin)
// 2. Direct file via jetpack-scan.php (Core) - screen ID will be 'jetpack-scan'
$current_screen = get_current_screen();
$is_our_page = (
( isset( $_GET['page'] ) && 'jetpack-scan-wp-admin' === $_GET['page'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
( $current_screen && 'jetpack-scan' === $current_screen->id )
);
if ( ! $is_our_page ) {
return;
}
// Load build constants
$build_constants = require __DIR__ . '/../../constants.php';
/**
* Fires when the jetpack-scan admin page is initialized so extensions can register routes and menu items.
*/
do_action( 'jetpack-scan-wp-admin_init' );
// Preload REST API data
jetpack_scan_jetpack_scan_wp_admin_preload_data();
// Get all registered routes
$routes = jetpack_scan_get_jetpack_scan_wp_admin_routes();
// Get boot module asset file for dependencies
$asset_file = __DIR__ . '/../../modules/boot/index.min.asset.php';
if ( file_exists( $asset_file ) ) {
$asset = require $asset_file;
// This script serves two purposes:
// 1. It ensures all the globals that are made available to the modules are loaded.
// 2. It initializes the boot module as an inline script.
wp_register_script( 'jetpack-scan-wp-admin-prerequisites', '', $asset['dependencies'], $asset['version'], true );
/*
* Add inline script to initialize the app using initSinglePage (no menuItems).
* The dynamic import is deferred until DOMContentLoaded so that all classic
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
* wp-theme, etc.) have finished parsing and executing before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
* against the classic-script-printing pass on fast CDN-fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
* "Cannot unlock an undefined object". See <https://core.trac.wordpress.org/ticket/65103>.
*/
$init_js_function = <<<'JS'
( mountId, routes ) => {
const run = async () => {
const mod = await import( "@wordpress/boot" );
mod.initSinglePage( { mountId, routes } );
};
if ( document.readyState === "loading" ) {
document.addEventListener( "DOMContentLoaded", run );
} else {
run();
}
}
JS;
wp_add_inline_script(
'jetpack-scan-wp-admin-prerequisites',
sprintf(
'( %s )( %s, %s );',
$init_js_function,
wp_json_encode( 'jetpack-scan-wp-admin-app', JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
)
);
// Register prerequisites style by filtering script dependencies to find registered styles
$style_dependencies = array_filter(
$asset['dependencies'],
function ( $handle ) {
return wp_style_is( $handle, 'registered' );
}
);
wp_register_style( 'jetpack-scan-wp-admin-prerequisites', false, $style_dependencies, $asset['version'] );
// Build dependencies for jetpack-scan-wp-admin module
$boot_dependencies = array(
array(
'import' => 'static',
'id' => '@wordpress/boot',
),
);
// Add all registered routes as dependencies
foreach ( $routes as $route ) {
if ( isset( $route['route_module'] ) ) {
$boot_dependencies[] = array(
'import' => 'static',
'id' => $route['route_module'],
);
}
if ( isset( $route['content_module'] ) ) {
$boot_dependencies[] = array(
'import' => 'dynamic',
'id' => $route['content_module'],
);
}
}
/**
* Filters the boot script-module dependencies for the
* jetpack-scan-wp-admin page.
*
* Surfaces extending this page can append entries to the boot
* dependency list. Each entry is an array with 'import' (string
* 'static' or 'dynamic') and 'id' (script-module handle) keys.
*
* @param array $boot_dependencies Boot dependencies for the page.
*/
$boot_dependencies = apply_filters(
'jetpack-scan-wp-admin_boot_dependencies',
$boot_dependencies
);
// Dummy script module to ensure dependencies are loaded
wp_register_script_module(
'jetpack-scan-wp-admin',
$build_constants['build_url'] . 'pages/jetpack-scan/loader.js',
$boot_dependencies
);
// Enqueue the boot scripts and styles
wp_enqueue_script( 'jetpack-scan-wp-admin-prerequisites' );
wp_enqueue_script_module( 'jetpack-scan-wp-admin' );
wp_enqueue_style( 'jetpack-scan-wp-admin-prerequisites' );
}
}
/**
* Render the jetpack-scan-wp-admin page.
* Call this function from add_menu_page or add_submenu_page.
* This renders within the normal WordPress admin interface.
*/
function jetpack_scan_jetpack_scan_wp_admin_render_page() {
?>
<style>
/* Critical styles to prevent layout shifts - inlined for immediate application */
#wpwrap {
overflow-y: auto;
}
body {
background: #fff;
}
/* Reset wp-admin padding */
#wpcontent {
padding-inline-start: 0;
}
#wpbody-content {
padding-bottom: 0;
}
/* Hide legacy admin elements */
#wpbody-content > div:not(.boot-layout-container):not(#screen-meta) {
display: none;
}
#wpfooter {
display: none;
}
/* Accessibility regions */
.a11y-speak-region {
inset-inline-start: -1px;
top: -1px;
}
/* Admin menu indicators */
ul#adminmenu a.wp-has-current-submenu::after,
ul#adminmenu > li.current > a.current::after {
border-inline-end-color: #fff;
}
/* Media frame fix */
.media-frame select.attachment-filters:last-of-type {
width: auto;
max-width: 100%;
}
/* Responsive overflow fix for #wpwrap */
@media (min-width: 782px) {
#wpwrap {
overflow-y: initial;
}
}
</style>
<div id="jetpack-scan-wp-admin-app" class="boot-layout-container"></div>
<?php
}
// Hook the enqueue function to admin_enqueue_scripts
add_action( 'admin_enqueue_scripts', 'jetpack_scan_jetpack_scan_wp_admin_enqueue_scripts' );
@@ -0,0 +1,318 @@
<?php
/**
* Page: jetpack-scan
* Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
// Global storage for jetpack-scan routes and menu items
global $jetpack_scan_jetpack_scan_routes, $jetpack_scan_jetpack_scan_menu_items;
$jetpack_scan_jetpack_scan_routes = array();
$jetpack_scan_jetpack_scan_menu_items = array();
/**
* Register a route for the jetpack-scan page.
*
* @param string $path Route path (e.g., '/types/$type/edit/$id').
* @param string|null $content_module Script module ID for content (stage/inspector).
* @param string|null $route_module Script module ID for route lifecycle hooks.
*/
function jetpack_scan_register_jetpack_scan_route( $path, $content_module = null, $route_module = null ) {
global $jetpack_scan_jetpack_scan_routes;
$route = array( 'path' => $path );
if ( ! empty( $content_module ) ) {
$route['content_module'] = $content_module;
}
if ( ! empty( $route_module ) ) {
$route['route_module'] = $route_module;
}
$jetpack_scan_jetpack_scan_routes[] = $route;
}
/**
* Register a menu item for the jetpack-scan page.
*
* @param string $id Menu item ID.
* @param string $label Display label.
* @param string $to Route path to navigate to.
* @param string $parent_id Optional. Parent menu item ID.
* @param string $parent_type Optional. Parent type: 'drilldown' or 'dropdown'.
*/
function jetpack_scan_register_jetpack_scan_menu_item( $id, $label, $to, $parent_id = '', $parent_type = '' ) {
global $jetpack_scan_jetpack_scan_menu_items;
$menu_item = array(
'id' => $id,
'label' => $label,
'to' => $to,
);
if ( ! empty( $parent_id ) ) {
$menu_item['parent'] = $parent_id;
}
if ( ! empty( $parent_type ) && in_array( $parent_type, array( 'drilldown', 'dropdown' ), true ) ) {
$menu_item['parent_type'] = $parent_type;
}
$jetpack_scan_jetpack_scan_menu_items[] = $menu_item;
}
/**
* Get all registered routes for the jetpack-scan page.
*
* @return array Array of route objects.
*/
function jetpack_scan_get_jetpack_scan_routes() {
global $jetpack_scan_jetpack_scan_routes;
return $jetpack_scan_jetpack_scan_routes ?? array();
}
/**
* Get all registered menu items for the jetpack-scan page.
*
* @return array Array of menu item objects.
*/
function jetpack_scan_get_jetpack_scan_menu_items() {
global $jetpack_scan_jetpack_scan_menu_items;
return $jetpack_scan_jetpack_scan_menu_items ?? array();
}
/**
* Preload REST API data for the jetpack-scan page.
* Automatically called during page rendering.
*/
function jetpack_scan_jetpack_scan_preload_data() {
// Define paths to preload - same for all pages
// Please also change packages/core-data/src/entities.js when changing this.
$preload_paths = array(
'/?_fields=description,gmt_offset,home,image_sizes,image_size_threshold,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front',
array( '/wp/v2/settings', 'OPTIONS' ),
);
// Use rest_preload_api_request to gather the preloaded data
$preload_data = array_reduce(
$preload_paths,
'rest_preload_api_request',
array()
);
// Register the preloading middleware with wp-api-fetch
wp_add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
wp_json_encode( $preload_data )
),
'after'
);
}
/**
* Render the jetpack-scan page.
* Call this function from add_menu_page or add_submenu_page.
*/
function jetpack_scan_jetpack_scan_render_page() {
// Load build constants
$build_constants = require __DIR__ . '/../../constants.php';
// Set current screen
set_current_screen();
// Remove unwanted deprecated handler
remove_action( 'admin_head', 'wp_admin_bar_header' );
// Remove unwanted scripts and styles that were enqueued during `admin_init`
foreach ( wp_scripts()->queue as $script ) {
wp_dequeue_script( $script );
}
foreach ( wp_styles()->queue as $style ) {
wp_dequeue_style( $style );
}
/**
* Fires when the jetpack-scan page is initialized so extensions can register routes and menu items.
*/
do_action( 'jetpack-scan_init' );
// Enqueue command palette assets for boot-based pages
if ( function_exists( 'wp_enqueue_command_palette_assets' ) ) {
wp_enqueue_command_palette_assets();
}
// Preload REST API data
jetpack_scan_jetpack_scan_preload_data();
// Get all registered routes and menu items
$menu_items = jetpack_scan_get_jetpack_scan_menu_items();
$routes = jetpack_scan_get_jetpack_scan_routes();
// Get boot module asset file for dependencies
$asset_file = __DIR__ . '/../../modules/boot/index.min.asset.php';
if ( file_exists( $asset_file ) ) {
$asset = require $asset_file;
// This script serves two purposes:
// 1. It ensures all the globals that are made available to the modules are loaded.
// 2. It initializes the boot module as an inline script.
wp_register_script( 'jetpack-scan-prerequisites', '', $asset['dependencies'], $asset['version'], true );
// Add inline script to initialize the app
$init_modules = [];
wp_add_inline_script(
'jetpack-scan-prerequisites',
sprintf(
'import("@wordpress/boot").then(mod => mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"}));',
'jetpack-scan-app',
wp_json_encode( $menu_items, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
wp_json_encode( $init_modules, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
esc_url( admin_url( '/' ) )
)
);
// Register prerequisites style by filtering script dependencies to find registered styles
$style_dependencies = array_filter(
$asset['dependencies'],
function ( $handle ) {
return wp_style_is( $handle, 'registered' );
}
);
wp_register_style( 'jetpack-scan-prerequisites', false, $style_dependencies, $asset['version'] );
// Build dependencies for jetpack-scan module
$boot_dependencies = array(
array(
'import' => 'static',
'id' => '@wordpress/boot',
),
);
// Add init modules as static dependencies
// No init modules configured
// Add all registered routes as dependencies
foreach ( $routes as $route ) {
if ( isset( $route['route_module'] ) ) {
$boot_dependencies[] = array(
'import' => 'static',
'id' => $route['route_module'],
);
}
if ( isset( $route['content_module'] ) ) {
$boot_dependencies[] = array(
'import' => 'dynamic',
'id' => $route['content_module'],
);
}
}
/**
* Filters the boot script-module dependencies for the
* jetpack-scan page.
*
* Surfaces extending this page can append entries to the boot
* dependency list. Each entry is an array with 'import' (string
* 'static' or 'dynamic') and 'id' (script-module handle) keys.
*
* @param array $boot_dependencies Boot dependencies for the page.
*/
$boot_dependencies = apply_filters(
'jetpack-scan_boot_dependencies',
$boot_dependencies
);
// Dummy script module to ensure dependencies are loaded
wp_register_script_module(
'jetpack-scan',
$build_constants['build_url'] . 'pages/jetpack-scan/loader.js',
$boot_dependencies
);
// Enqueue the boot scripts and styles
wp_enqueue_script( 'jetpack-scan-prerequisites' );
wp_enqueue_script_module( 'jetpack-scan' );
wp_enqueue_style( 'jetpack-scan-prerequisites' );
}
// Output the HTML
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo esc_html( get_admin_page_title() ); ?></title>
<style>
html {
background: #f1f1f1;
color: #444;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
line-height: 1.4em;
}
body {
margin: 0;
}
#wpadminbar { display: none; }
</style>
<?php
global $hook_suffix;
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$hook_suffix = 'jetpack-scan';
// BEGIN see wp-admin/admin-header.php
print_admin_styles();
print_head_scripts();
/** This action is documented in wp-admin/admin-header.php */
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_head' );
// END see wp-admin/admin-header.php
?>
</head>
<body class="jetpack-scan">
<div id="jetpack-scan-app" style="height: 100vh; box-sizing: border-box;"></div>
<?php
// BEGIN see wp-admin/admin-footer.php
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_footer', '' );
// Print import map first so it's available for inline scripts
wp_script_modules()->print_import_map();
print_footer_scripts();
wp_script_modules()->print_enqueued_script_modules();
wp_script_modules()->print_script_module_preloads();
wp_script_modules()->print_script_module_data();
/** This action is documented in wp-admin/admin-footer.php */
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// END see wp-admin/admin-footer.php
?>
</body>
</html>
<?php
exit;
}
/**
* Intercept admin_init to render the page early.
* This bypasses the default WordPress admin template.
*/
function jetpack_scan_jetpack_scan_intercept_render() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( isset( $_GET['page'] ) && 'jetpack-scan' === $_GET['page'] ) {
jetpack_scan_jetpack_scan_render_page();
exit;
}
}
// Hook the interceptor to admin_init
add_action( 'admin_init', 'jetpack_scan_jetpack_scan_intercept_render' );
@@ -0,0 +1,113 @@
<?php
/**
* Routes registration - Auto-generated by build process.
* Registers all routes on their respective page init hooks.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
// Load routes registry
$routes_file = __DIR__ . '/routes/registry.php';
if ( ! file_exists( $routes_file ) ) {
return;
}
$routes = require $routes_file;
// Group routes by page and store in globals for page-specific functions
$routes_by_page = array();
foreach ( $routes as $route ) {
$page_slug = $route['page'];
if ( ! isset( $routes_by_page[ $page_slug ] ) ) {
$routes_by_page[ $page_slug ] = array();
}
$routes_by_page[ $page_slug ][] = $route;
}
// Store routes data in globals for each page
foreach ( $routes_by_page as $page_slug => $page_routes ) {
$page_slug_underscore = str_replace( '-', '_', $page_slug );
$global_name = 'jetpack_scan_' . $page_slug_underscore . '_routes_data';
$GLOBALS[ $global_name ] = $page_routes;
}
/**
* Generic helper function to register routes for a page.
*
* @param array $page_routes Array of route data for the page.
* @param string $register_function_name Name of the function to call for registering each route.
*/
function jetpack_scan_register_page_routes( $page_routes, $register_function_name ) {
// Load build constants
$build_constants = require __DIR__ . '/constants.php';
foreach ( $page_routes as $route ) {
$content_handle = null;
$route_handle = null;
// Register content module if exists
if ( $route['has_content'] ) {
$content_asset_path = __DIR__ . "/routes/{$route['name']}/content.min.asset.php";
if ( file_exists( $content_asset_path ) ) {
$content_asset = require $content_asset_path;
$content_handle = 'jetpack-scan/routes/' . $route['name'] . '/content';
$extension = '.min.js';
// Deregister first to override any previously registered version
// (e.g., Core's default modules when running as a plugin).
wp_deregister_script_module( $content_handle );
wp_register_script_module(
$content_handle,
$build_constants['build_url'] . 'routes/' . $route['name'] . '/content' . $extension,
$content_asset['module_dependencies'] ?? array(),
$content_asset['version'] ?? false
);
}
}
// Register route module if exists
if ( $route['has_route'] ) {
$route_asset_path = __DIR__ . "/routes/{$route['name']}/route.min.asset.php";
if ( file_exists( $route_asset_path ) ) {
$route_asset = require $route_asset_path;
$route_handle = 'jetpack-scan/routes/' . $route['name'] . '/route';
$extension = '.min.js';
// Deregister first to override any previously registered version
// (e.g., Core's default modules when running as a plugin).
wp_deregister_script_module( $route_handle );
wp_register_script_module(
$route_handle,
$build_constants['build_url'] . 'routes/' . $route['name'] . '/route' . $extension,
$route_asset['module_dependencies'] ?? array(),
$route_asset['version'] ?? false
);
}
}
// Register route with page
if ( function_exists( $register_function_name ) ) {
call_user_func( $register_function_name, $route['path'], $content_handle, $route_handle );
}
}
}
// Page-specific route registration functions
// Page-specific route registration functions for jetpack-scan
/**
* Register routes for jetpack-scan page (full-page mode).
*/
function jetpack_scan_register_jetpack_scan_page_routes() {
global $jetpack_scan_jetpack_scan_routes_data;
jetpack_scan_register_page_routes( $jetpack_scan_jetpack_scan_routes_data, 'jetpack_scan_register_jetpack_scan_route' );
}
add_action( 'jetpack-scan_init', 'jetpack_scan_register_jetpack_scan_page_routes' );
/**
* Register routes for jetpack-scan page (wp-admin mode).
*/
function jetpack_scan_register_jetpack_scan_wp_admin_page_routes() {
global $jetpack_scan_jetpack_scan_routes_data;
jetpack_scan_register_page_routes( $jetpack_scan_jetpack_scan_routes_data, 'jetpack_scan_register_jetpack_scan_wp_admin_route' );
}
add_action( 'jetpack-scan-wp-admin_init', 'jetpack_scan_register_jetpack_scan_wp_admin_page_routes' );
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '63b5fff8850fad3669d1');
@@ -0,0 +1,38 @@
var xO=Object.create;var kh=Object.defineProperty;var SO=Object.getOwnPropertyDescriptor;var RO=Object.getOwnPropertyNames;var kO=Object.getPrototypeOf,CO=Object.prototype.hasOwnProperty;var EO=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var tt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ni=(e,t)=>{for(var r in t)kh(e,r,{get:t[r],enumerable:!0})},TO=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of RO(t))!CO.call(e,n)&&n!==r&&kh(e,n,{get:()=>t[n],enumerable:!(o=SO(t,n))||o.enumerable});return e};var p=(e,t,r)=>(r=e!=null?xO(kO(e)):{},TO(t||!e||!e.__esModule?kh(r,"default",{value:e,enumerable:!0}):r,e));var H=tt((HU,Rx)=>{Rx.exports=window.React});var V=tt((zU,kx)=>{kx.exports=window.ReactJSXRuntime});var U=tt((gW,Lx)=>{Lx.exports=window.wp.element});var li=tt((fq,z1)=>{z1.exports=window.ReactDOM});var qS=tt($S=>{"use strict";var Js=H();function aI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sI=typeof Object.is=="function"?Object.is:aI,cI=Js.useState,lI=Js.useEffect,dI=Js.useLayoutEffect,uI=Js.useDebugValue;function fI(e,t){var r=t(),o=cI({inst:{value:r,getSnapshot:t}}),n=o[0].inst,i=o[1];return dI(function(){n.value=r,n.getSnapshot=t,$v(n)&&i({inst:n})},[e,r,t]),lI(function(){return $v(n)&&i({inst:n}),e(function(){$v(n)&&i({inst:n})})},[e]),uI(r),r}function $v(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!sI(e,r)}catch{return!0}}function pI(e,t){return t()}var mI=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pI:fI;$S.useSyncExternalStore=Js.useSyncExternalStore!==void 0?Js.useSyncExternalStore:mI});var zl=tt((WY,GS)=>{"use strict";GS.exports=qS()});var KS=tt(YS=>{"use strict";var nf=H(),gI=zl();function hI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vI=typeof Object.is=="function"?Object.is:hI,bI=gI.useSyncExternalStore,wI=nf.useRef,_I=nf.useEffect,yI=nf.useMemo,xI=nf.useDebugValue;YS.useSyncExternalStoreWithSelector=function(e,t,r,o,n){var i=wI(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=yI(function(){function d(g){if(!c){if(c=!0,l=g,g=o(g),n!==void 0&&a.hasValue){var f=a.value;if(n(f,g))return u=f}return u=g}if(f=u,vI(l,g))return f;var h=o(g);return n!==void 0&&n(f,h)?(l=g,f):(l=g,u=h)}var c=!1,l,u,m=r===void 0?null:r;return[function(){return d(t())},m===null?void 0:function(){return d(m())}]},[t,r,o,n]);var s=bI(e,i[0],i[1]);return _I(function(){a.hasValue=!0,a.value=s},[s]),xI(s),s}});var XS=tt((qY,QS)=>{"use strict";QS.exports=KS()});var oe=tt((Joe,rk)=>{rk.exports=window.wp.i18n});var De=tt((one,sk)=>{sk.exports=window.wp.primitives});var sr=tt((Aie,pk)=>{pk.exports=window.wp.compose});var Nw=tt((Iie,mk)=>{mk.exports=window.wp.theme});var Fw=tt((jie,Ik)=>{Ik.exports=window.wp.privateApis});var eT=tt((lle,ZE)=>{var Gp={};try{Gp=EO("jetpackConfig")}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),Gp={missingConfig:!0}}var JE=e=>Object.hasOwn(Gp,e),JV=e=>{if(!JE(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return Gp[e]};ZE.exports={jetpackConfigHas:JE,jetpackConfigGet:JV}});var r0=tt((dle,tT)=>{tT.exports=window.wp.url});var de=tt((mle,cT)=>{cT.exports=window.wp.components});var Fn=tt((Ble,kT)=>{kT.exports=window.wp.date});var ET=tt((Ule,CT)=>{var vc=1e3,bc=vc*60,wc=bc*60,es=wc*24,vF=es*7,bF=es*365.25;CT.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return wF(e);if(r==="number"&&isFinite(e))return t.long?yF(e):_F(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function wF(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return r*bF;case"weeks":case"week":case"w":return r*vF;case"days":case"day":case"d":return r*es;case"hours":case"hour":case"hrs":case"hr":case"h":return r*wc;case"minutes":case"minute":case"mins":case"min":case"m":return r*bc;case"seconds":case"second":case"secs":case"sec":case"s":return r*vc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function _F(e){var t=Math.abs(e);return t>=es?Math.round(e/es)+"d":t>=wc?Math.round(e/wc)+"h":t>=bc?Math.round(e/bc)+"m":t>=vc?Math.round(e/vc)+"s":e+"ms"}function yF(e){var t=Math.abs(e);return t>=es?Xp(e,t,es,"day"):t>=wc?Xp(e,t,wc,"hour"):t>=bc?Xp(e,t,bc,"minute"):t>=vc?Xp(e,t,vc,"second"):e+" ms"}function Xp(e,t,r,o){var n=t>=r*1.5;retLine truncated
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
[role=tab]:is([aria-selected=true])
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var dd={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},VE=1,jE=(0,Xa.forwardRef)(function({children:t,variant:r="default",className:o,activateOnFocus:n,...i},a){let[s,d]=(0,Xa.useState)(null),[c,l]=(0,Xa.useState)({first:!1,last:!1,isScrolling:!1});(0,Xa.useEffect)(()=>{if(!s)return;let m=()=>{let{scrollWidth:b,clientWidth:w,scrollLeft:v}=s,y=Math.max(b-w,0),x=(s.dir||(typeof window<"u"?window.getComputedStyle(s).direction:"ltr"))==="rtl"&&v<0?-v:v;l({first:x>VE,last:x<y-VE,isScrolling:b>w})},g=new ResizeObserver(m);g.observe(s);let f=!1,h=()=>{f||(requestAnimationFrame(()=>{m(),f=!1}),f=!0)};return s.addEventListener("scroll",h,{passive:!0}),m(),()=>{s.removeEventListener("scroll",h),g.disconnect()}},[s]);let u=(0,FE.useMergeRefs)([a,m=>d(m)]);return(0,$p.jsxs)(cn.List,{ref:u,activateOnFocus:n,"data-select-on-move":n?"true":"false",className:z(dd.tablist,c.first&&dd["is-overflowing-first"],c.last&&dd["is-overflowing-last"],dd[`is-${r}-variant`],o),...i,tabIndex:i.tabIndex??(c.isScrolling?-1:void 0),children:[t,(0,$p.jsx)(cn.Indicator,{className:dd.indicator})]})});var BE=p(U(),1);var _r=p(U(),1);var ud=p(V(),1),qp=!1,K_=qp?(0,_r.createContext)(null):null;function LV(){let e=(0,_r.useContext)(K_);(0,_r.useEffect)(()=>{if(e)return e.registerTab()},[e])}function HV(){}var LE=qp?LV:HV;function zV(){let e=(0,_r.useContext)(K_);(0,_r.useEffect)(()=>{if(e)return e.registerPanel()},[e])}function BV(){}var HE=qp?zV:BV;function UV({children:e}){let t=(0,_r.useRef)(0),r=(0,_r.useRef)(0),o=Hp(()=>{let s=t.current,d=r.current;if(s!==d)throw new Error(`Tabs: Tab/Panel count mismatch (${s} Tabs, ${d} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`)}),n=(0,_r.useCallback)(()=>(t.current+=1,o(),()=>{t.current-=1,o()}),[o]),i=(0,_r.useCallback)(()=>(r.current+=1,o(),()=>{r.current-=1,o()}),[o]),a=(0,_r.useMemo)(()=>({registerTab:n,registerPanel:i}),[n,i]);return(0,ud.jsx)(K_.Provider,{value:a,children:e})}function WV({children:e}){return(0,ud.jsx)(ud.Fragment,{children:e})}var zE=qp?UV:WV;var $E=p(V(),1),Q_="data-wp-hash";function X_(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={documents:new Map,styles:new Map,injectedStyles:new WeakMap},typeof document<"u"&&qV(document)),e.__wpStyleRuntime}function $V(e,t){if(!e.head)return!1;for(let r of e.head.querySelectorAll(`style[${Q_}]`))if(r.getAttribute(Q_)===t)return!0;return!1}function UE(e,t,r){if(!e.head)return;let o=X_(),n=o.injectedStyles.get(e);if(n||(n=new Set,o.injectedStyles.set(e,n)),n.has(t))return;if($V(e,t)){n.add(t);return}let i=e.createElement("style");i.setAttribute(Q_,t),i.appendChild(e.createTextNode(r)),e.head.appendChild(i),n.add(t)}function qV(e){let t=X_();t.documents.set(e,(t.documents.get(e)??0)+1);for(let[r,o]of t.styles)UE(e,r,o);return()=>{let r=t.documents.get(e);if(r!==void 0){if(r<=1){t.documents.delete(e);return}t.documents.set(e,r-1)}}}function WE(e,t){let r=X_();r.styles.set(e,t);for(let o of r.documents.keys())UE(o,e,t)}typeof process>"u",WE("1fb29d3a3c","._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-inpu Line truncated
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
[role=tab]:is([aria-selected=true])
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var Z_={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},XE=(0,KE.forwardRef)(function({className:t,children:r,...o},n){return LE(),(0,fd.jsxs)(cn.Tab,{ref:n,className:z(Z_.tab,t),...o,children:[(0,fd.jsx)("span",{className:Z_["tab-children"],children:r}),(0,fd.jsx)(ln,{icon:Ub,className:Z_["tab-chevron"]})]})});var xr=p(V(),1);var Yp=p(eT(),1),rT=p(r0(),1);function pd(e){class t extends Error{constructor(...o){super(...o),this.name=e}}return t}var ZV=pd("JsonParseError"),eF=pd("JsonParseAfterRedirectError"),tF=pd("Api404Error"),rF=pd("Api404AfterRedirectError"),oF=pd("FetchNetworkError");function nF(e,t){let r=e,o=e,n={"X-WP-Nonce":t},i={credentials:"same-origin",headers:n},a={method:"post",credentials:"same-origin",headers:Object.assign({},n,{"Content-type":"application/json"})},s=c,d={setApiRoot(f){r=f},setWpcomOriginApiUrl(f){o=f},setApiNonce(f){n={"X-WP-Nonce":f},i={credentials:"same-origin",headers:n},a={method:"post",credentials:"same-origin",headers:Object.assign({},n,{"Content-type":"application/json"})}},setCacheBusterCallback:f=>{s=f},registerSite:(f,h,b)=>{let w={};return(0,Yp.jetpackConfigHas)("consumer_slug")&&(w.plugin_slug=(0,Yp.jetpackConfigGet)("consumer_slug")),h!==null&&(w.redirect_uri=h),b&&(w.from=b),u(`${r}jetpack/v4/connection/register`,a,{body:JSON.stringify(w)}).then(Z).then(ee)},fetchAuthorizationUrl:f=>l((0,rT.addQueryArgs)(`${r}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:f}),i).then(Z).then(ee),fetchSiteConnectionData:()=>l(`${r}jetpack/v4/connection/data`,i).then(ee),fetchSiteConnectionStatus:()=>l(`${r}jetpack/v4/connection`,i).then(ee),fetchSiteConnectionTest:()=>l(`${r}jetpack/v4/connection/test`,i).then(Z).then(ee),fetchUserConnectionData:()=>l(`${r}jetpack/v4/connection/data`,i).then(ee),fetchUserTrackingSettings:()=>l(`${r}jetpack/v4/tracking/settings`,i).then(Z).then(ee),updateUserTrackingSettings:f=>u(`${r}jetpack/v4/tracking/settings`,a,{body:JSON.stringify(f)}).then(Z).then(ee),disconnectSite:()=>u(`${r}jetpack/v4/connection`,a,{body:JSON.stringify({isActive:!1})}).then(Z).then(ee),fetchConnectUrl:()=>l(`${r}jetpack/v4/connection/url`,i).then(Z).then(ee),unlinkUser:(f=!1,h={})=>{let b={linked:!1,force:!!f};return h.disconnectAllUsers&&(b["disconnect-all-users"]=!0),u(`${r}jetpack/v4/connection/user`,a,{body:JSON.stringify(b)}).then(Z).then(ee)},reconnect:()=>u(`${r}jetpack/v4/connection/reconnect`,a).then(Z).then(ee),fetchConnectedPlugins:()=>l(`${r}jetpack/v4/connection/plugins`,i).then(Z).then(ee),setHasSeenWCConnectionModal:()=>u(`${r}jetpack/v4/seen-wc-connection-modal`,a).then(Z).then(ee),fetchModules:()=>l(`${r}jetpack/v4/module/all`,i).then(Z).then(ee),fetchModule:f=>l(`${r}jetpack/v4/module/${f}`,i).then(Z).then(ee),activateModule:f=>u(`${r}jetpack/v4/module/${f}/active`,a,{body:JSON.stringify({active:!0})}).then(Z).then(ee),deactivateModule:f=>u(`${r}jetpack/v4/module/${f}/active`,a,{body:JSON.stringify({active:!1})}),updateModuleOptions:(f,h)=>u(`${r}jetpack/v4/module/${f}`,a,{body:JSON.stringify(h)}).then(Z).then(ee),updateSettings:f=>u(`${r}jetpack/v4/settings`,a,{body:JSON.stringify(f)}).then(Z).then(ee),getProtectCount:()=>l(`${r}jetpack/v4/module/protect/data`,i).then(Z).then(ee),resetOptions:f=>u(`${r}jetpack/v4/options/${f}`,a,{body:JSON.stringify({reset:!0})}).then(Z).then(ee),activateVaultPress:()=>u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(Z).then(ee),getVaultPressData:()=>l(`${r}jetpack/v4/module/vaultpress/data`,i).then(Z).then(ee),installPlugin:(f,h)=>{let b={slug:f,status:"active"};return h&&(b.source=h),u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify(b)}).then(Z).then(ee)},activateAkismet:()=>u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(Z).then(ee),getAkismetData:()=>l(`${r}jetpack/v4/module/akismet/data`,i).then(Z).then(ee),checkAkismetKey:()=>l(`${r}jetpack/v4/module/akismet/key/check`,i).then(Z).then(ee),checkAkismetKeyTyped:f=>u(`${r}jetpack/v4/module/akismet/key/check`,a,{body:JSON.stringify({api_key:f})}).then(Z).then(ee),getFeatureTypeStatus:f=>l(`${r}jetpack/v4/feature/${f}`,i).then(Z).then(ee),fetchStatsData:f=>l(m(f),i).then(Z).then(ee).then(g),getPluginUpdates:()=>l(`${r}jetpack/v4/updates/plugins`,i).then(Z).then(ee),getPlans:()=>l(`${r}jetpack/v4/plans`,i).then(Z).then(ee),fetchSettings:()=>l(`${r}jetpack/v4/settings`,i).then(Z).then(ee),updateSetting:f=>u(`${r}jetpack/v4/settings`,a,{body:JSON.stringify(f)}).then(Z).then(ee),fetchSiteData:()=>l(`${r}jetpack/v4/site`,i).then(Z).then(ee).then(f=>JSON.parse Line truncated
`);return(0,lt.jsxs)(Ce,{gap:"lg",direction:"column",children:[(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsxs)(Ce,{gap:"sm",direction:"row",align:"center",wrap:"wrap",children:[(0,lt.jsx)(fe,{variant:"heading-lg",children:t.title}),!!t.severity&&(0,lt.jsx)(un,{severity:t.severity})]}),t.signature&&(0,lt.jsx)(fe,{variant:"body-sm",className:"jp-scan-text-muted",style:{fontFamily:"monospace"},children:t.signature})]}),t.description&&(0,lt.jsx)(fe,{children:t.description}),t.firstDetected&&(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:(0,Yo.__)("First detected","jetpack-scan-page")}),(0,lt.jsx)(fe,{children:(0,ix.dateI18n)("F j, Y",t.firstDetected,!1)})]}),t.fixedOn&&(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:(0,Yo.__)("Fixed on","jetpack-scan-page")}),(0,lt.jsx)(fe,{children:(0,ix.dateI18n)("F j, Y",t.fixedOn,!1)})]}),t.extension&&(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:t.extension.type==="themes"?(0,Yo.__)("Theme","jetpack-scan-page"):(0,Yo.__)("Plugin","jetpack-scan-page")}),(0,lt.jsxs)(fe,{children:[t.extension.name," ",t.extension.version,t.fixedIn&&` \u2192 ${t.fixedIn}`]})]}),t.filename&&(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:(0,Yo.__)("File","jetpack-scan-page")}),(0,lt.jsx)("pre",{style:sO,children:t.filename})]}),n&&(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:(0,Yo.__)("Context","jetpack-scan-page")}),(0,lt.jsx)("pre",{style:sO,children:n})]}),(0,lt.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,lt.jsx)(fe,{className:"jp-scan-text-muted",children:t.status==="fixed"?(0,Yo.__)("How was it fixed?","jetpack-scan-page"):(0,Yo.__)("How will it be fixed?","jetpack-scan-page")}),(0,lt.jsx)(fe,{children:o})]})]})}var Fr=p(V()),nB=()=>{let{data:e,isLoading:t,error:r}=Ia(N8()),{onFixThreats:o}=aO(),n=DT(),i=(0,hn.useMemo)(()=>e?.threats??[],[e]),a=(0,hn.useMemo)(()=>i.filter(h=>!!h.fixable).length,[i]),s=e?.state,d=s==="enqueued"||s==="running",c=Vr(),l=(0,hn.useCallback)((h,b)=>c(`jetpack_scan_${h}`,b),[c]),[u,m]=(0,hn.useState)(!1),g=(0,hn.useCallback)(()=>{c("jetpack_scan_fix_threats_cta_click",{threat_count:a}),c("jetpack_scan_bulk_fix_threats_modal_open",{threat_count:a}),m(!0)},[c,a]),f=(0,hn.useCallback)(()=>m(!1),[]);return(0,hn.useEffect)(()=>(n((0,Fr.jsxs)(Fr.Fragment,{children:[(0,Fr.jsx)(eO,{disabled:d}),a>0&&!d&&(0,Fr.jsx)(At,{variant:"solid",onClick:g,children:(0,Oa.sprintf)((0,Oa._n)("Auto-fix %d threat","Auto-fix %d threats",a,"jetpack-scan-page"),a)})]})),()=>n(null)),[a,d,n,g]),t?(0,Fr.jsx)(Ce,{align:"center",justify:"center",style:{minHeight:360},children:(0,Fr.jsx)(lO.Spinner,{})}):r?(0,Fr.jsx)("p",{children:(0,Oa.__)("Unable to load active threats. Please try again later.","jetpack-scan-page")}):d?(0,Fr.jsx)(rO,{state:s,progress:e?.current?.progress}):(0,Fr.jsxs)(Fr.Fragment,{children:[(0,Fr.jsx)(rl,{data:i,onFixThreats:o,RenderFixModal:q8,RenderIgnoreModal:K8,RenderViewModal:vh,showStatusFilter:!1,persistKey:"jetpack-scan:active-threats:view",onTrackEvent:l,empty:(0,Fr.jsx)(mh,{heading:(0,Oa.__)("You're set up. No active threats.","jetpack-scan-page"),body:(0,Oa.__)("Jetpack Scan watches your site for vulnerabilities and suspicious files. New findings will appear here.","jetpack-scan-page")})}),u&&(0,Fr.jsx)(U8,{threats:i,onClose:f})]})},dO=nB;var _h=p(de()),mO=p(U()),wh=p(oe());var uO=p(bo()),Ns=p(oe()),fO=p(Zi());var bh=p(H());var fo=p(V());function pO({items:e,closeModal:t}){let r=e[0],o=Vr(),n=L8(),{createSuccessNotice:i,createErrorNotice:a}=(0,uO.useDispatch)(fO.store);(0,bh.useEffect)(()=>{o("jetpack_scan_unignore_threat_modal_open")},[o]);let s=(0,bh.useCallback)(()=>{o("jetpack_scan_unignore_threat_click"),n.mutate(r.id,{onSuccess:()=>{t?.(),o("jetpack_scan_unignore_threat_success"),i((0,Ns.__)("Threat unignored.","jetpack-scan-page"),{type:"snackbar"})},onError:d=>{t?.(),o("jetpack_scan_unignore_threat_failed"),a(d instanceof Error?d.message:(0,Ns.__)("Failed to unignore threat. Please try again.","jetpack-scan-page"),{type:"snackbar"})}})},[r.id,n,t,o,i,a]);return(0,fo.jsxs)(Ce,{gap:"lg",direction:"column",children:[(0,fo.jsx)(fe,{className:"jp-scan-text-muted",children:(0,Ns.__)("Jetpack will be unignoring the following threat:","jetpack-scan-page")}),(0,fo.jsxs)(Ce,{gap:"xs",direction:"column",children:[(0,fo.jsxs)(Ce,{gap:"sm",direction:"row",align:"center",wrap:"wrap",children:[(0,fo.jsx)(fe,{variant:"heading-md",children:r.title}),!!r.severity&&(0,fo.jsx)(un,{severity:r.severity})]}),r.description&&(0,fo.jsx)(fe,{className:"jp-scan-text-muted",children:r.description})]}),(0,fo.jsx)(dn.Root,{intent:"warning",children:(0,fo.jsx)(dn.Description,{children:(0,Ns.__)("By unignoring this threat you confirm that you have reviewed the Line truncated
/*! Bundled license information:
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
(**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
(**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
tabbable/dist/index.esm.js:
(*!
* tabbable 6.4.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*)
*/
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '051fa939bb02df0ad906');
@@ -0,0 +1 @@
var e={inspector:()=>!1};export{e as route};
@@ -0,0 +1,17 @@
<?php
/**
* Route registry - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
return array(
array(
'name' => 'index',
'path' => '/',
'page' => 'jetpack-scan',
'has_route' => true,
'has_content' => true,
)
);
@@ -0,0 +1,85 @@
<?php
/**
* Script registration - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
/**
* Registers a script according to `wp_register_script`. Honors this request by
* reassigning internal dependency properties of any script handle already
* registered by that name. It does not deregister the original script, to
* avoid losing inline scripts which may have been attached.
*
* @param WP_Scripts $scripts WP_Scripts instance.
* @param string $handle Name of the script. Should be unique.
* @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
* @param array $deps Optional. An array of registered script handles this script depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
* as a query string for cache busting purposes. If version is set to false, a version
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added.
* @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>.
* Default 'false'.
*/
function jetpack_scan_override_script( $scripts, $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
$script = $scripts->query( $handle, 'registered' );
if ( $script ) {
/*
* In many ways, this is a reimplementation of `wp_register_script` but
* bypassing consideration of whether a script by the given handle had
* already been registered.
*/
// See: `_WP_Dependency::__construct` .
$script->src = $src;
$script->deps = $deps;
$script->ver = $ver;
$script->args = $in_footer ? 1 : null;
} else {
$scripts->add( $handle, $src, $deps, $ver, ( $in_footer ? 1 : null ) );
}
if ( in_array( 'wp-i18n', $deps, true ) ) {
$scripts->set_translations( $handle );
}
}
/**
* Register all package scripts.
*/
function jetpack_scan_register_package_scripts( $scripts ) {
// Load build constants
$build_constants = require __DIR__ . '/constants.php';
$default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
$extension = '.min.js';
$scripts_dir = __DIR__ . '/scripts';
$scripts_file = $scripts_dir . '/registry.php';
if ( ! file_exists( $scripts_file ) ) {
return;
}
$scripts_data = require $scripts_file;
$plugin_dir = dirname( __FILE__ );
foreach ( $scripts_data as $script_data ) {
$asset_file = $scripts_dir . '/' . $script_data['asset'];
$asset = file_exists( $asset_file ) ? require $asset_file : array();
$dependencies = $asset['dependencies'] ?? array();
$version = $asset['version'] ?? $default_version;
jetpack_scan_override_script(
$scripts,
$script_data['handle'],
$build_constants['build_url'] . 'scripts/' . $script_data['path'] . $extension,
$dependencies,
$version,
true
);
}
}
add_action( 'wp_default_scripts', 'jetpack_scan_register_package_scripts' );
@@ -0,0 +1,11 @@
<?php
/**
* Script registry - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
return array(
);
@@ -0,0 +1,73 @@
<?php
/**
* Style registration - Auto-generated by build process.
* Do not edit this file manually.
*
* Note: These styles can be overridden by calling jetpack_scan_override_style()
* in lib/client-assets.php for complex cases (multiple files, conditional deps, etc.)
*
* @package jetpack_scan
*/
/**
* Registers a style according to `wp_register_style`. Honors this request by
* deregistering any style by the same handler before registration.
*
* @param WP_Styles $styles WP_Styles instance.
* @param string $handle Name of the stylesheet. Should be unique.
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
* as a query string for cache busting purposes. If version is set to false, a version
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
* '(orientation: portrait)' and '(max-width: 640px)'.
*/
function jetpack_scan_override_style( $styles, $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
$style = $styles->query( $handle, 'registered' );
if ( $style ) {
$styles->remove( $handle );
}
$styles->add( $handle, $src, $deps, $ver, $media );
}
/**
* Register all package styles (simple cases only).
* Complex cases should be manually registered in lib/client-assets.php.
*
* @param WP_Styles $styles WP_Styles instance.
*/
function jetpack_scan_register_package_styles( $styles ) {
// Load build constants
$build_constants = require __DIR__ . '/constants.php';
$default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
$suffix = '.min';
$styles_dir = __DIR__ . '/styles';
$styles_file = $styles_dir . '/registry.php';
if ( ! file_exists( $styles_file ) ) {
return;
}
$styles_data = require $styles_file;
$plugin_dir = dirname( __FILE__ );
foreach ( $styles_data as $style_data ) {
jetpack_scan_override_style(
$styles,
$style_data['handle'],
$build_constants['build_url'] . 'styles/' . $style_data['path'] . $suffix . '.css',
$style_data['dependencies'],
$default_version
);
// Enable RTL support (WordPress automatically loads -rtl.css variant)
$styles->add_data( $style_data['handle'], 'rtl', 'replace' );
$styles->add_data( $style_data['handle'], 'suffix', $suffix );
}
}
add_action( 'wp_default_styles', 'jetpack_scan_register_package_styles' );
@@ -0,0 +1,11 @@
<?php
/**
* Style registry - Auto-generated by build process.
* Do not edit this file manually.
*
* @package jetpack_scan
*/
return array(
);