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-b28405ea.js";import{s as r}from"./p-49fdface.js";const{processors:d}=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}},...d},((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,r)=>!r.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,r;return!!e&&(null!==(o=e.supported_currencies)&&void 0!==o?o:[]).includes(null===(r=null===window||void 0===window?void 0:window.scData)||void 0===r?void 0:r.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==r?void 0:r.id,i=p(s)?e.sortOrder.paymentMethods[s]:[];return o(e.methods,"id",i||[]).filter((e=>{var o,r;return"applepay"!==e.id||(null===window||void 0===window?void 0:window.ApplePaySession)&&(null===(r=null===(o=null===window||void 0===window?void 0:window.ApplePaySession)||void 0===o?void 0:o.canMakePayments)||void 0===r?void 0:r.call(o))}))},b=()=>[...c(),...y()],j=()=>{var e;return(null===(e=b())||void 0===e?void 0:e.length)>1},k=()=>[...h(),...y(),u("mock")].filter(Boolean),g=()=>{var e;return(null===(e=k())||void 0===e?void 0:e.length)>1};export{c as a,y as b,h as c,j 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};