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