'use client';
import{jsx as e}from"react/jsx-runtime";import{useCartData as t}from"@gem-sdk/core";import{useRef as n}from"react";import o from"../../button/components/Button.js";let i=({setting:i,builderAttrs:r,builderProps:c,style:d,styles:l,className:w})=>{let{data:s}=t(),u=n(null),m=(e,t)=>{if(i?.openMode==="popup"){let n=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,c=i/window.screen.availWidth,d=(i-e)/2/c+n,l=(r-t)/2/c+o;u.current=window.open(s?.checkoutUrl,"checkout",`scrollbars=yes, width=${e/c}, height=${t/c}, top=${l}, left=${d}`),u.current?.focus()}else s?.checkoutUrl&&window.open(s?.checkoutUrl)};return e(o,{builderAttrs:r,builderProps:c,onClick:()=>m(600,600),style:d,className:w,setting:{label:i?.label},styles:l})};export{i as default};
