import{getCheckout}from"../checkouts/mutations";import state from"./store";import{isAddressComplete}from"../../functions/address";export const currentCheckout=()=>getCheckout(state.formId,state.mode);export const checkoutIsLocked=(e="")=>{var t;return e?state.locks.some((t=>t===e)):!!(null===(t=state.locks)||void 0===t?void 0:t.length)};export const getLineItemByProductId=e=>{var t,o;return((null===(o=null===(t=state.checkout)||void 0===t?void 0:t.line_items)||void 0===o?void 0:o.data)||[]).find((t=>{var o,r;return(null===(r=null===(o=null==t?void 0:t.price)||void 0===o?void 0:o.product)||void 0===r?void 0:r.id)===e}))};export const fullShippingAddressRequired=()=>{var e;return"full"===(null===(e=state.checkout)||void 0===e?void 0:e.shipping_address_accuracy_requirement)};export const shippingAddressRequired=()=>{var e,t;return"full"===(null===(e=state.checkout)||void 0===e?void 0:e.shipping_address_accuracy_requirement)||"tax"===(null===(t=state.checkout)||void 0===t?void 0:t.shipping_address_accuracy_requirement)};export const getCompleteAddress=(e="shipping")=>{var t,o;if(!isAddressComplete(null===(t=state.checkout)||void 0===t?void 0:t[`${e}_address`]))return;const{line_1:r,line_2:i,...s}=(null===(o=state.checkout)||void 0===o?void 0:o.shipping_address)||{};return{line1:r,line2:i,...s}};