(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7656],{8539:function(e,t,s){Promise.resolve().then(s.bind(s,7663))},87461:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(64090),l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),r=(e,t)=>{let s=(0,a.forwardRef)((s,r)=>{let{color:i="currentColor",size:o=24,strokeWidth:d=2,absoluteStrokeWidth:c,className:m="",children:x,...h}=s;return(0,a.createElement)("svg",{ref:r,...l,width:o,height:o,stroke:i,strokeWidth:c?24*Number(d)/Number(o):d,className:["lucide","lucide-".concat(n(e)),m].join(" "),...h},[...t.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(x)?x:[x]])});return s.displayName="".concat(e),s}},57976:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},49108:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},37805:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},93276:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},51930:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]])},37841:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},37451:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},18994:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},51318:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]])},40695:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},11213:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},71483:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let a=(0,s(87461).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},7663:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return f}});var a=s(3827),l=s(64090),n=s(71483),r=s(40695),i=s(18994),o=s(57976),d=s(93276),c=s(51930),m=s(37841),x=s(37451),h=s(11213);/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let u=(0,s(87461).Z)("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);var b=s(51318),g=s(49108),p=s(37805);let y={en:{title:"Install PageCraft AI",subtitle:"Setup wizard — follow the steps to configure your application",steps:["Requirements","Database","Site Info","Admin Account","API Keys","Install","Done!"],next:"Next",back:"Back",testConnection:"Test Connection",testKey:"Test",install:"Start Installation",regenerate:"Regenerate",required:"Required",optional:"Optional",checkingRequirements:"Checking system requirements...",allPassed:"All checks passed! You can proceed.",someFailures:"Some checks failed. Please fix the issues above.",dbTypeLabel:"Database Type",hostLabel:"Host",portLabel:"Port",databaseLabel:"Database Name",usernameLabel:"Username",passwordLabel:"Password",sslLabel:"Use SSL",connectionSuccess:"Connection successful!",siteNameLabel:"Site Name",siteUrlLabel:"Site URL",languageLabel:"Default Language",fullNameLabel:"Full Name",emailLabel:"Email",passwordLabel2:"Password",confirmPasswordLabel:"Confirm Password",passwordMismatch:"Passwords do not match",passwordTooShort:"Password must be at least 8 characters",openRouterLabel:"OpenRouter API Key",unsplashLabel:"Unsplash Access Key",googleIdLabel:"Google Client ID",googleSecretLabel:"Google Client Secret",installing:"Installing...",congratulations:"Installation Complete!",goToDashboard:"Go to Dashboard",loginInfo:"Login with:"},ar:{title:"تثبيت PageCraft AI",subtitle:"معالج الإعداد — اتبع الخطوات لتهيئة التطبيق",steps:["المتطلبات","قاعدة البيانات","معلومات الموقع","حساب المدير","مفاتيح API","التثبيت","تم!"],next:"التالي",back:"السابق",testConnection:"اختبار الاتصال",testKey:"اختبار",install:"بدء التثبيت",regenerate:"إعادة توليد",required:"مطلوب",optional:"اختياري",checkingRequirements:"جاري فحص متطلبات النظام...",allPassed:"جميع الفحوصات نجحت! يمكنك المتابعة.",someFailures:"بعض الفحوصات فشلت. يرجى إصلاح المشاكل أعلاه.",dbTypeLabel:"نوع قاعدة البيانات",hostLabel:"المضيف",portLabel:"المنفذ",databaseLabel:"اسم قاعدة البيانات",usernameLabel:"اسم المستخدم",passwordLabel:"كلمة المرور",sslLabel:"استخدام SSL",connectionSuccess:"الاتصال ناجح!",siteNameLabel:"اسم الموقع",siteUrlLabel:"رابط الموقع",languageLabel:"اللغة الافتراضية",fullNameLabel:"الاسم الكامل",emailLabel:"البريد الإلكتروني",passwordLabel2:"كلمة المرور",confirmPasswordLabel:"تأكيد كلمة المرور",passwordMismatch:"كلمتا المرور غير متطابقتين",passwordTooShort:"كلمة المرور يجب أن تكون 8 أحرف على الأقل",openRouterLabel:"مفتاح OpenRouter API",unsplashLabel:"مفتاح Unsplash",googleIdLabel:"معرّف عميل Google",googleSecretLabel:"سر عميل Google",installing:"جاري التثبيت...",congratulations:"اكتمل التثبيت!",goToDashboard:"الذهاب للوحة التحكم",loginInfo:"تسجيل الدخول بـ:"}};function f(){let[e,t]=(0,l.useState)("en"),[s,f]=(0,l.useState)(0),[w,j]=(0,l.useState)(!1),[N,k]=(0,l.useState)(""),[v,C]=(0,l.useState)([]),[L,P]=(0,l.useState)(!1),[Z,S]=(0,l.useState)(!1),[q,I]=(0,l.useState)([]),[R,T]=(0,l.useState)(!1),[A,K]=(0,l.useState)({dbType:"postgresql",dbHost:"localhost",dbPort:"5432",dbName:"pagecraft_ai",dbUser:"",dbPass:"",dbSsl:!1,siteName:"PageCraft AI",siteUrl:window.location.origin,siteLang:"ar",adminName:"",adminEmail:"",adminPass:"",adminPassConfirm:"",openRouterKey:"",unsplashKey:"",googleClientId:"",googleClientSecret:""}),[U,E]=(0,l.useState)({db:!1,admin:!1}),M=y[e],z="ar"===e,O=(e,t)=>{K(s=>{let a={...s,[e]:t};return"dbType"===e&&(a.dbPort="mysql"===t?"3306":"5432"),a}),k(""),e.startsWith("db")&&P(!1)},D=async()=>{j(!0),k("");try{let e=await fetch("/api/install/check"),t=await e.json();C(t.checks)}catch(e){k(e.message)}j(!1)};(0,l.useEffect)(()=>{0===s&&D()},[s]);let H=async()=>{j(!0),k("");try{let e=await fetch("/api/install/test-db",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:A.dbType,host:A.dbHost,port:parseInt(A.dbPort),database:A.dbName,username:A.dbUser,password:A.dbPass,ssl:A.dbSsl})}),t=await e.json();t.success?(P(!0),k("")):(k(t.error),P(!1))}catch(e){k(e.message)}j(!1)},_=async(e,t)=>{j(!0),k("");try{let s=await fetch("/api/install/test-api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,apiKey:t})}),a=await s.json();a.success?("openrouter"===e&&S(!0),k("")):k(a.error)}catch(e){k(e.message)}j(!1)},G=async()=>{j(!0),k(""),I([]);try{let e=await fetch("/api/install/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:{type:A.dbType,host:A.dbHost,port:parseInt(A.dbPort),database:A.dbName,username:A.dbUser,password:A.dbPass,ssl:A.dbSsl},site:{name:A.siteName,url:A.siteUrl,language:A.siteLang},admin:{name:A.adminName,email:A.adminEmail,password:A.adminPass},api:{openRouterKey:A.openRouterKey,unsplashKey:A.unsplashKey,googleClientId:A.googleClientId,googleClientSecret:A.googleClientSecret}})}),t=await e.json();I(t.steps||[]),t.success?(T(!0),f(6)):k(t.error||"Installation failed")}catch(e){k(e.message)}j(!1)},F=()=>{switch(s){case 0:return v.length>0&&v.every(e=>e.ok);case 1:return L;case 2:return!!A.siteName&&!!A.siteUrl;case 3:return!!A.adminName&&!!A.adminEmail&&A.adminPass.length>=8&&A.adminPass===A.adminPassConfirm;case 4:return Z;default:return!0}},J=e=>{let{label:t,value:s,onChange:l,type:n="text",placeholder:r="",required:i=!1,badge:o=""}=e;return(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-300",children:t}),o&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full ".concat(o===M.required?"bg-red-500/20 text-red-400":"bg-gray-500/20 text-gray-400"),children:o})]}),(0,a.jsx)("input",{type:n,value:s,onChange:e=>l(e.target.value),placeholder:r,required:i,className:"w-full bg-white/[0.04] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-sm placeholder:text-gray-600 focus:outline-none focus:border-indigo-500/60 focus:bg-white/[0.06] transition-all"})]})};return(0,a.jsxs)("div",{className:"min-h-screen bg-[#0a0a14] text-white ".concat(z?"rtl":"ltr"),dir:z?"rtl":"ltr",children:[(0,a.jsxs)("div",{className:"absolute top-4 right-4 flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>t("en"),className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-all ".concat("en"===e?"bg-indigo-500 text-white":"bg-white/[0.04] text-gray-400"),children:"EN"}),(0,a.jsx)("button",{onClick:()=>t("ar"),className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-all ".concat("ar"===e?"bg-indigo-500 text-white":"bg-white/[0.04] text-gray-400"),children:"عربي"})]}),(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-6 py-12",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold bg-gradient-to-r from-indigo-400 to-purple-400 bg-clip-text text-transparent",children:M.title}),(0,a.jsx)("p",{className:"text-gray-400 mt-2 text-sm",children:M.subtitle})]}),(0,a.jsx)(()=>(0,a.jsx)("div",{className:"flex items-center justify-center gap-1 mb-10",children:M.steps.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all ".concat(t<s?"bg-green-500 text-white":t===s?"bg-indigo-500 text-white":"bg-white/[0.06] text-gray-500"),children:t<s?"✓":t+1}),(0,a.jsx)("span",{className:"hidden sm:inline text-xs mx-2 ".concat(t===s?"text-white":"text-gray-500"),children:e}),t<M.steps.length-1&&(0,a.jsx)("div",{className:"w-8 h-0.5 ".concat(t<s?"bg-green-500":"bg-white/[0.06]")})]},t))}),{}),N&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 mb-6 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-sm",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 shrink-0"}),N]}),(0,a.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-2xl p-8",children:[0===s&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(r.Z,{className:"h-5 w-5 text-indigo-400"}),M.steps[0]]}),w?(0,a.jsxs)("div",{className:"flex items-center gap-3 text-gray-400",children:[(0,a.jsx)(i.Z,{className:"h-5 w-5 animate-spin"}),M.checkingRequirements]}):(0,a.jsxs)("div",{className:"space-y-3",children:[v.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/[0.02]",children:[e.ok?(0,a.jsx)(o.Z,{className:"h-5 w-5 text-green-400"}):(0,a.jsx)(n.Z,{className:"h-5 w-5 text-red-400"}),(0,a.jsx)("span",{className:e.ok?"text-gray-300":"text-red-400",children:e.message})]},e.name)),v.length>0&&(0,a.jsx)("p",{className:"text-sm mt-4 ".concat(v.every(e=>e.ok)?"text-green-400":"text-red-400"),children:v.every(e=>e.ok)?M.allPassed:M.someFailures})]})]}),1===s&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(d.Z,{className:"h-5 w-5 text-indigo-400"}),M.steps[1]]}),(0,a.jsx)("div",{className:"flex gap-3 mb-6",children:["postgresql","mysql"].map(e=>(0,a.jsx)("button",{onClick:()=>O("dbType",e),className:"flex-1 p-4 rounded-xl border text-center transition-all ".concat(A.dbType===e?"border-indigo-500 bg-indigo-500/10 text-white":"border-white/[0.08] bg-white/[0.02] text-gray-400 hover:border-white/[0.15]"),children:(0,a.jsx)("span",{className:"text-sm font-semibold",children:"postgresql"===e?"PostgreSQL":"MySQL"})},e))}),(0,a.jsx)(J,{label:M.hostLabel,value:A.dbHost,onChange:e=>O("dbHost",e),placeholder:"localhost"}),(0,a.jsx)(J,{label:M.portLabel,value:A.dbPort,onChange:e=>O("dbPort",e),placeholder:"mysql"===A.dbType?"3306":"5432"}),(0,a.jsx)(J,{label:M.databaseLabel,value:A.dbName,onChange:e=>O("dbName",e),placeholder:"pagecraft_ai",required:!0}),(0,a.jsx)(J,{label:M.usernameLabel,value:A.dbUser,onChange:e=>O("dbUser",e),required:!0}),(0,a.jsxs)("div",{className:"mb-4 relative",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:M.passwordLabel}),(0,a.jsx)("input",{type:U.db?"text":"password",value:A.dbPass,onChange:e=>O("dbPass",e.target.value),className:"w-full bg-white/[0.04] border border-white/[0.08] text-white rounded-xl px-4 py-3 text-sm focus:outline-none focus:border-indigo-500/60 transition-all"}),(0,a.jsx)("button",{type:"button",onClick:()=>E(e=>({...e,db:!e.db})),className:"absolute right-3 top-10 text-gray-500 hover:text-gray-300",children:U.db?(0,a.jsx)(c.Z,{className:"h-4 w-4"}):(0,a.jsx)(m.Z,{className:"h-4 w-4"})})]}),(0,a.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer mb-6",children:[(0,a.jsx)("input",{type:"checkbox",checked:A.dbSsl,onChange:e=>O("dbSsl",e.target.checked),className:"w-4 h-4 rounded border-gray-600 text-indigo-500 focus:ring-indigo-500"}),(0,a.jsx)("span",{className:"text-sm text-gray-300",children:M.sslLabel})]}),(0,a.jsxs)("button",{onClick:H,disabled:w||!A.dbUser||!A.dbName,className:"w-full bg-white/[0.06] hover:bg-white/[0.10] border border-white/[0.08] text-white font-medium py-3 rounded-xl transition-all disabled:opacity-40 flex items-center justify-center gap-2",children:[w?(0,a.jsx)(i.Z,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(d.Z,{className:"h-4 w-4"}),M.testConnection]}),L&&(0,a.jsxs)("p",{className:"text-green-400 text-sm mt-3 flex items-center gap-2",children:[(0,a.jsx)(o.Z,{className:"h-4 w-4"}),M.connectionSuccess]})]}),2===s&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(x.Z,{className:"h-5 w-5 text-indigo-400"}),M.steps[2]]}),(0,a.jsx)(J,{label:M.siteNameLabel,value:A.siteName,onChange:e=>O("siteName",e),placeholder:"PageCraft AI",required:!0}),(0,a.jsx)(J,{label:M.siteUrlLabel,value:A.siteUrl,onChange:e=>O("siteUrl",e),placeholder:"https://example.com",required:!0}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:M.languageLabel}),(0,a.jsx)("div",{className:"flex gap-3",children:["ar","en"].map(e=>(0,a.jsx)("button",{onClick:()=>O("siteLang",e),className:"flex-1 p-3 rounded-xl border text-center transition-all ".concat(A.siteLang===e?"border-indigo-500 bg-indigo-500/10 text-white":"border-white/[0.08] text-gray-400"),children:"ar"===e?"العربية":"English"},e))})]})]}),3===s&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(h.Z,{className:"h-5 w-5 text-indigo-400"}),M.steps[3]]}),(0,a.jsx)(J,{label:M.fullNameLabel,value:A.adminName,onChange:e=>O("adminName",e),required:!0}),(0,a.jsx)(J,{label:M.emailLabel,value:A.adminEmail,onChange:e=>O("adminEmail",e),type:"email",required:!0}),(0,a.jsx)(J,{label:M.passwordLabel2,value:A.adminPass,onChange:e=>O("adminPass",e),type:"password",required:!0}),(0,a.jsx)(J,{label:M.confirmPasswordLabel,value:A.adminPassConfirm,onChange:e=>O("adminPassConfirm",e),type:"password",required:!0}),A.adminPass&&A.adminPassConfirm&&A.adminPass!==A.adminPassConfirm&&(0,a.jsx)("p",{className:"text-red-400 text-sm",children:M.passwordMismatch}),A.adminPass&&A.adminPass.length<8&&(0,a.jsx)("p",{className:"text-amber-400 text-sm",children:M.passwordTooShort})]}),4===s&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(u,{className:"h-5 w-5 text-indigo-400"}),M.steps[4]]}),(0,a.jsx)(J,{label:M.openRouterLabel,value:A.openRouterKey,onChange:e=>{O("openRouterKey",e),S(!1)},badge:M.required}),(0,a.jsxs)("button",{onClick:()=>_("openrouter",A.openRouterKey),disabled:w||!A.openRouterKey,className:"w-full mb-6 bg-white/[0.06] hover:bg-white/[0.10] border border-white/[0.08] text-white font-medium py-2.5 rounded-xl transition-all disabled:opacity-40 flex items-center justify-center gap-2 text-sm",children:[w?(0,a.jsx)(i.Z,{className:"h-4 w-4 animate-spin"}):null,M.testKey," OpenRouter"]}),Z&&(0,a.jsxs)("p",{className:"text-green-400 text-sm mb-4 flex items-center gap-2",children:[(0,a.jsx)(o.Z,{className:"h-4 w-4"}),"OpenRouter OK"]}),(0,a.jsx)("hr",{className:"border-white/[0.06] my-6"}),(0,a.jsx)(J,{label:M.unsplashLabel,value:A.unsplashKey,onChange:e=>O("unsplashKey",e),badge:M.optional}),(0,a.jsx)(J,{label:M.googleIdLabel,value:A.googleClientId,onChange:e=>O("googleClientId",e),badge:M.optional}),(0,a.jsx)(J,{label:M.googleSecretLabel,value:A.googleClientSecret,onChange:e=>O("googleClientSecret",e),badge:M.optional})]}),5===s&&!R&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{className:"text-xl font-bold mb-6 flex items-center gap-2",children:[(0,a.jsx)(b.Z,{className:"h-5 w-5 text-indigo-400"}),M.steps[5]]}),0===q.length&&!w&&(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(b.Z,{className:"h-12 w-12 text-indigo-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-400 mb-6",children:z?"كل شيء جاهز. اضغط لبدء التثبيت.":"Everything is ready. Click to start installation."}),(0,a.jsx)("button",{onClick:G,className:"bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-500 hover:to-purple-500 text-white font-bold py-4 px-10 rounded-xl text-lg transition-all shadow-lg shadow-indigo-500/20",children:M.install})]}),(w||q.length>0)&&(0,a.jsxs)("div",{className:"space-y-3",children:[q.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/[0.02]",children:["ok"===e.status?(0,a.jsx)(o.Z,{className:"h-5 w-5 text-green-400"}):(0,a.jsx)(n.Z,{className:"h-5 w-5 text-red-400"}),(0,a.jsx)("span",{className:"ok"===e.status?"text-gray-300":"text-red-400",children:e.message})]},t)),w&&(0,a.jsxs)("div",{className:"flex items-center gap-3 text-gray-400",children:[(0,a.jsx)(i.Z,{className:"h-5 w-5 animate-spin"}),M.installing]})]})]}),6===s&&R&&(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"w-20 h-20 rounded-full bg-green-500/20 flex items-center justify-center mx-auto mb-6",children:(0,a.jsx)(o.Z,{className:"h-10 w-10 text-green-400"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold mb-2",children:M.congratulations}),(0,a.jsx)("p",{className:"text-gray-400 mb-2",children:M.loginInfo}),(0,a.jsx)("p",{className:"text-indigo-400 font-mono text-sm mb-8",children:A.adminEmail}),(0,a.jsx)("a",{href:"/login",className:"inline-block bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-500 hover:to-purple-500 text-white font-bold py-4 px-10 rounded-xl text-lg transition-all shadow-lg shadow-indigo-500/20",children:M.goToDashboard})]})]}),s<5&&(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsxs)("button",{onClick:()=>{f(s-1),k("")},disabled:0===s,className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-white/[0.04] text-gray-400 hover:bg-white/[0.08] disabled:opacity-30 transition-all",children:[(0,a.jsx)(g.Z,{className:"h-4 w-4"}),M.back]}),(0,a.jsxs)("button",{onClick:()=>{F()&&(f(s+1),k(""))},disabled:!F(),className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium disabled:opacity-30 transition-all",children:[M.next,(0,a.jsx)(p.Z,{className:"h-4 w-4"})]})]})]})]})}}},function(e){e.O(0,[2971,8069,1744],function(){return e(e.s=8539)}),_N_E=e.O()}]);