1import{h as z,u as v,g as pe,T as W,A as K}from"./2c1ab0fe.BqEHHmaW.js";import{W as ye,bz as me,bA as c,A as _e,bB as Pe,h as he,bC as be,bD as fe,bE as ve,bF as Ee,bG as ge,bH as Se,bI as Ae,bJ as Me,bK as Ce}from"./164ad2e3.BA-GikTU.js";import{O as E,P as X,aZ as Te,bH as q,k as N,bI as Ie,bJ as Re,bK as Ve,bL as J,aK as Ne,bM as Oe,aT as Be,a7 as Le,a6 as De,bN as Fe,bO as Ye,bP as we,bQ as Ge,bR as He,bS as Ue,bT as ke,Q as xe,bU as Qe,bV as We,bW as Je,bX as ze,T as Ke,bb as Xe,bY as qe}from"./4c290a1e.FJVsH4yi.js";import{h as Ze,a as je,u as $e}from"./58314944.CBBsxtpI.js";function ea({bannerId:e,errorType:r,children:t,...n}){const{observability:i}=E(),{tone:y,...s}=n;return z(()=>{i.log("error_log_banner_error_banner_rendered","[Displayed Error] Error banner was rendered",{bannerId:e})},[e,i]),v(ye,{errorType:r,id:e,tone:y,...s,children:t})}function aa(){const{checkout:e,i18n:r,shopPay:t}=E(),n=X(),{value:i}=n.paymentMethods,{value:y}=n.managedByMarketsPro,s=Ne({managedByMarketsPro:y}),d=pe(()=>Te({checkout:e})),m=me(),{value:g}=n.deferredTotal,o=t.session.selectedPaymentMethod.value,S=t.session.paymentMethodOption.value,{hasViolations:_}=c(q),p=o&&N(o)?Ie(o.paymentAttributes.brand):void 0,A=Re(),P=W(()=>{if(S?.name!=="SHOPIFY_INSTALLMENTS"){if(A.value||!o||m.value&&!g?.amount.amount)return!0;if(N(o)){if(_)return!1;const h=i?.filter(l=>l.type==="direct").flatMap(l=>l.paymentBrands);if(h&&h.length>0){const l=Ve(o.paymentAttributes);return l?h.includes(l):void 0}}return J(o)?ra(d.value,s,i):!0}},[S?.name,A.value,o,m.value,g?.amount.amount,_,i,d.value,s]),T=W(()=>{if(o&&P===!1){if(N(o))return p?r.translate("payment.brand_not_available",{brand:p}):r.translate("payment.generic_incorrect_card_info");if(J(o))return d.value?r.translate("payment_errors.payment_method_unavailable_with_subscriptions"):r.translate("payment.shop_pay_ideal_unavailable_error")}},[P,o,p,r,d.value]);return{paymentMethods:i,isSelectedPaymentMethodSupported:P,notSupportedError:T,label:p}}function ra(e,r,t){return!e&&r&&t?.some(n=>Oe(n,["ideal"]))}function ta(e){const{i18n:r}=E();if(e&&e.code!=="SURVEY_EXITED")return r.translate("hsa_qualification_errors",{scope:e.code.toLowerCase()})}function na(){const{i18n:e,checkout:r,embed:t,shopPay:n}=E(),{delegatedPaymentInstrument:i,inventoryRecoverySignal:y}=Be(),{lastJourneyProgression:s}=Le(),{progressing:d}=he(),{walletUsedForSubmissionSignal:m,inMemoryApplePayParts:{asPaymentMethod:g},receiptErrorSignal:o}=De(),{paymentMethods:S}=X(),{notSupportedError:_}=aa(),{hasViolations:p,violations:A}=c(q),{hasViolations:P}=c(Fe),{hasViolations:T}=c(Ye),{hasViolations:h}=c(we),{hasViolations:l}=c(Ge),{violations:O}=c(He),Z=!(s.value.type==="success"||s.value.type==="error"?s.value.negotiationStage==="completion":!1)&&O.size===1&&O.values().next().value.code==="PAYMENTS_METHOD",{hasViolations:j}=c(Ue),I=be(),{hasError:$,error:M}=fe(ke),{hasError:ee,error:ae}=ve(),{hasError:B}=Ee(),{hasError:re}=ge(),L=Se(M?{type:"payment",code:M}:void 0),D=ta(ae),C=xe(),te=C.generalPaymentError.value,b=C.generalPaymentErrorCode.value,ne=Ze(C.directPaymentErrors),F=je(C.directPaymentErrors),u=K(!1),oe=Ae(),Y=$e(te,b),w=Y&&!Qe(b)&&!We(b)&&!Je(b)&&!ze(b),G=e.translate("order_errors.inventory_reservation_failure"),{hasViolations:H}=Me(qe),se=!!Ke(S.value).length,ie=Xe("billingAddress").value,le=Ce().value,ce=m.value==="APPLE_PAY"||le,ue=M==="INCORRECT_CVC"&&n?.session.selectedPaymentMethod.value?.paymentMethod==="CREDIT_CARD",R=y.value,U=R!=null&&R.receiptId===r.latestReceipt.value?.id,k=s.value.type==="failed"&&s.value.negotiationStage==="completion",x=!!(w||F||I||k),V=U&&!R.dismissed&&!x;if(d.value)return{message:void 0,tone:"auto"};let a,f="critical";if(t&&r.configuration.isPaymentInstrumentsDelegationEnabled&&i.value&&H&&!ie&&(a=e.translate("payment_errors.payment_method_billing_address")),w&&(u.current=!0,f="warning",a=Y),I&&(u.current=!0,a=I),(ne||F&&(u.current||B))&&(a=e.translate("payment.generic_incorrect_card_info")),$&&M&&L&&!u.current&&m.value!=="GOOGLE_PAY"&&(!ce||g.value)&&!o.value&&!oe&&!ue&&(a=L),k&&s.value.type==="failed"&&(s.value.fetchFailed?a=e.translate("order_errors.network_failure"):s.value.reason==="decision_rule_block"?a=e.translate("payment_errors.generic_error"):a=e.translate("order_errors.creation_failure")),re&&!u.current&&(a=e.translate("order_errors.creation_failure")),B&&!x&&(U?V:!u.current)&&(a=G,V&&(f="critical")),ee&&D&&!u.current&&(a=D),j&&(a=e.translate("store_credit_errors.generic_error")),P&&(a=e.translate("payment.expired_payment_method")),p){const Q=[...A][0]?.nonLocalizedMessage?.split(":")[1]?.toLowerCase().trim();Q?a=e.translate("payment.brand_not_available",{brand:e.translate("payment_brand",{scope:Q})}):a=e.translate("payment.generic_incorrect_card_info")}h&&(a=e.translate("payment.generic_incorrect_card_info")),l&&(a=e.translate("payment_errors.method_not_available")),T&&(a=e.translate("payment_errors.generic_error")),Z&&(a=e.translate("payment_errors.available_methods_updated"),f="info"),_&&(a=_,f="critical"),se&&H&&(a=e.translate("address_management.invali
1d_billing_address_selected"));const de=V&&a===G?r.latestReceipt.value?.id:void 0;return{message:a,tone:f,inventoryRecoveryReceiptId:de}}function oa({message:e,tone:r,inventoryRecoveryReceiptId:t}){const{observability:n}=E(),i=K(!!t).current;return z(()=>{t&&n.counter({name:"inventory_recovery_error_banner_displayed",value:1})},[t,n]),v(sa,{identifier:"PaymentErrorBanner",tone:r,suppressAutoFocus:i,children:e})}function ya(){const e=na();return e.message?v(oa,{...e}):null}function sa({children:e,identifier:r,tone:t,suppressAutoFocus:n=!1}){return t==="critical"||t==="warning"?v(ea,{errorType:_e.PaymentError,bannerId:r,tone:t,autoFocus:!n,focusable:n,children:e}):v(Pe,{tone:t,children:e})}export{ea as E,ya as P,aa as a,oa as b,sa as c,na as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.