import{o}from"./p-6c74654a.js";import{o as i,s as d}from"./p-4cae87fc.js";import{o as s,a as l,b as n,c as r,i as t}from"./p-323c2e84.js";const u=()=>{var o,s;const i=[...l().map((({processor_type:o})=>o)),...n().map((({id:o})=>o))];i.includes(d.id)||(null===(s=null===(o=null===window||void 0===window?void 0:window.wp)||void 0===o?void 0:o.hooks)||void 0===s?void 0:s.applyFilters)&&!window.wp.hooks.applyFilters("surecart_auto_select_payment_method",!0)||(d.id=(null==i?void 0:i.length)?null==i?void 0:i[0]:null)},e=()=>{const o=(r()||[]).map((({id:o})=>o));t(null==d?void 0:d.id)?o.includes(d.method)||(d.method=(null==o?void 0:o.length)?null==o?void 0:o[0]:null):d.method=null};o("checkout",(()=>{u(),e()})),i("id",(()=>{u(),e()})),s("processors",(()=>u())),s("disabled",(()=>u())),s("methods",(()=>e()));