import{o as e,r as t}from"./chunk-Bdh3yLIe.js";import{t as n}from"./lib-BqQgGqqb.js";import{a as r,g as i,i as a,l as o,n as s,o as c,p as l,s as u}from"./v4-Cz62jjp5.js";import{r as d}from"./state-NQaDy_hK.js";import f from"node:path";var p=t({appTypes:()=>v,dataSourceSchema:()=>_,defaultSettings:()=>x,envNamesSchema:()=>g,getSettings:()=>w,mergeSettings:()=>E,readSettings:()=>T,setSettings:()=>D,uiTypes:()=>y,validateAndSetEnvFile:()=>O}),m=e(n(),1);const h=c(`type`,[o({type:u(`clerk`)}),o({type:u(`next-auth`)}),o({type:u(`proofkit`).transform(()=>`fmaddon`)}),o({type:u(`fmaddon`)}),o({type:u(`better-auth`)}),o({type:u(`none`)})]).default({type:`none`}),g=o({database:l().default(`FM_DATABASE`),server:l().default(`FM_SERVER`),apiKey:l().default(`OTTO_API_KEY`)}),_=c(`type`,[o({type:u(`fm`),name:l(),envNames:g}),o({type:u(`supabase`),name:l()})]),v=[`browser`,`webviewer`],y=[`shadcn`,`mantine`],b=c(`ui`,[o({ui:u(`mantine`),appType:s(v).default(`browser`),auth:h,envFile:l().optional(),dataSources:a(_).default([]),tanstackQuery:r().catch(!1),replacedMainPage:r().catch(!1),reactEmail:r().catch(!1),reactEmailServer:r().catch(!1),appliedUpgrades:a(l()).default([]),registryUrl:i().optional(),registryTemplates:a(l()).default([])}),o({ui:u(`shadcn`),appType:s(v).default(`browser`),envFile:l().optional(),dataSources:a(_).default([]),replacedMainPage:r().catch(!1),registryUrl:i().optional(),registryTemplates:a(l()).default([])})]),x=b.parse({auth:{type:`none`},ui:`shadcn`,appType:`browser`,dataSources:[],replacedMainPage:!1,registryTemplates:[]});let S;function C(e){if(!m.default.existsSync(e))throw Error(`ProofKit settings file not found at: ${e}`);let t=m.default.readJSONSync(e);return typeof t==`object`&&t&&!(`ui`in t)&&(t={...t,ui:`mantine`}),b.parse(t)}const w=()=>{if(S)return S;let e=C(f.join(d.projectDir,`proofkit.json`));return d.appType=e.appType,S=e,e};function T(e=d.projectDir){return C(f.join(e,`proofkit.json`))}function E(e){let t={...w(),...e};D(b.parse(t))}function D(e){return m.default.writeJSONSync(f.join(d.projectDir,`proofkit.json`),e,{spaces:2}),S=e,S}function O(e=`.env`){let t=w(),n=f.join(d.projectDir,e);if(m.default.existsSync(n))return D({...t,envFile:e}),e;if(t.envFile){let{envFile:e,...n}=t;D(n)}}export{D as a,T as i,E as n,p as r,w as t};
//# sourceMappingURL=parseSettings-DJgpSIYp.js.map