import{j as i,t as n,g as S,h as u,A as v,P as b,e as T,E as N,f as y}from"./index-CzTQZzQy.js";import{r}from"./vendor-L5FivjNr.js";import{B as m}from"./index-qcynDQwW.js";import{N as D,T as f}from"./index-Dm0I4kYC.js";/**
 * 2026 Paysera
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 *
 * @author Paysera <plugins@paysera.com>
 * @copyright 2026 Paysera
 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 */const P="_toolbar_1lev3_1",B="_sections_1lev3_8",L="_diagnosticSection_1lev3_14",w="_diagnosticSectionHeader_1lev3_21",C="_diagnosticSectionTitle_1lev3_40",k="_diagnosticSectionWarning_1lev3_46",A="_diagnosticSectionChevron_1lev3_52",E="_diagnosticSectionBody_1lev3_58",F="_diagnosticSectionLoading_1lev3_63",H="_diagnosticTable_1lev3_69",O="_diagnosticTableName_1lev3_94",U="_diagnosticTableDetails_1lev3_99",W="_diagnosticBadgePass_1lev3_111",R="_diagnosticBadgeFail_1lev3_112",I="_logsLink_1lev3_132",e={toolbar:P,sections:B,diagnosticSection:L,diagnosticSectionHeader:w,diagnosticSectionTitle:C,diagnosticSectionWarning:k,diagnosticSectionChevron:A,diagnosticSectionBody:E,diagnosticSectionLoading:F,diagnosticTable:H,diagnosticTableName:O,diagnosticTableDetails:U,diagnosticBadgePass:W,diagnosticBadgeFail:R,logsLink:I},$=({results:a})=>i.jsxs("table",{className:e.diagnosticTable,children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:n("Check")}),i.jsx("th",{children:n("Status")}),i.jsx("th",{children:n("Details")})]})}),i.jsx("tbody",{children:a.map(s=>i.jsxs("tr",{children:[i.jsx("td",{className:e.diagnosticTableName,children:s.name}),i.jsx("td",{children:i.jsx("span",{className:s.isSuccessful?e.diagnosticBadgePass:e.diagnosticBadgeFail,children:s.isSuccessful?n("Pass"):n("Fail")})}),i.jsx("td",{className:e.diagnosticTableDetails,children:i.jsx("pre",{children:s.details})})]},s.name))})]}),p=r.memo($);p.displayName="DiagnosticTable";const G=({title:a,section:s,isLoading:o,isError:t,isOpen:l,onToggle:c})=>i.jsxs("div",{className:e.diagnosticSection,children:[i.jsxs("button",{type:"button",className:e.diagnosticSectionHeader,onClick:c,"aria-expanded":l,children:[i.jsxs("span",{className:e.diagnosticSectionTitle,children:[s!=null&&s.hasFailure?i.jsx("span",{className:e.diagnosticSectionWarning,"aria-label":"warning",children:"⚠"}):null,a]}),i.jsx("span",{className:e.diagnosticSectionChevron,children:l?"−":"+"})]}),l?i.jsx("div",{className:e.diagnosticSectionBody,children:t&&!s?i.jsx("p",{className:e.diagnosticSectionLoading,children:n("Unable to load diagnostic data. Please refresh the page to try again.")}):o||!s?i.jsx("p",{className:e.diagnosticSectionLoading,children:n("Loading…")}):i.jsx(p,{results:s.results})}):null]}),d=r.memo(G);d.displayName="DiagnosticSection";const J=()=>{const{data:a,isLoading:s,isError:o}=S(),[t,l]=r.useState("php"),c=g=>{l(j=>j===g?null:g)},x=`${window.payseraData.ajaxUrl}&ajax=1&action=${u.downloadDiagnosticReport}`;return i.jsxs(v,{className:"paysera-diagnostic-page",children:[i.jsx(b,{title:n("Diagnostics"),subtitle:n("Diagnose your environment and review module logs.")}),o?i.jsx(D,{status:"error",isDismissible:!1,children:i.jsx(f,{children:n("Unable to load diagnostic data. Please refresh the page to try again.")})}):null,i.jsx("div",{className:e.toolbar,children:i.jsx(m,{variant:"primary",href:x,download:!0,children:n("Download diagnostic report")})}),i.jsxs("div",{className:e.sections,children:[i.jsx(d,{title:n("PHP information"),section:a==null?void 0:a.php,isLoading:s,isError:o,isOpen:t==="php",onToggle:()=>c("php")}),i.jsx(d,{title:n("Security information"),section:a==null?void 0:a.security,isLoading:s,isError:o,isOpen:t==="security",onToggle:()=>c("security")}),i.jsx(d,{title:n("Platform information"),section:a==null?void 0:a.platform,isLoading:s,isError:o,isOpen:t==="platform",onToggle:()=>c("platform")}),i.jsx(d,{title:n("Translations information"),section:a==null?void 0:a.translations,isLoading:s,isError:o,isOpen:t==="translations",onToggle:()=>c("translations")})]}),i.jsx("div",{className:e.logsLink,children:i.jsx(m,{variant:"link",href:window.payseraData.adminLogsUrl,children:n("Open PrestaShop logs")})})]})},_=r.memo(J);_.displayName="DiagnosticPage";const h=document.getElementById("paysera-react-root");h&&T(h).render(i.jsx(N,{children:i.jsx(y,{children:i.jsx(_,{})})}));
