import{r as a}from"./vendor-react-wBh_31cN.js";import{de as l,df as i,cP as u,dg as v,cg as d,J as S}from"./index-dNe6i2rS.js";import{c as g}from"./vendor-router-D1GqFWiT.js";class f extends i{getInfo({userId:e,projectId:t}){return super.get(e,t)}setInfo({userId:e,projectId:t,data:s}){const o=this.getAll(),c=o==null?void 0:o[e],n={...o,[e]:{...c,[t]:{...s}}};localStorage.setItem(this.localStorageKey,JSON.stringify(n))}delete({userId:e,projectId:t}){const s=this.getAll(),o=u([e,t],s);localStorage.setItem(this.localStorageKey,JSON.stringify(o))}}const p=new f(l),F=new f(v),m=(r=d.td)=>{const{data:{id:e}={}}=S(),{id:t}=g(),s=a.useMemo(()=>r===d.td?p:F,[r]),o=a.useMemo(()=>s.getInfo({userId:e,projectId:+t}),[t,s,e]),c=a.useCallback(I=>{s.setInfo({userId:e,projectId:+t,data:I})},[t,s,e]),n=a.useCallback(()=>{s.delete({userId:e,projectId:+t})},[t,s,e]);return[o,c,n]},h=(r,e=d.td,t=!1)=>{const[s,o]=m(e);a.useEffect(()=>{if(!t){const c=s?{...s,...r}:r;o(c)}},[t,e,r,o,s])};export{F,p as T,m as a,h as u};
