<?php
if (!defined('ABSPATH')) exit;

/**
 * Custom Auth Suite™ — Auth Pages Admin Tools
 *
 * Admin-only action/UI layer for creating and mapping CAS auth pages.
 * Core definitions/status live in inc/core/auth-pages.php.
 */

if (!function_exists('custausu_admin_auth_pages_primary_lang')) {
  function custausu_admin_auth_pages_primary_lang(array $settings = []): string {
    $lang = '';

    if (!empty($settings['routes_default_lang']) && is_scalar($settings['routes_default_lang'])) {
      $lang = sanitize_key((string) $settings['routes_default_lang']);
    }

    if ($lang === '') {
      $site_locale = (string) get_option('WPLANG');
      if ($site_locale === '') {
        $site_locale = (string) get_locale();
      }

      $lang = sanitize_key(strtolower((string) strtok($site_locale, '_')));
    }

    return $lang !== '' ? $lang : 'en';
  }
}

if (!function_exists('custausu_admin_auth_pages_default_title_for_route')) {
  function custausu_admin_auth_pages_default_title_for_route(string $route, string $lang = ''): string {
    $route = sanitize_key($route);
    $lang2 = strtolower(substr(sanitize_key($lang), 0, 2));

    $it = [
      'login' => 'Accesso account',
      'register' => 'Registrazione account',
      'lostpassword' => 'Recupera password',
      'lostpassword_confirm' => 'Conferma reset password',
    ];

    if ($lang2 === 'it' && isset($it[$route])) {
      return $it[$route];
    }

    return function_exists('custausu_auth_page_default_title')
      ? custausu_auth_page_default_title($route)
      : ucfirst(str_replace('_', ' ', $route));
  }
}

if (!function_exists('custausu_admin_auth_pages_default_slug_for_route')) {
  function custausu_admin_auth_pages_default_slug_for_route(string $route, string $lang = ''): string {
    $route = sanitize_key($route);
    $lang2 = strtolower(substr(sanitize_key($lang), 0, 2));

    $it = [
      'login' => 'login-account',
      'register' => 'registra-account',
      'lostpassword' => 'recupero-password',
      'lostpassword_confirm' => 'password-reset-confermato',
    ];

    if ($lang2 === 'it' && isset($it[$route])) {
      return $it[$route];
    }

    return function_exists('custausu_auth_page_default_slug')
      ? custausu_auth_page_default_slug($route)
      : sanitize_title(str_replace('_', '-', $route));
  }
}


if (!function_exists('custausu_admin_auth_pages_redirect_url')) {
  function custausu_admin_auth_pages_redirect_url(array $args = []): string {
    $url = admin_url('admin.php?page=custausu-settings');

    $args = array_merge([
      'custausu_section' => 'wizard',
      'custausu_wizard_step' => '2',
    ], $args);

    return add_query_arg($args, $url) . '#custausu-section-wizard';
  }
}


if (!function_exists('custausu_admin_auth_pages_get_query_arg')) {
  function custausu_admin_auth_pages_get_query_arg(string $key, string $default = ''): string {
    $key = sanitize_key($key);

    if ($key === '') {
      return $default;
    }

    // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin query arg used for notices/screen routing; no state change is performed here.
    if (!isset($_GET[$key])) {
      return $default;
    }

    // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Read-only admin query arg is unslashed and sanitized immediately below.
    $value = wp_unslash($_GET[$key]);

    if (is_array($value)) {
      return $default;
    }

    return sanitize_text_field((string) $value);
  }
}

