import{d as B,r as l,aq as F,m as C,E as L}from"./vendor-CB-jpi5M.js";import{g as f,q as M,bW as $,bX as x,bY as S,bZ as D,L as c,b_ as g}from"./index-Bjc9_X6l.js";async function R(){const{storeId:o,userId:t,cultureName:d,currencyCode:n}=f,{data:a}=await M.query({query:$,variables:{storeId:o,userId:t,cultureName:d,currencyCode:n}});return a?.getSavedForLater}function k(){const{storeId:o,currencyCode:t,cultureName:d,userId:n}=f,a=l(),{mutate:y,loading:_}=F(x),{add:h,overflowed:w,loading:b}=S(y);async function u(r,s){try{const e=await h({command:{storeId:o,userId:n,cultureName:d,currencyCode:t,cartId:r,lineItemIds:s}});a.value=e?.data?.moveToSavedForLater?.list}catch(e){if(e instanceof L&&e.networkError?.toString()===g.Explicit)return;c.error(`useSavedForLater.${u.name}`,e)}}const{mutate:p,loading:I}=F(D),{add:T,overflowed:E,loading:q}=S(p);async function m(r,s){try{const e=await T({command:{storeId:o,userId:n,cultureName:d,currencyCode:t,cartId:r,lineItemIds:s}});a.value=e?.data?.moveFromSavedForLater?.list}catch(e){if(e instanceof L&&e.networkError?.toString()===g.Explicit)return;c.error(`useSavedForLater.${m.name}`,e)}}const v=l(!1);async function i(){try{v.value=!0,a.value=await R()}catch(r){c.error(`useSavedForLater.${i.name}`,r)}finally{v.value=!1}}return{savedForLaterList:a,moveToSavedForLater:u,moveToSavedForLaterOverflowed:w,moveFromSavedForLater:m,moveFromSavedForLaterOverflowed:E,getSavedForLater:i,loading:C(()=>_.value||b.value||I.value||q.value||v.value)}}const O=B(k);export{O as u};
//# sourceMappingURL=useSaveForLater-DBcToRLB.js.map
