(function(){const o=window.trialCardSave||{},r=!!o.hasTrialCCSaveItem,s=new Set(o.vaultGateways||[]);if(!r)return;function l(){const e=document.querySelector('input[name="payment_gateway_id"]:checked');return e?e.value:null}function u(e){return s.has(e)}const a=document.getElementById("trial-card-save-section");if(!a)return;const t=document.getElementById("trial_save_card_consent"),i=document.getElementById("trial-card-save-fields");function c(){const e=l(),n=e&&u(e);a.style.display=n?"":"none",!n&&t&&(t.checked=!1),d()}function d(){if(!i||!t)return;const e=t.checked&&a.style.display!=="none";i.style.display=e?"":"none",i.querySelectorAll("input[data-trial-required]").forEach(function(n){n.required=e})}document.querySelectorAll('input[name="payment_gateway_id"]').forEach(function(e){e.addEventListener("change",c)}),t&&t.addEventListener("change",d),document.addEventListener("DOMContentLoaded",c),c()})();
