var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}var window = _____WB$wombat$assign$function_____("window");
var self = _____WB$wombat$assign$function_____("self");
var document = _____WB$wombat$assign$function_____("document");
var location = _____WB$wombat$assign$function_____("location");
var top = _____WB$wombat$assign$function_____("top");
var parent = _____WB$wombat$assign$function_____("parent");
var frames = _____WB$wombat$assign$function_____("frames");
var opener = _____WB$wombat$assign$function_____("opener");
import{i as g,bH as N,K as _,b0 as z,bI as W,e as H,bJ as O,bK as R,a as e,H as V,D as J,aB as q,a0 as K,bo as Q,bL as U,b7 as $,p as G,bM as X,bN as Y,b as j,bO as F,bP as Z,a7 as ee,bQ as ae,U as h,z as C,bR as d,W as M,A as v,bS as w,bf as te,bT as ne,d as le,E as se,bU as oe,bV as k}from"./app.ZXowmuNl.js";const re={id:"dc4ecefcf00ebff2a78742dd6bf1040bd4714e9f8101f5730eda8e55ac7c5ee5",type:"mutation",name:"DeleteVaultedPaymentMethod",source:"mutation DeleteVaultedPaymentMethod($token:String!){deleteVaultedPaymentMethod(token:$token){errors{localizedMessage __typename}__typename}}"};function ie(){const a=g(),l=N();return{deleteVaultedPaymentMethod:async o=>{try{const{data:s,error:n}=await l.mutate(re,{variables:{token:o}}),r=n?.message||s?.deleteVaultedPaymentMethod.errors?.[0]?.localizedMessage;return r?{error:r}:{error:void 0}}catch{return{error:a("customer_payment_methods.delete_customer_mandate.generic_error","There was an issue processing your request.")}}}}}function ce({paypalToken:a,setValidationMessage:l}){const t=g(),[o,s]=_(!1),n=z(),r=W(),{negotiate:y}=H();O();const c=R(),{deleteVaultedPaymentMethod:P}=ie();return e(q,{onClick:async()=>{try{if(s(!0),a){const{error:i}=await P(a);i&&l(i),r(),await y({fieldsToResolve:["paymentMethods"],force:!0,silenceViolations:["non-stock"]})}}catch{n.counter({name:"paypal_disconnect_error",value:1,attributes:{PCIv4:c}})}finally{s(!1)}},variant:"plain",loading:o,children:[e(V,{above:"extraSmall",children:e(J,{type:"delete"})}),e(V,{below:"small",children:t("payment.paypal_disconnect","Disconnect")})]})}function de({method:a}){const{billingAddressOption:l}=K(),t=g(),o=Q(),s=U({isPayWithPayPalButton:!0}),{inMemoryPayPalParts:{accountStatus:n,sdkStatus:r}}=$(),y=G(),c=X(),P=!o&&(r.value.status==="error"||s.value.status==="error"||n.value.status==="error"),u=Y()!==void 0,{optionList:{typographyStyle:i}}=j(),{purchasingCompany:b}=F(),{isValid:f}=Z(),[S,A]=_("");ee(()=>{b&&u&&(f?l.value="billing":l.value="shipping")},[b,f,u,l]),ae({active:u&&n.value.status==="loading"});const E=!o&&n.value.status==="connected"?e(d,{children:e(h,{inlineAlignment:"center",children:e(C,{children:t("wallets.logged_in",{email:n.value.email},"Connected to {{email}}")})})}):null,m=y||S,D=P?e(d,{children:e(h,{children:e(M,{errorType:v.PaymentError,tone:"critical",children:m})})}):null,p=c?t("brand.venmo","Venmo"):t("brand.paypal","PayPal"),B=c?e(k,{wallet:"venmo"}):e(k,{wallet:"payPal"}),T=a.type===w.PayPal?e(d,{children:[m&&e(M,{errorType:v.PaymentError,tone:"critical",children:m}),e(te,{columns:["fill","auto"],inlineAlignment:"start",minInlineSize:"fill",blockAlignment:"center",minBlockSize:60,spacing:"loose",children:[e(C,{textAlign:"center",children:t("wallets.logged_in",{email:a.paypalAccountEmail},"Connected to {{email}}")}),e(ce,{paypalToken:a.token,setValidationMessage:A})]})]}):null,L=e(d,{children:e(h,{inlineAlignment:"center",children:e(ne,{children:t("wallets.redirection_notice",{walletName:p,buttonLabel:t("wallets.call_to_action",{walletName:p},"Pay with {{walletName}}")},'After clicking "{{buttonLabel}}", you will be redirected to {{walletName}} to complete your purchase securely.')})})}),I=T||E||D||L,x=a.type===w.PayPal?a.type:"PAYPAL_EXPRESS";return e(oe,{id:x,details:I,secondaryContent:e(le,{blockAlignment:"center",children:B}),children:e(se,{style:i,children:p})})}export{de as default};