if (!function_exists('custausu_admin_auth_pages_create_primary_action')) {
  function custausu_admin_auth_pages_create_primary_action(): void {
    if (!current_user_can('manage_options')) {
      wp_die(esc_html__('You are not allowed to manage Custom Auth Suite settings.', 'custom-auth-suite'));
    }

    check_admin_referer('custausu_auth_pages_create_primary');

    $settings = get_option('custausu_global_settings', []);
    $settings = is_array($settings) ? $settings : [];

    $locale = (string) get_locale();
    $lang = sanitize_key((string)($settings['routes_default_lang'] ?? ''));

    if ($lang === '') {
      $lang = strtolower(substr($locale, 0, 2));
    }

    if ($lang === '') {
      $lang = 'en';
    }

    $is_it = ($lang === 'it' || strpos($locale, 'it_') === 0);

    $routes = function_exists('custausu_auth_page_route_keys')
      ? custausu_auth_page_route_keys()
      : ['login', 'register', 'lostpassword', 'lostpassword_confirm'];

    $template_fallback = [
      'login'                => 'account-login.php',
      'register'             => 'account-register.php',
      'lostpassword'         => 'lost-password.php',
      'lostpassword_confirm' => 'lost-password-confirm.php',
    ];

    $default_titles = $is_it
      ? [
        'login'                => 'Accesso account',
        'register'             => 'Registrazione account',
        'lostpassword'         => 'Recupera password',
        'lostpassword_confirm' => 'Conferma reset password',
      ]
      : [
        'login'                => 'Account Login',
        'register'             => 'Account Registration',
        'lostpassword'         => 'Lost Password',
        'lostpassword_confirm' => 'Password Reset Confirmation',
      ];

    $default_slugs = $is_it
      ? [
        'login'                => 'login-account',
        'register'             => 'registra-account',
        'lostpassword'         => 'recupero-password',
        'lostpassword_confirm' => 'password-reset-confermato',
      ]
      : [
        'login'                => 'account-login',
        'register'             => 'account-register',
        'lostpassword'         => 'lost-password',
        'lostpassword_confirm' => 'lost-password-confirm',
      ];

    $posted_titles = [];

    if (isset($_POST['custausu_auth_pages_titles']) && is_array($_POST['custausu_auth_pages_titles'])) {
      // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Auth page titles array is unslashed here and each scalar value is sanitized immediately below.
      $posted_titles_raw = wp_unslash($_POST['custausu_auth_pages_titles']);

      if (is_array($posted_titles_raw)) {
        $posted_titles = array_map(
          static function ($value): string {
            return is_scalar($value) ? sanitize_text_field((string) $value) : '';
          },
          $posted_titles_raw
        );
      }
    }

    if (!isset($settings['routes_paths']) || !is_array($settings['routes_paths'])) {
      $settings['routes_paths'] = [];
    }

    if (!isset($settings['routes_paths'][$lang]) || !is_array($settings['routes_paths'][$lang])) {
      $settings['routes_paths'][$lang] = [];
    }

    if (!isset($settings['routes_page_ids']) || !is_array($settings['routes_page_ids'])) {
      $settings['routes_page_ids'] = [];
    }

    if (!isset($settings['routes_page_ids'][$lang]) || !is_array($settings['routes_page_ids'][$lang])) {
      $settings['routes_page_ids'][$lang] = [];
    }

    $created = 0;
    $updated = 0;
    $failed  = 0;

    foreach ($routes as $route) {
      $route = sanitize_key((string) $route);

      if ($route === 'landing' || $route === '') {
        continue;
      }

      $template = function_exists('custausu_auth_page_expected_template')
        ? (string) custausu_auth_page_expected_template($route)
        : (string)($template_fallback[$route] ?? '');

      if ($template === '') {
        continue;
      }

      $title = isset($posted_titles[$route]) && is_scalar($posted_titles[$route])
        ? sanitize_text_field((string) $posted_titles[$route])
        : '';

      if ($title === '') {
        $title = $default_titles[$route] ?? ucfirst($route);
      }

      $slug = sanitize_title($default_slugs[$route] ?? $route);

      $page_id = absint($settings['routes_page_ids'][$lang][$route] ?? 0);

      if ($page_id <= 0 || !get_post($page_id) || get_post_type($page_id) !== 'page') {
        $page_id = function_exists('custausu_auth_page_find_by_template')
          ? absint(custausu_auth_page_find_by_template($route, $lang))
          : 0;
      }

      $payload = [
        'post_type'   => 'page',
        'post_status' => 'publish',
        'post_title'  => $title,
        'post_name'   => $slug,
      ];

      if ($page_id > 0) {
        $payload['ID'] = $page_id;
        $result = wp_update_post($payload, true);
        $was_update = true;
      } elseif (
        function_exists('custausu_auth_page_template_candidate_ids') &&
        custausu_auth_page_template_candidate_ids($route)
      ) {
        $failed++;
        continue;
      } else {
        $payload['post_content'] = '';
        $result = wp_insert_post($payload, true);
        $was_update = false;
      }

      if (is_wp_error($result) || absint($result) <= 0) {
        $failed++;
        continue;
      }

      $page_id = absint($result);

      update_post_meta($page_id, '_wp_page_template', $template);
      update_post_meta($page_id, '_cas_auth_page_language', $lang);


      $path = function_exists('custausu_auth_page_route_path_from_id')
        ? custausu_auth_page_route_path_from_id($page_id)
        : wp_parse_url(get_permalink($page_id), PHP_URL_PATH);

      $path = is_string($path) && $path !== ''
        ? '/' . trim($path, '/') . '/'
        : '';

      if ($path !== '') {
        $settings['routes_paths'][$lang][$route] = $path;
      }

      $settings['routes_page_ids'][$lang][$route] = $page_id;

      if ($was_update) {
        $updated++;
      } else {
        $created++;
      }
    }

    $settings['routes_default_lang'] = $lang;

    update_option('custausu_global_settings', $settings, false);

    if (function_exists('clean_post_cache')) {
      foreach (($settings['routes_page_ids'][$lang] ?? []) as $pid) {
        clean_post_cache(absint($pid));
      }
    }

    flush_rewrite_rules(false);

    $redirect = add_query_arg(
      [
        'page'                  => 'custausu-settings',
        'custausu_auth_pages_done'   => '1',
        'custausu_auth_pages_created'=> $created,
        'custausu_auth_pages_updated'=> $updated,
        'custausu_auth_pages_failed' => $failed,
      ],
      admin_url('admin.php')
    );

    wp_safe_redirect($redirect . '#custausu-section-wizard');
    exit;
  }
}

