import{ref as e,toRaw as t,unref as n,watch as r,watchEffect as i}from"vue";function a(a,o){let{defaultValue:s,value:c=e()}=o||{},l=typeof a==`function`?a():a;c.value!==void 0&&(l=n(c)),s!==void 0&&(l=typeof s==`function`?s():s);let u=e(l),d=e(l);i(()=>{let e=c.value===void 0?u.value:c.value;o.postState&&(e=o.postState(e)),d.value=e});function f(e){let n=d.value;u.value=e,t(d.value)!==e&&o.onChange&&o.onChange(e,n)}return r(c,()=>{u.value=c.value}),[d,f]}export{a as default};