"use strict";(()=>{var e={};e.id=7556,e.ids=[7556],e.modules={10846:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},29294:e=>{e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},14985:e=>{e.exports=require("dns")},94735:e=>{e.exports=require("events")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},91645:e=>{e.exports=require("net")},21820:e=>{e.exports=require("os")},33873:e=>{e.exports=require("path")},19771:e=>{e.exports=require("process")},27910:e=>{e.exports=require("stream")},41204:e=>{e.exports=require("string_decoder")},66136:e=>{e.exports=require("timers")},34631:e=>{e.exports=require("tls")},79551:e=>{e.exports=require("url")},28354:e=>{e.exports=require("util")},74075:e=>{e.exports=require("zlib")},4573:e=>{e.exports=require("node:buffer")},77598:e=>{e.exports=require("node:crypto")},53053:e=>{e.exports=require("node:diagnostics_channel")},47174:(e,r,t)=>{t.r(r),t.d(r,{patchFetch:()=>b,routeModule:()=>m,serverHooks:()=>w,workAsyncStorage:()=>q,workUnitAsyncStorage:()=>f});var o={};t.r(o),t.d(o,{POST:()=>h});var s=t(42706),i=t(28203),a=t(45994),n=t(65658),p=t(39187),u=t(98095),c=t(70357),l=t(50675),d=t(42770);let x=n.Ik({email:n.Yj().email(),origin:n.Yj().url().optional()});function g(){return p.NextResponse.json({success:!0,message:"Si el email existe, se enviara un correo con instrucciones para continuar."})}async function h(e){try{if("mysql"!==(0,u.f)())return p.NextResponse.json({error:"Auth local deshabilitada."},{status:404});let r=await e.json().catch(()=>null),t=x.safeParse(r);if(!t.success)return g();let o=t.data.email.trim().toLowerCase(),s=await (0,l.t7)(o);if(!s||!(0,l.zj)(s))return g();let i=function(e,r){let t;let o=String(r||"").trim()||String(e.headers.get("origin")||"").trim()||e.nextUrl.origin;try{t=new URL(o)}catch{t=new URL(e.nextUrl.origin)}if(!("localhost"===t.hostname||"127.0.0.1"===t.hostname||"0.0.0.0"===t.hostname)&&"https:"!==t.protocol)throw Error("Origin invalido: se requiere https fuera de localhost.");return t.origin}(e,t.data.origin),{token:a,expiresAt:n}=await (0,d.Vo)(o),h=`${i}/set-password?mode=reset&email=${encodeURIComponent(o)}&token=${encodeURIComponent(a)}`,m=`Recibimos una solicitud para crear o restablecer tu contrasena en OMR SEG.

Abre este enlace: ${h}

Este enlace expira el ${n.toISOString()}.
Si no solicitaste este cambio, ignora este correo.`,q=`
      <p>Recibimos una solicitud para crear o restablecer tu contrasena en <strong>OMR SEG</strong>.</p>
      <p><a href="${h}">Abrir enlace de recuperacion</a></p>
      <p>Si el boton no funciona, copia y pega este enlace:</p>
      <p>${h}</p>
      <p>Este enlace expira el <strong>${n.toISOString()}</strong>.</p>
      <p>Si no solicitaste este cambio, ignora este correo.</p>
    `;return await (0,c.x)({to:o,subject:"OMR SEG - Recuperacion de cuenta",text:m,html:q}),g()}catch(e){return console.error("[POST /api/auth/forgot-password] error:",e),p.NextResponse.json({error:"Error interno."},{status:500})}}let m=new s.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/auth/forgot-password/route",pathname:"/api/auth/forgot-password",filename:"route",bundlePath:"app/api/auth/forgot-password/route"},resolvedPagePath:"C:\\omrwebapp-git-roregar.cl\\src\\app\\api\\auth\\forgot-password\\route.ts",nextConfigOutput:"standalone",userland:o}),{workAsyncStorage:q,workUnitAsyncStorage:f,serverHooks:w}=m;function b(){return(0,a.patchFetch)({workAsyncStorage:q,workUnitAsyncStorage:f})}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[1989,5452,820,5658,8721,4032],()=>t(47174));module.exports=o})();