add_action('admin_post_custausu_auth_pages_create_primary', 'custausu_admin_auth_pages_create_primary_action');

if (!function_exists('custausu_admin_render_auth_pages_wizard_card')) {
  function custausu_admin_render_auth_pages_wizard_card(array $opt = []): void {
    $T = static function (string $en, string $it = ''): string {
      if (function_exists('custausu_admin_t')) {
        return custausu_admin_t($en, $it !== '' ? $it : $en);
      }

      $locale = (string) get_locale();
      return (strpos($locale, 'it_') === 0 && $it !== '') ? $it : $en;
    };

    $settings = is_array($opt) && !empty($opt)
      ? $opt
      : get_option('custausu_global_settings', []);

    $settings = is_array($settings) ? $settings : [];

    $locale = (string) get_locale();
    $lang = sanitize_key((string)($settings['routes_default_lang'] ?? ''));

    if ($lang === '') {
      $lang = strtolower(substr($locale, 0, 2));
    }

    if ($lang === '') {
      $lang = 'en';
    }

    $is_it = ($lang === 'it' || strpos($locale, 'it_') === 0);

    $routes = function_exists('custausu_auth_page_route_keys')
      ? custausu_auth_page_route_keys()
      : ['login', 'register', 'lostpassword', 'lostpassword_confirm'];

    $template_fallback = [
      'login'                => 'account-login.php',
      'register'             => 'account-register.php',
      'lostpassword'         => 'lost-password.php',
      'lostpassword_confirm' => 'lost-password-confirm.php',
    ];

    $default_titles = $is_it
      ? [
        'login'                => 'Accesso account',
        'register'             => 'Registrazione account',
        'lostpassword'         => 'Recupera password',
        'lostpassword_confirm' => 'Conferma reset password',
      ]
      : [
        'login'                => 'Account Login',
        'register'             => 'Account Registration',
        'lostpassword'         => 'Lost Password',
        'lostpassword_confirm' => 'Password Reset Confirmation',
      ];

    $issue_map = [];
    $translated_issue_map = [];

    if (function_exists('custausu_auth_page_route_consistency_issues')) {
      foreach ((array) custausu_auth_page_route_consistency_issues($settings) as $issue) {
        $issue_lang = sanitize_key((string)($issue['lang'] ?? ''));
        $issue_route = sanitize_key((string)($issue['route'] ?? ''));

        if ($issue_route === '') {
          continue;
        }

        if ($issue_lang === $lang) {
          $issue_map[$issue_route][] = $issue;
          continue;
        }

        if ($issue_lang !== '') {
          $translated_issue_map[$issue_lang][$issue_route][] = $issue;
        }
      }
    }

    /*
     * The automatic Auth Pages action manages only the primary CAS route
     * language. Translated mappings are reviewed manually in Routes &
     * Templates and must never turn this button into a misleading Fix action.
     */
    $has_issues = !empty($issue_map);
    $has_translated_issues = !empty($translated_issue_map);

    $settings_url = admin_url('options-general.php');

    echo '<div class="' . esc_attr( 'custausu-auth-pages-tool' . ($has_issues ? ' custausu-auth-pages-tool--needs-fix' : '') ) . '">';
    echo '<h3>' . esc_html($T('Create CAS Auth Pages', 'Crea pagine Auth CAS')) . '</h3>';

    echo '<p>' . esc_html($T(
      'Create or update the four WordPress pages required by Custom Auth Suite™, assign the correct CAS templates and connect them automatically to Routes & Templates.',
      'Crea o aggiorna le quattro pagine WordPress richieste da Custom Auth Suite™, assegna i template CAS corretti e collegale automaticamente a Percorsi e Template.'
    )) . '</p>';

    echo '<p class="custausu-auth-pages-tool__lang-note">';
    echo esc_html(sprintf(
      $T(
        'Site language, set in WordPress General Settings: %s.',
        'Lingua del sito, impostata nei settings generali WordPress: %s.'
      ),
      strtoupper($lang)
    ));
    echo ' <a href="' . esc_url($settings_url) . '" target="_blank" rel="noopener noreferrer">';
    echo esc_html($T('Open Settings > General', 'Apri Impostazioni > Generali'));
    echo '</a><br>';
    echo esc_html($T(
      'CAS creates and connects Auth pages for the language currently used by CAS routes. If you use Polylang, the separately distributed Advanced and Premium packages can map translated Auth pages manually in Routes & Templates after creating their translations in WordPress/Polylang.',
      'CAS crea e collega le pagine Auth per la lingua attualmente usata dalle route CAS. Se usi Polylang, i pacchetti Advanced e Premium distribuiti separatamente consentono di mapparle manualmente in Percorsi e Template dopo aver creato le traduzioni per ogni pagina Auth impostata qui.'
    ));
    echo '</p>';

    if (custausu_admin_auth_pages_get_query_arg('custausu_auth_pages_done') !== '') {
      $created = absint(custausu_admin_auth_pages_get_query_arg('custausu_auth_pages_created'));
      $updated = absint(custausu_admin_auth_pages_get_query_arg('custausu_auth_pages_updated'));
      $failed  = absint(custausu_admin_auth_pages_get_query_arg('custausu_auth_pages_failed'));

      echo '<div class="custausu-auth-pages-tool__notice custausu-auth-pages-tool__notice--ok">';
      echo esc_html(sprintf(
        $T(
          'Auth pages action completed. Created: %d. Updated: %d. Failed: %d.',
          'Azione pagine Auth completata. Create: %d. Aggiornate: %d. Fallite: %d.'
        ),
        $created,
        $updated,
        $failed
      ));
      echo '</div>';
    }

    if ($has_issues) {
      echo '<div class="custausu-auth-pages-tool__notice custausu-auth-pages-tool__notice--error">';
      echo esc_html($T(
        'One or more primary-language Auth pages changed public URL or template.',
        'Una o più pagine Auth della lingua primaria hanno cambiato URL pubblico o template.'
      ));
      echo '</div>';
    }

    if ($has_translated_issues) {
      $translated_languages = array_values(array_filter(array_map(
        static fn($issue_lang): string => strtoupper(sanitize_key((string) $issue_lang)),
        array_keys($translated_issue_map)
      )));

      echo '<div class="custausu-auth-pages-tool__notice custausu-auth-pages-tool__notice--error">';
      echo esc_html(sprintf(
        $T(
          'Translated Auth mappings need review in Routes & Templates (%s). The automatic Fix action manages only %s.',
          'Le mappature Auth tradotte richiedono una verifica in Percorsi e Template (%s). La riparazione automatica gestisce soltanto %s.'
        ),
        implode(', ', $translated_languages),
        strtoupper($lang)
      ));
      echo '</div>';
    }

    echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" class="custausu-auth-pages-tool__form">';
    wp_nonce_field('custausu_auth_pages_create_primary');
    echo '<input type="hidden" name="action" value="custausu_auth_pages_create_primary">';

    echo '<div class="custausu-auth-pages-grid">';

    foreach ($routes as $route) {
      $route = sanitize_key((string) $route);

      if ($route === 'landing' || $route === '') {
        continue;
      }

      $pid = function_exists('custausu_auth_page_find_by_template')
        ? absint(custausu_auth_page_find_by_template($route, $lang))
        : 0;

      $status = function_exists('custausu_auth_page_status')
        ? (array) custausu_auth_page_status($route, $pid)
        : [];

      $template = function_exists('custausu_auth_page_expected_template')
        ? (string) custausu_auth_page_expected_template($route)
        : (string)($template_fallback[$route] ?? '');

      $title = (string)($status['title'] ?? '');

      if ($title === '') {
        $title = $default_titles[$route] ?? ucfirst($route);
      }

      $path = (string)($status['path'] ?? '');

      $template_ok = !empty($status['template_ok']);
      $post_status = (string)($status['post_status'] ?? '');

      $route_has_issue = !empty($issue_map[$route]);
      $ready = ($pid > 0 && $template_ok && $post_status !== 'trash' && !$route_has_issue);

      $card_class = 'custausu-auth-pages-card';

      if ($route_has_issue) {
        $card_class .= ' custausu-auth-pages-card--error';
        $badge_class = 'custausu-badge custausu-badge--error';
        $badge_label = $T('Fix Required', 'Riparazione richiesta');
      } elseif ($ready) {
        $card_class .= ' custausu-auth-pages-card--ready';
        $badge_class = 'custausu-badge custausu-badge--ok';
        $badge_label = $T('Ready', 'Pronta');
      } else {
        $card_class .= ' custausu-auth-pages-card--missing';
        $badge_class = 'custausu-badge custausu-badge--error';
        $badge_label = $T('Missing', 'Mancante');
      }

      echo '<div class="' . esc_attr($card_class) . '">';
      echo '<h4>' . esc_html(ucfirst(str_replace('_', ' ', $route))) . '</h4>';
      echo '<span class="' . esc_attr($badge_class) . '">' . esc_html($badge_label) . '</span>';

      echo '<label class="custausu-auth-pages-card__label">';
      echo '<span>' . esc_html($T('Page title', 'Titolo pagina')) . '</span>';
      echo '<input type="text" name="custausu_auth_pages_titles[' . esc_attr($route) . ']" value="' . esc_attr($title) . '">';
      echo '</label>';

      echo '<p class="custausu-auth-pages-card__meta">';
      echo esc_html($T('Template:', 'Template:')) . ' <code>' . esc_html($template) . '</code>';

      if ($pid > 0) {
        echo '<br>' . esc_html($T('Page ID:', 'ID pagina:')) . ' ' . esc_html((string) $pid);
      }

      if ($path !== '') {
        echo '<br>' . esc_html($T('Path:', 'Percorso:')) . ' <code>' . esc_html($path) . '</code>';
      }

      echo '</p>';

      if ($route_has_issue) {
        foreach ($issue_map[$route] as $issue) {
          $stored = (string)($issue['stored_path'] ?? '');
          $current = (string)($issue['current_path'] ?? '');

          if ($stored !== '' || $current !== '') {
            echo '<p class="custausu-auth-pages-card__fix-note">';
            echo esc_html($T('Saved route:', 'Route salvata:')) . ' <code>' . esc_html($stored) . '</code>';
            echo '<br>';
            echo esc_html($T('Current page path:', 'Percorso pagina attuale:')) . ' <code>' . esc_html($current) . '</code>';
            echo '</p>';
          }
        }
      }

      echo '</div>';
    }

    echo '</div>';

    if ($has_issues) {
      echo '<p class="custausu-auth-pages-tool__disclaimer">';
      echo esc_html($T(
        'Fix Now will realign CAS Auth pages using the default CAS slugs for the current site language. If you want to keep custom slugs, update the affected paths manually in Routes & Templates instead.',
        'Ripara subito riallineerà le pagine Auth usando gli slug predefiniti CAS per la lingua attuale del sito. Se vuoi mantenere slug personalizzati, aggiorna manualmente i percorsi interessati in Percorsi e Template.'
      ));
      echo '</p>';
    }

    echo '<div class="custausu-auth-pages-actions">';
    echo '<button type="submit" class="button button-primary">';
    echo esc_html($has_issues ? $T('Fix Now', 'Ripara subito') : $T('Create/update CAS Auth Pages', 'Crea/aggiorna pagine Auth CAS'));
    echo '</button>';

    if ($has_issues || $has_translated_issues) {
      echo '<a href="#custausu-section-routes-templates" class="button custausu-scrollto" data-custausu-scroll-target="custausu-section-routes-templates">';
      echo esc_html($T('Go to Routes & Templates', 'Vai a Percorsi e Template'));
      echo ' <span class="custausu-scrollto__arrow">↓</span>';
      echo '</a>';
    }

    echo '</div>';

    echo '</form>';
    echo '</div>';
  }
}


