'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Button=require("../../button/components/Button.js");const CheckoutNow=({setting:e,builderAttrs:t,builderProps:n,style:o,styles:i,className:r})=>{let{data:c}=core.useCartData(),u=React.useRef(null),d=(t,n)=>{if(e?.openMode==="popup"){let e=void 0!==window.screenLeft?window.screenLeft:window.screenX,o=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,r=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,d=i/window.screen.availWidth,s=(i-t)/2/d+e,l=(r-n)/2/d+o;u.current=window.open(c?.checkoutUrl,"checkout",`scrollbars=yes, width=${t/d}, height=${n/d}, top=${l}, left=${s}`),u.current?.focus()}else c?.checkoutUrl&&window.open(c?.checkoutUrl)};return jsxRuntime.jsx(Button.default,{builderAttrs:t,builderProps:n,onClick:()=>d(600,600),style:o,className:r,setting:{label:e?.label},styles:i})};exports.default=CheckoutNow;
