bitsnap-react 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +85 -0
- package/README.md +53 -0
- package/dist/CartProvider-CC6YIZVS.js +2 -0
- package/dist/CartProvider-CC6YIZVS.js.map +1 -0
- package/dist/CartProvider-ZL65WZN6.mjs +2 -0
- package/dist/{PanelModelFiles-JZFSF7BF.mjs → PanelModelFiles-4B2HYGIE.mjs} +2 -2
- package/dist/{PanelModelFiles-7HPXWONN.js → PanelModelFiles-EKQRLF46.js} +2 -2
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -0
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/{chunk-VNV5BD4X.js → chunk-2XSLIZ27.js} +2 -2
- package/dist/chunk-2XSLIZ27.js.map +1 -0
- package/dist/{chunk-G4V2KWTV.js → chunk-5OCGXVLC.js} +2 -2
- package/dist/chunk-5OCGXVLC.js.map +1 -0
- package/dist/{chunk-5X7TP3TQ.mjs → chunk-5YN752OV.mjs} +2 -2
- package/dist/{chunk-GEBRXFT3.mjs → chunk-62WDFH7K.mjs} +2 -2
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-7BG22YBF.js +5 -0
- package/dist/chunk-7BG22YBF.js.map +1 -0
- package/dist/{chunk-ZATPBYOA.js → chunk-AHISXVEE.js} +2 -2
- package/dist/chunk-AHISXVEE.js.map +1 -0
- package/dist/{chunk-JA62KNAQ.js → chunk-DR7WYI37.js} +2 -2
- package/dist/chunk-DR7WYI37.js.map +1 -0
- package/dist/{chunk-GWF3MRUP.js → chunk-EOFJAQPT.js} +2 -2
- package/dist/chunk-EOFJAQPT.js.map +1 -0
- package/dist/{chunk-DP2NOHCI.js → chunk-G4SEOVLD.js} +2 -2
- package/dist/chunk-G4SEOVLD.js.map +1 -0
- package/dist/{chunk-CF45RDMD.mjs → chunk-GKJURMDO.mjs} +2 -2
- package/dist/{chunk-CF45RDMD.mjs.map → chunk-GKJURMDO.mjs.map} +1 -1
- package/dist/{chunk-UPAOIY4R.mjs → chunk-IGQZP4YR.mjs} +2 -2
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/{chunk-4HGZZJEL.js → chunk-N3B25GTY.js} +2 -2
- package/dist/chunk-N3B25GTY.js.map +1 -0
- package/dist/chunk-OFPRIENJ.mjs +2 -0
- package/dist/chunk-OFPRIENJ.mjs.map +1 -0
- package/dist/chunk-Q337IQNA.js +2 -0
- package/dist/chunk-Q337IQNA.js.map +1 -0
- package/dist/{chunk-JHJ3ZZF4.mjs → chunk-UTUPPMLK.mjs} +2 -2
- package/dist/{chunk-EVIDNS22.mjs → chunk-VWA3ZCNI.mjs} +2 -2
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-YGE2223J.mjs +5 -0
- package/dist/chunk-YGE2223J.mjs.map +1 -0
- package/dist/{chunk-4OVOKGGS.mjs → chunk-ZKT4N553.mjs} +2 -2
- package/dist/{chunk-ZHTMK5TA.mjs → chunk-ZM5T4TQW.mjs} +2 -2
- package/dist/consent.js.map +1 -1
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +272 -2
- package/dist/index.d.ts +272 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/methods-7DWKFCPK.js +2 -0
- package/dist/methods-7DWKFCPK.js.map +1 -0
- package/dist/methods-DQTADIN4.mjs +2 -0
- package/dist/model-files-client-P4PORZJ6.js.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/package.json +4 -3
- package/dist/CartProvider-OEI526IN.js +0 -2
- package/dist/CartProvider-OEI526IN.js.map +0 -1
- package/dist/CartProvider-RYAA3JDA.mjs +0 -2
- package/dist/PanelModelFiles-7HPXWONN.js.map +0 -1
- package/dist/chunk-4HGZZJEL.js.map +0 -1
- package/dist/chunk-7RXW6XFY.js +0 -2
- package/dist/chunk-7RXW6XFY.js.map +0 -1
- package/dist/chunk-DP2NOHCI.js.map +0 -1
- package/dist/chunk-G4V2KWTV.js.map +0 -1
- package/dist/chunk-GWF3MRUP.js.map +0 -1
- package/dist/chunk-JA62KNAQ.js.map +0 -1
- package/dist/chunk-V5ECGBFW.js +0 -5
- package/dist/chunk-V5ECGBFW.js.map +0 -1
- package/dist/chunk-VNV5BD4X.js.map +0 -1
- package/dist/chunk-VNYHJT6V.mjs +0 -2
- package/dist/chunk-VNYHJT6V.mjs.map +0 -1
- package/dist/chunk-WJO5GSY3.mjs +0 -5
- package/dist/chunk-WJO5GSY3.mjs.map +0 -1
- package/dist/chunk-ZATPBYOA.js.map +0 -1
- package/dist/methods-AULQDKVS.mjs +0 -2
- package/dist/methods-PMH5VQ25.js +0 -2
- package/dist/methods-PMH5VQ25.js.map +0 -1
- /package/dist/{CartProvider-RYAA3JDA.mjs.map → CartProvider-ZL65WZN6.mjs.map} +0 -0
- /package/dist/{PanelModelFiles-JZFSF7BF.mjs.map → PanelModelFiles-4B2HYGIE.mjs.map} +0 -0
- /package/dist/{chunk-5X7TP3TQ.mjs.map → chunk-5YN752OV.mjs.map} +0 -0
- /package/dist/{chunk-GEBRXFT3.mjs.map → chunk-62WDFH7K.mjs.map} +0 -0
- /package/dist/{chunk-UPAOIY4R.mjs.map → chunk-IGQZP4YR.mjs.map} +0 -0
- /package/dist/{chunk-JHJ3ZZF4.mjs.map → chunk-UTUPPMLK.mjs.map} +0 -0
- /package/dist/{chunk-EVIDNS22.mjs.map → chunk-VWA3ZCNI.mjs.map} +0 -0
- /package/dist/{chunk-4OVOKGGS.mjs.map → chunk-ZKT4N553.mjs.map} +0 -0
- /package/dist/{chunk-ZHTMK5TA.mjs.map → chunk-ZM5T4TQW.mjs.map} +0 -0
- /package/dist/{methods-AULQDKVS.mjs.map → methods-DQTADIN4.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkV5ECGBFWjs = require('./chunk-V5ECGBFW.js');var _chunkJA62KNAQjs = require('./chunk-JA62KNAQ.js');var _chunkZATPBYOAjs = require('./chunk-ZATPBYOA.js');var _chunkGWF3MRUPjs = require('./chunk-GWF3MRUP.js');var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunkVNV5BD4Xjs = require('./chunk-VNV5BD4X.js');var _chunkG4V2KWTVjs = require('./chunk-G4V2KWTV.js');var _chunk4HGZZJELjs = require('./chunk-4HGZZJEL.js');var _chunkDP2NOHCIjs = require('./chunk-DP2NOHCI.js');var _chunk7RXW6XFYjs = require('./chunk-7RXW6XFY.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');var _applepaybutton = require('apple-pay-button'); var _applepaybutton2 = _interopRequireDefault(_applepaybutton);function Ht(){try{return _chunkV5ECGBFWjs.K.call(void 0, )}catch (e2){return}}var _reactquery = require('@tanstack/react-query');var _jsxruntime = require('react/jsx-runtime');var Io=_nullishCoalesce(_applepaybutton2.default.default, () => (_applepaybutton2.default));function Ao({style:t,buttonType:e,colorType:a,items:o,onClick:i}){let{checkIfApplePayIsAvailable:n,getApplePayPaymentRequest:p,completeApplePayPayment:g,setCountry:b,setCouponCodeIfPossible:y,setDeliveryMethod:d,setEmail:v,setPostalCode:k,clearCart:f,getApplePayPreview:m}=_chunkV5ECGBFWjs.O.call(void 0, ),s=_chunkDP2NOHCIjs.m.call(void 0, ),E=_chunkV5ECGBFWjs.E.call(void 0, "paymentForCart"),{data:P}=_reactquery.useQuery.call(void 0, {queryKey:["is-apple-pay-available"],queryFn:n}),x=o.map(S=>`${S.id}:${S.quantity}`).join(","),h=_chunkV5ECGBFWjs.L.call(void 0, ),{data:R}=_reactquery.useQuery.call(void 0, {queryKey:["apple-pay-preview",x,_nullishCoalesce(h.country, () => ("")),_nullishCoalesce(h.couponCode, () => ("")),_nullishCoalesce(h.selectedDeliveryMethod, () => ("")),_nullishCoalesce(h.postalCode, () => (""))],queryFn:()=>m({items:o.map(S=>({productID:S.id,quantity:S.quantity,metadata:S.metadata}))}),enabled:P===!0});if(P!=!0)return null;let C=R!=null&&!_chunkV5ECGBFWjs.q.call(void 0, R)?R:{countryCode:h.country||"PL",currencyCode:_nullishCoalesce(_optionalChain([o, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.currency]), () => ("PLN")),totalAmount:`${_chunkV5ECGBFWjs.n.call(void 0, o.reduce((S,I)=>S+I.price*I.quantity,0)/100,2)}`},N=o.map(S=>({productID:S.id,quantity:S.quantity,metadata:S.metadata}));async function _(){let S=!1,I=c=>{S||(S=!0,s.track("apple_pay_result",{outcome:c}))};s.track("apple_pay_clicked",{}),s.track("payment_method_selected",{gateway:"apple_pay",method:"apple_pay"}),_chunkV5ECGBFWjs.p.call(void 0, {event:"initiateCheckout",items:o.map(c=>({id:c.id,name:c.name,price:c.price,quantity:c.quantity,currency:C.currencyCode}))});let A=o.find(c=>c.isDeliverable===!0)!=null,u=new ApplePaySession(14,{countryCode:C.countryCode,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard"],currencyCode:C.currencyCode,total:{amount:C.totalAmount,label:E,type:"pending"},lineItems:o.map(c=>({amount:`${_chunkV5ECGBFWjs.n.call(void 0, c.price*c.quantity/100,2)}`,label:c.name,type:"final"})),...A?{shippingMethods:[],supportsCouponCode:!0,requiredBillingContactFields:["name","email","postalAddress","phone"],requiredShippingContactFields:["name","email","postalAddress","phone"]}:{}});await _optionalChain([i, 'optionalCall', _4 => _4()]);let G=await p({expectedItems:N});if(_chunkV5ECGBFWjs.q.call(void 0, G)){console.error("Error creating ApplePaySession:",G.error),I("fail");return}u.oncancel=c=>{console.log("ApplePaySession cancelled",c),I("cancel")},u.onvalidatemerchant=async c=>{try{let w=await _chunkV5ECGBFWjs.a.get(_chunk4HGZZJELjs.e).applePayValidateMerchant({validationUrl:c.validationURL,projectId:_chunkV5ECGBFWjs.K.call(void 0, )});console.log("merchantSession",w.merchantSession),w.merchantSession.length>0?(console.log("completing merchant session"),u.completeMerchantValidation(JSON.parse(w.merchantSession))):u.abort()}catch (e3){u.abort()}},u.onshippingmethodselected=async c=>{console.log("shipping method selected",c),s.track("delivery_method_selected",{method:c.shippingMethod.identifier}),await d(c.shippingMethod.identifier);let w=await p({expectedItems:N});if(console.log("apRequest",w),_chunkV5ECGBFWjs.q.call(void 0, w))throw u.abort(),new Error("Failed to get Apple Pay payment request");u.completeShippingMethodSelection({newTotal:w.total,newLineItems:w.lineItems,newShippingMethods:w.shippingMethods})},u.onshippingcontactselected=async c=>{try{c.shippingContact.countryCode!=null&&await b(c.shippingContact.countryCode),c.shippingContact.postalCode!=null&&await k(c.shippingContact.postalCode),c.shippingContact.phoneNumber!=null&&await v(c.shippingContact.emailAddress);let w=await p({expectedItems:N});if(_chunkV5ECGBFWjs.q.call(void 0, w))throw u.abort(),new Error("Failed to get Apple Pay payment request");console.log("apRequest",w),u.completeShippingContactSelection({newLineItems:w.lineItems,newTotal:w.total,newShippingMethods:w.shippingMethods})}catch(w){console.log("shipping contact selected error",w),u.abort()}},u.oncouponcodechanged=async c=>{try{console.log("coupon code changed",c);let w=await y(c.couponCode),mt=await p({expectedItems:N});if(console.log("apRequest",mt),_chunkV5ECGBFWjs.q.call(void 0, mt))throw u.abort(),new Error("Failed to get Apple Pay payment request");u.completeCouponCodeChange({errors:_chunkV5ECGBFWjs.q.call(void 0, w)?[new ApplePayError("couponCodeInvalid")]:void 0,newTotal:mt.total,newLineItems:mt.lineItems,newShippingMethods:mt.shippingMethods})}catch(w){console.log("coupon code changed error",w),u.abort()}},u.onpaymentauthorized=async c=>{s.track("payment_submitted",{gateway:"apple_pay",method:"apple_pay"});try{let w=await g({token:c.payment.token,billingContact:c.payment.billingContact,shippingContact:c.payment.shippingContact});if(_chunkV5ECGBFWjs.q.call(void 0, w)){console.log("apple pay error",w),I("fail"),u.completePayment({status:ApplePaySession.STATUS_FAILURE});return}w.redirectURL&&setTimeout(()=>{open(w.redirectURL,"_self")},2e3),I(w.isSuccess?"success":"fail"),u.completePayment({status:w.isSuccess?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE}),w.isSuccess&&f()}catch (e4){I("fail"),u.completePayment({status:ApplePaySession.STATUS_FAILURE})}},u.begin()}return _jsxruntime.jsx.call(void 0, Io,{style:t,buttonStyle:a,type:e,onClick:_})}function zo(t){let e=_chunkDP2NOHCIjs.n.call(void 0, Ht(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkDP2NOHCIjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.P,{children:_jsxruntime.jsx.call(void 0, Ao,{...t})})})}var Oe=zo;var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);var _react3 = require('@formkit/auto-animate/react');var _reactdialog = require('@radix-ui/react-dialog'); var ut = _interopRequireWildcard(_reactdialog); var Y = _interopRequireWildcard(_reactdialog);var _reactdom = require('react-dom');var Ro=["root","overlay","panel","header","title","closeButton","productList","product","productImage","productName","productPrice","quantityControl","quantityInput","quantityButton","removeButton","summary","totalLabel","totalValue","deliveryText","summaryNote","countryLabel","countryTrigger","countryDropdown","countrySearch","countryOption","paymentButtons","paymentMethods","paymentMethodOption","checkoutButton","emptyState","error","skeleton"],Do={fontFamily:"--bitsnap-checkout-font-family",fontSize:"--bitsnap-checkout-font-size",background:"--bitsnap-checkout-background",surface:"--bitsnap-checkout-surface",foreground:"--bitsnap-checkout-foreground",mutedForeground:"--bitsnap-checkout-muted-foreground",border:"--bitsnap-checkout-border",buttonBackground:"--bitsnap-checkout-button-background",buttonForeground:"--bitsnap-checkout-button-foreground",buttonHoverBackground:"--bitsnap-checkout-button-hover-background",hoverSurface:"--bitsnap-checkout-hover-surface",focusRing:"--bitsnap-checkout-focus-ring",error:"--bitsnap-checkout-error",overlay:"--bitsnap-checkout-overlay",radius:"--bitsnap-checkout-radius"},_o={dark:{},light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#e4e4e7",focusRing:"#71717a",error:"#dc2626",overlay:"rgb(0 0 0 / 0.35)"}},Lo=[{token:"background",variable:"--background"},{token:"foreground",variable:"--foreground"},{token:"surface",variable:"--card"},{token:"surface",variable:"--popover"},{token:"foreground",variable:"--popover-foreground"},{token:"mutedForeground",variable:"--muted-foreground"},{token:"border",variable:"--border"},{token:"border",variable:"--input"},{token:"focusRing",variable:"--ring"},{token:"error",variable:"--destructive"},{token:"radius",variable:"--radius"}];function Uo(t){return{"--popover":_nullishCoalesce(t.surface, () => ("var(--color-neutral-800)")),"--popover-foreground":_nullishCoalesce(t.foreground, () => ("var(--color-neutral-200)"))}}function Be(t){let e=_chunkKOYBZORLjs.a.call(void 0, t,{defaultTheme:"dark",presets:_o,variables:Do,shadcnVariables:Lo});return{theme:e.theme,isCustomized:e.isCustomized,tokens:e.tokens,elements:e.elements,boundaryClassName:e.theme,boundaryStyle:e.boundaryStyle,dropdownStyle:Uo(e.tokens)}}function _a(t,e){return _chunkKOYBZORLjs.b.call(void 0, t.elements,e)}var La=_react.createContext.call(void 0, Be());function Ua({appearance:t,children:e}){let a=_react.useMemo.call(void 0, ()=>Be(t),[t]);return _jsxruntime.jsx.call(void 0, La.Provider,{value:a,children:e})}function Zt(){return _react.useContext.call(void 0, La)}function T(t){let e=Zt();return _nullishCoalesce(_a(e,t), () => ({}))}var _reactselect = require('@radix-ui/react-select'); var U = _interopRequireWildcard(_reactselect);var _lucidereact = require('lucide-react');function Oa({...t}){return _jsxruntime.jsx.call(void 0, U.Root,{"data-slot":"select",...t})}function Ba({...t}){return _jsxruntime.jsx.call(void 0, U.Value,{"data-slot":"select-value",...t})}var Fo="border-input dark:bg-input/30 dark:hover:bg-input/50 bg-transparent";function Ga({className:t,size:e="default",theme:a="default",children:o,...i}){return _jsxruntime.jsxs.call(void 0, U.Trigger,{"data-slot":"select-trigger","data-size":e,className:_chunk4HGZZJELjs.g.call(void 0, "data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-fit items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a==="bare"?"":Fo,t),...i,children:[o,_jsxruntime.jsx.call(void 0, U.Icon,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function ja({className:t,children:e,position:a="popper",align:o="center",...i}){return _jsxruntime.jsx.call(void 0, U.Portal,{children:_jsxruntime.jsxs.call(void 0, U.Content,{"data-slot":"select-content",className:_chunk4HGZZJELjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:o,...i,children:[_jsxruntime.jsx.call(void 0, Ho,{}),_jsxruntime.jsx.call(void 0, U.Viewport,{className:_chunk4HGZZJELjs.g.call(void 0, "p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),_jsxruntime.jsx.call(void 0, Vo,{})]})})}function qa({className:t,children:e,...a}){return _jsxruntime.jsxs.call(void 0, U.Item,{"data-slot":"select-item",className:_chunk4HGZZJELjs.g.call(void 0, "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[_jsxruntime.jsx.call(void 0, "span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:_jsxruntime.jsx.call(void 0, U.ItemIndicator,{children:_jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon,{className:"size-4"})})}),_jsxruntime.jsx.call(void 0, U.ItemText,{children:e})]})}function Ho({className:t,...e}){return _jsxruntime.jsx.call(void 0, U.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:_chunk4HGZZJELjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronUpIcon,{className:"size-4"})})}function Vo({className:t,...e}){return _jsxruntime.jsx.call(void 0, U.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:_chunk4HGZZJELjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4"})})}function $o({id:t,open:e,disabled:a=!1,onToggle:o,onChange:i,selectedValue:n,countries:p}){let[g,b]=_react.useState.call(void 0, ""),{isCustomized:y,boundaryClassName:d,boundaryStyle:v,dropdownStyle:k}=Zt(),f=T("countryTrigger"),m=T("countryDropdown"),s=T("countrySearch"),E=T("countryOption"),P=_chunkV5ECGBFWjs.E.call(void 0, "searchCountry"),x=_chunkV5ECGBFWjs.E.call(void 0, "noCountriesFound");_react.useEffect.call(void 0, ()=>{n==null&&p.length>0&&i(p[0].code)},[]);let h=p.filter(C=>C.name.toLowerCase().startsWith(g.toLowerCase())),R=p.find(C=>C.code===n);return _jsxruntime.jsxs.call(void 0, Oa,{value:n,onValueChange:C=>{i(C),b("")},open:e,onOpenChange:C=>{C!==e&&o(),C||b("")},disabled:a,children:[_jsxruntime.jsx.call(void 0, Ga,{"data-bitsnap-checkout-slot":"countryTrigger",theme:"bare",className:_chunk4HGZZJELjs.g.call(void 0, a?"bg-neutral-100 dark:bg-neutral-800 dark:border-neutral-700":"","w-full rounded-md",f.className),style:f.style,children:_jsxruntime.jsx.call(void 0, Ba,{children:R&&_jsxruntime.jsxs.call(void 0, "span",{className:"truncate flex items-center",children:[_jsxruntime.jsx.call(void 0, "img",{alt:n,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${n}.svg`,className:"inline mr-2 h-4 rounded-sm"}),R.name]})})}),_jsxruntime.jsxs.call(void 0, ja,{"data-bitsnap-checkout":y?"dropdown":void 0,"data-bitsnap-checkout-slot":y?"countryDropdown":void 0,className:_chunk4HGZZJELjs.g.call(void 0, y?"bitsnap-react":"",d,"w-full max-h-80 max-w-[350px] z-[999999]",m.className),style:{...y?{...v,...k}:void 0,...m.style},position:"popper",children:[_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"countrySearch",className:_chunk4HGZZJELjs.g.call(void 0, "sticky top-0 z-10 p-1 border-b",s.className),style:s.style,children:_jsxruntime.jsx.call(void 0, "input",{type:"search",name:"search",autoComplete:"off",className:"block w-full outline-none sm:text-body-regular bg-transparent rounded-md px-2 py-1.5",placeholder:P,"aria-label":P,value:g,onChange:C=>b(C.target.value),onClick:C=>C.stopPropagation(),onKeyDown:C=>C.stopPropagation()})}),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-64 overflow-y-auto",children:h.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"cursor-default select-none relative py-2 pl-3 pr-9 text-sm",children:x}):h.map(C=>_jsxruntime.jsxs.call(void 0, qa,{"data-bitsnap-checkout-slot":"countryOption",value:C.code,className:_chunk4HGZZJELjs.g.call(void 0, "cursor-default select-none relative py-2 pl-3 pr-9 flex items-center transition",E.className),style:E.style,children:[_jsxruntime.jsx.call(void 0, "img",{alt:C.code,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${C.code}.svg`,className:"inline mr-2 h-4 rounded-sm"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-normal truncate",children:C.name})]},`${t}-${C.code}`))})]})]})}var Fa=$o;var _reactslot = require('@radix-ui/react-slot');var _classvarianceauthority = require('class-variance-authority');var Xo=_classvarianceauthority.cva.call(void 0, "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Ha({className:t,orientation:e,...a}){return _jsxruntime.jsx.call(void 0, "div",{role:"group","data-slot":"button-group","data-orientation":e,className:_chunk4HGZZJELjs.g.call(void 0, Xo({orientation:e}),t),...a})}function Va({price:t,currency:e,pricing:a,quantity:o=1}){let i=_chunkV5ECGBFWjs.E.call(void 0, "lowestPrice30Days"),n=_chunkV5ECGBFWjs.E.call(void 0, "noPriceHistory"),p=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _5 => _5.regularPrice]), () => (t)),g=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _6 => _6.effectivePrice]), () => (t)),b=_optionalChain([a, 'optionalAccess', _7 => _7.discount, 'optionalAccess', _8 => _8.status])==="ACTIVE"&&g<p;return _jsxruntime.jsx.call(void 0, "span",{children:b?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-2 text-neutral-500 line-through",children:_chunkV5ECGBFWjs.o.call(void 0, p*o,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold text-red-700",children:_chunkV5ECGBFWjs.o.call(void 0, g*o,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block text-xs text-neutral-600",children:_optionalChain([a, 'optionalAccess', _9 => _9.referencePrice, 'access', _10 => _10.historyAvailable])&&a.referencePrice.amount!=null?`${i} ${_chunkV5ECGBFWjs.o.call(void 0, a.referencePrice.amount,e)}`:n})]}):_chunkV5ECGBFWjs.o.call(void 0, g*o,e)})}function he(t){return Number.isFinite(t)?Math.min(99,Math.max(1,Math.trunc(t))):1}function je(t,e){let a=parseInt(t,10);return Number.isNaN(a)?e:he(a)}var rn=({isNotAvailable:t,quantity:e,details:a,url:o,shouldUpdate:i})=>{let n=T("product"),p=T("productImage"),g=T("productName"),b=T("productPrice"),y=T("removeButton"),d=_chunkV5ECGBFWjs.E.call(void 0, "remove"),v=_nullishCoalesce(a.image_url, () => (_optionalChain([a, 'access', _11 => _11.images, 'optionalAccess', _12 => _12[0]]))),[k,f]=_react.useState.call(void 0, ),m=v!=null&&v.length>0&&v!==k,s=_nullishCoalesce(a.baseName, () => (a.name));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"product","data-bitsnap-checkout-unavailable":t?"":void 0,className:_chunk4HGZZJELjs.g.call(void 0, "flex items-center gap-3 mx-3",t?"outline outline-1 rounded-md m-1":"",n.className),style:n.style,children:[m&&_jsxruntime.jsx.call(void 0, Ka,{url:o,tabIndex:-1,"aria-hidden":"true",className:"contents",children:_jsxruntime.jsx.call(void 0, "img",{"data-bitsnap-checkout-slot":"productImage",className:_chunk4HGZZJELjs.g.call(void 0, "aspect-auto max-w-[30%] max-w-32 max-h-32 py-2 overflow-hidden",p.className),style:p.style,src:v,alt:"",onError:()=>f(v)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productName",className:_chunk4HGZZJELjs.g.call(void 0, "font-medium",g.className),style:g.style,children:_jsxruntime.jsx.call(void 0, Ka,{url:o,className:"text-inherit no-underline hover:underline",children:s})}),a.variantName!=null&&a.variantName.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm opacity-70",children:a.variantName}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productPrice",className:_chunk4HGZZJELjs.g.call(void 0, "text-sm",b.className),style:b.style,suppressHydrationWarning:!0,children:_jsxruntime.jsx.call(void 0, Va,{price:a.price,currency:a.currency,pricing:a.pricing,quantity:e})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between",children:[_jsxruntime.jsx.call(void 0, on,{className:"",quantity:e,shouldUpdate:i}),_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{"data-bitsnap-checkout-slot":"removeButton",type:"button",variant:"ghost",size:"sm",className:y.className,style:y.style,"aria-label":`${d}: ${a.name}`,onClick:()=>{Promise.resolve(i(0)).catch(()=>{})},children:d})]})]})]})},Qa=rn,Ka=({url:t,children:e,...a})=>t==null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, "a",{href:t,...a,children:e}),on=({quantity:t,shouldUpdate:e,className:a})=>{let[o,i]=_react.useState.call(void 0, t.toString()),n=_react.useRef.call(void 0, t),p=T("quantityControl"),g=T("quantityInput"),b=T("quantityButton"),y=_chunkV5ECGBFWjs.E.call(void 0, "quantity"),d=_chunkV5ECGBFWjs.E.call(void 0, "increaseQuantity"),v=_chunkV5ECGBFWjs.E.call(void 0, "decreaseQuantity"),k=_react.useRef.call(void 0, t);k.current=t,_react.useEffect.call(void 0, ()=>{n.current=t,i(t.toString())},[t]);function f(m){i(m.toString()),m!==n.current&&(n.current=m,Promise.resolve(e(m)).catch(()=>{n.current===m&&(n.current=k.current,i(k.current.toString()))}))}return _jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"quantityControl",className:_chunk4HGZZJELjs.g.call(void 0, "flex",a,p.className),style:p.style,children:_jsxruntime.jsxs.call(void 0, Ha,{"aria-label":y,children:[_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:b.className,style:b.style,"aria-label":v,onClick:()=>f(he(n.current-1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.MinusIcon,{"aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "input",{"data-bitsnap-checkout-slot":"quantityInput",className:_chunk4HGZZJELjs.g.call(void 0, "w-8 bg-transparent text-center",g.className),style:g.style,value:o,"aria-label":y,inputMode:"numeric",pattern:"[0-9]*",onChange:m=>i(m.currentTarget.value),onBlur:m=>f(je(m.currentTarget.value,n.current)),onKeyDown:m=>{m.key==="Enter"&&f(je(m.currentTarget.value,n.current))},type:"text"}),_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:b.className,style:b.style,"aria-label":d,onClick:()=>f(he(n.current+1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon,{"aria-hidden":"true"})})]})})};function qe({className:t,...e}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"skeleton",className:"bg-neutral-700 animate-pulse rounded-md "+t,...e})}function Za({choice:t,selected:e,onChange:a,disabled:o}){let i=_chunkV5ECGBFWjs.F.call(void 0, ),n=T("paymentMethods"),p=T("paymentMethodOption"),g=_react2.default.useId(),b=_react2.default.useId(),y=t.manualAccountTypes.length===0||t.manualAccountTypes.includes("blik"),d={online:{title:i("paymentMethodOnline"),description:i("paymentMethodOnlineDescription")},manual:{title:i(_chunkV5ECGBFWjs.v.call(void 0, t.manualAccountTypes)),description:i("paymentMethodManualDescription"),note:y?i("paymentMethodManualBlikNote"):void 0},cod:{title:i("paymentMethodCod"),description:i("paymentMethodCodDescription")}};return _jsxruntime.jsxs.call(void 0, "fieldset",{"data-bitsnap-checkout-slot":"paymentMethods","aria-labelledby":b,className:_chunk4HGZZJELjs.g.call(void 0, "mx-2 mt-4 mb-2 flex min-w-0 flex-col gap-2 border-0 p-0",n.className),style:n.style,disabled:o,children:[_jsxruntime.jsx.call(void 0, "legend",{id:b,className:"mb-1 px-1 text-sm font-medium",children:i("paymentMethodLegend")}),t.methods.map(v=>{let k=d[v],f=v===e,m=`${g}-${v}-description`;return _jsxruntime.jsxs.call(void 0, "label",{"data-bitsnap-checkout-slot":"paymentMethodOption","data-payment-method":v,"data-selected":f?"":void 0,className:_chunk4HGZZJELjs.g.call(void 0, "flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2.5 transition-colors",p.className),style:p.style,children:[_jsxruntime.jsx.call(void 0, "input",{type:"radio",name:g,value:v,checked:f,onChange:()=>a(v),"aria-describedby":m,className:"mt-0.5 size-4 shrink-0 cursor-pointer"}),_jsxruntime.jsxs.call(void 0, "span",{className:"flex min-w-0 flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-semibold leading-snug",children:k.title}),_jsxruntime.jsxs.call(void 0, "span",{id:m,"data-bitsnap-checkout-payment-method-description":"",className:"text-xs leading-snug",children:[k.description,f&&k.note!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block font-medium",children:k.note})]})]})]},v)})]})}var pn=({className:t,locale:e})=>{let a=_chunkV5ECGBFWjs.O.call(void 0, ),o=_chunkDP2NOHCIjs.m.call(void 0, ),i=_nullishCoalesce(e, () => (_chunk7RXW6XFYjs.f.call(void 0, ))),n=T("productList"),p=T("summary"),g=T("totalLabel"),b=T("totalValue"),y=T("deliveryText"),d=T("summaryNote"),v=T("countryLabel"),k=T("paymentButtons"),f=T("checkoutButton"),m=T("emptyState"),s=T("error"),E=T("skeleton"),P=_chunkV5ECGBFWjs.E.call(void 0, "unavailableProducts"),x=_chunkV5ECGBFWjs.F.call(void 0, ),h=_chunkV5ECGBFWjs.E.call(void 0, "emptyCart"),R=_chunkV5ECGBFWjs.E.call(void 0, "total"),C=_chunkV5ECGBFWjs.E.call(void 0, "delivery"),N=_chunkV5ECGBFWjs.E.call(void 0, "chooseCountry"),_=_chunkV5ECGBFWjs.E.call(void 0, "nextStep"),S=_chunkV5ECGBFWjs.E.call(void 0, "loadFailed"),I=_chunkV5ECGBFWjs.E.call(void 0, "retry"),A=_chunkV5ECGBFWjs.E.call(void 0, "countryRequired"),u=_chunkV5ECGBFWjs.E.call(void 0, "extrasCalculatedNext"),G=_react2.default.useId(),c=_react2.default.useId(),{mutateAsync:w}=_reactquery.useMutation.call(void 0, {mutationFn:a.removeProductFromCart}),{mutateAsync:mt}=_reactquery.useMutation.call(void 0, {mutationFn:a.updateQuantity}),{mutateAsync:ie}=_reactquery.useMutation.call(void 0, {mutationFn:a.setCountry}),{mutateAsync:Ne}=_reactquery.useMutation.call(void 0, {mutationFn:a.clearCart}),[se,Et]=_react2.default.useState(""),pt=_chunkV5ECGBFWjs.w.call(void 0, l=>l.notice);_react2.default.useEffect(()=>()=>_chunkV5ECGBFWjs.w.getState().setNotice(void 0),[]);let Kt=se.length>0?se:_nullishCoalesce(pt, () => ("")),[F,H]=_react2.default.useState([]),[rt,Er]=_react2.default.useState(!1),{mutateAsync:Ir,isPending:Te}=_reactquery.useMutation.call(void 0, {mutationFn:a.redirectToNextStep}),{data:Xe}=_reactquery.useQuery.call(void 0, {queryKey:["cart-available-countries"],queryFn:a.getAvailableCountries}),{data:Ar}=_reactquery.useQuery.call(void 0, {queryKey:["cart-one-click-payment"],queryFn:a.checkIfApplePayIsAvailable}),{data:Ee,isLoading:_t,isError:zr,refetch:Ze}=_reactquery.useQuery.call(void 0, {queryKey:["cart",i],queryFn:a.getProducts}),{data:It,refetch:Ye}=_reactquery.useQuery.call(void 0, {queryKey:["cart-country"],queryFn:a.getCountry}),[Rr]=_react3.useAutoAnimate.call(void 0, ),M=_chunkV5ECGBFWjs.q.call(void 0, Ee)?void 0:Ee,kt=It!=null&&!_chunkV5ECGBFWjs.q.call(void 0, It)&&It!=""?It:void 0,Je=_reactquery.useQueryClient.call(void 0, ),ce=M==null||M.length===0||kt==null?void 0:M.map(l=>`${l.productID}:${l.quantity}`).sort().join(","),ta={queryKey:["cart-payment-methods",_chunkV5ECGBFWjs.K.call(void 0, ),i,kt,ce],queryFn:async()=>a.getPaymentMethodChoice().catch(()=>null),staleTime:6e4,retry:!1},{data:ea,isPlaceholderData:Dr}=_reactquery.useQuery.call(void 0, {...ta,enabled:ce!=null,placeholderData:l=>l===void 0?void 0:_chunkV5ECGBFWjs.t.call(void 0, l)}),le=ce!=null?_nullishCoalesce(ea, () => (null)):null,[aa,_r]=_react2.default.useState(void 0),[ra,oa]=_react2.default.useState(!1),na=_react2.default.useRef(null),ia=!_t&&(zr||_chunkV5ECGBFWjs.q.call(void 0, Ee)),Ct=_chunkV5ECGBFWjs.q.call(void 0, Xe)?[]:Xe,$t=_nullishCoalesce(_optionalChain([M, 'optionalAccess', _13 => _13.reduce, 'call', _14 => _14((l,B)=>B.details==null?l:l+(_nullishCoalesce(_optionalChain([B, 'access', _15 => _15.details, 'access', _16 => _16.pricing, 'optionalAccess', _17 => _17.effectivePrice]), () => (B.details.price)))*B.quantity,0)]), () => (0)),Qt=_nullishCoalesce(_optionalChain([M, 'optionalAccess', _18 => _18[0], 'optionalAccess', _19 => _19.details, 'optionalAccess', _20 => _20.currency]), () => ("PLN")),Lr=_nullishCoalesce(_optionalChain([M, 'optionalAccess', _21 => _21.some, 'call', _22 => _22(l=>_optionalChain([l, 'access', _23 => _23.details, 'optionalAccess', _24 => _24.isDeliverable])===!0)]), () => (!1)),sa=It!==void 0&&kt==null,ca=_react2.default.useRef(!1);_react2.default.useEffect(()=>{ca.current||Ct==null||Ct.length===0||It==null||kt!=null&&Ct.some(l=>l.code===kt)||(ca.current=!0,ie(Ct[0].code).then(()=>Ye()).catch(()=>{}))},[Ct,It,kt]);let la=_react2.default.useRef(!1);_react2.default.useEffect(()=>{la.current||_t||(la.current=!0,o.track("cart_opened",{item_count:_nullishCoalesce(_optionalChain([M, 'optionalAccess', _25 => _25.reduce, 'call', _26 => _26((l,B)=>l+B.quantity,0)]), () => (0)),value_minor:$t,currency:Qt}))},[_t,o,M,$t,Qt]);let Ie=_react2.default.useRef(new Map);_react2.default.useEffect(()=>{Ie.current.clear()},[M]);function Ur(l,B){let J=_optionalChain([M, 'optionalAccess', _27 => _27.find, 'call', _28 => _28(Br=>Br.id===l)]);if(_optionalChain([J, 'optionalAccess', _29 => _29.details])==null)return;let tt=B-(_nullishCoalesce(Ie.current.get(l), () => (J.quantity)));if(Ie.current.set(l,B),tt===0)return;let dt=_nullishCoalesce(_optionalChain([J, 'access', _30 => _30.details, 'access', _31 => _31.pricing, 'optionalAccess', _32 => _32.effectivePrice]), () => (J.details.price)),pe=_nullishCoalesce(J.catalogProductID, () => (J.productID));o.track(tt>0?"add_to_cart":"remove_from_cart",{qty:Math.abs(tt),value_minor:Math.round(dt*Math.abs(tt)),currency:J.details.currency},{product_id:pe,variant_id:pe!==J.productID?J.productID:null})}let pa=_react2.default.useRef(!1);async function Mr(l,B){if(B!=null){Ur(l,Math.max(0,B));try{let J=B<=0?await w({id:l}):await mt({id:l,quantity:B});if(_chunkV5ECGBFWjs.q.call(void 0, J))throw new Error(`cannot change the cart: ${J.error}`)}finally{await Ze().catch(()=>{})}}}async function Or(){try{Et(""),H([]),_chunkV5ECGBFWjs.w.getState().setNotice(void 0);let l=le,B=l!=null?_chunkV5ECGBFWjs.u.call(void 0, l,aa):void 0;if(ce!=null&&(ea===void 0||Dr)){oa(!0);try{l=await Je.fetchQuery(ta).catch(()=>null)}finally{oa(!1)}if(l==null)B=void 0;else if(B==null||!l.methods.includes(B)){window.setTimeout(()=>{_optionalChain([na, 'access', _33 => _33.current, 'optionalAccess', _34 => _34.querySelector, 'call', _35 => _35("input:checked"), 'optionalAccess', _36 => _36.focus, 'call', _37 => _37()])},0);return}}if(M!=null){!pa.current&&M.length>0&&(pa.current=!0,o.track("checkout_started",{item_count:M.reduce((dt,pe)=>dt+pe.quantity,0),checkout_type:"cart",value_minor:$t,currency:Qt}));try{_chunkV5ECGBFWjs.p.call(void 0, {event:"initiateCheckout",items:_optionalChain([M, 'optionalAccess', _38 => _38.map, 'call', _39 => _39(dt=>({id:dt.productID,name:_nullishCoalesce(_optionalChain([dt, 'access', _40 => _40.details, 'optionalAccess', _41 => _41.name]), () => ("")),price:_nullishCoalesce(_optionalChain([dt, 'access', _42 => _42.details, 'optionalAccess', _43 => _43.price]), () => (0)),quantity:dt.quantity,currency:_nullishCoalesce(_optionalChain([dt, 'access', _44 => _44.details, 'optionalAccess', _45 => _45.currency]), () => ("PLN"))}))])})}catch (e5){}}let J=_chunkV5ECGBFWjs.M.call(void 0, ),tt=await Ir(B!=null?{paymentMethod:B}:void 0);if(_chunkV5ECGBFWjs.q.call(void 0, tt)){Je.invalidateQueries({queryKey:["cart-payment-methods"]}),tt.error=="item-ids-not-found"?(Et(P),"data"in tt&&Array.isArray(tt.data)&&H(tt.data)):B==="cod"&&tt.error=="gateway-not-configured"?Et(x("paymentMethodCodUnavailable")):Et(_chunkV5ECGBFWjs.s.call(void 0, tt,x));return}_chunkV5ECGBFWjs.G.call(void 0, tt,{cartProjectId:_chunkV5ECGBFWjs.K.call(void 0, ),lines:J})||await Ne(),window.location.href=tt.url}catch(l){console.warn("checkout failed",l),Et(x("checkoutFailed"))}}return _jsxruntime.jsxs.call(void 0, "div",{className:`${t} flex flex-col`,ref:Rr,children:[_t&&_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full justify-center flex-col gap-4",children:[_jsxruntime.jsx.call(void 0, qe,{"data-bitsnap-checkout-slot":"skeleton",className:_chunk4HGZZJELjs.g.call(void 0, "w-full h-32",E.className),style:E.style}),_jsxruntime.jsx.call(void 0, qe,{"data-bitsnap-checkout-slot":"skeleton",className:_chunk4HGZZJELjs.g.call(void 0, "w-full h-32",E.className),style:E.style})]}),ia&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-3 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4HGZZJELjs.g.call(void 0, s.className),style:s.style,children:S}),pt!=null&&pt.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4HGZZJELjs.g.call(void 0, "text-sm",s.className),style:s.style,children:pt}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"checkoutButton",onClick:()=>{Ze().then().catch()},className:_chunk4HGZZJELjs.g.call(void 0, "px-3 py-2 rounded-md transition font-bold",f.className),style:f.style,children:I})]}),!_t&&!ia&&(M==null||M.length==0)&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"emptyState",className:_chunk4HGZZJELjs.g.call(void 0, m.className),style:m.style,children:h}),pt!=null&&pt.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4HGZZJELjs.g.call(void 0, "text-sm",s.className),style:s.style,children:pt})]}),_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"productList",className:_chunk4HGZZJELjs.g.call(void 0, "max-h-[70vh] overflow-clip overflow-y-scroll",n.className),style:n.style,children:M!=null&&M.length>0&&_jsxruntime.jsx.call(void 0, "ul",{className:"mt-5",children:M.map(l=>_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:l.details!=null&&_jsxruntime.jsxs.call(void 0, "li",{className:"mb-3",children:[_jsxruntime.jsx.call(void 0, Qa,{isNotAvailable:F.includes(l.productID),quantity:l.quantity,details:l.details,url:l.url,shouldUpdate:B=>Mr(l.id,B)}),_jsxruntime.jsx.call(void 0, "hr",{className:"h-1"})]})},l.id))})}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),$t>0&&Qt!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"summary",className:_chunk4HGZZJELjs.g.call(void 0, "mx-3 flex flex-col",p.className),style:p.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between text-lg",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalLabel",className:_chunk4HGZZJELjs.g.call(void 0, "text-xl",g.className),style:g.style,children:R}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalValue",className:_chunk4HGZZJELjs.g.call(void 0, "font-medium",b.className),style:b.style,children:_chunkV5ECGBFWjs.o.call(void 0, $t,Qt)}),Lr&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"deliveryText",className:_chunk4HGZZJELjs.g.call(void 0, "opacity-70 text-right text-base",y.className),style:y.style,children:C})]})]}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"summaryNote",className:_chunk4HGZZJELjs.g.call(void 0, "opacity-70 text-sm",d.className),style:d.style,children:u})]}),Ct&&_optionalChain([Ct, 'optionalAccess', _46 => _46.length])>1&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h4",{"data-bitsnap-checkout-slot":"countryLabel",className:_chunk4HGZZJELjs.g.call(void 0, "ml-3 text-sm",v.className),style:v.style,children:N}),_jsxruntime.jsx.call(void 0, Fa,{id:G,open:rt,onToggle:()=>{Er(!rt)},onChange:l=>{ie(l).then(()=>{Ye().then().catch()})},selectedValue:_nullishCoalesce(kt, () => ("")),countries:Ct})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-3 flex flex-col",children:[Ar&&M!=null&&M.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunk4HGZZJELjs.g.call(void 0, "w-full px-2",k.className),style:k.style,children:_jsxruntime.jsx.call(void 0, Oe,{colorType:"white",style:{width:"100%"},items:_optionalChain([M, 'optionalAccess', _47 => _47.map, 'call', _48 => _48(l=>({name:_nullishCoalesce(_optionalChain([l, 'access', _49 => _49.details, 'optionalAccess', _50 => _50.name]), () => ("")),id:l.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([l, 'access', _51 => _51.details, 'optionalAccess', _52 => _52.pricing, 'optionalAccess', _53 => _53.effectivePrice]), () => (_optionalChain([l, 'access', _54 => _54.details, 'optionalAccess', _55 => _55.price]))), () => (0)),currency:_optionalChain([l, 'access', _56 => _56.details, 'optionalAccess', _57 => _57.currency]),quantity:l.quantity,isDeliverable:_nullishCoalesce(_optionalChain([l, 'access', _58 => _58.details, 'optionalAccess', _59 => _59.isDeliverable]), () => (!1)),metadata:l.metadata}))])})}),M!=null&&M.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunk4HGZZJELjs.g.call(void 0, "w-full px-2",k.className),style:k.style,children:_jsxruntime.jsx.call(void 0, Fe,{buttonSizeMode:"fill",buttonColor:"white",style:{width:"100%"},items:_optionalChain([M, 'optionalAccess', _60 => _60.map, 'call', _61 => _61(l=>({name:_nullishCoalesce(_optionalChain([l, 'access', _62 => _62.details, 'optionalAccess', _63 => _63.name]), () => ("")),id:l.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([l, 'access', _64 => _64.details, 'optionalAccess', _65 => _65.pricing, 'optionalAccess', _66 => _66.effectivePrice]), () => (_optionalChain([l, 'access', _67 => _67.details, 'optionalAccess', _68 => _68.price]))), () => (0)),quantity:l.quantity,isDeliverable:_nullishCoalesce(_optionalChain([l, 'access', _69 => _69.details, 'optionalAccess', _70 => _70.isDeliverable]), () => (!1)),metadata:l.metadata}))])})}),le!=null&&_jsxruntime.jsx.call(void 0, "div",{ref:na,className:"contents",children:_jsxruntime.jsx.call(void 0, Za,{choice:le,selected:_chunkV5ECGBFWjs.u.call(void 0, le,aa),onChange:_r,disabled:Te})}),_jsxruntime.jsx.call(void 0, "button",{"data-bitsnap-checkout-slot":"checkoutButton",onClick:Or,disabled:_t||Te||ra||kt==null,"aria-describedby":sa?c:void 0,className:_chunk4HGZZJELjs.g.call(void 0, "px-3 py-2 my-2 mx-2 rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition font-bold",f.className),style:f.style,children:Te||ra?_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{}):_}),sa&&_jsxruntime.jsx.call(void 0, "p",{id:c,className:"text-sm text-center opacity-70",children:A}),Kt.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4HGZZJELjs.g.call(void 0, "text-sm text-center",s.className),style:s.style,children:Kt})]})]})]})},Ya=pn;function fn({isVisible:t,shouldHide:e,panelId:a,locale:o}){let[i]=_react3.useAutoAnimate.call(void 0, ),[n,p]=_react.useState.call(void 0, null),g=_react.useCallback.call(void 0, h=>{i(h),p(h)},[i]),b=_react.useRef.call(void 0, null),{boundaryClassName:y,boundaryStyle:d}=Zt(),v=T("root"),k=T("overlay"),f=T("panel"),m=T("header"),s=T("title"),E=T("closeButton"),P=_chunkV5ECGBFWjs.E.call(void 0, "cart"),x=_chunkV5ECGBFWjs.E.call(void 0, "close");return _jsxruntime.jsx.call(void 0, "div",{ref:g,"data-bitsnap-checkout":"root","data-bitsnap-checkout-slot":"root",className:_chunk4HGZZJELjs.g.call(void 0, "bitsnap-react",y,v.className),style:{zIndex:999999,...d,...v.style},children:n!=null&&_jsxruntime.jsx.call(void 0, ut.Root,{open:t,onOpenChange:h=>{h||e()},children:_jsxruntime.jsxs.call(void 0, ut.Portal,{container:n,children:[_jsxruntime.jsx.call(void 0, ut.Overlay,{"data-bitsnap-checkout-slot":"overlay","aria-hidden":"true",className:_chunk4HGZZJELjs.g.call(void 0, "fixed top-0 right-0 left-0 bottom-0 cursor-pointer z-10",k.className),style:k.style,onClick:e}),_jsxruntime.jsxs.call(void 0, ut.Content,{id:a,"data-bitsnap-checkout-slot":"panel","aria-modal":"true","aria-describedby":void 0,onOpenAutoFocus:()=>{let h=document.activeElement;b.current=h instanceof HTMLElement?h:null},onCloseAutoFocus:h=>{h.preventDefault(),_optionalChain([b, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.focus, 'call', _73 => _73()]),b.current=null},className:_chunk4HGZZJELjs.g.call(void 0, "fixed z-20 top-0 right-0 bottom-0 w-full md:w-[350px] xl:w-[420px] flex flex-col overflow-y-auto",f.className),style:f.style,onPointerDownOutside:h=>h.preventDefault(),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"header",className:_chunk4HGZZJELjs.g.call(void 0, "mx-3 mt-7 flex justify-between items-center",m.className),style:m.style,children:[_jsxruntime.jsx.call(void 0, ut.Title,{asChild:!0,children:_jsxruntime.jsx.call(void 0, "h1",{"data-bitsnap-checkout-slot":"title",className:_chunk4HGZZJELjs.g.call(void 0, "text-2xl font-medium",s.className),style:s.style,children:P})}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"closeButton",className:_chunk4HGZZJELjs.g.call(void 0, "rounded-xl p-2 transition",E.className),style:E.style,"aria-label":x,onClick:e,children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-x","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),_jsxruntime.jsx.call(void 0, Ya,{className:"grow",locale:o})]})]})})})}var vn=t=>typeof window>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, Ua,{appearance:t.appearance,children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.D,{texts:t.texts,locale:t.locale,children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.P,{locale:t.locale,children:_jsxruntime.jsx.call(void 0, fn,{...t})})})}),document.body),Ja=vn;var xn=_zod2.default.object({id:_zod2.default.string(),isSubscription:_zod2.default.boolean().default(!1),quantity:_zod2.default.number(),metadata:_zod2.default.record(_zod2.default.string(),_zod2.default.string().optional()).optional(),url:_zod2.default.string().optional()}),kn={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Cn({projectID:t,locale:e,children:a,onVisibleChange:o,className:i,numberOfProductsInCartOptions:n,appearance:p,texts:g,analytics:b}){let y=_chunkDP2NOHCIjs.n.call(void 0, t,b,"cart");_chunkDP2NOHCIjs.q.call(void 0, y);let{isCartVisible:d,showCart:v,hideCart:k,numberOfProductsInCart:f}=_chunkV5ECGBFWjs.w.call(void 0, ),m=`bitsnap-cart-${_react.useId.call(void 0, )}`,s=N=>_chunk7RXW6XFYjs.c.call(void 0, N,_nullishCoalesce(e, () => (_chunk7RXW6XFYjs.f.call(void 0, ))),g),E=_react.useRef.call(void 0, s);E.current=s;function P(N){_chunkV5ECGBFWjs.w.getState().setNotice(E.current(N)),v()}function x(N){document.querySelectorAll("iframe").forEach(S=>{_optionalChain([S, 'access', _74 => _74.contentWindow, 'optionalAccess', _75 => _75.postMessage, 'call', _76 => _76(N,"*")])})}_react.useEffect.call(void 0, ()=>{_optionalChain([o, 'optionalCall', _77 => _77(d)]),d&&_chunkV5ECGBFWjs.p.call(void 0, {event:"viewCart"})},[d]),_react.useEffect.call(void 0, ()=>{_chunkV5ECGBFWjs.J.call(void 0, t)},[t]),_react.useEffect.call(void 0, ()=>{_chunk7RXW6XFYjs.e.call(void 0, e)},[e]),_react.useEffect.call(void 0, ()=>{if(!("cart"in window)){let N=_chunkV5ECGBFWjs.K.call(void 0, );if(N==null){console.warn("There is no project ID configured.");return}window.cart={buyProduct:async _=>{try{let S=_zod2.default.object({productID:_zod2.default.string(),email:_zod2.default.string().optional(),name:_zod2.default.string().optional(),country:_zod2.default.string().optional(),marketingAgreement:_zod2.default.boolean().optional(),locale:_zod2.default.string().optional()}).parse(_),I=_chunkV5ECGBFWjs.Q.call(void 0, N);try{let u=await I.getProducts();_chunkV5ECGBFWjs.q.call(void 0, u)==!1&&_chunkV5ECGBFWjs.p.call(void 0, {event:"initiateCheckout",items:u.map(G=>({id:G.productID,name:_nullishCoalesce(_optionalChain([G, 'access', _78 => _78.details, 'optionalAccess', _79 => _79.name]), () => ("")),price:_nullishCoalesce(_optionalChain([G, 'access', _80 => _80.details, 'optionalAccess', _81 => _81.price]), () => (0)),quantity:G.quantity,currency:_nullishCoalesce(_optionalChain([G, 'access', _82 => _82.details, 'optionalAccess', _83 => _83.currency]), () => ("PLN"))}))})}catch (e6){}let A=await I.justRedirectToPayment(S);_chunkV5ECGBFWjs.q.call(void 0, A)==!1?window.location.href=A.url:P("redirectFailed")}catch(S){console.warn(S)}}}}},[]);async function h(N,_){let S=_chunkV5ECGBFWjs.K.call(void 0, );if(S==null){console.warn("There is no project ID configured.");return}try{let I=xn.parse(_);if(I.isSubscription){await R(S,I);return}await _chunkV5ECGBFWjs.Q.call(void 0, S).addProduct({productID:I.id,quantity:I.quantity,metadata:I.metadata,url:I.url}),x({id:N,type:"ADD_TO_CART",success:!0}),v()}catch(I){console.warn("cannot add item to cart",I)}}async function R(N,_){console.warn("subscriptions cannot be added to the cart yet",N,_.id),P("subscriptionUnsupported")}function C(){"__cart_is_listening"in window||(window.__cart_is_listening=!0,window.addEventListener("message",N=>{if(typeof N.data.id<"u"&&typeof N.data.type<"u"){let{id:_,type:S}=N.data;switch(S){case"ADD_TO_CART".toString():h(_,N.data.payload).then().catch();break;default:break}}}))}return _react.useEffect.call(void 0, ()=>{if(C(),typeof window<"u")try{let N=new URLSearchParams(window.location.search),_=_nullishCoalesce(N.get("ref"), () => (N.get("utm-source")));typeof localStorage<"u"&&_&&_.length>0&&localStorage.setItem("bitsnap-ref",_)}catch (e7){return}},[]),_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>d?k():v(),"aria-label":a?void 0:f>0?`${s("openCart")}. ${s("cartItemsCount")}: ${f}`:s("openCart"),"aria-expanded":d,"aria-haspopup":"dialog","aria-controls":d?m:void 0,style:{position:"relative"},className:["bitsnap-react",_nullishCoalesce(i, () => ("rounded-full hover:bg-neutral-300 transition p-1"))].join(" "),children:[a?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:a}):_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-shopping-cart","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"8",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"19",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]}),f>0&&_jsxruntime.jsxs.call(void 0, "span",{style:kn,children:[s("cartItemsCount"),": ",f]}),_optionalChain([n, 'optionalAccess', _84 => _84.isVisible])!=!1&&f>0&&_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",style:{position:"absolute",bottom:-5,right:-5,background:"black",color:"white",borderRadius:"50%",width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"13px",fontWeight:600,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.25)",..._optionalChain([n, 'optionalAccess', _85 => _85.style])},children:f})]}),_jsxruntime.jsx.call(void 0, _chunkDP2NOHCIjs.l,{value:y,children:_jsxruntime.jsx.call(void 0, Ja,{isVisible:d,locale:e,appearance:p,texts:g,panelId:m,shouldHide:()=>{k()}})})]})}var Sn=Cn;var _buttonreact = require('@google-pay/button-react'); var _buttonreact2 = _interopRequireDefault(_buttonreact);function En({items:t,style:e,buttonColor:a,buttonSizeMode:o,test:i}){let{getGooglePayConfiguration:n,completeGooglePayPayment:p,setCountry:g,setCouponCodeIfPossible:b,setDeliveryMethod:y,setEmail:d,setPostalCode:v,clearCart:k}=_chunkV5ECGBFWjs.O.call(void 0, ),f=_chunkDP2NOHCIjs.m.call(void 0, ),{data:m}=_reactquery.useQuery.call(void 0, {queryKey:["get-google-pay-configuration",t.map(P=>P.id).join(",")],queryFn:()=>n({items:t.map(P=>({...P,id:void 0,productID:P.id}))})}),{mutateAsync:s,isPending:E}=_reactquery.useMutation.call(void 0, {mutationFn:p});return m==null||m.isAvailable!=!0?(console.log("google pay configuration is not available",m),null):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _buttonreact2.default,{buttonSizeMode:o,buttonColor:a,style:e,existingPaymentMethodRequired:!0,onClick:()=>f.track("payment_method_selected",{gateway:"google_pay",method:"google_pay"}),environment:i===!0?"TEST":"PRODUCTION",onPaymentDataChanged:async P=>{_chunkV5ECGBFWjs.p.call(void 0, {event:"initiateCheckout",items:t.map(h=>({id:h.id,name:h.name,price:h.price,quantity:h.quantity,currency:"PLN"}))}),console.log("payment data changed",P),_optionalChain([P, 'access', _86 => _86.shippingAddress, 'optionalAccess', _87 => _87.postalCode])!=null&&await v(_optionalChain([P, 'access', _88 => _88.shippingAddress, 'optionalAccess', _89 => _89.postalCode])),_optionalChain([P, 'access', _90 => _90.shippingAddress, 'optionalAccess', _91 => _91.countryCode])!=null&&await g(_optionalChain([P, 'access', _92 => _92.shippingAddress, 'optionalAccess', _93 => _93.countryCode])),_optionalChain([P, 'access', _94 => _94.shippingOptionData, 'optionalAccess', _95 => _95.id])!=null&&await y(P.shippingOptionData.id);let x=await n({items:[]});return console.log("PAYMENT DATA CHANGED CONFIG",x),x.isAvailable?{error:void 0,newShippingOptionParameters:x.config.shippingOptionParameters,newTransactionInfo:x.config.transactionInfo}:{error:void 0}},paymentRequest:m.config,onLoadPaymentData:async P=>{f.track("payment_submitted",{gateway:"google_pay",method:"google_pay"});try{let x=await s({paymentData:P});if(_chunkV5ECGBFWjs.q.call(void 0, x)){console.log("apple pay error",x);return}x.isSuccess&&k(),x.redirectURL&&open(x.redirectURL,"_self")}catch(x){console.warn("error completing google pay payment",x)}}}),E?_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{}):null]})}function In(t){let e=_chunkDP2NOHCIjs.n.call(void 0, Ht(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkDP2NOHCIjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.P,{children:_jsxruntime.jsx.call(void 0, En,{...t})})})}var Fe=In;var K=_chunkZATPBYOAjs.g.pl,D={title:null,description:null,managingDescription:"Zarz\u0105dzaj rodzajami powiadomie\u0144 i sposobem dostarczania.",formTitle:"Podaj Email aby zapisa\u0107 si\u0119\xA0do powiadomie\u0144",formEmailLabel:"Email",formPhoneLabel:"Numer telefonu",formPhoneOptional:"(opcjonalnie)",formEmailPlaceholder:"np. mail@gmail...",formPhonePlaceholder:"np. 663...",formSubmitButton:"Zapisz si\u0119",formSuccessMessage:"Zapisa\u0142e\u015B si\u0119 do powiadomie\u0144.",agreementText:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"red"},children:"*"}),"Wyra\u017Cam zgod\u0119 na przetwarzanie moich danych w celach marketingowych zgodnie z"," ",_jsxruntime.jsx.call(void 0, "a",{href:"/regulations/polityka-prywatnosci",target:"_blank",className:"cursor-alias font-bold hover:font-medium",children:"regulaminem"})," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-light",children:"(zgod\u0119 mo\u017Cna w ka\u017Cdej chwili wycofa\u0107)"})]}),qrCodeTitle:"lub zainstaluj aplikacj\u0119 mobiln\u0105",qrCodeSubtitle:"Aplikacja mobilna",qrCodeScanText:"zeskanuj kod QR",groupsNoSelectionWarning:"Je\u015Bli \u017Cadna z grup nie jest zaznaczona, nie otrzymasz \u017Cadnych powiadomie\u0144.",groupsSelectAllButton:"Zaznacz wszystkie",groupsUpdateButton:"Aktualizuj",groupsUpdateSuccess:"Zaktualizowano pomy\u015Blnie.",groupsTitle:"Zarz\u0105dzaj grupami z kt\xF3rych chcesz otrzymywa\u0107 powiadomienia",manageDataTitle:"Ustawienia powiadomie\u0144",manageDataDescription:"W jaki spos\xF3b chcesz otrzymywa\u0107 powiadomienia?",manageDataUnsubscribeButton:"Odsubskrybuj",manageDataUpdatedMessage:"Zaktualizowano",manageDataUnsubscribeDescription:"Wypisz mnie z wszystkich powiadomie\u0144 i grup.",loginEmailLabel:"Email",loginEmailPlaceholder:"Wprowad\u017A sw\xF3j email",loginSendCodeButton:"Wy\u015Blij kod weryfikacyjny",loginSendingButton:"Wysy\u0142anie...",loginCodeLabel:"Wprowad\u017A kod weryfikacyjny",loginCodeSentMessage:"Wys\u0142ali\u015Bmy kod weryfikacyjny na adres",loginChangeEmailButton:"Popraw email",loginResendCodeButton:"Wy\u015Blij kod ponownie",loginInvalidEmailError:"Wprowad\u017A prawid\u0142owy adres email",loginSlugRequiredError:"Wymagany jest identyfikator projektu",loginInvalidCodeError:"Nieprawid\u0142owy kod weryfikacyjny",loginVerificationFailedError:"Weryfikacja nie powiod\u0142a si\u0119. Sprawd\u017A sw\xF3j kod.",loginSendEmailError:"Nie uda\u0142o si\u0119 wys\u0142a\u0107 kodu weryfikacyjnego",loginVerifyCodeError:"Nie uda\u0142o si\u0119 zweryfikowa\u0107 kodu",loginResendEmailError:"Nie uda\u0142o si\u0119 ponownie wys\u0142a\u0107 kodu weryfikacyjnego",loginTitle:"Wpisz email aby zarz\u0105dza\u0107 powiadomieniami",loginDescription:"Dostaniesz kod weryfikacyjny na email.",loginIHaveCode:"Mam ju\u017C kod",loginVerifyButton:"Potwierd\u017A",loginResendInText:K.resendIn,loginResentMessage:K.resent,loginExpiredError:K.expired,loginTooManyAttemptsError:K.tooManyAttempts,loginRateLimitedError:K.rateLimited,loginNetworkError:K.network,loginSpamHint:K.spamHint,loginValidityHint:K.validity,loginVerifyingButton:K.verifying,loginStepEmailHint:K.stepEmail,loginStepCodeHint:K.stepCode,loginAlreadySentMessage:K.alreadySent,loginEmailNotFoundError:K.emailNotFound,loginDeliveryUnavailableError:K.deliveryUnavailable,loginResendNewCodeButton:K.resendNew,loginNoCodeButton:K.noCode,loginCodeIncompleteError:K.codeIncomplete};function ar({projectName:t,projectLogo:e,projectLogoDark:a,description:o,className:i,onLogout:n}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e!=null||t!=null&&_jsxruntime.jsxs.call(void 0, "h2",{className:_chunk4HGZZJELjs.g.call(void 0, "flex max-w-44 items-center gap-3 text-lg font-medium text-black sm:max-w-none md:text-xl lg:text-2xl xl:text-3xl dark:text-neutral-100",_optionalChain([i, 'optionalAccess', _96 => _96.headerTitle])),children:[e!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:e,alt:"",className:_chunk4HGZZJELjs.g.call(void 0, "h-12 w-auto dark:hidden",_optionalChain([i, 'optionalAccess', _97 => _97.headerLogo]))}),_jsxruntime.jsx.call(void 0, "img",{src:_nullishCoalesce(a, () => (e)),alt:"",className:_chunk4HGZZJELjs.g.call(void 0, "hidden h-12 w-auto dark:inline",_optionalChain([i, 'optionalAccess', _98 => _98.headerLogo]))})]}),_jsxruntime.jsx.call(void 0, "span",{children:t})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[o&&_jsxruntime.jsx.call(void 0, "p",{className:_chunk4HGZZJELjs.g.call(void 0, "mt-4 font-medium text-left",_optionalChain([i, 'optionalAccess', _99 => _99.headerDescription])),children:o}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),n&&_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{variant:"ghost",size:"icon-sm",onClick:n,children:_jsxruntime.jsx.call(void 0, _lucidereact.LogOutIcon,{className:"h-5 w-5"})})]})]})}var _reactswitch = require('@radix-ui/react-switch'); var Ce = _interopRequireWildcard(_reactswitch);function Vt({className:t,...e}){return _jsxruntime.jsx.call(void 0, Ce.Root,{"data-slot":"switch",className:_chunk4HGZZJELjs.g.call(void 0, "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:_jsxruntime.jsx.call(void 0, Ce.Thumb,{"data-slot":"switch-thumb",className:_chunk4HGZZJELjs.g.call(void 0, "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var _reactpopover = require('@radix-ui/react-popover'); var vt = _interopRequireWildcard(_reactpopover);function or({...t}){return _jsxruntime.jsx.call(void 0, vt.Root,{"data-slot":"popover",...t})}function nr({...t}){return _jsxruntime.jsx.call(void 0, vt.Trigger,{"data-slot":"popover-trigger",...t})}function ir({className:t,align:e="center",sideOffset:a=4,...o}){return _jsxruntime.jsx.call(void 0, vt.Portal,{children:_jsxruntime.jsx.call(void 0, vt.Content,{"data-slot":"popover-content",align:e,sideOffset:a,className:_chunk4HGZZJELjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...o})})}function sr({regularity:t}){let e="";switch(t){case"rarely":e="rzadko";break;case"often":e="cz\u0119sto";break;case"very_often":e="codzienne";break}return _jsxruntime.jsxs.call(void 0, or,{children:[_jsxruntime.jsx.call(void 0, nr,{onClick:a=>{a.stopPropagation()},children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"flex w-[30%] cursor-help flex-col items-center justify-center text-xs md:w-[25%] xl:w-[20%]",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ClockIcon,{size:12}),_jsxruntime.jsx.call(void 0, "span",{children:e})]})}),_jsxruntime.jsx.call(void 0, ir,{className:"w-80",children:_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, "h4",{className:"leading-none font-medium",children:"Co to oznacza?"}),_jsxruntime.jsxs.call(void 0, "ul",{className:"list-inside list-disc text-sm",children:[_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Rzadko"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane maksymalnie kilka razy w miesi\u0105cu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Cz\u0119sto"})," \u2013 powiadomienia mog\u0119 by\u0107 wysy\u0142ane kilka razy w tygodniu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Codzienne"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane nawet codziennie."]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grid gap-2"})]})})]})}function Pe({groups:t=[],isManaging:e,onToggle:a,onCheckAll:o,onUpdate:i,isUpdating:n,wasChanged:p,isUserGroupsUpdated:g,className:b,texts:y}){let[d]=_react3.useAutoAnimate.call(void 0, ),[v]=_react3.useAutoAnimate.call(void 0, ),k=t.filter(s=>s.isOn===!1).length>0,f=t.filter(s=>s.isOn===!1).length>0;if(t.length<=1&&e!=!0)return null;let m=_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:_chunk4HGZZJELjs.g.call(void 0, "my-5 flex flex-col gap-3",_optionalChain([b, 'optionalAccess', _100 => _100.groupsList])),children:[t.map(s=>_jsxruntime.jsxs.call(void 0, "div",{id:s.id,role:"button",className:_chunk4HGZZJELjs.g.call(void 0, s.isOn?"bg-neutral-50 hover:bg-transparent shadow-sm border-transparent dark:bg-neutral-800":"border-neutral-200 hover:bg-neutral-50 dark:hover:border-neutral-800 shadow-sm dark:border-neutral-800","active:bg-beige-300 flex w-full cursor-pointer items-center gap-3 rounded-xl border px-3 py-2 transition active:dark:bg-neutral-900",_optionalChain([b, 'optionalAccess', _101 => _101.groupItem])),onClick:E=>{E.target instanceof HTMLButtonElement||a(s.id)},children:[_jsxruntime.jsx.call(void 0, Vt,{checked:s.isOn,className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",onCheckedChange:()=>{a(s.id)}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start justify-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-medium text-sm",children:s.name}),s.description&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-light",children:s.description})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),s.howOften&&_jsxruntime.jsx.call(void 0, sr,{regularity:s.howOften})]},s.id)),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[e===!0&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:v,className:"flex flex-col items-start justify-start",children:[p&&_jsxruntime.jsxs.call(void 0, _chunkG4V2KWTVjs.q,{variant:"default",size:"sm",className:"relative",disabled:n,onClick:i,children:[_nullishCoalesce(_optionalChain([y, 'optionalAccess', _102 => _102.groupsUpdateButton]), () => (D.groupsUpdateButton)),n&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{})})]}),g&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-3 flex items-center gap-2 text-sm text-green-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{color:"var(--color-green-500",size:16})," ",_nullishCoalesce(_optionalChain([y, 'optionalAccess', _103 => _103.groupsUpdateSuccess]), () => (D.groupsUpdateSuccess))]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"})]}),f&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{className:"cursor-pointer dark:bg-neutral-700",onClick:o,size:"sm",variant:"secondary",type:"button",children:_nullishCoalesce(_optionalChain([y, 'optionalAccess', _104 => _104.groupsSelectAllButton]), () => (D.groupsSelectAllButton))})})]}),k&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex text-left gap-2 text-xs text-yellow-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"orange",size:16}),_nullishCoalesce(_optionalChain([y, 'optionalAccess', _105 => _105.groupsNoSelectionWarning]), () => (D.groupsNoSelectionWarning))]})]});return e==!0?_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.b,{className:"mt-5 text-left",children:[_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.c,{children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.d,{children:_nullishCoalesce(_optionalChain([y, 'optionalAccess', _106 => _106.groupsTitle]), () => (D.groupsTitle))})}),_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.e,{children:m})]}):m}function lr({showQRCode:t=!0,isManaging:e,className:a,texts:o}){let i=typeof window<"u",n=i?!!_optionalChain([window, 'access', _107 => _107.matchMedia, 'optionalCall', _108 => _108("(prefers-color-scheme: dark)"), 'access', _109 => _109.matches]):!1;function p(g){return g?window.location.href:""}return t?_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.b,{className:_chunk4HGZZJELjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([a, 'optionalAccess', _110 => _110.qrCodeSection])),children:[_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.c,{children:_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.d,{className:_chunk4HGZZJELjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([a, 'optionalAccess', _111 => _111.qrCodeTitle])),children:[_nullishCoalesce(_optionalChain([o, 'optionalAccess', _112 => _112.qrCodeSubtitle]), () => (D.qrCodeSubtitle))," "+(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _113 => _113.qrCodeTitle]), () => (D.qrCodeTitle)))]})}),_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.e,{className:"flex flex-col items-center gap-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mt-1.5 mb-3 flex items-center gap-x-2",children:[_jsxruntime.jsx.call(void 0, "a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunk4HGZZJELjs.e+"/app-store-logo.png",alt:"Download on App Store"})}),_jsxruntime.jsx.call(void 0, "a",{href:"https://play.google.com/store/apps/details?id=com.bitsnap.Bitsnap&pli=1",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunk4HGZZJELjs.e+"/google-play-logo.png",alt:"Get in on Google Play"})})]}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "flex min-w-[40%] flex-col items-center gap-2 rounded-xl bg-white p-2 dark:bg-neutral-900",_optionalChain([a, 'optionalAccess', _114 => _114.qrCodeContainer])),children:[_jsxruntime.jsx.call(void 0, "img",{className:"mt-3 w-[80%] p-1 pt-3",src:_chunk4HGZZJELjs.e+`/api/qr-gen?url=${p(i)}&bgColor=${n?"171717":"F6F4F0"}&textColor=${n?"ffffff":"000000"}&margin=0`}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs md:text-sm",children:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _115 => _115.qrCodeScanText]), () => (D.qrCodeScanText))})]})})]})]}):null}var _reactphonenumberinput = require('react-phone-number-input');var _reactlabel = require('@radix-ui/react-label');function dr({submit:t,isLoading:e,errMsg:a,emailLack:o,warnMsg:i,isSubmited:n,agreementLack:p,showPhoneInput:g=!1,agreementText:b,className:y,texts:d}){let[v,k]=_react.useState.call(void 0, ""),[f,m]=_react.useState.call(void 0, ""),[s,E]=_react.useState.call(void 0, !1),[P]=_react3.useAutoAnimate.call(void 0, );function x(h){h.preventDefault(),t(v,f,s)}return _jsxruntime.jsxs.call(void 0, "form",{ref:P,onSubmit:x,className:_chunk4HGZZJELjs.g.call(void 0, "flex flex-col gap-3 text-left",_optionalChain([y, 'optionalAccess', _116 => _116.formContainer])),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsx.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-email",children:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _117 => _117.formEmailLabel]), () => (D.formEmailLabel))}),_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.r,{value:v,onChange:h=>{k(h.currentTarget.value)},id:"bts-notifications-form-email",className:_chunk4HGZZJELjs.g.call(void 0, o===!0?"border-red-400":""),type:"email",placeholder:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _118 => _118.formEmailPlaceholder]), () => (D.formEmailPlaceholder))})]}),g&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsxs.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-phone",children:[_nullishCoalesce(_optionalChain([d, 'optionalAccess', _119 => _119.formPhoneLabel]), () => (D.formPhoneLabel))," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-neutral-500 dark:text-neutral-500",children:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _120 => _120.formPhoneOptional]), () => (D.formPhoneOptional))})]}),_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.r,{value:f,onChange:h=>{m(h.currentTarget.value)},id:"bts-notifications-form-phone",className:"",type:"tel",autoComplete:"tel",autoCorrect:"off",placeholder:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _121 => _121.formPhonePlaceholder]), () => (D.formPhonePlaceholder))})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-x-1.5",children:[_jsxruntime.jsx.call(void 0, "input",{className:"cursor-pointer",id:"bts-notifications-form-marketing-consent",type:"checkbox",checked:s,onChange:()=>{E(!s)}}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"bts-notifications-form-marketing-consent",className:_chunk4HGZZJELjs.g.call(void 0, "cursor-pointer text-xs leading-4 transition-colors md:text-sm md:leading-4",p===!0?"text-yellow-700":""),children:b})]}),a.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-red-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"#ff6467",size:16})," ",a]}),i.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-amber-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CircleAlertIcon,{color:"var(--color-amber-400)",size:16})," ",i]}),n==!1&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsxs.call(void 0, _chunkG4V2KWTVjs.q,{variant:"default",disabled:e,className:_chunk4HGZZJELjs.g.call(void 0, e?"cursor-not-allowed text-transparent":"","relative"),children:[_nullishCoalesce(_optionalChain([d, 'optionalAccess', _122 => _122.formSubmitButton]), () => (D.formSubmitButton)),e&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{})})]})}),n&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 text-sm text-green-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{size:16})," ",_nullishCoalesce(_optionalChain([d, 'optionalAccess', _123 => _123.formSuccessMessage]), () => (D.formSuccessMessage))]})]})}var Hn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;function ur({groups:t,onToggle:e,onCheckAll:a,slug:o,showPhoneInput:i=!1,agreementText:n,className:p,texts:g,isUpdating:b,wasChanged:y,onSuccess:d}){let[v,k]=_react.useState.call(void 0, ""),[f,m]=_react.useState.call(void 0, ""),[s,E]=_react.useState.call(void 0, !1),[P,x]=_react.useState.call(void 0, !1),[h,R]=_react.useState.call(void 0, !1),{mutateAsync:C,isPending:N}=_chunkG4V2KWTVjs.m.call(void 0, _chunkG4V2KWTVjs.k.notifications.createNotificationUser);function _(A){return A==null?!1:_reactphonenumberinput.isValidPhoneNumber.call(void 0, A,"PL")}async function S(A,u,G){if(k(""),m(""),R(!1),E(!1),x(!1),!G){x(!0),k("Zgoda w tym przypadku jest wymagana.");return}if(Hn.test(A)===!1){k("Email jest nieprawid\u0142owy."),R(!0);return}u.length>0&&_(u)===!1&&m("Numer telefonu mo\u017Ce by\u0107 nieprawid\u0142owy. Zapisali\u015Bmy go ale je\u015Bli jest nieprawid\u0142owy to wpisz jeszcze raz i kliknij przycisk.");try{let c=await C({slug:o,email:A,phone:u,groups:t.filter(w=>w.isOn==!0).map(w=>w.id),mobileNotificationEnabled:!0,emailNotificationEnabled:!0,smsNotificationEnabled:!0});if(c.result.case==="success"){E(!0),setTimeout(()=>{_optionalChain([d, 'optionalCall', _124 => _124(!1,c.userId,c.accessToken)])},1e3);return}else{E(!0);let w=c.result.value;if(w!=null){if(w==32){_optionalChain([d, 'optionalCall', _125 => _125(!0,void 0,void 0)]);return}console.log(`Code error: ${_chunkG4V2KWTVjs.g[w]}`),k("Wyst\u0105pi\u0142 b\u0142\u0105d: "+_chunkG4V2KWTVjs.g[w]);return}return}}catch(c){k("Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisywania. Spr\xF3buj ponownie."),console.log(`Error: ${c}`)}}let I=_nullishCoalesce(_optionalChain([g, 'optionalAccess', _126 => _126.formTitle]), () => (D.formTitle));return _jsxruntime.jsxs.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([p, 'optionalAccess', _127 => _127.formSection])),children:[I.length>0&&_jsxruntime.jsx.call(void 0, "h3",{className:_chunk4HGZZJELjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([p, 'optionalAccess', _128 => _128.formTitle])),children:I}),_jsxruntime.jsx.call(void 0, Pe,{groups:t,isManaging:!1,onToggle:_nullishCoalesce(e, () => ((()=>{}))),onCheckAll:_nullishCoalesce(a, () => ((()=>{}))),isUpdating:_nullishCoalesce(b, () => (!1)),wasChanged:_nullishCoalesce(y, () => (!1)),isUserGroupsUpdated:!1,className:p,texts:g}),_jsxruntime.jsx.call(void 0, dr,{errMsg:v,emailLack:h,warnMsg:f,submit:S,isLoading:N,isSubmited:s,agreementLack:P,showPhoneInput:i,agreementText:_nullishCoalesce(_nullishCoalesce(n, () => (_optionalChain([g, 'optionalAccess', _129 => _129.agreementText]))), () => (D.agreementText)),className:p,texts:g})]})}var _usedebounce = require('use-debounce');function mr({open:t,onOpenChange:e,onConfirm:a,isDeleting:o=!1}){let[i,n]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>(n(!0),()=>n(!1)),[]),_react.useEffect.call(void 0, ()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),!i||!t)return null;let p=b=>{b.target===b.currentTarget&&e(!1)},g=()=>{a()};return _reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, "div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4",onClick:p,children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "relative w-full max-w-md rounded-2xl bg-white p-6 shadow-lg","dark:bg-neutral-800","animate-in fade-in-0 zoom-in-95 duration-200"),onClick:b=>b.stopPropagation(),children:[_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(!1),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none dark:ring-offset-neutral-950 dark:focus:ring-neutral-300",disabled:o,children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{className:"h-4 w-4"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Zamknij"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{className:"h-6 w-6 text-amber-500","aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1",children:_jsxruntime.jsx.call(void 0, "h2",{className:"text-lg font-semibold text-black dark:text-neutral-100",children:"Czy na pewno chcesz si\u0119 wypisa\u0107?"})})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Klikni\u0119cie tego przycisku spowoduje wypisanie z wszelkich powiadomie\u0144 i grup, kt\xF3re zapisa\u0142e\u015B."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{type:"button",variant:"ghost",onClick:()=>e(!1),disabled:o,className:"sm:min-w-[100px]",children:"Anuluj"}),_jsxruntime.jsxs.call(void 0, _chunkG4V2KWTVjs.q,{type:"button",variant:"destructive",onClick:g,disabled:o,className:_chunk4HGZZJELjs.g.call(void 0, o&&"cursor-not-allowed text-transparent","relative sm:min-w-[100px]"),children:["Usu\u0144",o&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"})})]})]})]})]})}),document.body)}function hr({accessToken:t,slug:e,userID:a,className:o,texts:i}){let[n]=_react3.useAutoAnimate.call(void 0, ),[p]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:g,isPending:b}=_chunkG4V2KWTVjs.m.call(void 0, _chunkG4V2KWTVjs.k.notifications.deleteNotificationUser),{mutateAsync:y,isPending:d}=_chunkG4V2KWTVjs.m.call(void 0, _chunkG4V2KWTVjs.k.notifications.updateNotificationUser),{data:v,isFetching:k}=_chunkG4V2KWTVjs.l.call(void 0, _chunkG4V2KWTVjs.k.notifications.getNotificationUserSettings,{userId:a,slug:e,accessToken:t}),[f,m]=_react.useState.call(void 0, !1),[s,E]=_react.useState.call(void 0, !1),[P,x]=_react.useState.call(void 0, !1),[h,R]=_react.useState.call(void 0, !1),[C,N]=_react.useState.call(void 0, !1),_=_optionalChain([v, 'optionalAccess', _130 => _130.result, 'access', _131 => _131.case])==="success"?_optionalChain([v, 'optionalAccess', _132 => _132.result, 'optionalAccess', _133 => _133.value]):void 0;function S(){N(!0)}async function I(){await g({accessToken:t,slug:e,userId:a}),N(!1)}async function A(){await y({accessToken:t,slug:e,notificationUserId:a,mobileNotificationEnabled:h,emailNotificationEnabled:f,smsNotificationEnabled:s}),x(!0),setTimeout(()=>{x(!1)},3e3)}let u=_usedebounce.useDebouncedCallback.call(void 0, c=>{A()},300);_react.useEffect.call(void 0, ()=>{let c=_optionalChain([v, 'optionalAccess', _134 => _134.result, 'access', _135 => _135.case])==="success"?_optionalChain([v, 'optionalAccess', _136 => _136.result, 'optionalAccess', _137 => _137.value]):void 0;m(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _138 => _138.emailNotificationEnabled]), () => (!1))),E(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _139 => _139.smsNotificationEnabled]), () => (!1))),R(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _140 => _140.mobileNotificationEnabled]), () => (!1)))},[v]);function G(c,w){c==="email"&&m(w),c==="phone"&&E(w),c==="push"&&R(w),u(!0)}return _jsxruntime.jsxs.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([o, 'optionalAccess', _141 => _141.manageDataSection])),children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, "h3",{className:_chunk4HGZZJELjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([o, 'optionalAccess', _142 => _142.manageDataTitle])),children:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _143 => _143.manageDataTitle]), () => (D.manageDataTitle))})}),k?_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.u,{className:"h-64 w-full"}):_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.b,{ref:p,className:_chunk4HGZZJELjs.g.call(void 0, d&&"relative"),children:[_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.c,{children:_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.d,{children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-left",children:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _144 => _144.manageDataDescription]), () => (D.manageDataDescription))})})}),_jsxruntime.jsxs.call(void 0, _chunkV5ECGBFWjs.e,{ref:n,children:[_jsxruntime.jsx.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, d&&"opacity-50 pointer-events-none","flex flex-col gap-2"),children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-5 gap-x-2",children:[_optionalChain([_, 'optionalAccess', _145 => _145.emailNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, Vt,{id:"email-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:f,onCheckedChange:()=>{G("email",!f)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"email-enabled",className:"text-sm",children:"Email"})]}),_optionalChain([_, 'optionalAccess', _146 => _146.smsNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, Vt,{id:"sms-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:s,onCheckedChange:()=>{G("phone",!s)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"sms-enabled",className:"text-sm",children:"SMS"})]}),_optionalChain([_, 'optionalAccess', _147 => _147.mobileNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, Vt,{id:"push-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:h,onCheckedChange:()=>{G("push",!h)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"push-enabled",className:"text-sm",children:"Powiadomienia na telefon"})]}),_optionalChain([_, 'optionalAccess', _148 => _148.hasUserInstalledApp])===!1&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.MessageCircleWarningIcon,{color:"var(--color-amber-500)",size:26}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-amber-500",children:"Wygl\u0105da na to, \u017Ce nie masz zainstalowanej aplikacji mobilnej. Zainstaluj i wyra\u017A zgod\u0119 na otrzymywanie powiadomie\u0144 na telefon."})]})]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-5 flex flex-col gap-2 text-left",children:[_jsxruntime.jsx.call(void 0, "hr",{}),P&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-green-500",children:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _149 => _149.manageDataUpdatedMessage]), () => (D.manageDataUpdatedMessage))}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-x-2",children:_jsxruntime.jsxs.call(void 0, _chunkG4V2KWTVjs.q,{size:"sm",variant:"link",className:_chunk4HGZZJELjs.g.call(void 0, "pl-0 ml-0",b&&"cursor-not-allowed"),onClick:S,children:[_nullishCoalesce(_optionalChain([i, 'optionalAccess', _150 => _150.manageDataUnsubscribeButton]), () => (D.manageDataUnsubscribeButton)),b&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{})})]})})]})]}),d&&_jsxruntime.jsx.call(void 0, "div",{className:"bg-black/30 absolute inset-0 rounded-xl",children:_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{})})})]}),_jsxruntime.jsx.call(void 0, mr,{open:C,onOpenChange:N,onConfirm:I,isDeleting:b})]})}function fr({...t}){return _jsxruntime.jsx.call(void 0, Y.Root,{"data-slot":"dialog",...t})}function ei({...t}){return _jsxruntime.jsx.call(void 0, Y.Portal,{"data-slot":"dialog-portal",...t})}function ai({className:t,...e}){return _jsxruntime.jsx.call(void 0, Y.Overlay,{"data-slot":"dialog-overlay",className:_chunk4HGZZJELjs.g.call(void 0, "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function vr({className:t,children:e,showCloseButton:a=!0,...o}){return _jsxruntime.jsxs.call(void 0, ei,{"data-slot":"dialog-portal",children:[_jsxruntime.jsx.call(void 0, ai,{}),_jsxruntime.jsxs.call(void 0, Y.Content,{"data-slot":"dialog-content",className:_chunk4HGZZJELjs.g.call(void 0, "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...o,children:[e,a&&_jsxruntime.jsxs.call(void 0, Y.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Close"})]})]})]})}function yr({className:t,...e}){return _jsxruntime.jsx.call(void 0, Y.Title,{"data-slot":"dialog-title",className:_chunk4HGZZJELjs.g.call(void 0, "text-lg leading-none font-semibold",t),...e})}function wr({className:t,...e}){return _jsxruntime.jsx.call(void 0, Y.Description,{"data-slot":"dialog-description",className:_chunk4HGZZJELjs.g.call(void 0, "text-muted-foreground text-sm",t),...e})}var _connect = require('@connectrpc/connect');function Cr(t,e="pl"){let a=t.loginCodeSentMessage,o={emailLabel:t.loginEmailLabel,emailPlaceholder:t.loginEmailPlaceholder,sendCode:t.loginSendCodeButton,sending:t.loginSendingButton,invalidEmail:t.loginInvalidEmailError,codeSentTo:a!=null?`${a} {email}.`:void 0,changeEmail:t.loginChangeEmailButton,verify:t.loginVerifyButton,spamHint:t.loginSpamHint,validity:t.loginValidityHint,resend:t.loginResendCodeButton,resendIn:t.loginResendInText,resent:t.loginResentMessage,haveCodePrompt:"",haveCode:t.loginIHaveCode,wrongCode:t.loginInvalidCodeError,expired:t.loginExpiredError,tooManyAttempts:t.loginTooManyAttemptsError,rateLimited:t.loginRateLimitedError,network:t.loginNetworkError,generic:t.loginVerifyCodeError,deliveryFailed:t.loginSendEmailError,verifying:t.loginVerifyingButton,stepEmail:t.loginStepEmailHint,stepCode:t.loginStepCodeHint,alreadySent:t.loginAlreadySentMessage,emailNotFound:t.loginEmailNotFoundError,deliveryUnavailable:t.loginDeliveryUnavailableError,resendNew:t.loginResendNewCodeButton,noCode:t.loginNoCodeButton,codeIncomplete:t.loginCodeIncompleteError};return _chunkZATPBYOAjs.h.call(void 0, e,o)}function kr(t){let e=_connect.ConnectError.from(t),a=e.rawMessage||e.message;return e.code===_connect.Code.ResourceExhausted?/too many attempts/i.test(a)?"tooManyAttempts":"rateLimited":/invalid code/i.test(a)?"wrongCode":/expired/i.test(a)?"expired":e.code===_connect.Code.Unavailable?"unknown":_chunkZATPBYOAjs.a.call(void 0, t)}function Sr(t,e,a){return{async send(o,{resend:i}){if(!e)return{ok:!1,kind:"unknown",message:a.loginSlugRequiredError};try{let n=await t({email:o,slug:e});return n.ok===!1?n.retryIn!=null&&n.retryIn>0?{ok:!1,kind:"rateLimited",retryIn:n.retryIn}:{ok:!1,kind:"deliveryFailed",message:i?a.loginResendEmailError:a.loginSendEmailError}:n.sent===!1?{ok:!1,kind:"alreadySent",retryIn:n.retryIn||void 0}:{ok:!0,retryIn:n.retryIn||void 0}}catch(n){let p=kr(n);return{ok:!1,kind:p,cause:n,message:p==="unknown"?i?a.loginResendEmailError:a.loginSendEmailError:void 0}}},async verify({email:o,code:i}){try{let n=await t({email:o,code:i,slug:e});return n.ok&&n.accessToken?{ok:!0,value:{userId:n.userId,accessToken:n.accessToken}}:{ok:!1,kind:"wrongCode",message:a.loginVerificationFailedError}}catch(n){return{ok:!1,kind:kr(n),cause:n}}}}}function si({slug:t,onSuccess:e,onError:a,texts:o,projectName:i,projectLogo:n,projectLogoDark:p,showLogo:g}){let[b]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:y}=_chunkG4V2KWTVjs.m.call(void 0, _chunkG4V2KWTVjs.k.notifications.verifyUserEmail),d=_react.useMemo.call(void 0, ()=>Cr(o),[o]),[v,k]=d.codeSentTo.split("{email}"),f=_react.useRef.call(void 0, a);f.current=a;let m=_react.useMemo.call(void 0, ()=>{let x=Sr(h=>y(h),t,o);return{...x,async verify(h){let R=await x.verify(h);return!R.ok&&R.kind==="wrongCode"&&_optionalChain([f, 'access', _151 => _151.current, 'optionalCall', _152 => _152(R.cause instanceof Error?R.cause:new Error(_nullishCoalesce(R.message, () => ("wrongCode"))))]),R}}},[y,t,o]),s=_chunkZATPBYOAjs.j.call(void 0, {adapter:m,texts:d,storageKey:t?_chunkZATPBYOAjs.f.call(void 0, "notifications",t):void 0,onVerified:({userId:x,accessToken:h})=>_optionalChain([e, 'optionalCall', _153 => _153(x,h)]),onFailure:(x,h)=>_optionalChain([a, 'optionalCall', _154 => _154(h instanceof Error?h:new Error(x))])}),E=s.step==="code",P=E&&!s.needsEmail?_nullishCoalesce(o.loginCodeLabel, () => ("")):_nullishCoalesce(o.loginTitle, () => (""));return _jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col",children:[_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.c,{projectId:t,name:i,showLogo:g,logoUrl:n,logoDarkUrl:p,className:"text-foreground mb-3"}),_jsxruntime.jsxs.call(void 0, "div",{ref:b,className:"mb-2 flex items-start gap-2",children:[E&&_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{type:"button",variant:"ghost",size:"icon-sm",className:"-mt-2 -ml-2 size-11 shrink-0","aria-label":d.changeEmail,disabled:s.isBusy,onClick:s.changeEmail,children:_jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeft,{className:"h-5 w-5","aria-hidden":!0})}),_jsxruntime.jsx.call(void 0, yr,{className:"text-lg leading-6 font-semibold",children:P})]}),_jsxruntime.jsx.call(void 0, wr,{className:E?"sr-only":"mb-4",children:E?`${v}${s.email}${_nullishCoalesce(k, () => (""))}`:_nullishCoalesce(o.loginDescription, () => (""))}),_jsxruntime.jsx.call(void 0, _chunkV5ECGBFWjs.f,{login:s,texts:d})]})}function Tr({slug:t,onSuccess:e,onError:a,className:o,isOpen:i,onClose:n,texts:p,projectName:g,projectLogo:b,projectLogoDark:y,showLogo:d}){return _jsxruntime.jsx.call(void 0, fr,{open:i,onOpenChange:n,children:_jsxruntime.jsx.call(void 0, vr,{className:"max-h-[100dvh] overflow-y-auto sm:max-w-[425px]",children:_jsxruntime.jsx.call(void 0, si,{slug:t,onSuccess:e,onError:a,texts:p,projectName:g,projectLogo:b,projectLogoDark:y,showLogo:d})})})}function bi(t,e){switch(e.type){case"SET_IS_LOGGED_IN":return{...t,isLoggedIn:e.value};case"SET_USER_ID":return{...t,userID:e.value};case"SET_LOADING":return{...t,isLoading:e.value};case"SET_PUBLIC_GROUPS":return{...t,groupsProvided:e.value,groups:e.value!=null&&e.value.length>0?t.groups.filter(a=>_optionalChain([e, 'access', _155 => _155.value, 'optionalAccess', _156 => _156.find, 'call', _157 => _157(o=>o.id===a.id)])!=null):t.groups};case"SET_GROUPS":{let a=t.isLoggedIn==!1||t.groupsProvided!=null,o=e.value.map(i=>t.isLoggedIn==!0?i:{...i,isOn:_nullishCoalesce(_optionalChain([t, 'access', _158 => _158.groupsProvided, 'optionalAccess', _159 => _159.find, 'call', _160 => _160(n=>n.id===i.id), 'optionalAccess', _161 => _161.isOn]), () => (a))});return{...t,groups:o}}case"TOGGLE_GROUP":{let a=t.groups.map(o=>o.id===e.groupID?{...o,isOn:!o.isOn}:o);return{...t,wasChanged:!0,groups:a}}case"CHECK_ALL_GROUPS":{let a=t.groups.map(o=>({...o,isOn:!0}));return{...t,groups:a,wasChanged:!0}}case"SET_WAS_CHANGED":return{...t,wasChanged:e.value};case"SET_IS_USER_GROUPS_UPDATED":return{...t,isUserGroupsUpdated:e.value};case"RESET_UPDATE_STATE":return{...t,wasChanged:!1,isUserGroupsUpdated:!0};case"SHOW_SETTINGS":return{...t,showSettings:!0};case"HIDE_SETTINGS":return{...t,showSettings:!1};default:return t}}function mi({slug:t,userID:e,productID:a,projectID:o,analytics:i,projectName:n,projectLogo:p,projectLogoDark:g,showLoginLogo:b,groups:y,isManaging:d=!1,texts:v,showQRCode:k=!1,showPhoneInput:f=!1,hiddenGroupIds:m=[],className:s}){let[E]=_react3.useAutoAnimate.call(void 0, ),P=_chunkDP2NOHCIjs.n.call(void 0, _nullishCoalesce(o, () => (Ht())),i),x=_nullishCoalesce(_nullishCoalesce(t, () => (_chunkV5ECGBFWjs.K.call(void 0, ))), () => ((typeof window<"u"?window.location.hostname:"")));_chunkZATPBYOAjs.b.call(void 0, x.trim(),b!==!1&&!p&&!g&&x.trim()!=="");let{mutateAsync:h,isPending:R}=_chunkG4V2KWTVjs.m.call(void 0, _chunkG4V2KWTVjs.k.notifications.updateUserGroups),{data:C,refetch:N}=_reactquery.useQuery.call(void 0, {queryKey:["notifications_accessToken"],queryFn:()=>{if(typeof window<"u")return{accessToken:_nullishCoalesce(localStorage.getItem("notifications_accessToken"), () => (void 0)),userID:_nullishCoalesce(localStorage.getItem("notifications_userID"), () => (void 0))}}}),{data:_,isPending:S,refetch:I}=_chunkG4V2KWTVjs.l.call(void 0, _chunkG4V2KWTVjs.k.notifications.getUserGroups,{slug:x,accessToken:_optionalChain([C, 'optionalAccess', _162 => _162.accessToken])}),[A,u]=_react.useReducer.call(void 0, bi,{isLoading:S,isUserGroupsUpdated:!1,wasChanged:!1,groupsProvided:y,groups:[],showSettings:C!=null&&d==!0,isLoggedIn:C!=null,userID:void 0});_react.useEffect.call(void 0, ()=>{u({type:"SET_LOADING",value:R||S})},[R,S]),_react.useEffect.call(void 0, ()=>{u({type:"SET_IS_LOGGED_IN",value:_optionalChain([C, 'optionalAccess', _163 => _163.accessToken])!=null}),u({type:"SET_USER_ID",value:_optionalChain([C, 'optionalAccess', _164 => _164.userID])}),_optionalChain([C, 'optionalAccess', _165 => _165.accessToken])!=null&&d==!0&&u({type:"SHOW_SETTINGS"})},[C,d]),_react.useEffect.call(void 0, ()=>{if(_==null)return;let F=_.groups.map(H=>{let rt="rarely";switch(H.howOften){case 0:rt="rarely";break;case 1:rt="often";break;case 2:rt="veryOften";break}return{id:H.id,name:H.name,description:H.description,howOften:rt,isOn:_nullishCoalesce(H.isOn, () => (void 0))}});u({type:"SET_GROUPS",value:F})},[_,S,y]);let G=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{let F=_optionalChain([y, 'optionalAccess', _166 => _166.map, 'call', _167 => _167(H=>(H.id.startsWith("group_")||(H.id=`group_${H.id}`),H))]);u({type:"SET_PUBLIC_GROUPS",value:F})},[y]);let c={...D,...v};async function w(){await h({accessToken:_optionalChain([C, 'optionalAccess', _168 => _168.accessToken]),slug:x,userId:e,groupIds:A.groups.filter(F=>F.isOn===!0).map(F=>F.id)}),u({type:"RESET_UPDATE_STATE"}),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{u({type:"SET_IS_USER_GROUPS_UPDATED",value:!1})},2e3)}function mt(F){u({type:"TOGGLE_GROUP",groupID:F})}function ie(){u({type:"CHECK_ALL_GROUPS"})}function Ne(){u({type:"SHOW_SETTINGS"})}function se(){u({type:"HIDE_SETTINGS"})}function Et(){localStorage.removeItem("notifications_accessToken"),localStorage.removeItem("notifications_userID"),N(),u({type:"SET_USER_ID",value:void 0}),u({type:"SET_IS_LOGGED_IN",value:!1}),u({type:"HIDE_SETTINGS"})}async function pt(F,H){typeof window<"u"&&(localStorage.setItem("notifications_accessToken",H),F!=null&&localStorage.setItem("notifications_userID",F)),u({type:"SET_USER_ID",value:F});try{await N(),I().then().catch().finally(()=>{d==!0&&u({type:"SHOW_SETTINGS"})})}catch(rt){console.log(`Error: ${rt}`)}}_react.useEffect.call(void 0, ()=>()=>{G.current&&clearTimeout(G.current)},[]);let Kt=d==!0&&A.userID!=null&&_optionalChain([C, 'optionalAccess', _169 => _169.accessToken])!=null;return _jsxruntime.jsxs.call(void 0, "main",{className:_chunk4HGZZJELjs.g.call(void 0, "bitsnap-react relative",_optionalChain([s, 'optionalAccess', _170 => _170.container])),children:[c.title!=null&&_jsxruntime.jsx.call(void 0, "h1",{className:"text-2xl font-semibold text-black md:text-3xl lg:text-4xl xl:text-5xl dark:text-neutral-100",children:c.title}),!A.showSettings&&d&&_jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.q,{onClick:Ne,variant:"outline",size:"icon",className:"absolute bottom-6 right-6 z-50 h-12 w-12 rounded-full shadow-lg hover:shadow-xl md:bottom-8 md:right-8","aria-label":"Settings",children:_jsxruntime.jsx.call(void 0, _lucidereact.Settings,{className:"h-5 w-5"})}),_jsxruntime.jsx.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "md:pt8 relative z-0 mt-6 overflow-hidden rounded-2xl bg-white px-3 pt-6 pb-3 md:px-5 md:pb-5 dark:bg-neutral-800",_optionalChain([s, 'optionalAccess', _171 => _171.header])),children:A.showSettings?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-6",children:A.isLoggedIn&&_jsxruntime.jsxs.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6",Kt?"md:grid-cols-2":""),children:[_jsxruntime.jsxs.call(void 0, "div",{className:_optionalChain([s, 'optionalAccess', _172 => _172.groupsContainer]),children:[_jsxruntime.jsx.call(void 0, ar,{projectName:n,projectLogo:p,projectLogoDark:g,description:c.managingDescription,className:s,onLogout:Et}),S&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center items-center py-8",children:_jsxruntime.jsx.call(void 0, _chunkZATPBYOAjs.e,{})}),_jsxruntime.jsx.call(void 0, Pe,{groups:A.groups,hiddenGroupIds:m,isManaging:d,onToggle:mt,onCheckAll:ie,onUpdate:w,isUpdating:R,wasChanged:A.wasChanged,isUserGroupsUpdated:A.isUserGroupsUpdated,className:s,texts:c})]}),Kt&&_jsxruntime.jsx.call(void 0, hr,{accessToken:_nullishCoalesce(C.accessToken, () => ("")),slug:x,userID:_nullishCoalesce(A.userID, () => ("")),className:s,texts:c}),k!=!1&&_jsxruntime.jsx.call(void 0, lr,{showQRCode:k,isManaging:!0,className:s,texts:c})]})}):_jsxruntime.jsx.call(void 0, "div",{className:_chunk4HGZZJELjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6"),children:_jsxruntime.jsx.call(void 0, ur,{slug:x,onToggle:F=>{u({type:"TOGGLE_GROUP",groupID:F})},onCheckAll:()=>{u({type:"CHECK_ALL_GROUPS"})},onSuccess:(F,H,rt)=>{P.track("availability_signup",{},{product_id:_nullishCoalesce(a, () => (null))}),rt!=null&&pt(H,rt),F&&u({type:"SHOW_SETTINGS"})},groups:A.groups,showPhoneInput:f,agreementText:c.agreementText,className:s,texts:c,wasChanged:A.wasChanged,isUpdating:R})})}),_jsxruntime.jsx.call(void 0, Tr,{isOpen:A.showSettings&&!A.isLoggedIn,slug:x,onSuccess:pt,texts:c,onClose:se,projectName:n,projectLogo:p,projectLogoDark:g,showLogo:b})]})}function gi({slug:t,userID:e,productID:a,projectID:o,analytics:i,projectName:n,projectLogo:p,projectLogoDark:g,showLoginLogo:b,groups:y,isManaging:d,texts:v,showQRCode:k,showPhoneInput:f,hiddenGroupIds:m,className:s}){return _jsxruntime.jsx.call(void 0, _chunkG4V2KWTVjs.p,{children:_jsxruntime.jsx.call(void 0, mi,{slug:t,userID:e,productID:a,projectID:o,analytics:i,projectName:n,projectLogo:p,projectLogoDark:g,showLoginLogo:b,groups:y,isManaging:d,texts:v,showQRCode:k,showPhoneInput:f,hiddenGroupIds:m,className:s})})}var hi=gi;exports.ApplePayButton = Oe; exports.Bitsnap = _chunkV5ECGBFWjs.x; exports.BitsnapCheckout = Sn; exports.BitsnapReturns = _chunkJA62KNAQjs.a; exports.BitsnapReturnsProvider = _chunkZATPBYOAjs.v; exports.CHECKOUT_SLOT_NAMES = Ro; exports.Environment = _chunkG4V2KWTVjs.i; exports.GooglePayButton = Fe; exports.ITEM_IDS_NOT_FOUND = _chunkV5ECGBFWjs.r; exports.NotificationsComponent = hi; exports.PRODUCT_LIST_SLOT_NAMES = _chunkGWF3MRUPjs.a; exports.Panel = _chunkV5ECGBFWjs.m; exports.PanelLogin = _chunkV5ECGBFWjs.k; exports.PanelProvider = _chunkVNV5BD4Xjs.i; exports.ProductList = _chunkGWF3MRUPjs.d; exports.PublicOrderPage = _chunkV5ECGBFWjs.l; exports.RETURNS_SLOT_NAMES = _chunkZATPBYOAjs.l; exports.ReturnsAppearanceProvider = _chunkZATPBYOAjs.m; exports.ReturnsCodeStep = _chunkZATPBYOAjs.E; exports.ReturnsConfirmation = _chunkZATPBYOAjs.H; exports.ReturnsEmailStep = _chunkZATPBYOAjs.D; exports.ReturnsMyReturnDetail = _chunkZATPBYOAjs.K; exports.ReturnsMyReturnsList = _chunkZATPBYOAjs.J; exports.ReturnsOrderDetail = _chunkZATPBYOAjs.G; exports.ReturnsOrderList = _chunkZATPBYOAjs.F; exports.ReturnsProvider = _chunkZATPBYOAjs.u; exports.ReturnsResult = _chunkZATPBYOAjs.I; exports.buildAccessTokenRedirect = _chunkV5ECGBFWjs.j; exports.createCheckout = _chunkV5ECGBFWjs.A; exports.createPaymentURL = _chunkV5ECGBFWjs.z; exports.formatProductPrice = _chunkGWF3MRUPjs.b; exports.getAllowedReturnOrigins = _chunkVNV5BD4Xjs.h; exports.getLocale = _chunk7RXW6XFYjs.f; exports.getPanelConfig = _chunkVNV5BD4Xjs.b; exports.getPaymentMethodChoice = _chunkV5ECGBFWjs.y; exports.getReferenceIfPossible = _chunkV5ECGBFWjs.B; exports.getReturnURLFromSearch = _chunkV5ECGBFWjs.g; exports.injectReferenceToRequestIfNeeded = _chunkV5ECGBFWjs.C; exports.persistReturnURL = _chunkV5ECGBFWjs.h; exports.readPersistedReturnURL = _chunkV5ECGBFWjs.i; exports.setAllowedReturnOrigins = _chunkVNV5BD4Xjs.g; exports.setCustomHost = _chunk4HGZZJELjs.f; exports.setHost = _chunkVNV5BD4Xjs.f; exports.setLocale = _chunk7RXW6XFYjs.e; exports.setLoginURL = _chunkVNV5BD4Xjs.e; exports.setPanelConfig = _chunkVNV5BD4Xjs.a; exports.setPanelProjectID = _chunkVNV5BD4Xjs.c; exports.setProjectID = _chunkV5ECGBFWjs.J; exports.setTheme = _chunkVNV5BD4Xjs.d; exports.useCreateReturn = _chunkZATPBYOAjs.z; exports.useMyReturn = _chunkZATPBYOAjs.B; exports.useMyReturns = _chunkZATPBYOAjs.A; exports.usePanelConfig = _chunkVNV5BD4Xjs.j; exports.useProducts = _chunkGWF3MRUPjs.c; exports.useReturnOrders = _chunkZATPBYOAjs.x; exports.useReturnSession = _chunkZATPBYOAjs.w; exports.useReturnableOrder = _chunkZATPBYOAjs.y; exports.useReturnsAppearance = _chunkZATPBYOAjs.n; exports.useReturnsSlot = _chunkZATPBYOAjs.o; exports.useReturnsText = _chunkZATPBYOAjs.r;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunk7BG22YBFjs = require('./chunk-7BG22YBF.js');var _chunkDR7WYI37js = require('./chunk-DR7WYI37.js');var _chunkAHISXVEEjs = require('./chunk-AHISXVEE.js');var _chunkEOFJAQPTjs = require('./chunk-EOFJAQPT.js');var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunk2XSLIZ27js = require('./chunk-2XSLIZ27.js');var _chunk5OCGXVLCjs = require('./chunk-5OCGXVLC.js');var _chunkN3B25GTYjs = require('./chunk-N3B25GTY.js');var _chunkG4SEOVLDjs = require('./chunk-G4SEOVLD.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');var _applepaybutton = require('apple-pay-button'); var _applepaybutton2 = _interopRequireDefault(_applepaybutton);function Ct(){try{return _chunk7BG22YBFjs.K.call(void 0, )}catch (e2){return}}var _reactquery = require('@tanstack/react-query');var _jsxruntime = require('react/jsx-runtime');var fi=_nullishCoalesce(_applepaybutton2.default.default, () => (_applepaybutton2.default));function hi({style:t,buttonType:e,colorType:a,items:r,onClick:n}){let{checkIfApplePayIsAvailable:o,getApplePayPaymentRequest:i,completeApplePayPayment:c,setCountry:l,setCouponCodeIfPossible:u,setDeliveryMethod:s,setEmail:f,setPostalCode:v,clearCart:m,getApplePayPreview:g}=_chunk7BG22YBFjs.O.call(void 0, ),p=_chunkG4SEOVLDjs.m.call(void 0, ),S=_chunk7BG22YBFjs.E.call(void 0, "paymentForCart"),{data:R}=_reactquery.useQuery.call(void 0, {queryKey:["is-apple-pay-available"],queryFn:o}),h=r.map(I=>`${I.id}:${I.quantity}`).join(","),y=_chunk7BG22YBFjs.L.call(void 0, ),{data:A}=_reactquery.useQuery.call(void 0, {queryKey:["apple-pay-preview",h,_nullishCoalesce(y.country, () => ("")),_nullishCoalesce(y.couponCode, () => ("")),_nullishCoalesce(y.selectedDeliveryMethod, () => ("")),_nullishCoalesce(y.postalCode, () => (""))],queryFn:()=>g({items:r.map(I=>({productID:I.id,quantity:I.quantity,metadata:I.metadata}))}),enabled:R===!0});if(R!=!0)return null;let k=A!=null&&!_chunk7BG22YBFjs.q.call(void 0, A)?A:{countryCode:y.country||"PL",currencyCode:_nullishCoalesce(_optionalChain([r, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.currency]), () => ("PLN")),totalAmount:`${_chunk7BG22YBFjs.n.call(void 0, r.reduce((I,T)=>I+T.price*T.quantity,0)/100,2)}`},E=r.map(I=>({productID:I.id,quantity:I.quantity,metadata:I.metadata}));async function D(){let I=!1,T=b=>{I||(I=!0,p.track("apple_pay_result",{outcome:b}))};p.track("apple_pay_clicked",{}),p.track("payment_method_selected",{gateway:"apple_pay",method:"apple_pay"}),_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:r.map(b=>({id:b.id,name:b.name,price:b.price,quantity:b.quantity,currency:k.currencyCode}))});let P=r.find(b=>b.isDeliverable===!0)!=null,w=new ApplePaySession(14,{countryCode:k.countryCode,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard"],currencyCode:k.currencyCode,total:{amount:k.totalAmount,label:S,type:"pending"},lineItems:r.map(b=>({amount:`${_chunk7BG22YBFjs.n.call(void 0, b.price*b.quantity/100,2)}`,label:b.name,type:"final"})),...P?{shippingMethods:[],supportsCouponCode:!0,requiredBillingContactFields:["name","email","postalAddress","phone"],requiredShippingContactFields:["name","email","postalAddress","phone"]}:{}});await _optionalChain([n, 'optionalCall', _4 => _4()]);let U=await i({expectedItems:E});if(_chunk7BG22YBFjs.q.call(void 0, U)){console.error("Error creating ApplePaySession:",U.error),T("fail");return}w.oncancel=b=>{console.log("ApplePaySession cancelled",b),T("cancel")},w.onvalidatemerchant=async b=>{try{let C=await _chunk7BG22YBFjs.a.get(_chunkN3B25GTYjs.e).applePayValidateMerchant({validationUrl:b.validationURL,projectId:_chunk7BG22YBFjs.K.call(void 0, )});console.log("merchantSession",C.merchantSession),C.merchantSession.length>0?(console.log("completing merchant session"),w.completeMerchantValidation(JSON.parse(C.merchantSession))):w.abort()}catch (e3){w.abort()}},w.onshippingmethodselected=async b=>{console.log("shipping method selected",b),p.track("delivery_method_selected",{method:b.shippingMethod.identifier}),await s(b.shippingMethod.identifier);let C=await i({expectedItems:E});if(console.log("apRequest",C),_chunk7BG22YBFjs.q.call(void 0, C))throw w.abort(),new Error("Failed to get Apple Pay payment request");w.completeShippingMethodSelection({newTotal:C.total,newLineItems:C.lineItems,newShippingMethods:C.shippingMethods})},w.onshippingcontactselected=async b=>{try{b.shippingContact.countryCode!=null&&await l(b.shippingContact.countryCode),b.shippingContact.postalCode!=null&&await v(b.shippingContact.postalCode),b.shippingContact.phoneNumber!=null&&await f(b.shippingContact.emailAddress);let C=await i({expectedItems:E});if(_chunk7BG22YBFjs.q.call(void 0, C))throw w.abort(),new Error("Failed to get Apple Pay payment request");console.log("apRequest",C),w.completeShippingContactSelection({newLineItems:C.lineItems,newTotal:C.total,newShippingMethods:C.shippingMethods})}catch(C){console.log("shipping contact selected error",C),w.abort()}},w.oncouponcodechanged=async b=>{try{console.log("coupon code changed",b);let C=await u(b.couponCode),X=await i({expectedItems:E});if(console.log("apRequest",X),_chunk7BG22YBFjs.q.call(void 0, X))throw w.abort(),new Error("Failed to get Apple Pay payment request");w.completeCouponCodeChange({errors:_chunk7BG22YBFjs.q.call(void 0, C)?[new ApplePayError("couponCodeInvalid")]:void 0,newTotal:X.total,newLineItems:X.lineItems,newShippingMethods:X.shippingMethods})}catch(C){console.log("coupon code changed error",C),w.abort()}},w.onpaymentauthorized=async b=>{p.track("payment_submitted",{gateway:"apple_pay",method:"apple_pay"});try{let C=await c({token:b.payment.token,billingContact:b.payment.billingContact,shippingContact:b.payment.shippingContact});if(_chunk7BG22YBFjs.q.call(void 0, C)){console.log("apple pay error",C),T("fail"),w.completePayment({status:ApplePaySession.STATUS_FAILURE});return}C.redirectURL&&setTimeout(()=>{open(C.redirectURL,"_self")},2e3),T(C.isSuccess?"success":"fail"),w.completePayment({status:C.isSuccess?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE}),C.isSuccess&&m()}catch (e4){T("fail"),w.completePayment({status:ApplePaySession.STATUS_FAILURE})}},w.begin()}return _jsxruntime.jsx.call(void 0, fi,{style:t,buttonStyle:a,type:e,onClick:D})}function vi(t){let e=_chunkG4SEOVLDjs.n.call(void 0, Ct(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{children:_jsxruntime.jsx.call(void 0, hi,{...t})})})}var Sa=vi;var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);var _react3 = require('@formkit/auto-animate/react');var _reactdialog = require('@radix-ui/react-dialog'); var It = _interopRequireWildcard(_reactdialog); var it = _interopRequireWildcard(_reactdialog);var _reactdom = require('react-dom');var yi=["root","overlay","panel","header","title","closeButton","productList","product","productImage","productName","productPrice","quantityControl","quantityInput","quantityButton","removeButton","summary","totalLabel","totalValue","deliveryText","summaryNote","countryLabel","countryTrigger","countryDropdown","countrySearch","countryOption","paymentButtons","paymentMethods","paymentMethodOption","checkoutButton","emptyState","error","skeleton"],wi={fontFamily:"--bitsnap-checkout-font-family",fontSize:"--bitsnap-checkout-font-size",background:"--bitsnap-checkout-background",surface:"--bitsnap-checkout-surface",foreground:"--bitsnap-checkout-foreground",mutedForeground:"--bitsnap-checkout-muted-foreground",border:"--bitsnap-checkout-border",buttonBackground:"--bitsnap-checkout-button-background",buttonForeground:"--bitsnap-checkout-button-foreground",buttonHoverBackground:"--bitsnap-checkout-button-hover-background",hoverSurface:"--bitsnap-checkout-hover-surface",focusRing:"--bitsnap-checkout-focus-ring",error:"--bitsnap-checkout-error",overlay:"--bitsnap-checkout-overlay",radius:"--bitsnap-checkout-radius"},xi={dark:{},light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#e4e4e7",focusRing:"#71717a",error:"#dc2626",overlay:"rgb(0 0 0 / 0.35)"}},ki=[{token:"background",variable:"--background"},{token:"foreground",variable:"--foreground"},{token:"surface",variable:"--card"},{token:"surface",variable:"--popover"},{token:"foreground",variable:"--popover-foreground"},{token:"mutedForeground",variable:"--muted-foreground"},{token:"border",variable:"--border"},{token:"border",variable:"--input"},{token:"focusRing",variable:"--ring"},{token:"error",variable:"--destructive"},{token:"radius",variable:"--radius"}];function Ci(t){return{"--popover":_nullishCoalesce(t.surface, () => ("var(--color-neutral-800)")),"--popover-foreground":_nullishCoalesce(t.foreground, () => ("var(--color-neutral-200)"))}}function Ia(t){let e=_chunkKOYBZORLjs.a.call(void 0, t,{defaultTheme:"dark",presets:xi,variables:wi,shadcnVariables:ki});return{theme:e.theme,isCustomized:e.isCustomized,tokens:e.tokens,elements:e.elements,boundaryClassName:e.theme,boundaryStyle:e.boundaryStyle,dropdownStyle:Ci(e.tokens)}}function jr(t,e){return _chunkKOYBZORLjs.b.call(void 0, t.elements,e)}var qr=_react.createContext.call(void 0, Ia());function le({appearance:t,children:e}){let a=_react.useMemo.call(void 0, ()=>Ia(t),[t]);return _jsxruntime.jsx.call(void 0, qr.Provider,{value:a,children:e})}function Ce(){return _react.useContext.call(void 0, qr)}function L(t){let e=Ce();return _nullishCoalesce(jr(e,t), () => ({}))}var _reactselect = require('@radix-ui/react-select'); var G = _interopRequireWildcard(_reactselect);var _lucidereact = require('lucide-react');function Fr({...t}){return _jsxruntime.jsx.call(void 0, G.Root,{"data-slot":"select",...t})}function Wr({...t}){return _jsxruntime.jsx.call(void 0, G.Value,{"data-slot":"select-value",...t})}var Ri="border-input dark:bg-input/30 dark:hover:bg-input/50 bg-transparent";function Hr({className:t,size:e="default",theme:a="default",children:r,...n}){return _jsxruntime.jsxs.call(void 0, G.Trigger,{"data-slot":"select-trigger","data-size":e,className:_chunkN3B25GTYjs.g.call(void 0, "data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-fit items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a==="bare"?"":Ri,t),...n,children:[r,_jsxruntime.jsx.call(void 0, G.Icon,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Kr({className:t,children:e,position:a="popper",align:r="center",...n}){return _jsxruntime.jsx.call(void 0, G.Portal,{children:_jsxruntime.jsxs.call(void 0, G.Content,{"data-slot":"select-content",className:_chunkN3B25GTYjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:r,...n,children:[_jsxruntime.jsx.call(void 0, Ai,{}),_jsxruntime.jsx.call(void 0, G.Viewport,{className:_chunkN3B25GTYjs.g.call(void 0, "p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),_jsxruntime.jsx.call(void 0, Di,{})]})})}function Vr({className:t,children:e,...a}){return _jsxruntime.jsxs.call(void 0, G.Item,{"data-slot":"select-item",className:_chunkN3B25GTYjs.g.call(void 0, "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[_jsxruntime.jsx.call(void 0, "span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:_jsxruntime.jsx.call(void 0, G.ItemIndicator,{children:_jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon,{className:"size-4"})})}),_jsxruntime.jsx.call(void 0, G.ItemText,{children:e})]})}function Ai({className:t,...e}){return _jsxruntime.jsx.call(void 0, G.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronUpIcon,{className:"size-4"})})}function Di({className:t,...e}){return _jsxruntime.jsx.call(void 0, G.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4"})})}function Ui({id:t,open:e,disabled:a=!1,onToggle:r,onChange:n,selectedValue:o,countries:i}){let[c,l]=_react.useState.call(void 0, ""),{isCustomized:u,boundaryClassName:s,boundaryStyle:f,dropdownStyle:v}=Ce(),m=L("countryTrigger"),g=L("countryDropdown"),p=L("countrySearch"),S=L("countryOption"),R=_chunk7BG22YBFjs.E.call(void 0, "searchCountry"),h=_chunk7BG22YBFjs.E.call(void 0, "noCountriesFound");_react.useEffect.call(void 0, ()=>{o==null&&i.length>0&&n(i[0].code)},[]);let y=i.filter(k=>k.name.toLowerCase().startsWith(c.toLowerCase())),A=i.find(k=>k.code===o);return _jsxruntime.jsxs.call(void 0, Fr,{value:o,onValueChange:k=>{n(k),l("")},open:e,onOpenChange:k=>{k!==e&&r(),k||l("")},disabled:a,children:[_jsxruntime.jsx.call(void 0, Hr,{"data-bitsnap-checkout-slot":"countryTrigger",theme:"bare",className:_chunkN3B25GTYjs.g.call(void 0, a?"bg-neutral-100 dark:bg-neutral-800 dark:border-neutral-700":"","w-full rounded-md",m.className),style:m.style,children:_jsxruntime.jsx.call(void 0, Wr,{children:A&&_jsxruntime.jsxs.call(void 0, "span",{className:"truncate flex items-center",children:[_jsxruntime.jsx.call(void 0, "img",{alt:o,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${o}.svg`,className:"inline mr-2 h-4 rounded-sm"}),A.name]})})}),_jsxruntime.jsxs.call(void 0, Kr,{"data-bitsnap-checkout":u?"dropdown":void 0,"data-bitsnap-checkout-slot":u?"countryDropdown":void 0,className:_chunkN3B25GTYjs.g.call(void 0, u?"bitsnap-react":"",s,"w-full max-h-80 max-w-[350px] z-[999999]",g.className),style:{...u?{...f,...v}:void 0,...g.style},position:"popper",children:[_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"countrySearch",className:_chunkN3B25GTYjs.g.call(void 0, "sticky top-0 z-10 p-1 border-b",p.className),style:p.style,children:_jsxruntime.jsx.call(void 0, "input",{type:"search",name:"search",autoComplete:"off",className:"block w-full outline-none sm:text-body-regular bg-transparent rounded-md px-2 py-1.5",placeholder:R,"aria-label":R,value:c,onChange:k=>l(k.target.value),onClick:k=>k.stopPropagation(),onKeyDown:k=>k.stopPropagation()})}),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-64 overflow-y-auto",children:y.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"cursor-default select-none relative py-2 pl-3 pr-9 text-sm",children:h}):y.map(k=>_jsxruntime.jsxs.call(void 0, Vr,{"data-bitsnap-checkout-slot":"countryOption",value:k.code,className:_chunkN3B25GTYjs.g.call(void 0, "cursor-default select-none relative py-2 pl-3 pr-9 flex items-center transition",S.className),style:S.style,children:[_jsxruntime.jsx.call(void 0, "img",{alt:k.code,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${k.code}.svg`,className:"inline mr-2 h-4 rounded-sm"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-normal truncate",children:k.name})]},`${t}-${k.code}`))})]})]})}var $r=Ui;var _reactslot = require('@radix-ui/react-slot');var _classvarianceauthority = require('class-variance-authority');var Oi=_classvarianceauthority.cva.call(void 0, "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Qr({className:t,orientation:e,...a}){return _jsxruntime.jsx.call(void 0, "div",{role:"group","data-slot":"button-group","data-orientation":e,className:_chunkN3B25GTYjs.g.call(void 0, Oi({orientation:e}),t),...a})}function Xr({price:t,currency:e,pricing:a,quantity:r=1}){let n=_chunk7BG22YBFjs.E.call(void 0, "lowestPrice30Days"),o=_chunk7BG22YBFjs.E.call(void 0, "noPriceHistory"),i=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _5 => _5.regularPrice]), () => (t)),c=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _6 => _6.effectivePrice]), () => (t)),l=_optionalChain([a, 'optionalAccess', _7 => _7.discount, 'optionalAccess', _8 => _8.status])==="ACTIVE"&&c<i;return _jsxruntime.jsx.call(void 0, "span",{children:l?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-2 text-neutral-500 line-through",children:_chunk7BG22YBFjs.o.call(void 0, i*r,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold text-red-700",children:_chunk7BG22YBFjs.o.call(void 0, c*r,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block text-xs text-neutral-600",children:_optionalChain([a, 'optionalAccess', _9 => _9.referencePrice, 'access', _10 => _10.historyAvailable])&&a.referencePrice.amount!=null?`${n} ${_chunk7BG22YBFjs.o.call(void 0, a.referencePrice.amount,e)}`:o})]}):_chunk7BG22YBFjs.o.call(void 0, c*r,e)})}function He(t){return Number.isFinite(t)?Math.min(99,Math.max(1,Math.trunc(t))):1}function Ta(t,e){let a=parseInt(t,10);return Number.isNaN(a)?e:He(a)}var Wi=({isNotAvailable:t,quantity:e,details:a,url:r,shouldUpdate:n})=>{let o=L("product"),i=L("productImage"),c=L("productName"),l=L("productPrice"),u=L("removeButton"),s=_chunk7BG22YBFjs.E.call(void 0, "remove"),f=_nullishCoalesce(a.image_url, () => (_optionalChain([a, 'access', _11 => _11.images, 'optionalAccess', _12 => _12[0]]))),[v,m]=_react.useState.call(void 0, ),g=f!=null&&f.length>0&&f!==v,p=_nullishCoalesce(a.baseName, () => (a.name));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"product","data-bitsnap-checkout-unavailable":t?"":void 0,className:_chunkN3B25GTYjs.g.call(void 0, "flex items-center gap-3 mx-3",t?"outline outline-1 rounded-md m-1":"",o.className),style:o.style,children:[g&&_jsxruntime.jsx.call(void 0, Zr,{url:r,tabIndex:-1,"aria-hidden":"true",className:"contents",children:_jsxruntime.jsx.call(void 0, "img",{"data-bitsnap-checkout-slot":"productImage",className:_chunkN3B25GTYjs.g.call(void 0, "aspect-auto max-w-[30%] max-w-32 max-h-32 py-2 overflow-hidden",i.className),style:i.style,src:f,alt:"",onError:()=>m(f)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productName",className:_chunkN3B25GTYjs.g.call(void 0, "font-medium",c.className),style:c.style,children:_jsxruntime.jsx.call(void 0, Zr,{url:r,className:"text-inherit no-underline hover:underline",children:p})}),a.variantName!=null&&a.variantName.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm opacity-70",children:a.variantName}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productPrice",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",l.className),style:l.style,suppressHydrationWarning:!0,children:_jsxruntime.jsx.call(void 0, Xr,{price:a.price,currency:a.currency,pricing:a.pricing,quantity:e})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between",children:[_jsxruntime.jsx.call(void 0, Hi,{className:"",quantity:e,shouldUpdate:n}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"removeButton",type:"button",variant:"ghost",size:"sm",className:u.className,style:u.style,"aria-label":`${s}: ${a.name}`,onClick:()=>{Promise.resolve(n(0)).catch(()=>{})},children:s})]})]})]})},tn=Wi,Zr=({url:t,children:e,...a})=>t==null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, "a",{href:t,...a,children:e}),Hi=({quantity:t,shouldUpdate:e,className:a})=>{let[r,n]=_react.useState.call(void 0, t.toString()),o=_react.useRef.call(void 0, t),i=L("quantityControl"),c=L("quantityInput"),l=L("quantityButton"),u=_chunk7BG22YBFjs.E.call(void 0, "quantity"),s=_chunk7BG22YBFjs.E.call(void 0, "increaseQuantity"),f=_chunk7BG22YBFjs.E.call(void 0, "decreaseQuantity"),v=_react.useRef.call(void 0, t);v.current=t,_react.useEffect.call(void 0, ()=>{o.current=t,n(t.toString())},[t]);function m(g){n(g.toString()),g!==o.current&&(o.current=g,Promise.resolve(e(g)).catch(()=>{o.current===g&&(o.current=v.current,n(v.current.toString()))}))}return _jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"quantityControl",className:_chunkN3B25GTYjs.g.call(void 0, "flex",a,i.className),style:i.style,children:_jsxruntime.jsxs.call(void 0, Qr,{"aria-label":u,children:[_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:l.className,style:l.style,"aria-label":f,onClick:()=>m(He(o.current-1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.MinusIcon,{"aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "input",{"data-bitsnap-checkout-slot":"quantityInput",className:_chunkN3B25GTYjs.g.call(void 0, "w-8 bg-transparent text-center",c.className),style:c.style,value:r,"aria-label":u,inputMode:"numeric",pattern:"[0-9]*",onChange:g=>n(g.currentTarget.value),onBlur:g=>m(Ta(g.currentTarget.value,o.current)),onKeyDown:g=>{g.key==="Enter"&&m(Ta(g.currentTarget.value,o.current))},type:"text"}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:l.className,style:l.style,"aria-label":s,onClick:()=>m(He(o.current+1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon,{"aria-hidden":"true"})})]})})};function Na({className:t,...e}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"skeleton",className:"bg-neutral-700 animate-pulse rounded-md "+t,...e})}function an({choice:t,selected:e,onChange:a,disabled:r}){let n=_chunk7BG22YBFjs.F.call(void 0, ),o=L("paymentMethods"),i=L("paymentMethodOption"),c=_react2.default.useId(),l=_react2.default.useId(),u=t.manualAccountTypes.length===0||t.manualAccountTypes.includes("blik"),s={online:{title:n("paymentMethodOnline"),description:n("paymentMethodOnlineDescription")},manual:{title:n(_chunk7BG22YBFjs.v.call(void 0, t.manualAccountTypes)),description:n("paymentMethodManualDescription"),note:u?n("paymentMethodManualBlikNote"):void 0},cod:{title:n("paymentMethodCod"),description:n("paymentMethodCodDescription")}};return _jsxruntime.jsxs.call(void 0, "fieldset",{"data-bitsnap-checkout-slot":"paymentMethods","aria-labelledby":l,className:_chunkN3B25GTYjs.g.call(void 0, "mx-2 mt-4 mb-2 flex min-w-0 flex-col gap-2 border-0 p-0",o.className),style:o.style,disabled:r,children:[_jsxruntime.jsx.call(void 0, "legend",{id:l,className:"mb-1 px-1 text-sm font-medium",children:n("paymentMethodLegend")}),t.methods.map(f=>{let v=s[f],m=f===e,g=`${c}-${f}-description`;return _jsxruntime.jsxs.call(void 0, "label",{"data-bitsnap-checkout-slot":"paymentMethodOption","data-payment-method":f,"data-selected":m?"":void 0,className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2.5 transition-colors",i.className),style:i.style,children:[_jsxruntime.jsx.call(void 0, "input",{type:"radio",name:c,value:f,checked:m,onChange:()=>a(f),"aria-describedby":g,className:"mt-0.5 size-4 shrink-0 cursor-pointer"}),_jsxruntime.jsxs.call(void 0, "span",{className:"flex min-w-0 flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-semibold leading-snug",children:v.title}),_jsxruntime.jsxs.call(void 0, "span",{id:g,"data-bitsnap-checkout-payment-method-description":"",className:"text-xs leading-snug",children:[v.description,m&&v.note!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block font-medium",children:v.note})]})]})]},f)})]})}var $i="x-bitsnap-cart-token",rn=new Set;function Ra(t,e,a){rn.has(t)||(rn.add(t),console.warn(e,a))}function Qi(t,e,a){return`${t.replace(/\/+$/,"")}/api/integrations/${encodeURIComponent(e)}/public-commerce/express${a}`}async function Pe(t,e,a,r){let n=_nullishCoalesce(t.fetch, () => (((o,i)=>globalThis.fetch(o,i))));try{let o=await n(Qi(t.host,t.projectID,e),{method:"POST",headers:{..._chunkN3B25GTYjs.a,"Content-Type":"application/json",...r!=null?{[$i]:r}:{}},body:JSON.stringify(a),cache:"no-store",signal:t.signal}),i=await o.text().catch(()=>""),c;try{c=i.length>0?JSON.parse(i):void 0}catch (e5){c=void 0}return{status:o.status,json:c,text:i}}catch(o){return{transportError:o}}}function Pt(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)}function nn(t){return Xi(t)?{ok:!1,code:"network",message:"aborted"}:{ok:!1,code:"network",message:"The server could not be reached."}}function Xi(t){return typeof t=="object"&&t!=null&&t.name==="AbortError"}function de(t){return t===404||t===405||t===501||t===502}function Aa(t,e){return typeof t=="string"&&t.length>0?t:e}async function on(t,e){let a=await Pe(t,"/availability",e);if("transportError"in a){Ra(`availability:${t.host}:${t.projectID}`,"Bitsnap express availability is not reachable; express buttons stay hidden.",a.transportError);return}if(de(a.status)||a.status!==200){Ra(`availability-status:${t.host}:${t.projectID}`,"Bitsnap express availability is not available on this backend; express buttons stay hidden.",a.status);return}let r=a.json;if(!Pt(r)||r.success!==!0||!Pt(r.providers)){Ra(`availability-shape:${t.host}:${t.projectID}`,"Bitsnap express availability returned an unknown shape; express buttons stay hidden.",void 0);return}return r}async function sn(t,e,a){let r=await Pe(t,"/cart",{...e,...a!=null?{cartId:a.cartId,expectedRevision:a.expectedRevision}:{}},_optionalChain([a, 'optionalAccess', _13 => _13.cartToken]));if("transportError"in r)return{ok:!1,code:"internal",message:"The cart could not be saved."};let n=r.json;if(!Pt(n)||typeof n.success!="boolean")return{ok:!1,code:r.status===403?"cart-forbidden":"internal",message:"The cart endpoint returned an unknown answer."};if(n.success===!0){let o=n.snapshot;return o==null||typeof o.revision!="number"?{ok:!1,code:"internal",message:"The cart endpoint returned no snapshot."}:{ok:!0,...typeof n.cartToken=="string"?{cartToken:n.cartToken}:{},snapshot:o}}return{ok:!1,code:Aa(n.code,"internal"),message:typeof n.message=="string"?n.message:"The cart could not be saved.",...typeof n.currentRevision=="number"?{currentRevision:n.currentRevision}:{},...Pt(n.snapshot)?{snapshot:n.snapshot}:{},...Array.isArray(n.conflicts)?{conflicts:n.conflicts}:{}}}function Yi(t){let e=Aa(t.code,"internal");return{code:e,message:Aa(t.message,e)}}async function cn(t,e,a){let r=await Pe(t,"/cart-snapshot",{cartId:e},a);if("transportError"in r)return nn(r.transportError);let n=r.json;return r.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found",status:404}:r.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden",status:403}:!Pt(n)||n.success!==!0||!Pt(n.snapshot)?{ok:!1,code:de(r.status)?"not-implemented":"invalid-response",message:"The cart snapshot is not available.",status:r.status}:{ok:!0,value:n.snapshot}}async function ln(t,e,a){let n=await Pe(t,e==="inpostPay"?"/inpost/start":e==="revolutPay"?"/revolut/start":"/adyen/start",{cartId:a.cartId,...a.returnUrl!=null?{returnUrl:a.returnUrl}:{},...a.cancelUrl!=null?{cancelUrl:a.cancelUrl}:{},...a.embedOrigin!=null?{embedOrigin:a.embedOrigin}:{}},a.cartToken);if("transportError"in n)return nn(n.transportError);let o=n.json;if(!Pt(o)||typeof o.success!="boolean")return{ok:!1,code:de(n.status)?"not-implemented":"invalid-response",message:"The provider start is not available.",status:n.status};if(o.success===!0)return typeof o.redirectUrl!="string"||typeof o.providerOrderId!="string"?{ok:!1,code:"invalid-response",message:"The provider start returned no redirect.",status:n.status}:{ok:!0,value:{ok:!0,provider:e,redirectUrl:o.redirectUrl,providerOrderId:o.providerOrderId,...Pt(o.publicConfig)?{publicConfig:o.publicConfig}:{},cartRevision:typeof o.cartRevision=="number"?o.cartRevision:0}};let i=o;return{ok:!1,code:de(n.status)?"not-implemented":i.code,message:typeof i.message=="string"?i.message:"The provider start failed.",status:n.status}}function dn(t,e,a){return un(t,"/revolut/status",e,a)}function pn(t,e,a){return un(t,"/inpost/status",e,a)}async function un(t,e,a,r){let n=await Pe(t,e,{cartId:a},r);if("transportError"in n)return{ok:!1,code:"network",message:"The status is not available."};let o=n.json;return n.status===401||n.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden"}:n.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found"}:!Pt(o)||typeof o.success!="boolean"?{ok:!1,code:de(n.status)?"not-implemented":"provider-error",message:"The status is not available."}:o.success===!0?o.status==="pending"||o.status==="completed"||o.status==="failed"||o.status==="cancelled"?{ok:!0,status:o.status,...typeof o.orderId=="string"?{orderId:o.orderId}:{}}:{ok:!1,code:"provider-error",message:"Unknown status."}:{ok:!1,code:de(n.status)?"not-implemented":"provider-error",message:Pt(o)?Yi(o).message:"The status failed."}}var Zi="bitsnap-express-cart";function mn(t,e=Date.now()){let a=_optionalChain([t, 'optionalAccess', _14 => _14.pending]);if(a!=null)return e-a.ts<=864e5?a:void 0}function Da(){try{return typeof localStorage>"u"?void 0:localStorage}catch (e6){return}}function La(t,e){return`${Zi}:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function bn(t){let e=_nullishCoalesce(t.storage, () => (Da()));if(e==null)return;let a=La(t.host,t.projectID),r;try{let n=e.getItem(a);if(n==null)return;r=JSON.parse(n)}catch (e7){St(t);return}if(!Qe(r)){St(t);return}if(r.projectID!==t.projectID||r.host!==t.host||typeof r.cartId!="string"||r.cartId.length===0||typeof r.cartToken!="string"||r.cartToken.length===0||typeof r.revision!="number"||r.environment!=="test"&&r.environment!=="production"){St(t);return}return{projectID:r.projectID,host:r.host,environment:r.environment,cartId:r.cartId,cartToken:r.cartToken,revision:r.revision,updatedAt:typeof r.updatedAt=="number"?r.updatedAt:0,...Array.isArray(r.syncedLines)?{syncedLines:r.syncedLines.filter(n=>Qe(n)&&typeof n.id=="string"&&typeof n.quantity=="number")}:{},...typeof r.inpostBindingApiKey=="string"?{inpostBindingApiKey:r.inpostBindingApiKey}:{},...Ji(r.pending)?{pending:r.pending}:{}}}function Qt(t,e=Da()){if(e==null)return!1;try{return e.setItem(La(t.host,t.projectID),JSON.stringify(t)),!0}catch (e8){return!1}}function St(t){let e=_nullishCoalesce(t.storage, () => (Da()));if(e!=null)try{e.removeItem(La(t.host,t.projectID))}catch (e9){}}function Qe(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)}function Ji(t){return!Qe(t)||t.provider!=="inpostPay"&&t.provider!=="revolutPay"||typeof t.ts!="number"||!Array.isArray(t.lines)?!1:t.lines.every(e=>Qe(e)&&typeof e.id=="string"&&typeof e.quantity=="number")}var ts=3,Xe= (_class =class{__init() {this.running=Promise.resolve()}constructor(e){;_class.prototype.__init.call(this);this.options=e}getRecord(){return bn(this.options)}getInpostBindingApiKey(){return _optionalChain([this, 'access', _15 => _15.getRecord, 'call', _16 => _16(), 'optionalAccess', _17 => _17.inpostBindingApiKey])}previewUpload(e){return this.options.local.upload(e)}getPendingAttempt(){return _optionalChain([this, 'access', _18 => _18.getRecord, 'call', _19 => _19(), 'optionalAccess', _20 => _20.pending])}ensure(e){return this.serialize(()=>this.ensureNow(e))}async ensureNow(e){let a=this.getRecord();a!=null&&e.environment!=null&&a.environment!==e.environment&&(St(this.options),a=void 0);let r,n=_nullishCoalesce(this.options.maxAttempts, () => (ts));for(let o=0;o<n;o++){let i=this.options.local.upload(e.locale);if(i==null)return{ok:!1,code:"invalid-cart",message:"The cart is empty."};let c=this.options.local.signature(),l=await this.options.write(i,a!=null?{cartId:a.cartId,cartToken:a.cartToken,expectedRevision:a.revision}:void 0);if(l.ok){let u=_nullishCoalesce(l.cartToken, () => (_optionalChain([a, 'optionalAccess', _21 => _21.cartToken])));if(u==null)return{ok:!1,code:"internal",message:"The created cart has no access token."};let s=l.snapshot;if(a={projectID:this.options.projectID,host:this.options.host,environment:s.environment,cartId:s.cartId,cartToken:u,revision:s.revision,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),syncedLines:i.items.map(v=>({id:v.id,quantity:v.quantity})),..._optionalChain([a, 'optionalAccess', _22 => _22.inpostBindingApiKey])!=null?{inpostBindingApiKey:a.inpostBindingApiKey}:{}},Qt(a,this.options.storage),this.options.local.signature()===c)return{ok:!0,value:{record:a,snapshot:s}};continue}switch(r=l,l.code){case"revision-conflict":{let u=_nullishCoalesce(_optionalChain([l, 'access', _23 => _23.snapshot, 'optionalAccess', _24 => _24.revision]), () => (l.currentRevision));if(a==null||u==null)return l;let s=as({base:a.syncedLines,local:this.options.local.lines(),server:gn(_optionalChain([l, 'access', _25 => _25.snapshot, 'optionalAccess', _26 => _26.lines]))});if(!s.ok)return{...l,currentRevision:u,snapshot:l.snapshot,conflicts:s.conflicts};if(!es(s.lines,this.options.local.lines())){if(this.options.local.replaceLines==null)return{...l,currentRevision:u,snapshot:l.snapshot,conflicts:s.conflicts};this.options.local.replaceLines(s.lines)}a={...a,revision:u},_optionalChain([l, 'access', _27 => _27.snapshot, 'optionalAccess', _28 => _28.environment])!=null&&(a.environment=l.snapshot.environment),l.snapshot!=null&&(a.syncedLines=gn(l.snapshot.lines)),Qt(a,this.options.storage);continue}case"cart-locked":{St(this.options),a=void 0;continue}case"cart-not-found":case"cart-forbidden":{St(this.options),a=void 0;continue}case"invalid-request":case"product-not-available":case"currency-unsupported":return l;default:return l}}return _nullishCoalesce(r, () => ({ok:!1,code:"internal",message:"The cart could not be saved."}))}reconcileFromServer(){return this.serialize(async()=>{let e=this.getRecord();if(e==null)return{ok:!1,code:"cart-not-found",message:"There is no cart to read."};let a=jt(this.options.local.lines()),r=await this.options.read(e.cartId,e.cartToken);if(!r.ok)return(r.code==="cart-not-found"||r.code==="cart-forbidden")&&St(this.options),r;let n=r.value,o=jt(this.options.local.lines()),i=jt(_nullishCoalesce(e.syncedLines, () => ([]))),c=e.syncedLines!=null?i:a;this.options.local.adoptSnapshot(n);let l=rs(o,c);l.length>0&&this.options.local.appendLines(l);let u=this.getRecord();if(u!=null&&u.cartId===n.cartId&&Qt({...u,revision:n.revision,environment:n.environment,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage),l.length>0){let s=await this.ensureNow({locale:n.locale,environment:n.environment});if(!s.ok)return{ok:!1,code:s.code,message:s.message,...s.status!=null?{status:s.status}:{},...s.currentRevision!=null?{currentRevision:s.currentRevision}:{},...s.snapshot!=null?{snapshot:s.snapshot}:{},...s.conflicts!=null?{conflicts:s.conflicts}:{}}}return{ok:!0,value:n}})}async start(e,a){let r=await this.ensure({locale:a.locale,...a.environment!=null?{environment:a.environment}:{}});if(!r.ok)return r;let{record:n,snapshot:o}=r.value,i=await a.start({cartId:n.cartId,cartToken:n.cartToken,...a.returnUrl!=null?{returnUrl:a.returnUrl}:{},...a.cancelUrl!=null?{cancelUrl:a.cancelUrl}:{},...a.embedOrigin!=null?{embedOrigin:a.embedOrigin}:{}});if(!i.ok)return(i.code==="cart-locked"||i.code==="cart-not-found"||i.code==="cart-forbidden")&&St(this.options),i;let c=this.getRecord();return c!=null&&c.cartId===n.cartId&&Qt({...c,revision:Math.max(c.revision,i.value.cartRevision),updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),..._optionalChain([i, 'access', _29 => _29.value, 'access', _30 => _30.publicConfig, 'optionalAccess', _31 => _31.basketBindingApiKey])!=null?{inpostBindingApiKey:i.value.publicConfig.basketBindingApiKey}:{},pending:{provider:e,...i.value.providerOrderId.length>0?{providerOrderId:i.value.providerOrderId}:{},lines:o.lines.map(l=>({id:l.productId,quantity:l.quantity})),ts:(_nullishCoalesce(this.options.now, () => (Date.now)))()}},this.options.storage),{ok:!0,value:{start:i.value,snapshot:o}}}storeInpostBindingApiKey(e){let a=this.getRecord();a==null||e.length===0||Qt({...a,inpostBindingApiKey:e,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage)}completePurchase(e){let a=this.getRecord(),r=_nullishCoalesce(_nullishCoalesce(e, () => (_optionalChain([a, 'optionalAccess', _32 => _32.pending, 'optionalAccess', _33 => _33.lines]))), () => ([]));r.length>0&&this.options.local.removeLines(r),St(this.options)}keepCart(){}clearPending(){let e=this.getRecord();if(e==null||e.pending==null)return;let{pending:a,...r}=e;Qt(r,this.options.storage)}status(e){let a=this.getRecord();return a==null?Promise.resolve({ok:!1,code:"cart-not-found",message:"There is no cart to check."}):e(a.cartId,a.cartToken)}serialize(e){let a=this.running.then(e,e);return this.running=a.then(()=>{},()=>{}),a}}, _class);function jt(t){let e=new Map;for(let a of t)e.set(a.id,(_nullishCoalesce(e.get(a.id), () => (0)))+a.quantity);return e}function gn(t){return(_nullishCoalesce(t, () => ([]))).map(e=>({id:e.productId,quantity:e.quantity}))}function es(t,e){let a=jt(t),r=jt(e);if(a.size!==r.size)return!1;for(let[n,o]of a)if(r.get(n)!==o)return!1;return!0}function as(t){if(t.base==null||t.server==null)return{ok:!1,lines:t.local,conflicts:[]};let e=jt(t.base),a=jt(t.local),r=jt(t.server),n=new Set([...e.keys(),...a.keys(),...r.keys()]),o=[],i=[];for(let c of n){let l=_nullishCoalesce(e.get(c), () => (0)),u=_nullishCoalesce(a.get(c), () => (0)),s=_nullishCoalesce(r.get(c), () => (0)),f=u!==l,v=s!==l,m;f?(v&&(u===s||i.push({id:c,base:l,local:u,server:s})),m=u):m=s,m>0&&!i.some(g=>g.id===c)&&o.push({id:c,quantity:m})}return{ok:i.length===0,lines:o,conflicts:i}}function rs(t,e){let a=[];for(let[r,n]of t){let o=n-(_nullishCoalesce(e.get(r), () => (0)));o>0&&a.push({id:r,quantity:o})}return a}var _a=new Map,ns=5*60*1e3;function fn(t,e,a){let r=_chunk7BG22YBFjs.L.call(void 0, );return[t,e,a.items.map(n=>`${n.id}:${n.quantity}`).sort().join(","),(_nullishCoalesce(a.countries, () => ([]))).slice().sort().join(","),_nullishCoalesce(a.couponCode, () => ("")),_nullishCoalesce(a.deliveryMethod, () => ("")),_nullishCoalesce(r.postalCode, () => (""))].join("|")}function pe(t,e,a){let r=fn(t,e,a),n=_a.get(r);if(n!=null){if(Date.now()-n.at>ns){_a.delete(r);return}return n.quote}}function os(t,e,a,r){_a.set(fn(t,e,a),{quote:r,at:Date.now()})}function Xt(t,e){return e==null||e.delivery.length===0?t:{...t,delivery:t.delivery!=null&&t.delivery.length>0?t.delivery:e.delivery,...t.deliveryMethod==null&&e.deliveryMethod!=null?{deliveryMethod:e.deliveryMethod}:{}}}async function is(t){if(t.upload.items.length===0)return{delivery:[]};let e=_chunk7BG22YBFjs.L.call(void 0, );try{let a=await _chunk7BG22YBFjs.a.get(t.host).getPreOrderDetails({projectId:t.projectID,items:t.upload.items.map(i=>({id:i.id,quantity:i.quantity})),..._optionalChain([t, 'access', _34 => _34.upload, 'access', _35 => _35.countries, 'optionalAccess', _36 => _36[0]])!=null?{countryCode:t.upload.countries[0]}:{},...t.upload.couponCode!=null?{couponCode:t.upload.couponCode}:{},...t.upload.deliveryMethod!=null?{selectedDeliveryMethod:t.upload.deliveryMethod}:e.selectedDeliveryMethod!=null?{selectedDeliveryMethod:e.selectedDeliveryMethod}:{},...e.postalCode!=null?{postCode:e.postalCode}:{}}),r=a.methods.map(i=>({name:i.id,...i.description!=null?{desc:i.description}:{},min:_nullishCoalesce(i.minDays, () => (1)),max:_nullishCoalesce(i.maxDays, () => (14)),price:i.amount/100})),n=_nullishCoalesce(_nullishCoalesce(a.selectedDeliveryMethod, () => (_optionalChain([r, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.name]))), () => (void 0)),o={delivery:r,...n!=null?{deliveryMethod:n}:{}};return os(t.host,t.projectID,t.upload,o),o}catch(a){console.warn("cannot resolve the express delivery quote",a);return}}async function Ye(t){if(t.upload.delivery!=null&&t.upload.delivery.length>0)return{ok:!0,upload:t.upload,quote:{delivery:t.upload.delivery,...t.upload.deliveryMethod!=null?{deliveryMethod:t.upload.deliveryMethod}:{}}};let e=pe(t.host,t.projectID,t.upload);if(e!=null)return{ok:!0,upload:Xt(t.upload,e),quote:e};let a=await is(t);return a==null?{ok:!1,message:"The delivery quote for this cart is not available. Use the regular checkout."}:{ok:!0,upload:Xt(t.upload,a),quote:a}}function Ua(t){return{lines:()=>_chunk7BG22YBFjs.Q.call(void 0, ).map(e=>({id:e.productID,quantity:e.quantity})),signature:_chunk7BG22YBFjs.R,upload:e=>{let a=_chunk7BG22YBFjs.S.call(void 0, e);if(a!=null)return Xt(a,pe(t.host,t.projectID,a))},adoptSnapshot:e=>{_chunk7BG22YBFjs.T.call(void 0, e.lines.map(a=>({productId:a.productId,quantity:a.quantity})))},appendLines:_chunk7BG22YBFjs.V,removeLines:_chunk7BG22YBFjs.U,replaceLines:e=>{_chunk7BG22YBFjs.T.call(void 0, e.map(a=>({productId:a.id,quantity:a.quantity})))}}}function Yt(t){let e=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),a={projectID:t.projectID,host:e,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}};return new Xe({projectID:t.projectID,host:e,local:_nullishCoalesce(t.local, () => (Ua({host:e,projectID:t.projectID}))),...t.storage!=null?{storage:t.storage}:{},...t.now!=null?{now:t.now}:{},write:(r,n)=>sn(a,r,n),read:(r,n)=>cn(a,r,n)})}async function Ze(t,e,a=Yt(t)){let r=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),n=a.previewUpload(t.locale);if(n!=null){let o=await Ye({host:r,projectID:t.projectID,upload:n});if(!o.ok)return{ok:!1,code:"invalid-cart",message:o.message}}return a.start(e,{locale:t.locale,...t.environment!=null?{environment:t.environment}:{},...t.returnUrl!=null?{returnUrl:t.returnUrl}:{},...t.cancelUrl!=null?{cancelUrl:t.cancelUrl}:{},...t.embedOrigin!=null?{embedOrigin:t.embedOrigin}:{},start:o=>ln({projectID:t.projectID,host:r,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},e,o)})}function hn(t,e){return yn(t,"revolutPay",e)}function vn(t,e){return yn(t,"inpostPay",e)}function yn(t,e,a){let r=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e));return(_nullishCoalesce(a, () => (Yt(t)))).status((o,i)=>(e==="inpostPay"?pn:dn)({projectID:t.projectID,host:r,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},o,i))}function wn(){return typeof window>"u"?void 0:window}var Oa="inpost-izi-button",Ma="inpost-thank-you";function Cn(t){return t!=null&&/^pl\b/i.test(t)?"pl":"en"}var ss="https://sandbox-inpostpay-widget-api.inpost.pl",cs="https://inpostpay-widget-api.inpost.pl",xn={test:"https://sandbox-inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js",production:"https://inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js"},kn={test:ss,production:cs};function ls(t,e){return t==="test"||t==="production"?t:t==="prod"||t==="live"?"production":_nullishCoalesce(e, () => ("production"))}function Je(t){return t.includes("sandbox")}function Pn(t,e){if(t==null)return;let a=t.merchantClientId;if(a==null||a.length===0)return;let r=_nullishCoalesce(e, () => (ls(t.environment,void 0))),n=_nullishCoalesce(t.widgetApiBaseUrl, () => (t.apiBaseUrl)),o=t.widgetScriptUrl,i=r==="test"?n!=null&&Je(n)?n:kn.test:n!=null&&!Je(n)?n:kn.production,c=r==="test"?o!=null&&Je(o)?o:xn.test:o!=null&&!Je(o)?o:xn.production;return{merchantClientId:a,environment:r,apiBaseUrl:i,scriptUrl:c,...t.basketBindingApiKey!=null&&t.basketBindingApiKey.length>0?{basketBindingApiKey:t.basketBindingApiKey}:{},...t.basketId!=null&&t.basketId.length>0?{basketId:t.basketId}:{}}}var za;function Sn(){if(typeof window>"u")return Promise.reject(new Error("InPost Pay needs a browser."));let t=_optionalChain([wn, 'call', _39 => _39(), 'optionalAccess', _40 => _40.InPostPayWidget]);return t!=null?Promise.resolve(t):(za??=Promise.resolve().then(() => _interopRequireWildcard(require("@inpost-pay/widget"))).then(e=>{let a=e,r=typeof a.initialiseInpostPayWidget=="function"?a.initialiseInpostPayWidget:typeof a.default=="function"?a.default:typeof _optionalChain([a, 'access', _41 => _41.default, 'optionalAccess', _42 => _42.initialiseInpostPayWidget])=="function"?a.default.initialiseInpostPayWidget:void 0,n=_optionalChain([wn, 'call', _43 => _43(), 'optionalAccess', _44 => _44.InPostPayWidget]);if(n!=null)return n;if(r!=null)return{init:r};throw new Error("The InPost Pay widget exposed no init function.")}).catch(e=>{throw za=void 0,e}),za)}function In(t){if(typeof window>"u")return;let e=window,a=e.__bitsnapInpostOwner,r=e.__INPOST_PAY_WIDGET__;if(r!=null){if(a!=null&&a.projectID===t.owner.projectID&&a.host===t.owner.host&&a.merchantClientId===t.owner.merchantClientId)return r.refresh(t.options),r;if(ds()){_optionalChain([t, 'access', _45 => _45.warn, 'optionalCall', _46 => _46("InPost Pay already runs for another project on this page; mount one InPost Pay button per page.")]);return}delete e.__INPOST_PAY_WIDGET__,delete e.__bitsnapInpostOwner}let n=t.namespace.init(t.options);return e.__INPOST_PAY_WIDGET__=n,e.__bitsnapInpostOwner=t.owner,n}function ds(){return typeof document>"u"?!1:document.querySelector(`${Oa}, ${Ma}`)!=null}function En(t){return{binding_place:t.bindingPlace,...t.productId!=null?{"data-product-id":t.productId}:{},...t.variation!=null?{variation:t.variation}:{}}}function ue(t){let e=Math.max(1,Math.trunc(_nullishCoalesce(t.quantity, () => (1)))),a={...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},productQuantity:e};if(t.items!=null&&t.items.length>0)return{...a,items:t.items.map(n=>({id:n.id,quantity:Math.max(1,Math.trunc(n.quantity))})),source:"items"};let r=_chunk7BG22YBFjs.Q.call(void 0, ).map(n=>({id:n.productID,quantity:n.quantity}));if(t.productId!=null&&t.productId.length>0){let n=r.some(o=>o.id===t.productId);return{...a,items:n?r:[...r,{id:t.productId,quantity:e}],source:"product",productId:t.productId}}return{...a,items:r,source:"cart"}}function ta(t){let e=t.items.map(a=>`${a.id}:${a.quantity}`).sort().join(",");return[t.source,e,_nullishCoalesce(t.country, () => ("")),_nullishCoalesce(t.couponCode, () => ("")),_nullishCoalesce(t.productId, () => (""))].join("|")}function ea(t,e,a){if(t.source==="cart")return Ua(a);let r={items:t.items.map(n=>({id:n.id,quantity:n.quantity})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},locale:e};return{lines:()=>t.items,signature:()=>ta(t),upload:()=>Xt(r,pe(a.host,a.projectID,r)),adoptSnapshot:()=>{},appendLines:()=>{},removeLines:()=>{}}}function Se(){return _react.useSyncExternalStore.call(void 0, _chunk7BG22YBFjs.W,_chunk7BG22YBFjs.X,()=>0)}function aa(t){let e=_react.useRef.call(void 0, t);e.current=t;let a=ue(t),r=ta(a),n=Se(),[o,i]=_react.useState.call(void 0, {loading:!1,provider:void 0,environment:void 0,failed:!1});return _react.useEffect.call(void 0, ()=>{let c=e.current;if(c.enabled===!1||c.projectID==null||c.projectID.length===0||typeof window>"u"){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let l=ue(c);if(l.items.length===0){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let u=new AbortController,s=!0;return i(f=>({...f,loading:!0})),fs({projectID:c.projectID,...c.host!=null?{host:c.host}:{},locale:c.locale,cart:l,...c.fetch!=null?{fetch:c.fetch}:{},signal:u.signal}).then(f=>{if(!s)return;let v=_optionalChain([f, 'optionalAccess', _47 => _47.providers, 'optionalAccess', _48 => _48[c.provider]]);i({loading:!1,provider:v,environment:_nullishCoalesce(_optionalChain([f, 'optionalAccess', _49 => _49.environment]), () => (_optionalChain([v, 'optionalAccess', _50 => _50.environment]))),failed:f==null})}).catch(()=>{s&&i({loading:!1,provider:void 0,environment:void 0,failed:!0})}),()=>{s=!1,u.abort()}},[r,n,t.projectID,t.host,t.provider,t.locale,t.enabled]),o}function ra(t){return _nullishCoalesce(t, () => (_chunkN3B25GTYjs.e))}function gs(t,e,a){let r=t.source==="cart"?_chunk7BG22YBFjs.S.call(void 0, e):t.items.length===0?void 0:{items:t.items.map(n=>({id:n.id,quantity:n.quantity})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},locale:e};if(r!=null)return _optionalChain([a, 'optionalAccess', _51 => _51.host])==null||a.projectID==null?r:Xt(r,pe(a.host,a.projectID,r))}async function fs(t){let e=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),a=gs(t.cart,t.locale);if(a==null)return;let r=await Ye({host:e,projectID:t.projectID,upload:a});if(!r.ok)return;let n=await on({projectID:t.projectID,host:e,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},r.upload);if(n==null)return;if(r.quote.delivery.length===0)return n;let o=n.providers.revolutPay;return o==null||o.available!==!0?n:{...n,providers:{...n.providers,revolutPay:{...o,available:!1,reasons:[...o.reasons,"delivery-unsupported"]}}}}function Tn(t){if(t==null)return;let e=_nullishCoalesce(t.publicKey, () => (t.publicToken)),a=t.mode;if(!(e==null||e.length===0)&&!(a!=="sandbox"&&a!=="prod"))return{publicKey:e,mode:a,...t.orderToken!=null&&t.orderToken.length>0?{orderToken:t.orderToken}:{}}}function Nn(t){let e=_optionalChain([t, 'access', _52 => _52.publicConfig, 'optionalAccess', _53 => _53.orderToken]);return e!=null&&e.length>0?e:t.providerOrderId}function Rn(t){return t!=null&&/^pl\b/i.test(t)?"pl":"en"}var hs=6e4,vs=2e3;function ys(t){return new Promise(e=>setTimeout(e,t))}async function Ba(t){let e=_nullishCoalesce(t.timeoutMs, () => (hs)),a=_nullishCoalesce(t.intervalMs, () => (vs)),r=_nullishCoalesce(t.sleep, () => (ys)),n=(_nullishCoalesce(t.now, () => (Date.now)))(),o=Math.min(1e4,Math.max(1,Math.ceil(e/Math.max(1,a))+1)),i=0,c;for(;;){if(i+=1,_optionalChain([t, 'access', _54 => _54.signal, 'optionalAccess', _55 => _55.aborted])===!0)return c;try{c=await t.check()}catch (e10){c=void 0}if(_optionalChain([c, 'optionalAccess', _56 => _56.ok])===!0&&c.status!=="pending"||_optionalChain([c, 'optionalAccess', _57 => _57.ok])===!1&&c.code==="not-implemented"||i>=o||(_nullishCoalesce(t.now, () => (Date.now)))()-n>=e)return c;await r(a)}}var An=Ba;var ws={pending:"expressPending",confirmed:"expressConfirmed",failed:"expressFailed",cancelled:"expressCancelled","load-failed":"expressLoadFailed","cart-unavailable":"expressCartUnavailable","cart-conflict":"expressCartConflict","price-changed":"expressPriceChanged","product-unavailable":"expressProductUnavailable"},xs=["failed","cancelled","load-failed","cart-unavailable","cart-conflict","price-changed","product-unavailable"];function Ie({phase:t}){let e=_chunk7BG22YBFjs.F.call(void 0, ),a=L("error");if(t==="idle")return null;let r=xs.includes(t);return _jsxruntime.jsx.call(void 0, "p",{role:r?"alert":"status","aria-live":r?"assertive":"polite","data-bitsnap-express-status":t,className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2 text-center text-sm",r&&"opacity-90",a.className),style:a.style,children:e(ws[t])})}function _n(t){return typeof t=="object"&&t!=null&&t.undeliverable===!0}function ja(t){let{projectID:e}=t,a=ra(t.host),r=_nullishCoalesce(t.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),n=_chunkG4SEOVLDjs.m.call(void 0, ),o=_optionalChain([t, 'access', _58 => _58.confirmation, 'optionalAccess', _59 => _59.timeoutMs]),i=_optionalChain([t, 'access', _60 => _60.confirmation, 'optionalAccess', _61 => _61.intervalMs]),c=_optionalChain([t, 'access', _62 => _62.confirmation, 'optionalAccess', _63 => _63.sleep]),l=_optionalChain([t, 'access', _64 => _64.confirmation, 'optionalAccess', _65 => _65.now]),u=Se(),s=_react.useMemo.call(void 0, ()=>ue({...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{}}),[t.items,t.productId,t.quantity,u]),f=ta(s),v=aa({provider:"inpostPay",projectID:e,host:a,locale:r,...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),m=v.provider,g=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _66 => _66.environment]), () => (v.environment)),p=_optionalChain([m, 'optionalAccess', _67 => _67.available])===!0?Pn(m.publicConfig,g):void 0,S=_optionalChain([p, 'optionalAccess', _68 => _68.merchantClientId]),R=_optionalChain([p, 'optionalAccess', _69 => _69.apiBaseUrl]),h=_react.useMemo.call(void 0, ()=>Yt({projectID:e,host:a,...s.source==="items"?{local:ea(s,r,{host:a,projectID:e})}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),[e,a,t.fetch,s,r]),[y,A]=_react.useState.call(void 0, "idle"),k=_react.useRef.call(void 0, void 0),E=_react.useRef.call(void 0, void 0),D=_react.useRef.call(void 0, !0),I=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>(D.current=!0,()=>{D.current=!1}),[]);let P=_react.useRef.call(void 0, {cart:s,locale:r,environment:g,session:h,onOrderCreated:t.onOrderCreated,onBasketChanged:t.onBasketChanged});P.current={cart:s,locale:r,environment:g,session:h,onOrderCreated:t.onOrderCreated,onBasketChanged:t.onBasketChanged};let w=_react.useCallback.call(void 0, async()=>{if(E.current!=null)return E.current;let O=Ze({projectID:e,host:a,locale:P.current.locale,...P.current.environment!=null?{environment:P.current.environment}:{},...typeof window<"u"?{returnUrl:window.location.href,cancelUrl:window.location.href,embedOrigin:window.location.origin}:{},...t.fetch!=null?{fetch:t.fetch}:{}},"inpostPay",P.current.session).then(z=>{if(!z.ok)throw A(z.code==="revision-conflict"?"cart-conflict":"cart-unavailable"),new Error(`inpost-start-${z.code}`);return n.track("payment_submitted",{gateway:"inpost_pay",method:"inpost_pay"}),z.value.start}).finally(()=>{E.current=void 0});return E.current=O,O},[e,a,n,t.fetch]),U=_react.useCallback.call(void 0, async O=>{if(_chunk7BG22YBFjs.Q.call(void 0, ).some(_=>_.productID===O)||P.current.cart.source==="items")return;if(await _chunk7BG22YBFjs.x.addProductToCart(O,P.current.cart.productQuantity)!=null)throw{undeliverable:!0}},[]),b=_react.useCallback.call(void 0, async O=>{n.track("payment_method_selected",{gateway:"inpost_pay",method:"inpost_pay"});try{O!=null&&await U(O);let N=await _asyncOptionalChain([(await w()), 'access', async _70 => _70.publicConfig, 'optionalAccess', async _71 => _71.basketBindingApiKey]);if(N==null||N.length===0)throw new Error("inpost-start-without-basket-key");return P.current.session.storeInpostBindingApiKey(N),A("idle"),N}catch(z){throw _n(z)?(A("product-unavailable"),new Error("UNDELIVERABLE_PRODUCT")):(A(z instanceof Error&&z.message==="inpost-start-revision-conflict"?"cart-conflict":"cart-unavailable"),z instanceof Error?z:new Error("inpost-pay-failed"))}},[U,n,w]),C=_react.useCallback.call(void 0, async O=>{let z=_nullishCoalesce(O, () => (P.current.cart.productId));if(z!=null)try{if(await _chunk7BG22YBFjs.x.addProductToCart(z,P.current.cart.productQuantity)!=null)throw{undeliverable:!0};await P.current.session.ensure({locale:P.current.locale,...P.current.environment!=null?{environment:P.current.environment}:{}})}catch(N){throw A("product-unavailable"),_n(N)?new Error("UNDELIVERABLE_PRODUCT"):N instanceof Error?N:new Error("inpost-pay-failed")}},[]),X=_react.useCallback.call(void 0, async()=>{if(!I.current){I.current=!0;try{let O=P.current.session,z=O.getPendingAttempt();if(_optionalChain([z, 'optionalAccess', _72 => _72.provider])!=="inpostPay")return;D.current&&A("pending");let N=await Ba({check:()=>vn({projectID:e,host:a,...t.fetch!=null?{fetch:t.fetch}:{}},O),timeoutMs:_nullishCoalesce(o, () => (2e4)),intervalMs:_nullishCoalesce(i, () => (1500)),...c!=null?{sleep:c}:{},...l!=null?{now:l}:{}});if(!D.current)return;let _=z.providerOrderId;if(_optionalChain([N, 'optionalAccess', _73 => _73.ok])===!0&&N.status==="completed"){let W=await O.reconcileFromServer(),F=W.ok?W.value.lines.map(V=>({id:V.productId,quantity:V.quantity})):z.lines;F.length>0&&O.completePurchase(F),A("confirmed"),n.track("payment_returned",{gateway:"inpost_pay",method:"inpost_pay",outcome:"pending"}),T.current||(T.current=!0,_optionalChain([P, 'access', _74 => _74.current, 'access', _75 => _75.onOrderCreated, 'optionalCall', _76 => _76({..._!=null?{providerOrderId:_}:{},status:"completed"})]));return}if(_optionalChain([N, 'optionalAccess', _77 => _77.ok])===!0&&N.status==="failed"){O.clearPending(),A("failed"),T.current||(T.current=!0,_optionalChain([P, 'access', _78 => _78.current, 'access', _79 => _79.onOrderCreated, 'optionalCall', _80 => _80({..._!=null?{providerOrderId:_}:{},status:"failed"})]));return}if(_optionalChain([N, 'optionalAccess', _81 => _81.ok])===!0&&N.status==="cancelled"){O.clearPending(),A("cancelled"),T.current||(T.current=!0,_optionalChain([P, 'access', _82 => _82.current, 'access', _83 => _83.onOrderCreated, 'optionalCall', _84 => _84({..._!=null?{providerOrderId:_}:{},status:"cancelled"})]));return}A("pending"),T.current||(T.current=!0,_optionalChain([P, 'access', _85 => _85.current, 'access', _86 => _86.onOrderCreated, 'optionalCall', _87 => _87({..._!=null?{providerOrderId:_}:{},status:"pending"})]))}finally{I.current=!1}}},[i,l,c,o,a,n,e,t.fetch]),yt=_react.useCallback.call(void 0, async O=>{if(O==="basketProductChanged"){let z=await P.current.session.reconcileFromServer();return z.ok&&_optionalChain([P, 'access', _88 => _88.current, 'access', _89 => _89.onBasketChanged, 'optionalCall', _90 => _90(z.value)]),!0}return O==="orderCreated"&&X(),!0},[X]);if(_react.useEffect.call(void 0, ()=>{_optionalChain([m, 'optionalAccess', _91 => _91.available])===!0&&_optionalChain([h, 'access', _92 => _92.getPendingAttempt, 'call', _93 => _93(), 'optionalAccess', _94 => _94.provider])==="inpostPay"&&X()},[_optionalChain([m, 'optionalAccess', _95 => _95.available]),h,X]),_react.useEffect.call(void 0, ()=>{if(_optionalChain([m, 'optionalAccess', _96 => _96.available])!==!0||S==null||S.length===0||typeof window>"u")return;let O=!1;return Sn().then(z=>{if(O)return;let N=In({namespace:z,owner:{projectID:e,host:a,merchantClientId:S},options:{merchantClientId:S,basketBindingApiKey:h.getInpostBindingApiKey(),unboundWidgetClicked:b,...s.source==="product"||t.productId!=null?{addToBasketClicked:C}:{},handleBasketEvent:yt,...R!=null?{apiBaseUrl:R}:{},language:Cn(r)}});if(N==null){A("cart-unavailable");return}k.current=N,N.rerender()}).catch(()=>{O||A("load-failed")}),()=>{O=!0,k.current=void 0}},[_optionalChain([m, 'optionalAccess', _97 => _97.available]),S,R,r,e,a,h,b,C,yt,s.source,t.productId]),_react.useEffect.call(void 0, ()=>{_optionalChain([k, 'access', _98 => _98.current, 'optionalAccess', _99 => _99.refresh, 'call', _100 => _100({basketBindingApiKey:h.getInpostBindingApiKey()})])},[f,h]),_optionalChain([m, 'optionalAccess', _101 => _101.available])!==!0||S==null||S.length===0)return _jsxruntime.jsx.call(void 0, Ie,{phase:y==="idle"?"idle":y});let Ot=_nullishCoalesce(t.bindingPlace, () => ((t.productId!=null?"PRODUCT_CARD":"BASKET_SUMMARY")));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"inpostPay","aria-busy":y==="pending"?!0:void 0,className:t.className,style:t.style,children:[Ot==="THANK_YOU_PAGE"?_react.createElement.call(void 0, Ma,{...t.variation!=null?{variation:t.variation}:{}}):_react.createElement.call(void 0, Oa,En({bindingPlace:Ot,...t.productId!=null?{productId:t.productId}:{},...t.variation!=null?{variation:t.variation}:{}})),_jsxruntime.jsx.call(void 0, Ie,{phase:y})]})}function Ps(t){let e=_nullishCoalesce(t.projectID, () => (Ct())),a=_chunkG4SEOVLDjs.n.call(void 0, e,t.analytics,"cart");return _react.useEffect.call(void 0, ()=>{t.projectID!=null&&_chunk7BG22YBFjs.J.call(void 0, t.projectID)},[t.projectID]),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:a,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{locale:t.locale,texts:t.texts,children:_jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:e==null?null:_jsxruntime.jsx.call(void 0, ja,{...t,projectID:e})})})})}var Ss=Ps;var Es={prod:"https://merchant.revolut.com/embed.js",sandbox:"https://sandbox-merchant.revolut.com/embed.js"},Un={prod:"revolut-checkout",sandbox:"revolut-checkout-sandbox"},qa=new Map;function zn(t,e={}){if(typeof window>"u")return Promise.reject(new Error("Revolut Checkout needs a browser."));let a=window.RevolutCheckout;if(a!=null)return Promise.resolve(a);let r=qa.get(t);if(r!=null)return r;let n=_nullishCoalesce(e.document, () => (document)),o=_nullishCoalesce(e.timeoutMs, () => (15e3)),i=new Promise((c,l)=>{let u=!1,s=n.getElementById(Un[t]),f,v=()=>{f!=null&&clearTimeout(f),_optionalChain([s, 'optionalAccess', _102 => _102.removeEventListener, 'call', _103 => _103("load",g)]),_optionalChain([s, 'optionalAccess', _104 => _104.removeEventListener, 'call', _105 => _105("error",p)])},m=S=>{u||(u=!0,v(),S())},g=()=>{m(()=>{let S=window.RevolutCheckout;S!=null?c(S):l(new Error("Revolut Checkout did not initialise."))})},p=()=>{m(()=>l(new Error("Revolut Checkout could not be loaded.")))};s==null?(s=n.createElement("script"),s.id=Un[t],s.src=Es[t],s.async=!0,s.addEventListener("load",g),s.addEventListener("error",p),n.head.appendChild(s)):(s.addEventListener("load",g),s.addEventListener("error",p)),f=setTimeout(()=>{m(()=>l(new Error("Revolut Checkout timed out while loading.")))},o)});return qa.set(t,i),i.catch(()=>qa.delete(t)),i}function On(t,e){return t.payments({publicToken:e.publicKey,mode:e.mode,locale:e.locale})}var Ga="bitsnap_express",Fa="bitsnap_express_cart",Wa="bitsnap_express_result",Mn="_rp_oid";function Bn(t){let e;try{e=new URLSearchParams(t.startsWith("?")?t:`?${t}`)}catch (e11){return{returned:!1}}let a=e.get(Ga),r=_nullishCoalesce(e.get(Mn), () => (void 0)),n=_nullishCoalesce(e.get(Fa), () => (void 0)),o=e.get(Wa),i=o==="success"||o==="failure"||o==="cancel"?o:void 0,c=a==="inpostPay"||a==="revolutPay";return{returned:c||r!=null,...c?{provider:a}:{},...n!=null?{cartId:n}:{},...r!=null?{orderToken:r}:{},...i!=null?{result:i}:{}}}function na(t,e){let a=typeof window<"u"?window.location.href:"https://localhost/",r=new URL(t,a);return r.searchParams.set(Ga,e.provider),r.searchParams.set(Fa,e.cartId),r.searchParams.set(Wa,e.result),r.toString()}function jn(t){let e=typeof window<"u"?window.location.href:"https://localhost/",a=new URL(t,e);return a.searchParams.delete(Ga),a.searchParams.delete(Fa),a.searchParams.delete(Wa),a.searchParams.delete(Mn),a.pathname+a.search+a.hash}function Ka(t){let{projectID:e}=t,a=ra(t.host),r=_nullishCoalesce(t.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),n=_chunkG4SEOVLDjs.m.call(void 0, ),o=_optionalChain([t, 'access', _106 => _106.confirmation, 'optionalAccess', _107 => _107.timeoutMs]),i=_optionalChain([t, 'access', _108 => _108.confirmation, 'optionalAccess', _109 => _109.intervalMs]),c=_optionalChain([t, 'access', _110 => _110.confirmation, 'optionalAccess', _111 => _111.sleep]),l=_optionalChain([t, 'access', _112 => _112.confirmation, 'optionalAccess', _113 => _113.now]),u=JSON.stringify(_nullishCoalesce(t.buttonStyle, () => (null))),s=Se(),f=_react.useMemo.call(void 0, ()=>ue({...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{}}),[t.items,t.productId,t.quantity,t.country,t.couponCode,s]),v=[f.source,f.items.map(I=>`${I.id}:${I.quantity}`).sort().join(",")].join("|"),m=aa({provider:"revolutPay",projectID:e,host:a,locale:r,...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),g=_optionalChain([m, 'access', _114 => _114.provider, 'optionalAccess', _115 => _115.available])===!0?Tn(m.provider.publicConfig):void 0,p=_nullishCoalesce(_optionalChain([m, 'access', _116 => _116.provider, 'optionalAccess', _117 => _117.environment]), () => (m.environment)),S=_react.useRef.call(void 0, null),[R,h]=_react.useState.call(void 0, "idle"),[y,A]=_react.useState.call(void 0, 0),k=_react.useRef.call(void 0, !0),E=_react.useRef.call(void 0, void 0),D=_react.useRef.call(void 0, void 0);return _react.useEffect.call(void 0, ()=>(k.current=!0,()=>{k.current=!1}),[]),_react.useEffect.call(void 0, ()=>{if(g==null||typeof window>"u"||S.current==null)return;let I=new AbortController,T=!1,P,w=ea(f,r,{host:a,projectID:e}),U=Yt({projectID:e,host:a,local:w,...t.fetch!=null?{fetch:t.fetch}:{},signal:I.signal}),b=_nullishCoalesce(t.returnUrl, () => (window.location.href)),C=!1,X=!1,yt=async N=>{if(!k.current||X)return;h("pending");let _=await An({check:()=>hn({projectID:e,host:a,...t.fetch!=null?{fetch:t.fetch}:{},signal:I.signal},N),signal:I.signal,...o!=null?{timeoutMs:o}:{},...i!=null?{intervalMs:i}:{},...c!=null?{sleep:c}:{},...l!=null?{now:l}:{}});if(!(T||!k.current)){if(_optionalChain([_, 'optionalAccess', _118 => _118.ok])===!0&&_.status==="completed"){X=!0,N.completePurchase(),h("confirmed"),_optionalChain([t, 'access', _119 => _119.onPaymentResult, 'optionalCall', _120 => _120({status:"completed",..._.orderId!=null?{orderId:_.orderId}:{}})]);return}if(_optionalChain([_, 'optionalAccess', _121 => _121.ok])===!0&&_.status==="failed"){X=!0,N.clearPending(),h("failed"),_optionalChain([t, 'access', _122 => _122.onPaymentResult, 'optionalCall', _123 => _123({status:"failed"})]);return}if(_optionalChain([_, 'optionalAccess', _124 => _124.ok])===!0&&_.status==="cancelled"){X=!0,N.clearPending(),h("cancelled"),_optionalChain([t, 'access', _125 => _125.onPaymentResult, 'optionalCall', _126 => _126({status:"cancelled"})]);return}h("pending"),_optionalChain([t, 'access', _127 => _127.onPaymentResult, 'optionalCall', _128 => _128({status:"pending"})])}},Ot=N=>{C||(C=!0,yt(N).finally(()=>{C=!1}))},O=N=>{if(N.type==="cancel"){n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"cancel"}),U.clearPending(),h("cancelled"),_optionalChain([t, 'access', _129 => _129.onPaymentResult, 'optionalCall', _130 => _130({status:"cancelled"})]);return}if(N.type==="error"){n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"fail"}),U.clearPending();let _=D.current;D.current=void 0,h(_nullishCoalesce(_, () => ("failed"))),_==null&&_optionalChain([t, 'access', _131 => _131.onPaymentResult, 'optionalCall', _132 => _132({status:"failed"})]);return}n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"pending"}),Ot(U)};return(async()=>{let N=await U.ensure({locale:r,...p!=null?{environment:p}:{}});if(T)return;if(!N.ok){h(N.code==="revision-conflict"?"cart-conflict":"cart-unavailable");return}let _=N.value.snapshot;E.current={cartId:_.cartId,currency:_.currency,totalMinor:_.totalMinor};let W=await zn(g.mode);if(T)return;let F=await On(W,{publicKey:g.publicKey,mode:g.mode,locale:Rn(r)});if(T){_optionalChain([F, 'access', _133 => _133.destroy, 'optionalCall', _134 => _134()]);return}let{revolutPay:V}=F,Wt,ua=async()=>(Wt!=null||(Wt=(async()=>{let Y=await U.ensure({locale:r,...p!=null?{environment:p}:{}});if(!Y.ok)throw D.current=Y.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-cart-${Y.code}`);if(!Gn(Y.value.snapshot,E.current))throw E.current={cartId:Y.value.snapshot.cartId,currency:Y.value.snapshot.currency,totalMinor:Y.value.snapshot.totalMinor},D.current="price-changed",h("price-changed"),A(ye=>ye+1),new Error("revolut-amount-changed");let rt=await Ze({projectID:e,host:a,locale:r,...p!=null?{environment:p}:{},returnUrl:b,cancelUrl:_nullishCoalesce(t.cancelUrl, () => (b)),embedOrigin:window.location.origin,...t.fetch!=null?{fetch:t.fetch}:{}},"revolutPay",U);if(!rt.ok)throw D.current=rt.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-start-${rt.code}`);if(!Gn(rt.value.snapshot,E.current))throw E.current={cartId:rt.value.snapshot.cartId,currency:rt.value.snapshot.currency,totalMinor:rt.value.snapshot.totalMinor},D.current="price-changed",h("price-changed"),A(ye=>ye+1),new Error("revolut-amount-changed");return n.track("payment_submitted",{gateway:"revolut_pay",method:"revolut_pay"}),{publicId:Nn(rt.value.start)}})().finally(()=>{Wt=void 0})),Wt);V.mount(S.current,{currency:_.currency,totalAmount:_.totalMinor,createOrder:ua,mobileRedirectUrls:{success:na(b,{provider:"revolutPay",cartId:_.cartId,result:"success"}),failure:na(b,{provider:"revolutPay",cartId:_.cartId,result:"failure"}),cancel:na(b,{provider:"revolutPay",cartId:_.cartId,result:"cancel"})},...t.buttonStyle!=null?{buttonStyle:t.buttonStyle}:{}}),V.on("click",()=>{n.track("payment_method_selected",{gateway:"revolut_pay",method:"revolut_pay"})}),V.on("payment",O),!T&&k.current&&h(Y=>Y==="price-changed"||Y==="cart-conflict"||Y==="confirmed"||Y==="failed"||Y==="cancelled"?Y:"idle"),P=()=>{try{V.destroy()}catch (e12){}try{_optionalChain([F, 'access', _135 => _135.destroy, 'optionalCall', _136 => _136()])}catch (e13){}};let Tt=Bn(window.location.search),ba=_optionalChain([mn, 'call', _137 => _137(U.getRecord()), 'optionalAccess', _138 => _138.provider])==="revolutPay"&&(Tt.cartId==null||Tt.cartId===_.cartId)||Tt.returned&&Tt.provider==="revolutPay";Tt.returned&&window.history.replaceState({},"",jn(window.location.href)),ba&&await yt(U)})().catch(()=>{!T&&k.current&&h("load-failed")}),()=>{T=!0,I.abort(),_optionalChain([P, 'optionalCall', _139 => _139()])}},[_optionalChain([g, 'optionalAccess', _140 => _140.publicKey]),_optionalChain([g, 'optionalAccess', _141 => _141.mode]),p,r,v,e,a,t.fetch,t.returnUrl,t.cancelUrl,u,o,i,c,l,y]),_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"revolutPay","aria-busy":R==="pending"?!0:void 0,className:t.className,style:t.style,children:[_jsxruntime.jsx.call(void 0, "div",{ref:S}),_jsxruntime.jsx.call(void 0, Ie,{phase:R})]})}function Gn(t,e){return e!=null&&t.cartId===e.cartId&&t.currency===e.currency&&t.totalMinor===e.totalMinor}function Ns(t){let e=_nullishCoalesce(t.projectID, () => (Ct())),a=_chunkG4SEOVLDjs.n.call(void 0, e,t.analytics,"cart");return _react.useEffect.call(void 0, ()=>{t.projectID!=null&&_chunk7BG22YBFjs.J.call(void 0, t.projectID)},[t.projectID]),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:a,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{locale:t.locale,texts:t.texts,children:_jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:e==null?null:_jsxruntime.jsx.call(void 0, Ka,{...t,projectID:e})})})})}var Rs=Ns;var _s=({className:t,locale:e})=>{let a=_chunk7BG22YBFjs.O.call(void 0, ),r=_chunkG4SEOVLDjs.m.call(void 0, ),n=_nullishCoalesce(e, () => (_chunkQ337IQNAjs.f.call(void 0, ))),o=L("productList"),i=L("summary"),c=L("totalLabel"),l=L("totalValue"),u=L("deliveryText"),s=L("summaryNote"),f=L("countryLabel"),v=L("paymentButtons"),m=L("checkoutButton"),g=L("emptyState"),p=L("error"),S=L("skeleton"),R=_chunk7BG22YBFjs.E.call(void 0, "unavailableProducts"),h=_chunk7BG22YBFjs.F.call(void 0, ),y=_chunk7BG22YBFjs.E.call(void 0, "emptyCart"),A=_chunk7BG22YBFjs.E.call(void 0, "total"),k=_chunk7BG22YBFjs.E.call(void 0, "delivery"),E=_chunk7BG22YBFjs.E.call(void 0, "chooseCountry"),D=_chunk7BG22YBFjs.E.call(void 0, "nextStep"),I=_chunk7BG22YBFjs.E.call(void 0, "loadFailed"),T=_chunk7BG22YBFjs.E.call(void 0, "retry"),P=_chunk7BG22YBFjs.E.call(void 0, "countryRequired"),w=_chunk7BG22YBFjs.E.call(void 0, "extrasCalculatedNext"),U=_react2.default.useId(),b=_react2.default.useId(),{mutateAsync:C}=_reactquery.useMutation.call(void 0, {mutationFn:a.removeProductFromCart}),{mutateAsync:X}=_reactquery.useMutation.call(void 0, {mutationFn:a.updateQuantity}),{mutateAsync:yt}=_reactquery.useMutation.call(void 0, {mutationFn:a.setCountry}),{mutateAsync:Ot}=_reactquery.useMutation.call(void 0, {mutationFn:a.clearCart}),[O,z]=_react2.default.useState(""),N=_chunk7BG22YBFjs.w.call(void 0, x=>x.notice);_react2.default.useEffect(()=>()=>_chunk7BG22YBFjs.w.getState().setNotice(void 0),[]);let _=O.length>0?O:_nullishCoalesce(N, () => ("")),[W,F]=_react2.default.useState([]),[V,Wt]=_react2.default.useState(!1),{mutateAsync:ua,isPending:Tt}=_reactquery.useMutation.call(void 0, {mutationFn:a.redirectToNextStep}),{data:ma}=_reactquery.useQuery.call(void 0, {queryKey:["cart-available-countries"],queryFn:a.getAvailableCountries}),{data:ba}=_reactquery.useQuery.call(void 0, {queryKey:["cart-one-click-payment"],queryFn:a.checkIfApplePayIsAvailable}),{data:Y,isLoading:rt,isError:ye,refetch:tr}=_reactquery.useQuery.call(void 0, {queryKey:["cart",n],queryFn:a.getProducts}),{data:Ht,refetch:er}=_reactquery.useQuery.call(void 0, {queryKey:["cart-country"],queryFn:a.getCountry}),[wo]=_react3.useAutoAnimate.call(void 0, ),j=_chunk7BG22YBFjs.q.call(void 0, Y)?void 0:Y,Mt=Ht!=null&&!_chunk7BG22YBFjs.q.call(void 0, Ht)&&Ht!=""?Ht:void 0,ar=_reactquery.useQueryClient.call(void 0, ),ze=j==null||j.length===0||Mt==null?void 0:j.map(x=>`${x.productID}:${x.quantity}`).sort().join(","),rr={queryKey:["cart-payment-methods",_chunk7BG22YBFjs.K.call(void 0, ),n,Mt,ze],queryFn:async()=>a.getPaymentMethodChoice().catch(()=>null),staleTime:6e4,retry:!1},{data:nr,isPlaceholderData:xo}=_reactquery.useQuery.call(void 0, {...rr,enabled:ze!=null,placeholderData:x=>x===void 0?void 0:_chunk7BG22YBFjs.t.call(void 0, x)}),Oe=ze!=null?_nullishCoalesce(nr, () => (null)):null,[or,ko]=_react2.default.useState(void 0),[ir,sr]=_react2.default.useState(!1),cr=_react2.default.useRef(null),lr=!rt&&(ye||_chunk7BG22YBFjs.q.call(void 0, Y)),Bt=_chunk7BG22YBFjs.q.call(void 0, ma)?[]:ma,we=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _142 => _142.reduce, 'call', _143 => _143((x,K)=>K.details==null?x:x+(_nullishCoalesce(_optionalChain([K, 'access', _144 => _144.details, 'access', _145 => _145.pricing, 'optionalAccess', _146 => _146.effectivePrice]), () => (K.details.price)))*K.quantity,0)]), () => (0)),xe=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _147 => _147[0], 'optionalAccess', _148 => _148.details, 'optionalAccess', _149 => _149.currency]), () => ("PLN")),Co=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _150 => _150.some, 'call', _151 => _151(x=>_optionalChain([x, 'access', _152 => _152.details, 'optionalAccess', _153 => _153.isDeliverable])===!0)]), () => (!1)),dr=Ht!==void 0&&Mt==null,pr=_react2.default.useRef(!1);_react2.default.useEffect(()=>{pr.current||Bt==null||Bt.length===0||Ht==null||Mt!=null&&Bt.some(x=>x.code===Mt)||(pr.current=!0,yt(Bt[0].code).then(()=>er()).catch(()=>{}))},[Bt,Ht,Mt]);let ur=_react2.default.useRef(!1);_react2.default.useEffect(()=>{ur.current||rt||(ur.current=!0,r.track("cart_opened",{item_count:_nullishCoalesce(_optionalChain([j, 'optionalAccess', _154 => _154.reduce, 'call', _155 => _155((x,K)=>x+K.quantity,0)]), () => (0)),value_minor:we,currency:xe}))},[rt,r,j,we,xe]);let ga=_react2.default.useRef(new Map);_react2.default.useEffect(()=>{ga.current.clear()},[j]);function Po(x,K){let st=_optionalChain([j, 'optionalAccess', _156 => _156.find, 'call', _157 => _157(Eo=>Eo.id===x)]);if(_optionalChain([st, 'optionalAccess', _158 => _158.details])==null)return;let ct=K-(_nullishCoalesce(ga.current.get(x), () => (st.quantity)));if(ga.current.set(x,K),ct===0)return;let wt=_nullishCoalesce(_optionalChain([st, 'access', _159 => _159.details, 'access', _160 => _160.pricing, 'optionalAccess', _161 => _161.effectivePrice]), () => (st.details.price)),Me=_nullishCoalesce(st.catalogProductID, () => (st.productID));r.track(ct>0?"add_to_cart":"remove_from_cart",{qty:Math.abs(ct),value_minor:Math.round(wt*Math.abs(ct)),currency:st.details.currency},{product_id:Me,variant_id:Me!==st.productID?st.productID:null})}let mr=_react2.default.useRef(!1);async function So(x,K){if(K!=null){Po(x,Math.max(0,K));try{let st=K<=0?await C({id:x}):await X({id:x,quantity:K});if(_chunk7BG22YBFjs.q.call(void 0, st))throw new Error(`cannot change the cart: ${st.error}`)}finally{await tr().catch(()=>{})}}}async function Io(){try{z(""),F([]),_chunk7BG22YBFjs.w.getState().setNotice(void 0);let x=Oe,K=x!=null?_chunk7BG22YBFjs.u.call(void 0, x,or):void 0;if(ze!=null&&(nr===void 0||xo)){sr(!0);try{x=await ar.fetchQuery(rr).catch(()=>null)}finally{sr(!1)}if(x==null)K=void 0;else if(K==null||!x.methods.includes(K)){window.setTimeout(()=>{_optionalChain([cr, 'access', _162 => _162.current, 'optionalAccess', _163 => _163.querySelector, 'call', _164 => _164("input:checked"), 'optionalAccess', _165 => _165.focus, 'call', _166 => _166()])},0);return}}if(j!=null){!mr.current&&j.length>0&&(mr.current=!0,r.track("checkout_started",{item_count:j.reduce((wt,Me)=>wt+Me.quantity,0),checkout_type:"cart",value_minor:we,currency:xe}));try{_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:_optionalChain([j, 'optionalAccess', _167 => _167.map, 'call', _168 => _168(wt=>({id:wt.productID,name:_nullishCoalesce(_optionalChain([wt, 'access', _169 => _169.details, 'optionalAccess', _170 => _170.name]), () => ("")),price:_nullishCoalesce(_optionalChain([wt, 'access', _171 => _171.details, 'optionalAccess', _172 => _172.price]), () => (0)),quantity:wt.quantity,currency:_nullishCoalesce(_optionalChain([wt, 'access', _173 => _173.details, 'optionalAccess', _174 => _174.currency]), () => ("PLN"))}))])})}catch (e14){}}let st=_chunk7BG22YBFjs.M.call(void 0, ),ct=await ua(K!=null?{paymentMethod:K}:void 0);if(_chunk7BG22YBFjs.q.call(void 0, ct)){ar.invalidateQueries({queryKey:["cart-payment-methods"]}),ct.error=="item-ids-not-found"?(z(R),"data"in ct&&Array.isArray(ct.data)&&F(ct.data)):K==="cod"&&ct.error=="gateway-not-configured"?z(h("paymentMethodCodUnavailable")):z(_chunk7BG22YBFjs.s.call(void 0, ct,h));return}_chunk7BG22YBFjs.G.call(void 0, ct,{cartProjectId:_chunk7BG22YBFjs.K.call(void 0, ),lines:st})||await Ot(),window.location.href=ct.url}catch(x){console.warn("checkout failed",x),z(h("checkoutFailed"))}}return _jsxruntime.jsxs.call(void 0, "div",{className:`${t} flex flex-col`,ref:wo,children:[rt&&_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full justify-center flex-col gap-4",children:[_jsxruntime.jsx.call(void 0, Na,{"data-bitsnap-checkout-slot":"skeleton",className:_chunkN3B25GTYjs.g.call(void 0, "w-full h-32",S.className),style:S.style}),_jsxruntime.jsx.call(void 0, Na,{"data-bitsnap-checkout-slot":"skeleton",className:_chunkN3B25GTYjs.g.call(void 0, "w-full h-32",S.className),style:S.style})]}),lr&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-3 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, p.className),style:p.style,children:I}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",p.className),style:p.style,children:N}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"checkoutButton",onClick:()=>{tr().then().catch()},className:_chunkN3B25GTYjs.g.call(void 0, "px-3 py-2 rounded-md transition font-bold",m.className),style:m.style,children:T})]}),!rt&&!lr&&(j==null||j.length==0)&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"emptyState",className:_chunkN3B25GTYjs.g.call(void 0, g.className),style:g.style,children:y}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",p.className),style:p.style,children:N})]}),_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"productList",className:_chunkN3B25GTYjs.g.call(void 0, "max-h-[70vh] overflow-clip overflow-y-scroll",o.className),style:o.style,children:j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "ul",{className:"mt-5",children:j.map(x=>_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:x.details!=null&&_jsxruntime.jsxs.call(void 0, "li",{className:"mb-3",children:[_jsxruntime.jsx.call(void 0, tn,{isNotAvailable:W.includes(x.productID),quantity:x.quantity,details:x.details,url:x.url,shouldUpdate:K=>So(x.id,K)}),_jsxruntime.jsx.call(void 0, "hr",{className:"h-1"})]})},x.id))})}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),we>0&&xe!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"summary",className:_chunkN3B25GTYjs.g.call(void 0, "mx-3 flex flex-col",i.className),style:i.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between text-lg",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalLabel",className:_chunkN3B25GTYjs.g.call(void 0, "text-xl",c.className),style:c.style,children:A}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalValue",className:_chunkN3B25GTYjs.g.call(void 0, "font-medium",l.className),style:l.style,children:_chunk7BG22YBFjs.o.call(void 0, we,xe)}),Co&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"deliveryText",className:_chunkN3B25GTYjs.g.call(void 0, "opacity-70 text-right text-base",u.className),style:u.style,children:k})]})]}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"summaryNote",className:_chunkN3B25GTYjs.g.call(void 0, "opacity-70 text-sm",s.className),style:s.style,children:w})]}),Bt&&_optionalChain([Bt, 'optionalAccess', _175 => _175.length])>1&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h4",{"data-bitsnap-checkout-slot":"countryLabel",className:_chunkN3B25GTYjs.g.call(void 0, "ml-3 text-sm",f.className),style:f.style,children:E}),_jsxruntime.jsx.call(void 0, $r,{id:U,open:V,onToggle:()=>{Wt(!V)},onChange:x=>{yt(x).then(()=>{er().then().catch()})},selectedValue:_nullishCoalesce(Mt, () => ("")),countries:Bt})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-3 flex flex-col",children:[ba&&j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, Sa,{colorType:"white",style:{width:"100%"},items:_optionalChain([j, 'optionalAccess', _176 => _176.map, 'call', _177 => _177(x=>({name:_nullishCoalesce(_optionalChain([x, 'access', _178 => _178.details, 'optionalAccess', _179 => _179.name]), () => ("")),id:x.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([x, 'access', _180 => _180.details, 'optionalAccess', _181 => _181.pricing, 'optionalAccess', _182 => _182.effectivePrice]), () => (_optionalChain([x, 'access', _183 => _183.details, 'optionalAccess', _184 => _184.price]))), () => (0)),currency:_optionalChain([x, 'access', _185 => _185.details, 'optionalAccess', _186 => _186.currency]),quantity:x.quantity,isDeliverable:_nullishCoalesce(_optionalChain([x, 'access', _187 => _187.details, 'optionalAccess', _188 => _188.isDeliverable]), () => (!1)),metadata:x.metadata}))])})}),j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, Va,{buttonSizeMode:"fill",buttonColor:"white",style:{width:"100%"},items:_optionalChain([j, 'optionalAccess', _189 => _189.map, 'call', _190 => _190(x=>({name:_nullishCoalesce(_optionalChain([x, 'access', _191 => _191.details, 'optionalAccess', _192 => _192.name]), () => ("")),id:x.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([x, 'access', _193 => _193.details, 'optionalAccess', _194 => _194.pricing, 'optionalAccess', _195 => _195.effectivePrice]), () => (_optionalChain([x, 'access', _196 => _196.details, 'optionalAccess', _197 => _197.price]))), () => (0)),quantity:x.quantity,isDeliverable:_nullishCoalesce(_optionalChain([x, 'access', _198 => _198.details, 'optionalAccess', _199 => _199.isDeliverable]), () => (!1)),metadata:x.metadata}))])})}),j!=null&&j.length>0&&_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:[_jsxruntime.jsx.call(void 0, ja,{projectID:_nullishCoalesce(_chunk7BG22YBFjs.K.call(void 0, ), () => ("")),locale:n}),_jsxruntime.jsx.call(void 0, Ka,{projectID:_nullishCoalesce(_chunk7BG22YBFjs.K.call(void 0, ), () => ("")),locale:n})]}),Oe!=null&&_jsxruntime.jsx.call(void 0, "div",{ref:cr,className:"contents",children:_jsxruntime.jsx.call(void 0, an,{choice:Oe,selected:_chunk7BG22YBFjs.u.call(void 0, Oe,or),onChange:ko,disabled:Tt})}),_jsxruntime.jsx.call(void 0, "button",{"data-bitsnap-checkout-slot":"checkoutButton",onClick:Io,disabled:rt||Tt||ir||Mt==null,"aria-describedby":dr?b:void 0,className:_chunkN3B25GTYjs.g.call(void 0, "px-3 py-2 my-2 mx-2 rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition font-bold",m.className),style:m.style,children:Tt||ir?_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{}):D}),dr&&_jsxruntime.jsx.call(void 0, "p",{id:b,className:"text-sm text-center opacity-70",children:P}),_.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm text-center",p.className),style:p.style,children:_})]})]})]})},Fn=_s;function qs({isVisible:t,shouldHide:e,panelId:a,locale:r}){let[n]=_react3.useAutoAnimate.call(void 0, ),[o,i]=_react.useState.call(void 0, null),c=_react.useCallback.call(void 0, y=>{n(y),i(y)},[n]),l=_react.useRef.call(void 0, null),{boundaryClassName:u,boundaryStyle:s}=Ce(),f=L("root"),v=L("overlay"),m=L("panel"),g=L("header"),p=L("title"),S=L("closeButton"),R=_chunk7BG22YBFjs.E.call(void 0, "cart"),h=_chunk7BG22YBFjs.E.call(void 0, "close");return _jsxruntime.jsx.call(void 0, "div",{ref:c,"data-bitsnap-checkout":"root","data-bitsnap-checkout-slot":"root",className:_chunkN3B25GTYjs.g.call(void 0, "bitsnap-react",u,f.className),style:{zIndex:999999,...s,...f.style},children:o!=null&&_jsxruntime.jsx.call(void 0, It.Root,{open:t,onOpenChange:y=>{y||e()},children:_jsxruntime.jsxs.call(void 0, It.Portal,{container:o,children:[_jsxruntime.jsx.call(void 0, It.Overlay,{"data-bitsnap-checkout-slot":"overlay","aria-hidden":"true",className:_chunkN3B25GTYjs.g.call(void 0, "fixed top-0 right-0 left-0 bottom-0 cursor-pointer z-10",v.className),style:v.style,onClick:e}),_jsxruntime.jsxs.call(void 0, It.Content,{id:a,"data-bitsnap-checkout-slot":"panel","aria-modal":"true","aria-describedby":void 0,onOpenAutoFocus:()=>{let y=document.activeElement;l.current=y instanceof HTMLElement?y:null},onCloseAutoFocus:y=>{y.preventDefault(),_optionalChain([l, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.focus, 'call', _202 => _202()]),l.current=null},className:_chunkN3B25GTYjs.g.call(void 0, "fixed z-20 top-0 right-0 bottom-0 w-full md:w-[350px] xl:w-[420px] flex flex-col overflow-y-auto",m.className),style:m.style,onPointerDownOutside:y=>y.preventDefault(),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"header",className:_chunkN3B25GTYjs.g.call(void 0, "mx-3 mt-7 flex justify-between items-center",g.className),style:g.style,children:[_jsxruntime.jsx.call(void 0, It.Title,{asChild:!0,children:_jsxruntime.jsx.call(void 0, "h1",{"data-bitsnap-checkout-slot":"title",className:_chunkN3B25GTYjs.g.call(void 0, "text-2xl font-medium",p.className),style:p.style,children:R})}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"closeButton",className:_chunkN3B25GTYjs.g.call(void 0, "rounded-xl p-2 transition",S.className),style:S.style,"aria-label":h,onClick:e,children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-x","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),_jsxruntime.jsx.call(void 0, Fn,{className:"grow",locale:r})]})]})})})}var Gs=t=>typeof window>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{texts:t.texts,locale:t.locale,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{locale:t.locale,children:_jsxruntime.jsx.call(void 0, qs,{...t})})})}),document.body),Wn=Gs;var Hs=_zod2.default.object({id:_zod2.default.string(),isSubscription:_zod2.default.boolean().default(!1),quantity:_zod2.default.number(),metadata:_zod2.default.record(_zod2.default.string(),_zod2.default.string().optional()).optional(),url:_zod2.default.string().optional()}),Ks={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Vs({projectID:t,locale:e,children:a,onVisibleChange:r,className:n,numberOfProductsInCartOptions:o,appearance:i,texts:c,analytics:l}){let u=_chunkG4SEOVLDjs.n.call(void 0, t,l,"cart");_chunkG4SEOVLDjs.q.call(void 0, u);let{isCartVisible:s,showCart:f,hideCart:v,numberOfProductsInCart:m}=_chunk7BG22YBFjs.w.call(void 0, ),g=`bitsnap-cart-${_react.useId.call(void 0, )}`,p=E=>_chunkQ337IQNAjs.c.call(void 0, E,_nullishCoalesce(e, () => (_chunkQ337IQNAjs.f.call(void 0, ))),c),S=_react.useRef.call(void 0, p);S.current=p;function R(E){_chunk7BG22YBFjs.w.getState().setNotice(S.current(E)),f()}function h(E){document.querySelectorAll("iframe").forEach(I=>{_optionalChain([I, 'access', _203 => _203.contentWindow, 'optionalAccess', _204 => _204.postMessage, 'call', _205 => _205(E,"*")])})}_react.useEffect.call(void 0, ()=>{_optionalChain([r, 'optionalCall', _206 => _206(s)]),s&&_chunk7BG22YBFjs.p.call(void 0, {event:"viewCart"})},[s]),_react.useEffect.call(void 0, ()=>{_chunk7BG22YBFjs.J.call(void 0, t)},[t]),_react.useEffect.call(void 0, ()=>{_chunkQ337IQNAjs.e.call(void 0, e)},[e]),_react.useEffect.call(void 0, ()=>{if(!("cart"in window)){let E=_chunk7BG22YBFjs.K.call(void 0, );if(E==null){console.warn("There is no project ID configured.");return}window.cart={buyProduct:async D=>{try{let I=_zod2.default.object({productID:_zod2.default.string(),email:_zod2.default.string().optional(),name:_zod2.default.string().optional(),country:_zod2.default.string().optional(),marketingAgreement:_zod2.default.boolean().optional(),locale:_zod2.default.string().optional()}).parse(D),T=_chunk7BG22YBFjs.Y.call(void 0, E);try{let w=await T.getProducts();_chunk7BG22YBFjs.q.call(void 0, w)==!1&&_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:w.map(U=>({id:U.productID,name:_nullishCoalesce(_optionalChain([U, 'access', _207 => _207.details, 'optionalAccess', _208 => _208.name]), () => ("")),price:_nullishCoalesce(_optionalChain([U, 'access', _209 => _209.details, 'optionalAccess', _210 => _210.price]), () => (0)),quantity:U.quantity,currency:_nullishCoalesce(_optionalChain([U, 'access', _211 => _211.details, 'optionalAccess', _212 => _212.currency]), () => ("PLN"))}))})}catch (e15){}let P=await T.justRedirectToPayment(I);_chunk7BG22YBFjs.q.call(void 0, P)==!1?window.location.href=P.url:R("redirectFailed")}catch(I){console.warn(I)}}}}},[]);async function y(E,D){let I=_chunk7BG22YBFjs.K.call(void 0, );if(I==null){console.warn("There is no project ID configured.");return}try{let T=Hs.parse(D);if(T.isSubscription){await A(I,T);return}await _chunk7BG22YBFjs.Y.call(void 0, I).addProduct({productID:T.id,quantity:T.quantity,metadata:T.metadata,url:T.url}),h({id:E,type:"ADD_TO_CART",success:!0}),f()}catch(T){console.warn("cannot add item to cart",T)}}async function A(E,D){console.warn("subscriptions cannot be added to the cart yet",E,D.id),R("subscriptionUnsupported")}function k(){"__cart_is_listening"in window||(window.__cart_is_listening=!0,window.addEventListener("message",E=>{if(typeof E.data.id<"u"&&typeof E.data.type<"u"){let{id:D,type:I}=E.data;switch(I){case"ADD_TO_CART".toString():y(D,E.data.payload).then().catch();break;default:break}}}))}return _react.useEffect.call(void 0, ()=>{if(k(),typeof window<"u")try{let E=new URLSearchParams(window.location.search),D=_nullishCoalesce(E.get("ref"), () => (E.get("utm-source")));typeof localStorage<"u"&&D&&D.length>0&&localStorage.setItem("bitsnap-ref",D)}catch (e16){return}},[]),_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>s?v():f(),"aria-label":a?void 0:m>0?`${p("openCart")}. ${p("cartItemsCount")}: ${m}`:p("openCart"),"aria-expanded":s,"aria-haspopup":"dialog","aria-controls":s?g:void 0,style:{position:"relative"},className:["bitsnap-react",_nullishCoalesce(n, () => ("rounded-full hover:bg-neutral-300 transition p-1"))].join(" "),children:[a?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:a}):_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-shopping-cart","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"8",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"19",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]}),m>0&&_jsxruntime.jsxs.call(void 0, "span",{style:Ks,children:[p("cartItemsCount"),": ",m]}),_optionalChain([o, 'optionalAccess', _213 => _213.isVisible])!=!1&&m>0&&_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",style:{position:"absolute",bottom:-5,right:-5,background:"black",color:"white",borderRadius:"50%",width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"13px",fontWeight:600,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.25)",..._optionalChain([o, 'optionalAccess', _214 => _214.style])},children:m})]}),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:u,children:_jsxruntime.jsx.call(void 0, Wn,{isVisible:s,locale:e,appearance:i,texts:c,panelId:g,shouldHide:()=>{v()}})})]})}var $s=Vs;var _buttonreact = require('@google-pay/button-react'); var _buttonreact2 = _interopRequireDefault(_buttonreact);function Zs({items:t,style:e,buttonColor:a,buttonSizeMode:r,test:n}){let{getGooglePayConfiguration:o,completeGooglePayPayment:i,setCountry:c,setCouponCodeIfPossible:l,setDeliveryMethod:u,setEmail:s,setPostalCode:f,clearCart:v}=_chunk7BG22YBFjs.O.call(void 0, ),m=_chunkG4SEOVLDjs.m.call(void 0, ),{data:g}=_reactquery.useQuery.call(void 0, {queryKey:["get-google-pay-configuration",t.map(R=>R.id).join(",")],queryFn:()=>o({items:t.map(R=>({...R,id:void 0,productID:R.id}))})}),{mutateAsync:p,isPending:S}=_reactquery.useMutation.call(void 0, {mutationFn:i});return g==null||g.isAvailable!=!0?(console.log("google pay configuration is not available",g),null):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _buttonreact2.default,{buttonSizeMode:r,buttonColor:a,style:e,existingPaymentMethodRequired:!0,onClick:()=>m.track("payment_method_selected",{gateway:"google_pay",method:"google_pay"}),environment:n===!0?"TEST":"PRODUCTION",onPaymentDataChanged:async R=>{_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:t.map(y=>({id:y.id,name:y.name,price:y.price,quantity:y.quantity,currency:"PLN"}))}),console.log("payment data changed",R),_optionalChain([R, 'access', _215 => _215.shippingAddress, 'optionalAccess', _216 => _216.postalCode])!=null&&await f(_optionalChain([R, 'access', _217 => _217.shippingAddress, 'optionalAccess', _218 => _218.postalCode])),_optionalChain([R, 'access', _219 => _219.shippingAddress, 'optionalAccess', _220 => _220.countryCode])!=null&&await c(_optionalChain([R, 'access', _221 => _221.shippingAddress, 'optionalAccess', _222 => _222.countryCode])),_optionalChain([R, 'access', _223 => _223.shippingOptionData, 'optionalAccess', _224 => _224.id])!=null&&await u(R.shippingOptionData.id);let h=await o({items:[]});return console.log("PAYMENT DATA CHANGED CONFIG",h),h.isAvailable?{error:void 0,newShippingOptionParameters:h.config.shippingOptionParameters,newTransactionInfo:h.config.transactionInfo}:{error:void 0}},paymentRequest:g.config,onLoadPaymentData:async R=>{m.track("payment_submitted",{gateway:"google_pay",method:"google_pay"});try{let h=await p({paymentData:R});if(_chunk7BG22YBFjs.q.call(void 0, h)){console.log("apple pay error",h);return}h.isSuccess&&v(),h.redirectURL&&open(h.redirectURL,"_self")}catch(h){console.warn("error completing google pay payment",h)}}}),S?_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{}):null]})}function Js(t){let e=_chunkG4SEOVLDjs.n.call(void 0, Ct(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{children:_jsxruntime.jsx.call(void 0, Zs,{...t})})})}var Va=Js;var tt=_chunkAHISXVEEjs.g.pl,B={title:null,description:null,managingDescription:"Zarz\u0105dzaj rodzajami powiadomie\u0144 i sposobem dostarczania.",formTitle:"Podaj Email aby zapisa\u0107 si\u0119\xA0do powiadomie\u0144",formEmailLabel:"Email",formPhoneLabel:"Numer telefonu",formPhoneOptional:"(opcjonalnie)",formEmailPlaceholder:"np. mail@gmail...",formPhonePlaceholder:"np. 663...",formSubmitButton:"Zapisz si\u0119",formSuccessMessage:"Zapisa\u0142e\u015B si\u0119 do powiadomie\u0144.",agreementText:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"red"},children:"*"}),"Wyra\u017Cam zgod\u0119 na przetwarzanie moich danych w celach marketingowych zgodnie z"," ",_jsxruntime.jsx.call(void 0, "a",{href:"/regulations/polityka-prywatnosci",target:"_blank",className:"cursor-alias font-bold hover:font-medium",children:"regulaminem"})," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-light",children:"(zgod\u0119 mo\u017Cna w ka\u017Cdej chwili wycofa\u0107)"})]}),qrCodeTitle:"lub zainstaluj aplikacj\u0119 mobiln\u0105",qrCodeSubtitle:"Aplikacja mobilna",qrCodeScanText:"zeskanuj kod QR",groupsNoSelectionWarning:"Je\u015Bli \u017Cadna z grup nie jest zaznaczona, nie otrzymasz \u017Cadnych powiadomie\u0144.",groupsSelectAllButton:"Zaznacz wszystkie",groupsUpdateButton:"Aktualizuj",groupsUpdateSuccess:"Zaktualizowano pomy\u015Blnie.",groupsTitle:"Zarz\u0105dzaj grupami z kt\xF3rych chcesz otrzymywa\u0107 powiadomienia",manageDataTitle:"Ustawienia powiadomie\u0144",manageDataDescription:"W jaki spos\xF3b chcesz otrzymywa\u0107 powiadomienia?",manageDataUnsubscribeButton:"Odsubskrybuj",manageDataUpdatedMessage:"Zaktualizowano",manageDataUnsubscribeDescription:"Wypisz mnie z wszystkich powiadomie\u0144 i grup.",loginEmailLabel:"Email",loginEmailPlaceholder:"Wprowad\u017A sw\xF3j email",loginSendCodeButton:"Wy\u015Blij kod weryfikacyjny",loginSendingButton:"Wysy\u0142anie...",loginCodeLabel:"Wprowad\u017A kod weryfikacyjny",loginCodeSentMessage:"Wys\u0142ali\u015Bmy kod weryfikacyjny na adres",loginChangeEmailButton:"Popraw email",loginResendCodeButton:"Wy\u015Blij kod ponownie",loginInvalidEmailError:"Wprowad\u017A prawid\u0142owy adres email",loginSlugRequiredError:"Wymagany jest identyfikator projektu",loginInvalidCodeError:"Nieprawid\u0142owy kod weryfikacyjny",loginVerificationFailedError:"Weryfikacja nie powiod\u0142a si\u0119. Sprawd\u017A sw\xF3j kod.",loginSendEmailError:"Nie uda\u0142o si\u0119 wys\u0142a\u0107 kodu weryfikacyjnego",loginVerifyCodeError:"Nie uda\u0142o si\u0119 zweryfikowa\u0107 kodu",loginResendEmailError:"Nie uda\u0142o si\u0119 ponownie wys\u0142a\u0107 kodu weryfikacyjnego",loginTitle:"Wpisz email aby zarz\u0105dza\u0107 powiadomieniami",loginDescription:"Dostaniesz kod weryfikacyjny na email.",loginIHaveCode:"Mam ju\u017C kod",loginVerifyButton:"Potwierd\u017A",loginResendInText:tt.resendIn,loginResentMessage:tt.resent,loginExpiredError:tt.expired,loginTooManyAttemptsError:tt.tooManyAttempts,loginRateLimitedError:tt.rateLimited,loginNetworkError:tt.network,loginSpamHint:tt.spamHint,loginValidityHint:tt.validity,loginVerifyingButton:tt.verifying,loginStepEmailHint:tt.stepEmail,loginStepCodeHint:tt.stepCode,loginAlreadySentMessage:tt.alreadySent,loginEmailNotFoundError:tt.emailNotFound,loginDeliveryUnavailableError:tt.deliveryUnavailable,loginResendNewCodeButton:tt.resendNew,loginNoCodeButton:tt.noCode,loginCodeIncompleteError:tt.codeIncomplete};function Vn({projectName:t,projectLogo:e,projectLogoDark:a,description:r,className:n,onLogout:o}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e!=null||t!=null&&_jsxruntime.jsxs.call(void 0, "h2",{className:_chunkN3B25GTYjs.g.call(void 0, "flex max-w-44 items-center gap-3 text-lg font-medium text-black sm:max-w-none md:text-xl lg:text-2xl xl:text-3xl dark:text-neutral-100",_optionalChain([n, 'optionalAccess', _225 => _225.headerTitle])),children:[e!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:e,alt:"",className:_chunkN3B25GTYjs.g.call(void 0, "h-12 w-auto dark:hidden",_optionalChain([n, 'optionalAccess', _226 => _226.headerLogo]))}),_jsxruntime.jsx.call(void 0, "img",{src:_nullishCoalesce(a, () => (e)),alt:"",className:_chunkN3B25GTYjs.g.call(void 0, "hidden h-12 w-auto dark:inline",_optionalChain([n, 'optionalAccess', _227 => _227.headerLogo]))})]}),_jsxruntime.jsx.call(void 0, "span",{children:t})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[r&&_jsxruntime.jsx.call(void 0, "p",{className:_chunkN3B25GTYjs.g.call(void 0, "mt-4 font-medium text-left",_optionalChain([n, 'optionalAccess', _228 => _228.headerDescription])),children:r}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),o&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{variant:"ghost",size:"icon-sm",onClick:o,children:_jsxruntime.jsx.call(void 0, _lucidereact.LogOutIcon,{className:"h-5 w-5"})})]})]})}var _reactswitch = require('@radix-ui/react-switch'); var la = _interopRequireWildcard(_reactswitch);function he({className:t,...e}){return _jsxruntime.jsx.call(void 0, la.Root,{"data-slot":"switch",className:_chunkN3B25GTYjs.g.call(void 0, "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:_jsxruntime.jsx.call(void 0, la.Thumb,{"data-slot":"switch-thumb",className:_chunkN3B25GTYjs.g.call(void 0, "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var _reactpopover = require('@radix-ui/react-popover'); var Lt = _interopRequireWildcard(_reactpopover);function Qn({...t}){return _jsxruntime.jsx.call(void 0, Lt.Root,{"data-slot":"popover",...t})}function Xn({...t}){return _jsxruntime.jsx.call(void 0, Lt.Trigger,{"data-slot":"popover-trigger",...t})}function Yn({className:t,align:e="center",sideOffset:a=4,...r}){return _jsxruntime.jsx.call(void 0, Lt.Portal,{children:_jsxruntime.jsx.call(void 0, Lt.Content,{"data-slot":"popover-content",align:e,sideOffset:a,className:_chunkN3B25GTYjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}function Zn({regularity:t}){let e="";switch(t){case"rarely":e="rzadko";break;case"often":e="cz\u0119sto";break;case"very_often":e="codzienne";break}return _jsxruntime.jsxs.call(void 0, Qn,{children:[_jsxruntime.jsx.call(void 0, Xn,{onClick:a=>{a.stopPropagation()},children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"flex w-[30%] cursor-help flex-col items-center justify-center text-xs md:w-[25%] xl:w-[20%]",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ClockIcon,{size:12}),_jsxruntime.jsx.call(void 0, "span",{children:e})]})}),_jsxruntime.jsx.call(void 0, Yn,{className:"w-80",children:_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, "h4",{className:"leading-none font-medium",children:"Co to oznacza?"}),_jsxruntime.jsxs.call(void 0, "ul",{className:"list-inside list-disc text-sm",children:[_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Rzadko"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane maksymalnie kilka razy w miesi\u0105cu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Cz\u0119sto"})," \u2013 powiadomienia mog\u0119 by\u0107 wysy\u0142ane kilka razy w tygodniu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Codzienne"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane nawet codziennie."]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grid gap-2"})]})})]})}function pa({groups:t=[],isManaging:e,onToggle:a,onCheckAll:r,onUpdate:n,isUpdating:o,wasChanged:i,isUserGroupsUpdated:c,className:l,texts:u}){let[s]=_react3.useAutoAnimate.call(void 0, ),[f]=_react3.useAutoAnimate.call(void 0, ),v=t.filter(p=>p.isOn===!1).length>0,m=t.filter(p=>p.isOn===!1).length>0;if(t.length<=1&&e!=!0)return null;let g=_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:_chunkN3B25GTYjs.g.call(void 0, "my-5 flex flex-col gap-3",_optionalChain([l, 'optionalAccess', _229 => _229.groupsList])),children:[t.map(p=>_jsxruntime.jsxs.call(void 0, "div",{id:p.id,role:"button",className:_chunkN3B25GTYjs.g.call(void 0, p.isOn?"bg-neutral-50 hover:bg-transparent shadow-sm border-transparent dark:bg-neutral-800":"border-neutral-200 hover:bg-neutral-50 dark:hover:border-neutral-800 shadow-sm dark:border-neutral-800","active:bg-beige-300 flex w-full cursor-pointer items-center gap-3 rounded-xl border px-3 py-2 transition active:dark:bg-neutral-900",_optionalChain([l, 'optionalAccess', _230 => _230.groupItem])),onClick:S=>{S.target instanceof HTMLButtonElement||a(p.id)},children:[_jsxruntime.jsx.call(void 0, he,{checked:p.isOn,className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",onCheckedChange:()=>{a(p.id)}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start justify-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-medium text-sm",children:p.name}),p.description&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-light",children:p.description})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),p.howOften&&_jsxruntime.jsx.call(void 0, Zn,{regularity:p.howOften})]},p.id)),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[e===!0&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:f,className:"flex flex-col items-start justify-start",children:[i&&_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{variant:"default",size:"sm",className:"relative",disabled:o,onClick:n,children:[_nullishCoalesce(_optionalChain([u, 'optionalAccess', _231 => _231.groupsUpdateButton]), () => (B.groupsUpdateButton)),o&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]}),c&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-3 flex items-center gap-2 text-sm text-green-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{color:"var(--color-green-500",size:16})," ",_nullishCoalesce(_optionalChain([u, 'optionalAccess', _232 => _232.groupsUpdateSuccess]), () => (B.groupsUpdateSuccess))]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"})]}),m&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{className:"cursor-pointer dark:bg-neutral-700",onClick:r,size:"sm",variant:"secondary",type:"button",children:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _233 => _233.groupsSelectAllButton]), () => (B.groupsSelectAllButton))})})]}),v&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex text-left gap-2 text-xs text-yellow-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"orange",size:16}),_nullishCoalesce(_optionalChain([u, 'optionalAccess', _234 => _234.groupsNoSelectionWarning]), () => (B.groupsNoSelectionWarning))]})]});return e==!0?_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{className:"mt-5 text-left",children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.d,{children:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _235 => _235.groupsTitle]), () => (B.groupsTitle))})}),_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.e,{children:g})]}):g}function to({showQRCode:t=!0,isManaging:e,className:a,texts:r}){let n=typeof window<"u",o=n?!!_optionalChain([window, 'access', _236 => _236.matchMedia, 'optionalCall', _237 => _237("(prefers-color-scheme: dark)"), 'access', _238 => _238.matches]):!1;function i(c){return c?window.location.href:""}return t?_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([a, 'optionalAccess', _239 => _239.qrCodeSection])),children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.d,{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([a, 'optionalAccess', _240 => _240.qrCodeTitle])),children:[_nullishCoalesce(_optionalChain([r, 'optionalAccess', _241 => _241.qrCodeSubtitle]), () => (B.qrCodeSubtitle))," "+(_nullishCoalesce(_optionalChain([r, 'optionalAccess', _242 => _242.qrCodeTitle]), () => (B.qrCodeTitle)))]})}),_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.e,{className:"flex flex-col items-center gap-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mt-1.5 mb-3 flex items-center gap-x-2",children:[_jsxruntime.jsx.call(void 0, "a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunkN3B25GTYjs.e+"/app-store-logo.png",alt:"Download on App Store"})}),_jsxruntime.jsx.call(void 0, "a",{href:"https://play.google.com/store/apps/details?id=com.bitsnap.Bitsnap&pli=1",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunkN3B25GTYjs.e+"/google-play-logo.png",alt:"Get in on Google Play"})})]}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "flex min-w-[40%] flex-col items-center gap-2 rounded-xl bg-white p-2 dark:bg-neutral-900",_optionalChain([a, 'optionalAccess', _243 => _243.qrCodeContainer])),children:[_jsxruntime.jsx.call(void 0, "img",{className:"mt-3 w-[80%] p-1 pt-3",src:_chunkN3B25GTYjs.e+`/api/qr-gen?url=${i(n)}&bgColor=${o?"171717":"F6F4F0"}&textColor=${o?"ffffff":"000000"}&margin=0`}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs md:text-sm",children:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _244 => _244.qrCodeScanText]), () => (B.qrCodeScanText))})]})})]})]}):null}var _reactphonenumberinput = require('react-phone-number-input');var _reactlabel = require('@radix-ui/react-label');function ao({submit:t,isLoading:e,errMsg:a,emailLack:r,warnMsg:n,isSubmited:o,agreementLack:i,showPhoneInput:c=!1,agreementText:l,className:u,texts:s}){let[f,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[p,S]=_react.useState.call(void 0, !1),[R]=_react3.useAutoAnimate.call(void 0, );function h(y){y.preventDefault(),t(f,m,p)}return _jsxruntime.jsxs.call(void 0, "form",{ref:R,onSubmit:h,className:_chunkN3B25GTYjs.g.call(void 0, "flex flex-col gap-3 text-left",_optionalChain([u, 'optionalAccess', _245 => _245.formContainer])),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsx.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-email",children:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _246 => _246.formEmailLabel]), () => (B.formEmailLabel))}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.r,{value:f,onChange:y=>{v(y.currentTarget.value)},id:"bts-notifications-form-email",className:_chunkN3B25GTYjs.g.call(void 0, r===!0?"border-red-400":""),type:"email",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _247 => _247.formEmailPlaceholder]), () => (B.formEmailPlaceholder))})]}),c&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsxs.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-phone",children:[_nullishCoalesce(_optionalChain([s, 'optionalAccess', _248 => _248.formPhoneLabel]), () => (B.formPhoneLabel))," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-neutral-500 dark:text-neutral-500",children:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _249 => _249.formPhoneOptional]), () => (B.formPhoneOptional))})]}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.r,{value:m,onChange:y=>{g(y.currentTarget.value)},id:"bts-notifications-form-phone",className:"",type:"tel",autoComplete:"tel",autoCorrect:"off",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _250 => _250.formPhonePlaceholder]), () => (B.formPhonePlaceholder))})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-x-1.5",children:[_jsxruntime.jsx.call(void 0, "input",{className:"cursor-pointer",id:"bts-notifications-form-marketing-consent",type:"checkbox",checked:p,onChange:()=>{S(!p)}}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"bts-notifications-form-marketing-consent",className:_chunkN3B25GTYjs.g.call(void 0, "cursor-pointer text-xs leading-4 transition-colors md:text-sm md:leading-4",i===!0?"text-yellow-700":""),children:l})]}),a.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-red-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"#ff6467",size:16})," ",a]}),n.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-amber-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CircleAlertIcon,{color:"var(--color-amber-400)",size:16})," ",n]}),o==!1&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{variant:"default",disabled:e,className:_chunkN3B25GTYjs.g.call(void 0, e?"cursor-not-allowed text-transparent":"","relative"),children:[_nullishCoalesce(_optionalChain([s, 'optionalAccess', _251 => _251.formSubmitButton]), () => (B.formSubmitButton)),e&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]})}),o&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 text-sm text-green-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{size:16})," ",_nullishCoalesce(_optionalChain([s, 'optionalAccess', _252 => _252.formSuccessMessage]), () => (B.formSuccessMessage))]})]})}var bc=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;function ro({groups:t,onToggle:e,onCheckAll:a,slug:r,showPhoneInput:n=!1,agreementText:o,className:i,texts:c,isUpdating:l,wasChanged:u,onSuccess:s}){let[f,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[p,S]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[y,A]=_react.useState.call(void 0, !1),{mutateAsync:k,isPending:E}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.createNotificationUser);function D(P){return P==null?!1:_reactphonenumberinput.isValidPhoneNumber.call(void 0, P,"PL")}async function I(P,w,U){if(v(""),g(""),A(!1),S(!1),h(!1),!U){h(!0),v("Zgoda w tym przypadku jest wymagana.");return}if(bc.test(P)===!1){v("Email jest nieprawid\u0142owy."),A(!0);return}w.length>0&&D(w)===!1&&g("Numer telefonu mo\u017Ce by\u0107 nieprawid\u0142owy. Zapisali\u015Bmy go ale je\u015Bli jest nieprawid\u0142owy to wpisz jeszcze raz i kliknij przycisk.");try{let b=await k({slug:r,email:P,phone:w,groups:t.filter(C=>C.isOn==!0).map(C=>C.id),mobileNotificationEnabled:!0,emailNotificationEnabled:!0,smsNotificationEnabled:!0});if(b.result.case==="success"){S(!0),setTimeout(()=>{_optionalChain([s, 'optionalCall', _253 => _253(!1,b.userId,b.accessToken)])},1e3);return}else{S(!0);let C=b.result.value;if(C!=null){if(C==32){_optionalChain([s, 'optionalCall', _254 => _254(!0,void 0,void 0)]);return}console.log(`Code error: ${_chunk5OCGXVLCjs.g[C]}`),v("Wyst\u0105pi\u0142 b\u0142\u0105d: "+_chunk5OCGXVLCjs.g[C]);return}return}}catch(b){v("Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisywania. Spr\xF3buj ponownie."),console.log(`Error: ${b}`)}}let T=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _255 => _255.formTitle]), () => (B.formTitle));return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([i, 'optionalAccess', _256 => _256.formSection])),children:[T.length>0&&_jsxruntime.jsx.call(void 0, "h3",{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([i, 'optionalAccess', _257 => _257.formTitle])),children:T}),_jsxruntime.jsx.call(void 0, pa,{groups:t,isManaging:!1,onToggle:_nullishCoalesce(e, () => ((()=>{}))),onCheckAll:_nullishCoalesce(a, () => ((()=>{}))),isUpdating:_nullishCoalesce(l, () => (!1)),wasChanged:_nullishCoalesce(u, () => (!1)),isUserGroupsUpdated:!1,className:i,texts:c}),_jsxruntime.jsx.call(void 0, ao,{errMsg:f,emailLack:y,warnMsg:m,submit:I,isLoading:E,isSubmited:p,agreementLack:R,showPhoneInput:n,agreementText:_nullishCoalesce(_nullishCoalesce(o, () => (_optionalChain([c, 'optionalAccess', _258 => _258.agreementText]))), () => (B.agreementText)),className:i,texts:c})]})}var _usedebounce = require('use-debounce');function oo({open:t,onOpenChange:e,onConfirm:a,isDeleting:r=!1}){let[n,o]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>(o(!0),()=>o(!1)),[]),_react.useEffect.call(void 0, ()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),!n||!t)return null;let i=l=>{l.target===l.currentTarget&&e(!1)},c=()=>{a()};return _reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, "div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4",onClick:i,children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "relative w-full max-w-md rounded-2xl bg-white p-6 shadow-lg","dark:bg-neutral-800","animate-in fade-in-0 zoom-in-95 duration-200"),onClick:l=>l.stopPropagation(),children:[_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(!1),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none dark:ring-offset-neutral-950 dark:focus:ring-neutral-300",disabled:r,children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{className:"h-4 w-4"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Zamknij"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{className:"h-6 w-6 text-amber-500","aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1",children:_jsxruntime.jsx.call(void 0, "h2",{className:"text-lg font-semibold text-black dark:text-neutral-100",children:"Czy na pewno chcesz si\u0119 wypisa\u0107?"})})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Klikni\u0119cie tego przycisku spowoduje wypisanie z wszelkich powiadomie\u0144 i grup, kt\xF3re zapisa\u0142e\u015B."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"ghost",onClick:()=>e(!1),disabled:r,className:"sm:min-w-[100px]",children:"Anuluj"}),_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"destructive",onClick:c,disabled:r,className:_chunkN3B25GTYjs.g.call(void 0, r&&"cursor-not-allowed text-transparent","relative sm:min-w-[100px]"),children:["Usu\u0144",r&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"})})]})]})]})]})}),document.body)}function so({accessToken:t,slug:e,userID:a,className:r,texts:n}){let[o]=_react3.useAutoAnimate.call(void 0, ),[i]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:c,isPending:l}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.deleteNotificationUser),{mutateAsync:u,isPending:s}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.updateNotificationUser),{data:f,isFetching:v}=_chunk5OCGXVLCjs.l.call(void 0, _chunk5OCGXVLCjs.k.notifications.getNotificationUserSettings,{userId:a,slug:e,accessToken:t}),[m,g]=_react.useState.call(void 0, !1),[p,S]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[y,A]=_react.useState.call(void 0, !1),[k,E]=_react.useState.call(void 0, !1),D=_optionalChain([f, 'optionalAccess', _259 => _259.result, 'access', _260 => _260.case])==="success"?_optionalChain([f, 'optionalAccess', _261 => _261.result, 'optionalAccess', _262 => _262.value]):void 0;function I(){E(!0)}async function T(){await c({accessToken:t,slug:e,userId:a}),E(!1)}async function P(){await u({accessToken:t,slug:e,notificationUserId:a,mobileNotificationEnabled:y,emailNotificationEnabled:m,smsNotificationEnabled:p}),h(!0),setTimeout(()=>{h(!1)},3e3)}let w=_usedebounce.useDebouncedCallback.call(void 0, b=>{P()},300);_react.useEffect.call(void 0, ()=>{let b=_optionalChain([f, 'optionalAccess', _263 => _263.result, 'access', _264 => _264.case])==="success"?_optionalChain([f, 'optionalAccess', _265 => _265.result, 'optionalAccess', _266 => _266.value]):void 0;g(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _267 => _267.emailNotificationEnabled]), () => (!1))),S(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _268 => _268.smsNotificationEnabled]), () => (!1))),A(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _269 => _269.mobileNotificationEnabled]), () => (!1)))},[f]);function U(b,C){b==="email"&&g(C),b==="phone"&&S(C),b==="push"&&A(C),w(!0)}return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([r, 'optionalAccess', _270 => _270.manageDataSection])),children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, "h3",{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([r, 'optionalAccess', _271 => _271.manageDataTitle])),children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _272 => _272.manageDataTitle]), () => (B.manageDataTitle))})}),v?_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.u,{className:"h-64 w-full"}):_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{ref:i,className:_chunkN3B25GTYjs.g.call(void 0, s&&"relative"),children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.d,{children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-left",children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _273 => _273.manageDataDescription]), () => (B.manageDataDescription))})})}),_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.e,{ref:o,children:[_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, s&&"opacity-50 pointer-events-none","flex flex-col gap-2"),children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-5 gap-x-2",children:[_optionalChain([D, 'optionalAccess', _274 => _274.emailNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"email-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:m,onCheckedChange:()=>{U("email",!m)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"email-enabled",className:"text-sm",children:"Email"})]}),_optionalChain([D, 'optionalAccess', _275 => _275.smsNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"sms-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:p,onCheckedChange:()=>{U("phone",!p)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"sms-enabled",className:"text-sm",children:"SMS"})]}),_optionalChain([D, 'optionalAccess', _276 => _276.mobileNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"push-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:y,onCheckedChange:()=>{U("push",!y)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"push-enabled",className:"text-sm",children:"Powiadomienia na telefon"})]}),_optionalChain([D, 'optionalAccess', _277 => _277.hasUserInstalledApp])===!1&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.MessageCircleWarningIcon,{color:"var(--color-amber-500)",size:26}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-amber-500",children:"Wygl\u0105da na to, \u017Ce nie masz zainstalowanej aplikacji mobilnej. Zainstaluj i wyra\u017A zgod\u0119 na otrzymywanie powiadomie\u0144 na telefon."})]})]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-5 flex flex-col gap-2 text-left",children:[_jsxruntime.jsx.call(void 0, "hr",{}),R&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-green-500",children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _278 => _278.manageDataUpdatedMessage]), () => (B.manageDataUpdatedMessage))}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-x-2",children:_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{size:"sm",variant:"link",className:_chunkN3B25GTYjs.g.call(void 0, "pl-0 ml-0",l&&"cursor-not-allowed"),onClick:I,children:[_nullishCoalesce(_optionalChain([n, 'optionalAccess', _279 => _279.manageDataUnsubscribeButton]), () => (B.manageDataUnsubscribeButton)),l&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]})})]})]}),s&&_jsxruntime.jsx.call(void 0, "div",{className:"bg-black/30 absolute inset-0 rounded-xl",children:_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})})]}),_jsxruntime.jsx.call(void 0, oo,{open:k,onOpenChange:E,onConfirm:T,isDeleting:l})]})}function co({...t}){return _jsxruntime.jsx.call(void 0, it.Root,{"data-slot":"dialog",...t})}function Sc({...t}){return _jsxruntime.jsx.call(void 0, it.Portal,{"data-slot":"dialog-portal",...t})}function Ic({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Overlay,{"data-slot":"dialog-overlay",className:_chunkN3B25GTYjs.g.call(void 0, "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function lo({className:t,children:e,showCloseButton:a=!0,...r}){return _jsxruntime.jsxs.call(void 0, Sc,{"data-slot":"dialog-portal",children:[_jsxruntime.jsx.call(void 0, Ic,{}),_jsxruntime.jsxs.call(void 0, it.Content,{"data-slot":"dialog-content",className:_chunkN3B25GTYjs.g.call(void 0, "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...r,children:[e,a&&_jsxruntime.jsxs.call(void 0, it.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Close"})]})]})]})}function po({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Title,{"data-slot":"dialog-title",className:_chunkN3B25GTYjs.g.call(void 0, "text-lg leading-none font-semibold",t),...e})}function uo({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Description,{"data-slot":"dialog-description",className:_chunkN3B25GTYjs.g.call(void 0, "text-muted-foreground text-sm",t),...e})}var _connect = require('@connectrpc/connect');function go(t,e="pl"){let a=t.loginCodeSentMessage,r={emailLabel:t.loginEmailLabel,emailPlaceholder:t.loginEmailPlaceholder,sendCode:t.loginSendCodeButton,sending:t.loginSendingButton,invalidEmail:t.loginInvalidEmailError,codeSentTo:a!=null?`${a} {email}.`:void 0,changeEmail:t.loginChangeEmailButton,verify:t.loginVerifyButton,spamHint:t.loginSpamHint,validity:t.loginValidityHint,resend:t.loginResendCodeButton,resendIn:t.loginResendInText,resent:t.loginResentMessage,haveCodePrompt:"",haveCode:t.loginIHaveCode,wrongCode:t.loginInvalidCodeError,expired:t.loginExpiredError,tooManyAttempts:t.loginTooManyAttemptsError,rateLimited:t.loginRateLimitedError,network:t.loginNetworkError,generic:t.loginVerifyCodeError,deliveryFailed:t.loginSendEmailError,verifying:t.loginVerifyingButton,stepEmail:t.loginStepEmailHint,stepCode:t.loginStepCodeHint,alreadySent:t.loginAlreadySentMessage,emailNotFound:t.loginEmailNotFoundError,deliveryUnavailable:t.loginDeliveryUnavailableError,resendNew:t.loginResendNewCodeButton,noCode:t.loginNoCodeButton,codeIncomplete:t.loginCodeIncompleteError};return _chunkAHISXVEEjs.h.call(void 0, e,r)}function bo(t){let e=_connect.ConnectError.from(t),a=e.rawMessage||e.message;return e.code===_connect.Code.ResourceExhausted?/too many attempts/i.test(a)?"tooManyAttempts":"rateLimited":/invalid code/i.test(a)?"wrongCode":/expired/i.test(a)?"expired":e.code===_connect.Code.Unavailable?"unknown":_chunkAHISXVEEjs.a.call(void 0, t)}function fo(t,e,a){return{async send(r,{resend:n}){if(!e)return{ok:!1,kind:"unknown",message:a.loginSlugRequiredError};try{let o=await t({email:r,slug:e});return o.ok===!1?o.retryIn!=null&&o.retryIn>0?{ok:!1,kind:"rateLimited",retryIn:o.retryIn}:{ok:!1,kind:"deliveryFailed",message:n?a.loginResendEmailError:a.loginSendEmailError}:o.sent===!1?{ok:!1,kind:"alreadySent",retryIn:o.retryIn||void 0}:{ok:!0,retryIn:o.retryIn||void 0}}catch(o){let i=bo(o);return{ok:!1,kind:i,cause:o,message:i==="unknown"?n?a.loginResendEmailError:a.loginSendEmailError:void 0}}},async verify({email:r,code:n}){try{let o=await t({email:r,code:n,slug:e});return o.ok&&o.accessToken?{ok:!0,value:{userId:o.userId,accessToken:o.accessToken}}:{ok:!1,kind:"wrongCode",message:a.loginVerificationFailedError}}catch(o){return{ok:!1,kind:bo(o),cause:o}}}}}function Ac({slug:t,onSuccess:e,onError:a,texts:r,projectName:n,projectLogo:o,projectLogoDark:i,showLogo:c}){let[l]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:u}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.verifyUserEmail),s=_react.useMemo.call(void 0, ()=>go(r),[r]),[f,v]=s.codeSentTo.split("{email}"),m=_react.useRef.call(void 0, a);m.current=a;let g=_react.useMemo.call(void 0, ()=>{let h=fo(y=>u(y),t,r);return{...h,async verify(y){let A=await h.verify(y);return!A.ok&&A.kind==="wrongCode"&&_optionalChain([m, 'access', _280 => _280.current, 'optionalCall', _281 => _281(A.cause instanceof Error?A.cause:new Error(_nullishCoalesce(A.message, () => ("wrongCode"))))]),A}}},[u,t,r]),p=_chunkAHISXVEEjs.j.call(void 0, {adapter:g,texts:s,storageKey:t?_chunkAHISXVEEjs.f.call(void 0, "notifications",t):void 0,onVerified:({userId:h,accessToken:y})=>_optionalChain([e, 'optionalCall', _282 => _282(h,y)]),onFailure:(h,y)=>_optionalChain([a, 'optionalCall', _283 => _283(y instanceof Error?y:new Error(h))])}),S=p.step==="code",R=S&&!p.needsEmail?_nullishCoalesce(r.loginCodeLabel, () => ("")):_nullishCoalesce(r.loginTitle, () => (""));return _jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col",children:[_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.c,{projectId:t,name:n,showLogo:c,logoUrl:o,logoDarkUrl:i,className:"text-foreground mb-3"}),_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:"mb-2 flex items-start gap-2",children:[S&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"ghost",size:"icon-sm",className:"-mt-2 -ml-2 size-11 shrink-0","aria-label":s.changeEmail,disabled:p.isBusy,onClick:p.changeEmail,children:_jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeft,{className:"h-5 w-5","aria-hidden":!0})}),_jsxruntime.jsx.call(void 0, po,{className:"text-lg leading-6 font-semibold",children:R})]}),_jsxruntime.jsx.call(void 0, uo,{className:S?"sr-only":"mb-4",children:S?`${f}${p.email}${_nullishCoalesce(v, () => (""))}`:_nullishCoalesce(r.loginDescription, () => (""))}),_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.f,{login:p,texts:s})]})}function yo({slug:t,onSuccess:e,onError:a,className:r,isOpen:n,onClose:o,texts:i,projectName:c,projectLogo:l,projectLogoDark:u,showLogo:s}){return _jsxruntime.jsx.call(void 0, co,{open:n,onOpenChange:o,children:_jsxruntime.jsx.call(void 0, lo,{className:"max-h-[100dvh] overflow-y-auto sm:max-w-[425px]",children:_jsxruntime.jsx.call(void 0, Ac,{slug:t,onSuccess:e,onError:a,texts:i,projectName:c,projectLogo:l,projectLogoDark:u,showLogo:s})})})}function Oc(t,e){switch(e.type){case"SET_IS_LOGGED_IN":return{...t,isLoggedIn:e.value};case"SET_USER_ID":return{...t,userID:e.value};case"SET_LOADING":return{...t,isLoading:e.value};case"SET_PUBLIC_GROUPS":return{...t,groupsProvided:e.value,groups:e.value!=null&&e.value.length>0?t.groups.filter(a=>_optionalChain([e, 'access', _284 => _284.value, 'optionalAccess', _285 => _285.find, 'call', _286 => _286(r=>r.id===a.id)])!=null):t.groups};case"SET_GROUPS":{let a=t.isLoggedIn==!1||t.groupsProvided!=null,r=e.value.map(n=>t.isLoggedIn==!0?n:{...n,isOn:_nullishCoalesce(_optionalChain([t, 'access', _287 => _287.groupsProvided, 'optionalAccess', _288 => _288.find, 'call', _289 => _289(o=>o.id===n.id), 'optionalAccess', _290 => _290.isOn]), () => (a))});return{...t,groups:r}}case"TOGGLE_GROUP":{let a=t.groups.map(r=>r.id===e.groupID?{...r,isOn:!r.isOn}:r);return{...t,wasChanged:!0,groups:a}}case"CHECK_ALL_GROUPS":{let a=t.groups.map(r=>({...r,isOn:!0}));return{...t,groups:a,wasChanged:!0}}case"SET_WAS_CHANGED":return{...t,wasChanged:e.value};case"SET_IS_USER_GROUPS_UPDATED":return{...t,isUserGroupsUpdated:e.value};case"RESET_UPDATE_STATE":return{...t,wasChanged:!1,isUserGroupsUpdated:!0};case"SHOW_SETTINGS":return{...t,showSettings:!0};case"HIDE_SETTINGS":return{...t,showSettings:!1};default:return t}}function Mc({slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s=!1,texts:f,showQRCode:v=!1,showPhoneInput:m=!1,hiddenGroupIds:g=[],className:p}){let[S]=_react3.useAutoAnimate.call(void 0, ),R=_chunkG4SEOVLDjs.n.call(void 0, _nullishCoalesce(r, () => (Ct())),n),h=_nullishCoalesce(_nullishCoalesce(t, () => (_chunk7BG22YBFjs.K.call(void 0, ))), () => ((typeof window<"u"?window.location.hostname:"")));_chunkAHISXVEEjs.b.call(void 0, h.trim(),l!==!1&&!i&&!c&&h.trim()!=="");let{mutateAsync:y,isPending:A}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.updateUserGroups),{data:k,refetch:E}=_reactquery.useQuery.call(void 0, {queryKey:["notifications_accessToken"],queryFn:()=>{if(typeof window<"u")return{accessToken:_nullishCoalesce(localStorage.getItem("notifications_accessToken"), () => (void 0)),userID:_nullishCoalesce(localStorage.getItem("notifications_userID"), () => (void 0))}}}),{data:D,isPending:I,refetch:T}=_chunk5OCGXVLCjs.l.call(void 0, _chunk5OCGXVLCjs.k.notifications.getUserGroups,{slug:h,accessToken:_optionalChain([k, 'optionalAccess', _291 => _291.accessToken])}),[P,w]=_react.useReducer.call(void 0, Oc,{isLoading:I,isUserGroupsUpdated:!1,wasChanged:!1,groupsProvided:u,groups:[],showSettings:k!=null&&s==!0,isLoggedIn:k!=null,userID:void 0});_react.useEffect.call(void 0, ()=>{w({type:"SET_LOADING",value:A||I})},[A,I]),_react.useEffect.call(void 0, ()=>{w({type:"SET_IS_LOGGED_IN",value:_optionalChain([k, 'optionalAccess', _292 => _292.accessToken])!=null}),w({type:"SET_USER_ID",value:_optionalChain([k, 'optionalAccess', _293 => _293.userID])}),_optionalChain([k, 'optionalAccess', _294 => _294.accessToken])!=null&&s==!0&&w({type:"SHOW_SETTINGS"})},[k,s]),_react.useEffect.call(void 0, ()=>{if(D==null)return;let W=D.groups.map(F=>{let V="rarely";switch(F.howOften){case 0:V="rarely";break;case 1:V="often";break;case 2:V="veryOften";break}return{id:F.id,name:F.name,description:F.description,howOften:V,isOn:_nullishCoalesce(F.isOn, () => (void 0))}});w({type:"SET_GROUPS",value:W})},[D,I,u]);let U=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{let W=_optionalChain([u, 'optionalAccess', _295 => _295.map, 'call', _296 => _296(F=>(F.id.startsWith("group_")||(F.id=`group_${F.id}`),F))]);w({type:"SET_PUBLIC_GROUPS",value:W})},[u]);let b={...B,...f};async function C(){await y({accessToken:_optionalChain([k, 'optionalAccess', _297 => _297.accessToken]),slug:h,userId:e,groupIds:P.groups.filter(W=>W.isOn===!0).map(W=>W.id)}),w({type:"RESET_UPDATE_STATE"}),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{w({type:"SET_IS_USER_GROUPS_UPDATED",value:!1})},2e3)}function X(W){w({type:"TOGGLE_GROUP",groupID:W})}function yt(){w({type:"CHECK_ALL_GROUPS"})}function Ot(){w({type:"SHOW_SETTINGS"})}function O(){w({type:"HIDE_SETTINGS"})}function z(){localStorage.removeItem("notifications_accessToken"),localStorage.removeItem("notifications_userID"),E(),w({type:"SET_USER_ID",value:void 0}),w({type:"SET_IS_LOGGED_IN",value:!1}),w({type:"HIDE_SETTINGS"})}async function N(W,F){typeof window<"u"&&(localStorage.setItem("notifications_accessToken",F),W!=null&&localStorage.setItem("notifications_userID",W)),w({type:"SET_USER_ID",value:W});try{await E(),T().then().catch().finally(()=>{s==!0&&w({type:"SHOW_SETTINGS"})})}catch(V){console.log(`Error: ${V}`)}}_react.useEffect.call(void 0, ()=>()=>{U.current&&clearTimeout(U.current)},[]);let _=s==!0&&P.userID!=null&&_optionalChain([k, 'optionalAccess', _298 => _298.accessToken])!=null;return _jsxruntime.jsxs.call(void 0, "main",{className:_chunkN3B25GTYjs.g.call(void 0, "bitsnap-react relative",_optionalChain([p, 'optionalAccess', _299 => _299.container])),children:[b.title!=null&&_jsxruntime.jsx.call(void 0, "h1",{className:"text-2xl font-semibold text-black md:text-3xl lg:text-4xl xl:text-5xl dark:text-neutral-100",children:b.title}),!P.showSettings&&s&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{onClick:Ot,variant:"outline",size:"icon",className:"absolute bottom-6 right-6 z-50 h-12 w-12 rounded-full shadow-lg hover:shadow-xl md:bottom-8 md:right-8","aria-label":"Settings",children:_jsxruntime.jsx.call(void 0, _lucidereact.Settings,{className:"h-5 w-5"})}),_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "md:pt8 relative z-0 mt-6 overflow-hidden rounded-2xl bg-white px-3 pt-6 pb-3 md:px-5 md:pb-5 dark:bg-neutral-800",_optionalChain([p, 'optionalAccess', _300 => _300.header])),children:P.showSettings?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-6",children:P.isLoggedIn&&_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6",_?"md:grid-cols-2":""),children:[_jsxruntime.jsxs.call(void 0, "div",{className:_optionalChain([p, 'optionalAccess', _301 => _301.groupsContainer]),children:[_jsxruntime.jsx.call(void 0, Vn,{projectName:o,projectLogo:i,projectLogoDark:c,description:b.managingDescription,className:p,onLogout:z}),I&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center items-center py-8",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})}),_jsxruntime.jsx.call(void 0, pa,{groups:P.groups,hiddenGroupIds:g,isManaging:s,onToggle:X,onCheckAll:yt,onUpdate:C,isUpdating:A,wasChanged:P.wasChanged,isUserGroupsUpdated:P.isUserGroupsUpdated,className:p,texts:b})]}),_&&_jsxruntime.jsx.call(void 0, so,{accessToken:_nullishCoalesce(k.accessToken, () => ("")),slug:h,userID:_nullishCoalesce(P.userID, () => ("")),className:p,texts:b}),v!=!1&&_jsxruntime.jsx.call(void 0, to,{showQRCode:v,isManaging:!0,className:p,texts:b})]})}):_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6"),children:_jsxruntime.jsx.call(void 0, ro,{slug:h,onToggle:W=>{w({type:"TOGGLE_GROUP",groupID:W})},onCheckAll:()=>{w({type:"CHECK_ALL_GROUPS"})},onSuccess:(W,F,V)=>{R.track("availability_signup",{},{product_id:_nullishCoalesce(a, () => (null))}),V!=null&&N(F,V),W&&w({type:"SHOW_SETTINGS"})},groups:P.groups,showPhoneInput:m,agreementText:b.agreementText,className:p,texts:b,wasChanged:P.wasChanged,isUpdating:A})})}),_jsxruntime.jsx.call(void 0, yo,{isOpen:P.showSettings&&!P.isLoggedIn,slug:h,onSuccess:N,texts:b,onClose:O,projectName:o,projectLogo:i,projectLogoDark:c,showLogo:l})]})}function Bc({slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s,texts:f,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:p}){return _jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.p,{children:_jsxruntime.jsx.call(void 0, Mc,{slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s,texts:f,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:p})})}var jc=Bc;exports.ApplePayButton = Sa; exports.Bitsnap = _chunk7BG22YBFjs.x; exports.BitsnapCheckout = $s; exports.BitsnapReturns = _chunkDR7WYI37js.a; exports.BitsnapReturnsProvider = _chunkAHISXVEEjs.v; exports.CHECKOUT_SLOT_NAMES = yi; exports.Environment = _chunk5OCGXVLCjs.i; exports.GooglePayButton = Va; exports.ITEM_IDS_NOT_FOUND = _chunk7BG22YBFjs.r; exports.InPostPayButton = Ss; exports.NotificationsComponent = jc; exports.PRODUCT_LIST_SLOT_NAMES = _chunkEOFJAQPTjs.a; exports.Panel = _chunk7BG22YBFjs.m; exports.PanelLogin = _chunk7BG22YBFjs.k; exports.PanelProvider = _chunk2XSLIZ27js.i; exports.ProductList = _chunkEOFJAQPTjs.d; exports.PublicOrderPage = _chunk7BG22YBFjs.l; exports.RETURNS_SLOT_NAMES = _chunkAHISXVEEjs.l; exports.ReturnsAppearanceProvider = _chunkAHISXVEEjs.m; exports.ReturnsCodeStep = _chunkAHISXVEEjs.E; exports.ReturnsConfirmation = _chunkAHISXVEEjs.H; exports.ReturnsEmailStep = _chunkAHISXVEEjs.D; exports.ReturnsMyReturnDetail = _chunkAHISXVEEjs.K; exports.ReturnsMyReturnsList = _chunkAHISXVEEjs.J; exports.ReturnsOrderDetail = _chunkAHISXVEEjs.G; exports.ReturnsOrderList = _chunkAHISXVEEjs.F; exports.ReturnsProvider = _chunkAHISXVEEjs.u; exports.ReturnsResult = _chunkAHISXVEEjs.I; exports.RevolutPayButton = Rs; exports.buildAccessTokenRedirect = _chunk7BG22YBFjs.j; exports.createCheckout = _chunk7BG22YBFjs.A; exports.createPaymentURL = _chunk7BG22YBFjs.z; exports.formatProductPrice = _chunkEOFJAQPTjs.b; exports.getAllowedReturnOrigins = _chunk2XSLIZ27js.h; exports.getLocale = _chunkQ337IQNAjs.f; exports.getPanelConfig = _chunk2XSLIZ27js.b; exports.getPaymentMethodChoice = _chunk7BG22YBFjs.y; exports.getReferenceIfPossible = _chunk7BG22YBFjs.B; exports.getReturnURLFromSearch = _chunk7BG22YBFjs.g; exports.injectReferenceToRequestIfNeeded = _chunk7BG22YBFjs.C; exports.persistReturnURL = _chunk7BG22YBFjs.h; exports.readPersistedReturnURL = _chunk7BG22YBFjs.i; exports.setAllowedReturnOrigins = _chunk2XSLIZ27js.g; exports.setCustomHost = _chunkN3B25GTYjs.f; exports.setHost = _chunk2XSLIZ27js.f; exports.setLocale = _chunkQ337IQNAjs.e; exports.setLoginURL = _chunk2XSLIZ27js.e; exports.setPanelConfig = _chunk2XSLIZ27js.a; exports.setPanelProjectID = _chunk2XSLIZ27js.c; exports.setProjectID = _chunk7BG22YBFjs.J; exports.setTheme = _chunk2XSLIZ27js.d; exports.useCreateReturn = _chunkAHISXVEEjs.z; exports.useMyReturn = _chunkAHISXVEEjs.B; exports.useMyReturns = _chunkAHISXVEEjs.A; exports.usePanelConfig = _chunk2XSLIZ27js.j; exports.useProducts = _chunkEOFJAQPTjs.c; exports.useReturnOrders = _chunkAHISXVEEjs.x; exports.useReturnSession = _chunkAHISXVEEjs.w; exports.useReturnableOrder = _chunkAHISXVEEjs.y; exports.useReturnsAppearance = _chunkAHISXVEEjs.n; exports.useReturnsSlot = _chunkAHISXVEEjs.o; exports.useReturnsText = _chunkAHISXVEEjs.r;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|