if (!function_exists('custausu_admin_auth_pages_route_consistency_enqueue')) {
  function custausu_admin_auth_pages_route_consistency_enqueue(string $hook): void {
    if (
      $hook !== 'toplevel_page_custausu-settings'
      || !current_user_can('manage_options')
      || !function_exists('custausu_auth_page_route_consistency_issues')
    ) {
      return;
    }

    $issues = custausu_auth_page_route_consistency_issues();

    if (empty($issues)) {
      return;
    }

    $payload = [];

    foreach ((array) $issues as $issue) {
      $payload[] = [
        'lang'    => sanitize_key((string)($issue['lang'] ?? '')),
        'route'   => sanitize_key((string)($issue['route'] ?? '')),
        'reason'  => sanitize_key((string)($issue['reason'] ?? '')),
        'stored'  => (string)($issue['stored_path'] ?? ''),
        'current' => (string)($issue['current_path'] ?? ''),
      ];
    }

    $T = static function (string $en, string $it = ''): string {
      if (function_exists('custausu_admin_t')) {
        return custausu_admin_t($en, $it !== '' ? $it : $en);
      }

      $locale = (string) get_locale();
      return (strpos($locale, 'it_') === 0 && $it !== '') ? $it : $en;
    };

    $script_path = CUSTAUSU_PLUGIN_DIR . 'inc/assets/js/custausu-admin-auth-pages-consistency.js';

    wp_enqueue_script(
      'custausu-admin-auth-pages-consistency',
      CUSTAUSU_PLUGIN_URL . 'inc/assets/js/custausu-admin-auth-pages-consistency.js',
      [],
      is_readable($script_path) ? (string) filemtime($script_path) : CUSTAUSU_VERSION,
      true
    );

    wp_localize_script(
      'custausu-admin-auth-pages-consistency',
      'CUSTAUSU_ADMIN_AUTH_PAGES_CONSISTENCY',
      [
        'issues' => $payload,
        'noteText' => $T(
          'Review this Auth mapping in Routes & Templates.',
          'Controlla questa mappatura Auth in Percorsi e Template.'
        ),
        'noteTexts' => [
          'auth_route_stale_path' => $T(
            'This saved fallback Path does not match the selected page public URL. Update it to the value shown, or leave Path empty to use the selected page permalink.',
            'Questo Percorso di fallback salvato non coincide con l’URL pubblico della pagina selezionata. Aggiornalo al valore mostrato oppure lascia vuoto Percorso per usare il permalink della pagina.'
          ),
          'auth_route_template_mismatch' => $T(
            'The selected page no longer uses the expected CAS template. Review the Page mapping or repair the primary-language Auth pages.',
            'La pagina selezionata non usa più il template CAS previsto. Controlla la mappatura Pagina oppure ripara le pagine Auth della lingua primaria.'
          ),
          'auth_route_page_missing' => $T(
            'The selected Auth page no longer exists. Select another page or configure a valid public Path.',
            'La pagina Auth selezionata non esiste più. Seleziona un’altra pagina oppure configura un Percorso pubblico valido.'
          ),
        ],
      ]
    );
  }
}

add_action(
  'admin_enqueue_scripts',
  'custausu_admin_auth_pages_route_consistency_enqueue'
);

