1import{a as F,r as t,j as e,ac as k,ad as P,p as L}from"./index-c-vW2Iaa.js";import{C as A}from"./chevron-left-DLMIvFMO.js";import{S as B}from"./shield-DgnAujJY.js";import{C as M}from"./circle-check-big-CB1K6fU6.js";import{L as x}from"./lock-C7E--olC.js";import{E as d}from"./eye-off-DGzWwWvt.js";import{E as m}from"./eye-BWvynMZn.js";import"./createLucideIcon-Dl_lvxww.js";const J=()=>{const v=F(),[l,p]=t.useState(""),[a,h]=t.useState(""),[i,u]=t.useState(""),[n,g]=t.useState(!1),[c,b]=t.useState(!1),[o,C]=t.useState(!1),[f,j]=t.useState(!1),[N,r]=t.useState(""),[E,w]=t.useState(!1),y=async()=>{if(!l||!a||!i){r("Veuillez remplir tous les champs");return}if(a!==i){r("Les mots de passe ne correspondent pas");return}if(a.length<8){r("Le nouveau mot de passe doit contenir au moins 8 caractères");return}j(!0),r("");try{let s=null;if(k.isNativePlatform()){const{value:S}=await P.get({key:"customer_token"});s=S}else s=localStorage.getItem("customer_token");if(!s)throw new Error("Non authentifié");await L.request("/api/customers/change-password",{method:"POST",headers:{Authorization:`Bearer ${s}`},body:JSON.stringify({currentPassword:l,newPassword:a})},!1),w(!0),p(""),h(""),u(""),setTimeout(()=>{w(!1)},3e3)}catch(s){console.error("Error changing password:",s),r(s.message||"Erreur lors du changement de mot de passe")}finally{j(!1)}};return e.jsx("div",{className:"fixed inset-0 z-[20000] bg-[#F2F2F7] overflow-auto",children:e.jsxs("div",{className:"min-h-full",style:{paddingTop:"env(safe-area-inset-top)",paddingBottom:"max(env(safe-area-inset-bottom), 20px)",paddingLeft:"env(safe-area-inset-left)",paddingRight:"env(safe-area-inset-right)"},children:[e.jsx("div",{className:"bg-[#F2F2F7] border-b border-[#C6C6C8]/50",children:e.jsxs("div",{className:"flex items-center justify-between h-[44px] px-4",children:[e.jsxs("button",{onClick:()=>v(-1),className:"flex items-center text-[#007AFF] active:opacity-50",children:[e.jsx(A,{className:"w-6 h-6"}),e.jsx("span",{className:"text-[17px]",children:"Retour"})]}),e.jsx("h1",{className:"text-[17px] font-semibold text-black",children:"Sécurité"}),e.jsx("div",{className:"w-16"})]})}),e.jsx("div",{className:"px-5 py-4",children:e.jsxs("div",{className:"bg-white rounded-xl p-4 shadow-sm flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 bg-[#34C759]/10 rounded-full flex items-center justify-center",children:e.jsx(B,{className:"w-7 h-7 text-[#34C759]"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-[17px] font-semibold text-black",children:"Compte sécurisé"}),e.jsx("p",{className:"text-[13px] text-[#8E8E93]",children:"Votre compte est protégé par un mot de passe"})]})]})}),e.jsxs("div",{className:"px-5 mb-4",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-[#8E8E93] uppercase tracking-wide mb-2 px-1",children:"Changer le mot de passe"}),E&&e.jsxs("div",{className:"bg-[#34C759]/10 rounded-xl p-4 mb-4 flex items-center gap-3",children:[e.jsx(M,{className:"w-5 h-5 text-[#34C759]"}),e.jsx("span",{className:"text-[15px] text-[#34C759]",children:"Mot de passe modifié avec succès"})]}),N&&e.jsx("div",{className:"bg-[#FF3B30]/10 rounded-xl p-4 mb-4",children:e.jsx("span",{className:"text-[15px] text-[#FF3B30]",children:N})}),e.jsxs("div",{className:"bg-white rounded-xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"flex items-center px-4 py-3",children:[e.jsx("div",{className:"w-10 h-10 bg-[#8E8E93] rounded-xl flex items-center justify-center mr-3",children:e.jsx(x,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-[13px] text-[#8E8E93]",children:"Mot de passe actuel"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:n?"text":"password",value:l,onChange:s=>p(s.target.value),placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",className:"flex-1 text-[17px] text-black bg-transparent outline-none"}),e.jsx("button",{onClick:()=>g(!n),className:"p-2 active:opacity-50",children:n?e.jsx(d,{className:"w-5 h-5 text-[#8E8E93]"}):e.jsx(m,{className:"w-5 h-5 text-[#8E8E93]"})})]})]})]}),e.jsx("div",{className:"h-[0.5px] bg-[#C6C6C8] ml-[60px]"}),e.jsxs("div",{className:"flex items-center px-4 py-3",children:[e.jsx("div",{className:"w-10 h-10 bg-[#007AFF] rounded-xl flex items-center justify-center mr-3",children:e.jsx(x,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-[13px] text-[#8E8E93]",children:"Nouveau mot de passe"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:c?"text":"password",value:a,onChange:s=>h(s.target.value),placeholder:"Min. 8 caractères",className:"flex-1 text-[17px] text-black bg-transparent outline-none"}),e.jsx("button",{onClick:()=>b(!c),className:"p-2 active:opacity-50",children:c?e.jsx(d,{className:"w-5 h-5 text-[#8E8E93]"}):e.jsx(m,{className:"w-5 h-5 text-[#8E8E93]"})})]})]})]}),e.jsx("div",{className:"h-[0.5px] bg-[#C6C6C8] ml-[60px]"}),e.jsxs("div",{className:"flex items-center px-4 py-3",children:[e.jsx("div",{className:"w-10 h-10 bg-[#007AFF] rounded-xl flex items-center justify-center mr-3",children:e.jsx(x,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-[13px] text-[#8E8E93]",children:"Confirmer le mot de passe"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:o?"text":"password",value:i,onChange:s=>u(s.target.value),placeholder:"Confirmer",className:"flex-1 text-[17px] text-black bg-transparent outline-none"}),e.jsx("button",{onClick:()=>C(!o),className:"p-2 active:opacity-50",children:o?e.jsx(d,{className:"w-5 h-5 text-[#8E8E93]"}):e.jsx(m,{className:"w-5 h-5 text-[#8E8E93]"})})]})]})]})]})]}),e.jsx("div",{className:"px-5 pb-6",children:e.jsx("button",{onClick:y,disabled:f,className:"w-full bg-[#007AFF] text-white text-[17px] font-semibold py-4 rounded-xl flex items-center justify-center gap-2 active:bg-[#0056b3] transition-colors shadow-sm disabled:opacity-50",children:f?e.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent roun
1ded-full animate-spin"}):"Modifier le mot de passe"})})]})})};export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.