import{f as g}from"./index-Z_QI94Zg.js";const y=g((f,m)=>({drafts:{},setPromptDraft:(t,s,r,i)=>{if(!s&&r.length===0&&i.length===0){const{drafts:n}=m(),o=n[t];if(!o)return;const{prompt:e,images:c,selectedFiles:l,...a}=o;if(Object.keys(a).length===0){const{[t]:p,..._}=n;f({drafts:_})}else f({drafts:{...n,[t]:a}});return}f(n=>({drafts:{...n.drafts,[t]:{...n.drafts[t],prompt:s,images:r,selectedFiles:i}}}))},setCommitDraft:(t,s,r)=>{if(!s&&!r){const{drafts:i}=m(),n=i[t];if(!n)return;const{commitTitle:o,commitBody:e,...c}=n;if(Object.keys(c).length===0){const{[t]:l,...a}=i;f({drafts:a})}else f({drafts:{...i,[t]:c}});return}f(i=>({drafts:{...i.drafts,[t]:{...i.drafts[t],commitTitle:s,commitBody:r}}}))},clearPromptDraft:t=>{const{drafts:s}=m(),r=s[t];if(!r)return;const{prompt:i,images:n,selectedFiles:o,...e}=r;if(Object.keys(e).length===0){const{[t]:c,...l}=s;f({drafts:l})}else f({drafts:{...s,[t]:e}})},clearCommitDraft:t=>{const{drafts:s}=m(),r=s[t];if(!r)return;const{commitTitle:i,commitBody:n,...o}=r;if(Object.keys(o).length===0){const{[t]:e,...c}=s;f({drafts:c})}else f({drafts:{...s,[t]:o}})}}));export{y as u};
