import{o as onChange}from"./mutations-6bbbe793.js";import{o as onChange$1,s as state}from"./watchers-38693c1f.js";import{o as onChange$2,a as availableProcessors,b as availableManualPaymentMethods,c as availableMethodTypes}from"./getters-b5084f91.js";const maybeUpdateProcessor=()=>{var e,a;const o=[...availableProcessors().map((({processor_type:e})=>e)),...availableManualPaymentMethods().map((({id:e})=>e))];o.includes(state.id)||(null===(a=null===(e=null===window||void 0===window?void 0:window.wp)||void 0===e?void 0:e.hooks)||void 0===a?void 0:a.applyFilters)&&!window.wp.hooks.applyFilters("surecart_auto_select_payment_method",!0)||(state.id=(null==o?void 0:o.length)?null==o?void 0:o[0]:null)},maybeUpdateMethod=()=>{const e=(availableMethodTypes()||[]).map((({id:e})=>e));"mollie"===(null==state?void 0:state.id)?e.includes(state.method)||(state.method=(null==e?void 0:e.length)?null==e?void 0:e[0]:null):state.method=null};onChange("checkout",(()=>{maybeUpdateProcessor(),maybeUpdateMethod()})),onChange$1("id",(()=>maybeUpdateProcessor())),onChange$2("processors",(()=>maybeUpdateProcessor())),onChange$2("disabled",(()=>maybeUpdateProcessor())),onChange$2("methods",(()=>maybeUpdateMethod()));