import{jsxs as e,jsx as r}from"react/jsx-runtime";import{createStyle as o,createClass as t}from"@gem-sdk/system";import{getWrapperStyles as s,getContainerStyles as i,getTextStyle as m}from"../common/styles.js";import{getWrapperClassName as d,getCheckboxContainerClassName as l,getLinkComponentClassName as c,getLinkComponentStyles as n}from"../common/classes.js";import{getComponentTag as a}from"../common/helpers.js";import{useRenderMode as h,useProduct as u,usePageStore as p,filterToolbarPreview as f}from"@gem-sdk/core";import y from"./PostPurchaseCheckbox.js";import{useBuyerConsentChecked as k}from"../hooks/useBuyerConsentChecked.js";let b=({styles:b,builderProps:g,setting:j,builderAttrs:C,style:x,children:v})=>{let{isEditMode:N}=h(),B=u(),{checked:P,setChecked:$}=k(),F=p(e=>e.subscriptionVisible),{description:V,policyLabel:_,policyLink:q,align:w}=j??{},z=B?.id?`buyer-consent-product-${g?.uid}-${B.id}`:void 0,A=a(q),D=o(s({styles:b})),E=t(d({align:w,uid:g?.uid})),G=o(i({styles:b})),H=t(l()),I=o(m({styles:b})),J=t(c()),K=o(n()),L=!N&&!F?.[B?.id??""]?.length;return L?null:e("div",{...C,style:{...x},children:[r("div",{"data-id":g?.uid,style:D,className:E,children:e("label",{htmlFor:z,dir:b?.direction??"ltr",style:G,className:H,children:[r(y,{id:z,name:z,type:"checkbox",checked:P,onChange:e=>{$(e.target.checked)}}),e("bdo",{dir:b?.direction??"ltr",style:I,children:[V," ",r(A,{target:"_blank",rel:"noreferrer",href:q,className:J,style:K,children:_})]})]})}),f(v,!0)]})};export{b as default};
