import{d as F,r as N,aT as t,W as o,a3 as b,bK as h,u as i,a2 as S,bh as f,F as a,X as _,b2 as d,aF as T,U as k,Q as D,bP as j,O as w}from"./vendor-reka-Edfq1EPl.js";import{useForm as O}from"./vendor/inertia-CR4tWtMT.js";import{n as E,g as K,d as M}from"./registry-DyIszw9-.js";import{_ as $}from"./DynamicField.vue_vue_type_script_setup_true_lang-DYH52Q2k.js";import{_ as P}from"./PageHeader.vue_vue_type_script_setup_true_lang-Cr1rE6nR.js";import{_ as z}from"./SettingsTabBar.vue_vue_type_script_setup_true_lang-DBToUWT9.js";import"./Input.vue_vue_type_script_setup_true_lang-D6nVx0lb.js";import"./LocaleSwitcher.vue_vue_type_script_setup_true_lang-4M-c0Clb.js";import"./HorizontalTabNavigation.vue_vue_type_script_setup_true_lang-CsRrMj9y.js";const L={class:"-mx-6 px-6 border-b"},Q={class:"-mb-px flex gap-6"},W=["onClick"],X={key:0,class:"py-6 space-y-4"},q={key:0,class:"text-sm text-muted-foreground"},A={key:0,class:"mb-2"},G={class:"text-sm text-muted-foreground"},oe=F({__name:"Show",props:{settingsDefinition:{},values:{}},setup(l){var v;const{t:V}=E(),g=K(),u=l,p={};for(const m of u.settingsDefinition.sections)for(const r of m.fields)p[r.name]=u.values[r.name]??r.default??null;const n=O(p);function C(){const m=u.settingsDefinition.key,r=m.split(".");let e;r.length>=2?e=`/${g}/settings/${r[0]}/${r.slice(1).join(".")}`:e=`/${g}/settings/${m}`;const s=n,c=Object.keys(p);n.optimistic(U=>({values:{...U.values,...Object.fromEntries(c.map(x=>[x,s[x]]))}})).put(e)}const B=w(()=>u.settingsDefinition.sections.length>1),y=N(((v=u.settingsDefinition.sections[0])==null?void 0:v.key)??"default");return(m,r)=>(t(),o("form",{onSubmit:j(C,["prevent"])},[b(P,{title:l.settingsDefinition.label},{actions:h(()=>[b(M,{type:"submit",disabled:i(n).processing},{default:h(()=>[S(f(i(V)("builder.resources.save")),1)]),_:1},8,["disabled"])]),_:1},8,["title"]),b(z),B.value?(t(),o(a,{key:0},[_("div",L,[_("div",Q,[(t(!0),o(a,null,d(l.settingsDefinition.sections,e=>(t(),o("button",{key:e.key,type:"button",class:T(["pb-3 text-sm font-medium border-b-2 transition-colors",y.value===e.key?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:s=>y.value=e.key},f(e.label),11,W))),128))])]),(t(!0),o(a,null,d(l.settingsDefinition.sections,e=>(t(),o(a,{key:e.key},[y.value===e.key?(t(),o("div",X,[e.description?(t(),o("p",q,f(e.description),1)):k("",!0),(t(!0),o(a,null,d(e.fields,s=>(t(),D($,{key:s.name,field:s,"model-value":i(n)[s.name],error:i(n).errors[s.name],"onUpdate:modelValue":c=>i(n)[s.name]=c},null,8,["field","model-value","error","onUpdate:modelValue"]))),128))])):k("",!0)],64))),128))],64)):(t(!0),o(a,{key:1},d(l.settingsDefinition.sections,e=>(t(),o("div",{key:e.key,class:"space-y-4"},[e.description?(t(),o("div",A,[_("p",G,f(e.description),1)])):k("",!0),(t(!0),o(a,null,d(e.fields,s=>(t(),D($,{key:s.name,field:s,"model-value":i(n)[s.name],error:i(n).errors[s.name],"onUpdate:modelValue":c=>i(n)[s.name]=c},null,8,["field","model-value","error","onUpdate:modelValue"]))),128))]))),128))],32))}});export{oe as default};
