import{s as o}from"./p-fb28f84f.js";import{c as s}from"./p-2b28ea49.js";import{g as i}from"./p-dd24e53c.js";import{s as n}from"./p-1282ed4a.js";import{s as d}from"./p-49fdface.js";const{processors:r}=i(),{state:e,onChange:l,on:a,dispose:t}=s({processors:[],methods:[],manualPaymentMethods:[],disabled:{processors:[]},sortOrder:{processors:["stripe","paystack","paypal","mollie","mock"],manualPaymentMethods:[],paymentMethods:{mollie:["creditcard","paypal"],razorpay:["card","upi"]}},instances:{stripe:void 0},config:{stripe:{paymentElement:!1}},...r},((e,o)=>JSON.stringify(e)!==JSON.stringify(o))),v=["mollie","razorpay"],p=e=>!!e&&v.includes(e),c=()=>o(e.processors,"processor_type",e.sortOrder.processors).filter((e=>(null==e?void 0:e.live_mode)===("live"===(null==n?void 0:n.mode)))).filter((o=>!(e.disabled.processors||[]).includes(o.processor_type))).filter((e=>{var o;return!(null===(o=null==n?void 0:n.checkout)||void 0===o?void 0:o.reusable_payment_method_required)||!!(null==e?void 0:e.recurring_enabled)})).filter(((e,o,s)=>!s.some((e=>"mollie"===e.processor_type))||"mollie"===e.processor_type||"mock"===e.processor_type)),u=e=>c().find((({processor_type:o})=>o===e)),m=e=>c().find((({processor_type:o})=>o===e)),w=e=>{var o,s;return!!e&&(null!==(o=e.supported_currencies)&&void 0!==o?o:[]).includes(null===(s=null===window||void 0===window?void 0:window.scData)||void 0===s?void 0:s.currency)},f=e=>c().some((({processor_type:o})=>o!==e&&"paypal"!==o&&"mock"!==o)),y=()=>o(e.manualPaymentMethods,"id",e.sortOrder.manualPaymentMethods).filter((o=>!(e.disabled.processors||[]).includes(null==o?void 0:o.id))).filter((e=>{var o;return!(null===(o=null==n?void 0:n.checkout)||void 0===o?void 0:o.reusable_payment_method_required)||!!(null==e?void 0:e.reusable)})),h=()=>{const s=null==d?void 0:d.id,r=p(s)?e.sortOrder.paymentMethods[s]:[];return o(e.methods,"id",r||[]).filter((e=>{var o,s;return"applepay"!==e.id||(null===window||void 0===window?void 0:window.ApplePaySession)&&(null===(s=null===(o=null===window||void 0===window?void 0:window.ApplePaySession)||void 0===o?void 0:o.canMakePayments)||void 0===s?void 0:s.call(o))}))},j=()=>[...c(),...y()],k=()=>{var e;return(null===(e=j())||void 0===e?void 0:e.length)>1},b=()=>[...h(),...y(),u("mock")].filter(Boolean),g=()=>{var e;return(null===(e=b())||void 0===e?void 0:e.length)>1};export{c as a,y as b,h as c,k as d,g as e,m as f,u as g,f as h,p as i,l as o,w as p,e as s};