1import{h as e,u as r,k as a,T as t,g as n}from"./2c1ab0fe.Bywc2Brn.js";import{a9 as o,bS as s,bT as i,aa as l,bU as u,v as c,bV as d,bx as p,bW as _,bX as m,bY as y,bZ as b,b_ as v,b$ as f,c0 as g}from"./164ad2e3.DHuJhR22.js";import{c as h,aP as E,bs as P,bt as M,bu as S,bv as I,bw as A,bx as T,y as R,by as V,a5 as C,bz as w,bA as k,bB as B,bC as D,bD as F,bE as L,bF as x,bG as O,bH as Y,bI as j,bJ as N,T as z,b9 as G,bK as H}from"./9dba8418.DInoCEzY.js";import{h as U,a as J,u as X}from"./58314944.BgFF-GDw.js";function q({bannerId:a,errorType:t,children:n,...s}){const{observability:i}=h(),{tone:l,...u}=s;return e(()=>{i.log("error_log_banner_error_banner_rendered","[Displayed Error] Error banner was rendered",{bannerId:a})},[a,i]),r(o,{errorType:t,id:a,tone:l,...u,children:n})}function K(){const{checkout:e,i18n:r,shopPay:n}=h(),{value:o}=e.negotiator.current.fields.paymentMethods,{value:l}=e.negotiator.current.fields.managedByMarketsPro,u=R({managedByMarketsPro:l}),c=a(()=>E({checkout:e})),d=s(),{value:p}=e.negotiator.current.fields.deferredTotal,_=n.session.selectedPaymentMethod.value,m=n.session.paymentMethodOption.value,{hasViolations:y}=i(P),b=_&&M(_)?S(_.paymentAttributes.brand):void 0,v=I(),f=t(()=>{if("SHOPIFY_INSTALLMENTS"!==m?.name){if(v.value)return!0;if(!_)return!0;if(d.value&&!p?.amount.amount)return!0;if(M(_)){if(y)return!1;const e=o?.filter(e=>"direct"===e.type).flatMap(e=>e.paymentBrands);if(e&&e.length>0){const r=A(_.paymentAttributes);if(!r)return;return e.includes(r)}}return!T(_)||function(e,r,a){return!e&&r&&a?.some(e=>V(e,["ideal"]))}(c.value,u,o)}},[m?.name,v.value,_,d.value,p?.amount.amount,y,o,c.value,u]),g=t(()=>{if(_&&!1===f){if(M(_))return b?r.translate("payment.brand_not_available",{brand:b}):r.translate("payment.generic_incorrect_card_info");if(T(_))return c.value?r.translate("payment_errors.payment_method_unavailable_with_subscriptions"):r.translate("payment.shop_pay_ideal_unavailable_error")}},[f,_,b,r,c.value]);return{paymentMethods:o,isSelectedPaymentMethodSupported:f,notSupportedError:g,label:b}}function W(){const{i18n:e,checkout:r,embed:a,shopPay:t}=h(),{delegatedPaymentInstrument:o,inventoryRecoverySignal:s}=r.negotiator.context,{lastJourneyProgression:l}=r.negotiator,{progressing:u}=c(),{walletUsedForSubmissionSignal:E,inMemoryApplePayParts:{asPaymentMethod:M},receiptErrorSignal:S}=C(),{paymentMethods:I}=r.negotiator.current.fields,{notSupportedError:A}=K(),{hasViolations:T,violations:R}=i(P),{hasViolations:V}=i(w),{hasViolations:q}=i(k),{hasViolations:W}=i(B),{hasViolations:Z}=i(D),{violations:$}=i(F),Q=!(("success"===l.value.type||"error"===l.value.type)&&"completion"===l.value.negotiationStage)&&1===$.size&&"PAYMENTS_METHOD"===$.values().next().value.code,{hasViolations:ee}=i(L),re=d(),{hasError:ae,error:te}=p(x),{hasError:ne,error:oe}=_(),{hasError:se}=m(),{hasError:ie}=y(),le=b(te?{type:"payment",code:te}:void 0),ue=function(e){const{i18n:r}=h();if(e&&"SURVEY_EXITED"!==e.code)return r.translate("hsa_qualification_errors",{scope:e.code.toLowerCase()})}(oe),ce=r.negotiator.parts.generalPaymentError.value,de=r.negotiator.parts.generalPaymentErrorCode.value,pe=U(r.negotiator.parts.directPaymentErrors),_e=J(r.negotiator.parts.directPaymentErrors),me=n(!1),ye=v(),be=X(ce,de),ve=be&&!O(de)&&!Y(de)&&!j(de)&&!N(de),fe=e.translate("order_errors.inventory_reservation_failure"),{hasViolations:ge}=f(H),he=Boolean(z(I.value).length),Ee=G("billingAddress").value,Pe=g().value,Me="APPLE_PAY"===E.value||Pe,Se="INCORRECT_CVC"===te&&"CREDIT_CARD"===t?.session.selectedPaymentMethod.value?.paymentMethod,Ie=s.value,Ae=null!=Ie&&Ie.receiptId===r.latestReceipt.value?.id,Te="failed"===l.value.type&&"completion"===l.value.negotiationStage,Re=Boolean(ve||_e||re||Te),Ve=Ae&&!Ie.dismissed&&!Re;if(u.value)return{message:void 0,tone:"auto"};let Ce,we="critical";if(a&&r.configuration.isPaymentInstrumentsDelegationEnabled&&o.value&&ge&&!Ee&&(Ce=e.translate("payment_errors.payment_method_billing_address")),ve&&(me.current=!0,we="warning",Ce=be),re&&(me.current=!0,Ce=re),(pe||_e&&(me.current||se))&&(Ce=e.translate("payment.generic_incorrect_card_info")),!(ae&&te&&le)||me.current||"GOOGLE_PAY"===E.value||Me&&!M.value||S.value||ye||Se||(Ce=le),Te&&"failed"===l.value.type&&(Ce=l.value.fetchFailed?e.translate("order_errors.network_failure"):"decision_rule_block"===l.value.reason?e.translate("payment_errors.generic_error"):e.translate("order_errors.creation_failure")),ie&&!me.current&&(Ce=e.translate("order_errors.creation_failure")),se&&!Re&&(Ae?Ve:!me.current)&&(Ce=fe,Ve&&(we="critical")),ne&&ue&&!me.current&&(Ce=ue),ee&&(Ce=e.translate("store_credit_errors.generic_error")),V&&(Ce=e.translate("payment.expired_payment_method")),T){const r=[...R][0],a=r?.nonLocalizedMessage?.split(":")[1]?.toLowerCase().trim();Ce=a?e.translate("payment.brand_not_available",{brand:e.translate("payment_brand",{scope:a})}):e.translate("payment.generic_incorrect_card_info")}return W&&(Ce=e.translate("payment.generic_incorrect_card_info")),Z&&(Ce=e.translate("payment_errors.method_not_available")),q&&(Ce=e.translate("payment_errors.generic_error")),Q&&(Ce=e.translate("payment_errors.available_methods_updated"),we="info"),A&&(Ce=A,we="critical"),he&&ge&&(Ce=e.translate("address_management.invali
1d_billing_address_selected")),{message:Ce,tone:we,inventoryRecoveryReceiptId:Ve&&Ce===fe?r.latestReceipt.value?.id:void 0}}function Z({message:a,tone:t,inventoryRecoveryReceiptId:o}){const{observability:s}=h(),i=n(Boolean(o)).current;return e(()=>{o&&s.counter({name:"inventory_recovery_error_banner_displayed",value:1})},[o,s]),r(Q,{identifier:"PaymentErrorBanner",tone:t,suppressAutoFocus:i,children:a})}function $(){const e=W();return e.message?r(Z,{...e}):null}function Q({children:e,identifier:a,tone:t,suppressAutoFocus:n=!1}){return"critical"===t||"warning"===t?r(q,{errorType:l.PaymentError,bannerId:a,tone:t,autoFocus:!n,focusable:n,children:e}):r(u,{tone:t,children:e})}export{q as E,Q as P,$ as a,K as b,Z as c,W 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.