(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,866057,e=>{"use strict";var t,o=e.i(843476),a=e.i(271645);(t={}).UpdateDeliveryType="UPDATE_DELIVERY_TYPE",t.UpdateDeliveryPoint="UPDATE_DELIVERY_POINT",t.UpdatePaymentMethod="UPDATE_PAYMENT_METHOD",t.UpdateDeliverDate="UPDATE_DELIVERY_DATE",t.UpdateDeliveryAddress="UPDATE_DELIVERY_ADDRESS",t.ClearState="CLEAR_STATE",t.UpdateProductNote="UPDATE_PRODUCT_NOTE",t.UpdateShopNote="UPDATE_SHOP_NOTE",t.UpdateShopCoupon="UPDATE_SHOP_COUPON",t.DeleteShopCoupon="DELETE_SHOP_COUPON",t.UpdateTips="UPDATE_TIPS",t.UpdateFromWalletPrice="UPDATE_FROM_WALLET_PRICE";let r=(e,t)=>{switch(t.type){case"UPDATE_DELIVERY_TYPE":return{...e,deliveryType:t.payload.type};case"UPDATE_DELIVERY_POINT":return{...e,deliveryPoint:t.payload.point};case"UPDATE_PAYMENT_METHOD":return{...e,paymentMethod:t.payload.paymentMethod};case"UPDATE_DELIVERY_DATE":return{...e,deliveryDate:t.payload.date};case"UPDATE_DELIVERY_ADDRESS":return{...e,deliveryAddress:t.payload.address,deliveryPrice:t.payload.deliveryPrice};case"UPDATE_PRODUCT_NOTE":return{...e,notes:{...e.notes,[t.payload.stockId]:t.payload.note}};case"UPDATE_SHOP_NOTE":return{...e,shopNotes:{...e.shopNotes,[t.payload.shopId]:t.payload.note}};case"UPDATE_SHOP_COUPON":return{...e,coupons:{...e.coupons,[t.payload.shopId]:t.payload.name}};case"DELETE_SHOP_COUPON":{let o={...e.coupons};return delete o?.[t.payload.shopId],{...e,coupons:o}}case"UPDATE_TIPS":return{...e,tips:t.payload.tips};case"UPDATE_FROM_WALLET_PRICE":return{...e,fromWalletPrice:t.payload.fromWalletPrice};case"CLEAR_STATE":return{deliveryType:"delivery",deliveryPoint:void 0,deliveryPrice:void 0,deliveryAddress:void 0,paymentMethod:void 0,deliveryDate:new Date(Date.now()),notes:t.payload.all?{}:e.notes,shopNotes:t.payload.all?{}:e.shopNotes,coupons:t.payload.all?{}:e.coupons,fromWalletPrice:void 0};default:return e}},d={deliveryType:"delivery",deliveryDate:new Date(Date.now()),notes:{},shopNotes:{},coupons:{}},l=(0,a.createContext)({state:d,dispatch:()=>null});e.s(["default",0,({children:e})=>{let[t,s]=(0,a.useReducer)(r,d),p=(0,a.useMemo)(()=>({state:t,dispatch:s}),[t]);return(0,o.jsx)(l.Provider,{value:p,children:e})},"useCheckout",0,()=>{let e=(0,a.useContext)(l);if(!e)throw Error("useCheckout has to be used within <CheckoutContext.Provider>");return e}],866057)}]);