import{d as q,r as l,aq as F,m as C,E as L}from"./vendor-DYYUXsKb.js";import{g as f,r as M,bO as R,bP as $,bQ as S,bR as x,L as c,bS as g}from"./index-DlGZkra7.js";async function D(){const{storeId:o,userId:t,cultureName:d,currencyCode:n}=f,{data:a}=await M.query({query:R,variables:{storeId:o,userId:t,cultureName:d,currencyCode:n}});return a?.getSavedForLater}function O(){const{storeId:o,currencyCode:t,cultureName:d,userId:n}=f,a=l(),{mutate:y,loading:h}=F($),{add:w,overflowed:_,loading:b}=S(y);async function u(r,s){try{const e=await w({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(x),{add:T,overflowed:E,loading:B}=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 D()}catch(r){c.error(`useSavedForLater.${i.name}`,r)}finally{v.value=!1}}return{savedForLaterList:a,moveToSavedForLater:u,moveToSavedForLaterOverflowed:_,moveFromSavedForLater:m,moveFromSavedForLaterOverflowed:E,getSavedForLater:i,loading:C(()=>h.value||b.value||I.value||B.value||v.value)}}const N=q(O);export{N as u};
//# sourceMappingURL=useSaveForLater-Ckq7X4Ku.js.map
