import{createStore}from"@stencil/store";import{getSerializedState}from"../utils";import{getLineItemByProductId}from"../checkout/getters";const{productDonation:productDonation}=getSerializedState(),productDonationData=Object.keys(productDonation||{}).reduce(((t,o)=>{var e;const n=getLineItemByProductId(o);return(null==n?void 0:n.id)&&(t[o]={...t[o],...(null==n?void 0:n.ad_hoc_amount)?{ad_hoc_amount:n.ad_hoc_amount}:{},...(null==n?void 0:n.price)?{selectedPrice:n.price}:{},custom_amount:(null===(e=t[o].amounts||[])||void 0===e?void 0:e.includes(n.ad_hoc_amount))?null:n.ad_hoc_amount}),t}),productDonation),{state:state,onChange:onChange,on:on,set:set,get:get,dispose:dispose}=createStore({...productDonationData},((t,o)=>JSON.stringify(t)!==JSON.stringify(o)));export default state;export{state,onChange,on,set,get,dispose};