import { e as error } from './index-wpIsICWW.js';
import { a as authServer } from './auth-server-BSz1rlv-.js';
import { a as userSignInSchema } from './validation-D8AX0Tpi.js';
import { B as BETTER_AUTH_SESSION_COOKIE } from './index3-Cipag7JS.js';
import { c as cookieStrToObj } from './utils2-BNPuf_o4.js';
import { v as validateBodyMiddleware } from './middleware-DEO9L-XC.js';
import 'drizzle-orm';
import './index5-BOKyATXQ.js';
import 'nodemailer';
import 'arktype';
import 'drizzle-orm/libsql';
import 'drizzle-orm/sqlite-core';
import 'crypto';
import 'dotenv/config.js';

const actions = {
  async default(event) {
    const body = await validateBodyMiddleware(userSignInSchema, event);
    const authResponse = await authServer.api.signInEmail({
      body,
      headers: event.request.headers,
      asResponse: true
    });
    const data = await authResponse.json();
    if (!authResponse.ok) {
      error(authResponse.status, data.message);
    }
    const setCookieHeader = authResponse.headers.get("set-cookie") ?? "";
    const cookiesObj = cookieStrToObj(setCookieHeader);
    event.cookies.set(BETTER_AUTH_SESSION_COOKIE, cookiesObj[BETTER_AUTH_SESSION_COOKIE], {
      path: "/",
      ...cookiesObj
    });
    return data;
  }
};

var _page_server = /*#__PURE__*/Object.freeze({
  __proto__: null,
  actions: actions
});

const index = 5;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-Dha9gn2k.js')).default;
const server_id = "src/routes/sign-in/+page.server.js";
const imports = ["_app/immutable/nodes/5.DnxHHHeL.js","_app/immutable/chunks/cL9VaPgy.js","_app/immutable/chunks/C75YQU_W.js","_app/immutable/chunks/Dj1UN0wv.js","_app/immutable/chunks/D1kbsK6n.js","_app/immutable/chunks/CblvSmSU.js","_app/immutable/chunks/Wy6oXzdU.js","_app/immutable/chunks/B4FYT0oR.js","_app/immutable/chunks/D-5ps19L.js","_app/immutable/chunks/BGk0RnQK.js","_app/immutable/chunks/Cz-4yBSw.js","_app/immutable/chunks/BpVw-oe-.js","_app/immutable/chunks/Bkiwg8SD.js"];
const stylesheets = [];
const fonts = [];

export { component, fonts, imports, index, _page_server as server, server_id, stylesheets };
//# sourceMappingURL=5-k6gy52D3.js.map
