"use strict";var core=require("@gem-sdk/core"),React=require("react"),product=require("../../../product/helpers/product.js"),useBuyerConsentChecked=require("../../buyer-consent/hooks/useBuyerConsentChecked.js"),useSubscriptionSellingType=require("./useSubscriptionSellingType.js");const useSubscriptionConsentCheck=()=>{let{checked:e}=useBuyerConsentChecked.useBuyerConsentChecked(),r=core.useProductStore(e=>e.selectedOptions),{isOneTime:s}=useSubscriptionSellingType.useSubscriptionSellingType(),n=core.usePageStore(e=>e.getSubscriptionVisible()),t=core.useProduct(),u=core.useVariants(),i=React.useMemo(()=>{let i=!n?.[t?.id??""]?.length;if(e||s||i)return!1;let o=!!t?.sellingPlanGroups?.length||!!t?.variants?.edges.find(e=>!!e.node?.sellingPlanGroups?.length);if(!o||!r)return!1;let c=product.checkDefaultVariant(t);if(!c){let e=u.find(e=>e?.selectedOptions.every(e=>r[e.name??""]===e.value)),s=!!e?.sellingPlanGroups?.length;return s}return!0},[r,s,e,t,u]);return{isDisableAccept:i}};exports.useSubscriptionConsentCheck=useSubscriptionConsentCheck;
