import{b as F,r as u,j as e,a as E}from"./app-BwDemWQz.js";import{B as y}from"./Button-B-KWyoQR.js";import{C as I,a as L}from"./Card-DJ3wHKN-.js";import{I as d}from"./Input-BJaxI6jp.js";import{L as i}from"./Label-1lm7x8-L.js";import{m as b}from"./proxy-DQ767J20.js";import{c as v}from"./createLucideIcon-BASx8f0E.js";import{C as j}from"./circle-alert-BdYD3adQ.js";import{C as $}from"./circle-check-D63KpeJI.js";import{U as q}from"./user-DdNqTlyU.js";import{M}from"./mail-6ZJ7GN6n.js";import{L as f}from"./lock-BkJ6aXiy.js";import{E as N}from"./eye-off-CLMyxla3.js";import{E as w}from"./eye-C30qcgue.js";import{A as B}from"./arrow-left-B11txR0s.js";import{A as D}from"./arrow-right-Ctvx1a-x.js";/* empty css            *//**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const U=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],z=v("at-sign",U);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],T=v("user-plus",R);function ne({appName:k="Postuno",errors:t={},flash:s={},old:c={}}){const{data:r,setData:n,post:C,processing:g}=F({name:c.name||"",username:c.username||"",email:c.email||"",password:"",password_confirmation:"",force:c.force||"0"}),[p,A]=u.useState(!1),[h,S]=u.useState(!1),_=a=>{a.preventDefault(),C("/install/account/setup/store")},P=()=>{E.visit("/install/envato-verification?verify_token="+btoa("envato_verification"))},o=(()=>{if(!r.password)return{level:0,text:"",color:""};const a=r.password;let l=0,m="Weak",x="red";return a.length>=6&&l++,a.length>=8&&l++,/[A-Z]/.test(a)&&l++,/[0-9]/.test(a)&&l++,/[^A-Za-z0-9]/.test(a)&&l++,l>=4?(m="Strong",x="green"):l>=3?(m="Good",x="yellow"):l>=2&&(m="Fair",x="orange"),{level:l,text:m,color:x}})();return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 dark:from-gray-900 dark:via-gray-800 dark:to-gray-900",children:e.jsx("div",{className:"container mx-auto px-4 py-12",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs(b.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"text-center mb-12",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-gradient-to-r from-blue-500 to-purple-600 mb-6",children:e.jsx(T,{className:"w-10 h-10 text-white"})}),e.jsx("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-4",children:"Admin Account Setup"}),e.jsxs("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:["Create your administrator account for ",k]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Installation Progress"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Step 4 of 6"})]}),e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2 dark:bg-gray-700",children:e.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-purple-600 h-2 rounded-full transition-all duration-500",style:{width:"67%"}})})]}),e.jsx(b.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsx(I,{className:"backdrop-blur-sm bg-white/90 dark:bg-gray-800/90 shadow-xl border-0",children:e.jsx(L,{className:"p-8",children:e.jsxs("form",{onSubmit:_,className:"space-y-6",children:[s.error&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx(j,{className:"w-5 h-5 text-red-500 mt-0.5 mr-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-red-800 dark:text-red-200 font-medium",children:"Database Issue"}),e.jsx("p",{className:"text-red-600 dark:text-red-300 text-sm mt-1",children:s.error}),e.jsx("p",{className:"text-red-600 dark:text-red-300 text-xs mt-2",children:'Check the "Force Installation" option below to overwrite existing data.'})]})]})}),s.success&&e.jsx("div",{className:"mb-6 p-4 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx($,{className:"w-5 h-5 text-green-500 mt-0.5 mr-3"}),e.jsx("p",{className:"text-green-600 dark:text-green-300 text-sm",children:s.success})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"name",className:"text-gray-700 dark:text-gray-300",children:["Full Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(q,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx(d,{id:"name",type:"text",placeholder:"John Doe",value:r.name,onChange:a=>n("name",a.target.value),className:"pl-10 h-12",required:!0})]}),t.name&&e.jsx("p",{className:"text-sm text-red-500",children:t.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"username",className:"text-gray-700 dark:text-gray-300",children:["Username ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx(d,{id:"username",type:"text",placeholder:"admin",value:r.username,onChange:a=>n("username",a.target.value.toLowerCase().replace(/[^a-z0-9]/g,"")),className:"pl-10 h-12",required:!0})]}),t.username&&e.jsx("p",{className:"text-sm text-red-500",children:t.username}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Only lowercase letters and numbers allowed. This will be your login username."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"email",className:"text-gray-700 dark:text-gray-300",children:["Email Address ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(M,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx(d,{id:"email",type:"email",placeholder:"admin@example.com",value:r.email,onChange:a=>n("email",a.target.value),className:"pl-10 h-12",required:!0})]}),t.email&&e.jsx("p",{className:"text-sm text-red-500",children:t.email}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"You'll use this email to log in to your admin panel"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"password",className:"text-gray-700 dark:text-gray-300",children:["Password ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx(d,{id:"password",type:p?"text":"password",placeholder:"Enter a strong password",value:r.password,onChange:a=>n("password",a.target.value),className:"pl-10 pr-10 h-12",required:!0}),e.jsx("button",{type:"button",onClick:()=>A(!p),className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:p?e.jsx(N,{className:"w-5 h-5 text-gray-400"}):e.jsx(w,{className:"w-5 h-5 text-gray-400"})})]}),t.password&&e.jsx("p",{className:"text-sm text-red-500",children:t.password}),r.password&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(a=>e.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${a<=o.level?o.color==="red"?"bg-red-500":o.color==="orange"?"bg-orange-500":o.color==="yellow"?"bg-yellow-500":"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`},a))}),e.jsxs("p",{className:`text-xs ${o.color==="red"?"text-red-500":o.color==="orange"?"text-orange-500":o.color==="yellow"?"text-yellow-500":"text-green-500"}`,children:["Password Strength: ",o.text]})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Use at least 8 characters for better security"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"password_confirmation",className:"text-gray-700 dark:text-gray-300",children:["Confirm Password ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx(d,{id:"password_confirmation",type:h?"text":"password",placeholder:"Re-enter your password",value:r.password_confirmation,onChange:a=>n("password_confirmation",a.target.value),className:"pl-10 pr-10 h-12",required:!0}),e.jsx("button",{type:"button",onClick:()=>S(!h),className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:h?e.jsx(N,{className:"w-5 h-5 text-gray-400"}):e.jsx(w,{className:"w-5 h-5 text-gray-400"})})]}),r.password_confirmation&&r.password!==r.password_confirmation&&e.jsx("p",{className:"text-sm text-red-500",children:"Passwords do not match"})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-800 dark:text-blue-300 mb-2",children:"Admin Account Setup"}),e.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"This will be your main administrator account. You can add more users later from the dashboard."})]}),e.jsx("div",{className:`border rounded-lg p-4 transition-colors ${s.error?"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800":"bg-gray-50 dark:bg-gray-900/20 border-gray-200 dark:border-gray-700"}`,children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("input",{type:"checkbox",id:"force",checked:r.force==="1",onChange:a=>n("force",a.target.checked?"1":"0"),className:`w-4 h-4 rounded focus:ring-2 ${s.error?"text-orange-600 bg-gray-100 border-gray-300 focus:ring-orange-500 dark:bg-gray-600 dark:border-gray-500":"text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:bg-gray-600 dark:border-gray-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("label",{htmlFor:"force",className:`block text-sm font-medium cursor-pointer ${s.error?"text-orange-800 dark:text-orange-200":"text-gray-800 dark:text-gray-200"}`,children:["Force Installation (Overwrite Existing Data)",s.error&&e.jsx("span",{className:"text-red-500 ml-2",children:"← Recommended to fix the error"})]}),e.jsx("p",{className:`text-xs mt-1 ${s.error?"text-orange-600 dark:text-orange-300":"text-gray-600 dark:text-gray-400"}`,children:s.error?"This will delete all existing data in your database and create a completely fresh installation.":"Check this option if you want to completely reset your database and start fresh. This will delete any existing data."}),s.error&&e.jsx("div",{className:"mt-2 p-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded text-xs",children:e.jsxs("p",{className:"text-yellow-700 dark:text-yellow-300",children:[e.jsx("strong",{children:"⚠️ Warning:"})," Force installation will permanently delete all data in your database. Make sure you have a backup if you need to preserve any existing data."]})})]})]})}),t.general&&e.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:e.jsxs("div",{className:"flex items-start",children:[e.jsx(j,{className:"w-5 h-5 text-red-500 mt-0.5 mr-3"}),e.jsx("p",{className:"text-red-600 dark:text-red-400",children:t.general})]})}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsxs(y,{type:"button",onClick:P,variant:"outline",className:"flex-1",disabled:g,children:[e.jsx(B,{className:"mr-2 h-4 w-4"}),"Back"]}),e.jsx(y,{type:"submit",disabled:g||!r.name||!r.email||!r.password||!r.password_confirmation||r.password!==r.password_confirmation,className:"flex-1 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white",children:g?e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating Account..."]}):e.jsxs("span",{className:"flex items-center justify-center",children:["Create Admin Account",e.jsx(D,{className:"ml-2 h-4 w-4"})]})})]})]})})})})]})})})}export{ne as default};
