import { c as config } from './config-BHx687w1.js'; import './stores-Cv0rQqhp.js'; import './index-CUXxL1oq.js'; import './index-Ddp2AB5f.js'; import { s as superValidate, z as zod, f as fail } from './zod-D1iX83g6.js'; import { z } from 'zod'; const schema = z.object({ id: z.string(), name: z.string().min(4).max(32), // primary_color_hex: z.string().length(7), // secondary_color_hex: z.string().length(7), // text_color_hex: z.string().length(7), domain: z.string().refine((key) => key === null || /^[a-z0-9\.\-]*$/.test(key), { message: "Invalid domain" }).nullable(), use_freebie: z.boolean().default(false), freebie_title: z.string().nullable(), freebie_url: z.string().nullable(), freebie_image_url: z.string().nullable(), freebie_text: z.string().nullable(), title: z.string(), subtitle: z.string(), auto_publish: z.boolean(), use_contact_page: z.boolean(), contact_email: z.string().email().nullable(), use_about_page: z.boolean(), about_text: z.string().nullable() }).superRefine((data, ctx) => { if (data.use_freebie) { if (!data.freebie_url) { ctx.addIssue({ path: ["freebie_url"], message: "A freebie file is required when 'Use freebie' is true.", code: "custom" }); } } if (data.use_contact_page && !data.contact_email) { ctx.addIssue({ path: ["contact_email"], message: "A contact email is required when the contact page is enabled", code: "custom" }); } }); const load = async ({ fetch }) => { const blogRes = await fetch(config.api_url + "/blog?mine=true", { credentials: "include" }); const { site } = await blogRes.json(); return { blog_info: site, form: await superValidate(site, zod(schema)) }; }; const actions = { default: async (event) => { const form = await superValidate(event, zod(schema)); if (!form.valid) { return fail(400, { form }); } let data = structuredClone(form.data); const res = await event.fetch(config.api_url + "/dashboard/website", { method: "PUT", body: JSON.stringify(data), headers: { "content-type": "application/json" } }); const res_data = await res.json(); if (!res_data.success) return fail(res.status, { form }); return { form }; } }; var _page_server = /*#__PURE__*/Object.freeze({ __proto__: null, actions: actions, load: load }); const index = 7; let component_cache; const component = async () => component_cache ??= (await import('./_page.svelte-BzuMFO5u.js')).default; const server_id = "src/routes/(app)/website/+page.server.js"; const imports = ["_app/immutable/nodes/7.BVz9Jxbf.js","_app/immutable/chunks/scheduler.TiWp2jL2.js","_app/immutable/chunks/index.BGG1x4jY.js","_app/immutable/chunks/spread.CgU5AtxT.js","_app/immutable/chunks/textarea.B6S-VsYb.js","_app/immutable/chunks/button.BSgz0N-_.js","_app/immutable/chunks/index.ClIX1ZeE.js","_app/immutable/chunks/index.aejygcvy.js","_app/immutable/chunks/Toaster.svelte_svelte_type_style_lang.CL0N33eq.js","_app/immutable/chunks/each.BM-upbTq.js","_app/immutable/chunks/stores.D8ajiEzo.js","_app/immutable/chunks/entry.B36SwUsf.js","_app/immutable/chunks/forms.92Dwl29W.js","_app/immutable/chunks/config.D7OJDjr-.js"]; const stylesheets = ["_app/immutable/assets/7.BXHCoMPH.css","_app/immutable/assets/textarea.Crp_yK76.css","_app/immutable/assets/Toaster.CZzI-Nh6.css"]; const fonts = []; var _7 = /*#__PURE__*/Object.freeze({ __proto__: null, component: component, fonts: fonts, imports: imports, index: index, server: _page_server, server_id: server_id, stylesheets: stylesheets }); export { _7 as _, schema as s }; //# sourceMappingURL=7-DkJEpN6k.js.map