"use strict";var e=require("@gem-sdk/core"),s=require("@gem-sdk/system"),i=require("react"),r=require("../../../constants/index.js"),t=require("../common/classes.js"),u=require("../common/styles.js"),n=require("../../../../../helpers.js"),l=require("./useSellingPlanChange.js"),c=require("./useSellingPlanOptions.js"),o=require("./useSellingSubscription.js"),a=require("./useSubscriptionVisibility.js"),p=require("../../../hooks/useDynamicProduct.js"),S=require("./useCheckProductsSubscriptionExistence.js");exports.useProductSubscriptionContentData=({setting:b,styles:d,builderProps:g})=>{let y=e.useProduct(),{defaultValue:P,selectedSellingPlan:m,setSelectedSellingPlan:q}=o.useSellingSubscription(b),E=c.useSellingPlanOptions(b),{selectedValue:I,handleSellingPlanChange:C}=l.useSellingPlanChange({defaultValue:P,selectedSellingPlan:m,setSelectedSellingPlan:q,sellingPlanOptions:E}),h=i.useRef(null),j=i.useId(),T=a.useSubscriptionVisibility({setting:b}),O=s.createStyle(u.getSubscriptionStyles(d)),D=s.createStyle(u.getSubscriptionWrapperStyles(d?.align)),N=s.createClass(t.getWrapperClasses()),x=s.createClass(t.getContainerClasses()),k=`product-subscription-${n.extractProductID(y?.baseID??"")}`,R=n.extractProductID(y?.baseID??""),M=`subscription-type-selection-${j}`,U=b?.sellingType===r.SubscriptionEnum.ONE_TIME,_=b?.sellingType===r.SubscriptionEnum.SUBSCRIPTION,B=U?r.SubscriptionEnum.ONE_TIME:r.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:V}=p.useDynamicProduct(),{sellingTitleDirection:W,sellingTitleOneTimeDirection:$}=d??{},f=B===r.SubscriptionEnum.ONE_TIME?$??"ltr":W??"ltr";return S.useCheckProductsSubscriptionExistence({productId:y?.id,elementUid:g?.uid,isSubscription:_,hasNoSellingPlanOptions:T.hasNoSellingPlanOptions,isDynamicProduct:V}),{componentRef:h,componentId:k,wrapperClasses:N,subscriptionWrapperStyles:D,visibility:T,productId:R,renderType:B,radioGroupName:M,direction:f,containerClasses:x,subscriptionStyles:O,selectedValue:I,sellingPlanOptions:E,handleSellingPlanChange:C,onSelectType:e=>{T.shouldShowRadio&&T.selectedType!==e&&T.setSubscriptionSellingType(e)},isDynamicProduct:V}};
