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{a as g,a$ as w,a2 as T,b0 as h,b1 as E,b2 as I,b3 as N,al as W,b4 as L,Y as R,b5 as O,b6 as x,b7 as M,a7 as B,b8 as A,b9 as y,ba as U,bb as $}from"./app.ZXowmuNl.js";const D="_557NI",G={GooglePayButton:D},S="google-pay-button-container";function z(){return typeof window>"u"?g("div",{id:S,className:G.GooglePayButton}):g(F,{})}function F(){const t=w(),r=T(),b=h(),f=E(),{markAsLoaded:l}=I(),p=N(),i=W(null),m=L(),C=R(O);x();const{activeWalletSessionSignal:k,inMemoryGooglePayParts:{buttonStatus:n,sdkStatus:P}}=M(),_=()=>{const s=i.current;s&&(s.style.display="none")};return B(()=>(n.value={status:"not_rendered"},()=>{n.peek().status==="rendered"&&(n.value={status:"not_rendered"})}),[n]),B(()=>{if(P.value.status!=="available")return;const c={value:!0},v=({failedMethod:a,error:e,statusToWrite:o="error"})=>{if(c.value&&(_(),n.value={status:o},l(),e&&a)){const u=`${a} failed: ${JSON.stringify(e,["statusCode","statusMessage","message"])}`;let d={};switch(e instanceof Error&&(d={metadata:{additionalKey:{errorMessage:e.message}}}),a){case"createButton":r.notify(new $(u,{cause:e}),d);break;default:r.notify(new U(u,"GooglePayGenericError::RenderFailure",{cause:e}),d);break}}};return(async()=>{if(!c.value)return;const a=i.current;if(!a)return;const e=A();if(e){v({statusToWrite:"not_eligible"}),b.counter({name:"google_pay_not_eligible_webview",value:1,attributes:{webviewType:e,PCIv4:!1}});return}try{const o=t({isShippingRequired:!1}).createButton({buttonColor:f==="dark"?"black":"white",buttonType:"plain",buttonSizeMode:"fill",onClick:()=>p()}),u=o.querySelector("button");u?.classList.add(y.borderRadius,y.focusOutline),C&&u?.classList.add(y.shadow),q(a,o),n.value={status:"rendered"},l()}catch(o){v({failedMethod:"createButton",error:o})}})(),()=>{c.value=!1}},[k,f,l,p,r,b,n,t,P.value,C]),g("div",{ref:s=>{i.current=s,m("google_pay")(s)},id:S,className:G.GooglePayButton})}function q(t,r){t.innerHTML="",t.style.display==="none"&&(t.style.display="inherit"),t.appendChild(r)}export{z as default};