bitsnap-react 1.18.1 → 1.20.0
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 +21 -0
- package/README.md +45 -0
- package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
- package/dist/BitsnapCart-V4S4EXYV.js +2 -0
- package/dist/BitsnapCart-V4S4EXYV.js.map +1 -0
- package/dist/BitsnapCart-Z6JFYNH2.mjs +2 -0
- package/dist/CartProvider-5NP4WACK.js +2 -0
- package/dist/CartProvider-5NP4WACK.js.map +1 -0
- package/dist/CartProvider-G7FQUPXL.mjs +2 -0
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
- 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/chat.css +2 -0
- package/dist/chat.css.map +1 -0
- package/dist/chat.d.mts +173 -0
- package/dist/chat.d.ts +173 -0
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/chat.mjs +2 -0
- package/dist/chat.mjs.map +1 -0
- package/dist/chunk-2G46TAUX.mjs +2 -0
- package/dist/chunk-2G46TAUX.mjs.map +1 -0
- package/dist/{chunk-N3B25GTY.js → chunk-4Y233NII.js} +2 -2
- package/dist/chunk-4Y233NII.js.map +1 -0
- package/dist/chunk-5M3OUOMU.mjs +5 -0
- package/dist/chunk-5M3OUOMU.mjs.map +1 -0
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-A2ZDFN3J.mjs +2 -0
- package/dist/{chunk-ZM5T4TQW.mjs.map → chunk-A2ZDFN3J.mjs.map} +1 -1
- package/dist/{chunk-DR7WYI37.js → chunk-AQYHQY2Y.js} +2 -2
- package/dist/chunk-AQYHQY2Y.js.map +1 -0
- package/dist/{chunk-62WDFH7K.mjs → chunk-BTERIY6N.mjs} +2 -2
- package/dist/chunk-C736F727.js +2 -0
- package/dist/chunk-C736F727.js.map +1 -0
- package/dist/chunk-EFN4OW2C.js +2 -0
- package/dist/chunk-EFN4OW2C.js.map +1 -0
- package/dist/chunk-EMR4YXNY.mjs +2 -0
- package/dist/chunk-EMR4YXNY.mjs.map +1 -0
- package/dist/chunk-GHBRR665.js +2 -0
- package/dist/chunk-GHBRR665.js.map +1 -0
- package/dist/chunk-HKRH6FI6.mjs +2 -0
- package/dist/chunk-HKRH6FI6.mjs.map +1 -0
- package/dist/chunk-HP3I6D2R.js +2 -0
- package/dist/chunk-HP3I6D2R.js.map +1 -0
- package/dist/{chunk-G4SEOVLD.js → chunk-IRZJIPUF.js} +2 -2
- package/dist/chunk-IRZJIPUF.js.map +1 -0
- package/dist/chunk-IXQCN7MR.mjs +2 -0
- package/dist/chunk-IXQCN7MR.mjs.map +1 -0
- package/dist/chunk-IXX6SUMB.mjs +2 -0
- package/dist/chunk-IXX6SUMB.mjs.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KDL35KEI.js +2 -0
- package/dist/chunk-KDL35KEI.js.map +1 -0
- package/dist/chunk-KO7ZERN5.mjs +2 -0
- package/dist/chunk-KO7ZERN5.mjs.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-KZWCVKLU.js +5 -0
- package/dist/chunk-KZWCVKLU.js.map +1 -0
- package/dist/chunk-LHNTSQYO.mjs +2 -0
- package/dist/chunk-LHNTSQYO.mjs.map +1 -0
- package/dist/chunk-LHQEM3CU.mjs +2 -0
- package/dist/chunk-LHQEM3CU.mjs.map +1 -0
- package/dist/chunk-MDAFPGPA.js +2 -0
- package/dist/chunk-MDAFPGPA.js.map +1 -0
- package/dist/chunk-Q337IQNA.js.map +1 -1
- package/dist/chunk-RJPQMDIQ.js +2 -0
- package/dist/chunk-RJPQMDIQ.js.map +1 -0
- package/dist/{chunk-GKJURMDO.mjs → chunk-TW25G7XX.mjs} +2 -2
- package/dist/{chunk-GKJURMDO.mjs.map → chunk-TW25G7XX.mjs.map} +1 -1
- package/dist/{chunk-UTUPPMLK.mjs → chunk-URQBHNJK.mjs} +2 -2
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-XEXPQFKN.mjs +2 -0
- package/dist/chunk-XEXPQFKN.mjs.map +1 -0
- package/dist/chunk-YPA6MMGJ.js +2 -0
- package/dist/chunk-YPA6MMGJ.js.map +1 -0
- package/dist/chunk-Z3YOJ6NZ.js +2 -0
- package/dist/chunk-Z3YOJ6NZ.js.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.d.mts +2 -14
- package/dist/course.d.ts +2 -14
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +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 +50 -33
- package/dist/index.d.ts +50 -33
- 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-33CWGKNA.mjs +2 -0
- package/dist/methods-33CWGKNA.mjs.map +1 -0
- package/dist/methods-4GB652MQ.js +2 -0
- package/dist/methods-4GB652MQ.js.map +1 -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/texts-9kfgClsA.d.mts +14 -0
- package/dist/texts-9kfgClsA.d.ts +14 -0
- package/dist/{types-D6LsoycW.d.mts → types-CjWyHunk.d.mts} +9 -1
- package/dist/{types-ClFCVzk_.d.ts → types-DfqzDP9k.d.ts} +9 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +2 -2
- package/dist/viewer3d.mjs.map +1 -1
- package/dist/widgets-Bsojw94g.d.ts +556 -0
- package/dist/widgets-u7xMJbsY.d.mts +556 -0
- package/package.json +16 -2
- package/dist/CartProvider-CC6YIZVS.js +0 -2
- package/dist/CartProvider-CC6YIZVS.js.map +0 -1
- package/dist/CartProvider-ZL65WZN6.mjs +0 -2
- package/dist/chunk-2XSLIZ27.js +0 -2
- package/dist/chunk-2XSLIZ27.js.map +0 -1
- package/dist/chunk-5OCGXVLC.js +0 -2
- package/dist/chunk-5OCGXVLC.js.map +0 -1
- package/dist/chunk-5YN752OV.mjs +0 -2
- package/dist/chunk-5YN752OV.mjs.map +0 -1
- package/dist/chunk-7BG22YBF.js +0 -5
- package/dist/chunk-7BG22YBF.js.map +0 -1
- package/dist/chunk-AHISXVEE.js +0 -2
- package/dist/chunk-AHISXVEE.js.map +0 -1
- package/dist/chunk-DR7WYI37.js.map +0 -1
- package/dist/chunk-EOFJAQPT.js +0 -2
- package/dist/chunk-EOFJAQPT.js.map +0 -1
- package/dist/chunk-G4SEOVLD.js.map +0 -1
- package/dist/chunk-IGQZP4YR.mjs +0 -2
- package/dist/chunk-IGQZP4YR.mjs.map +0 -1
- package/dist/chunk-N3B25GTY.js.map +0 -1
- package/dist/chunk-VWA3ZCNI.mjs +0 -2
- package/dist/chunk-VWA3ZCNI.mjs.map +0 -1
- package/dist/chunk-YGE2223J.mjs +0 -5
- package/dist/chunk-YGE2223J.mjs.map +0 -1
- package/dist/chunk-ZKT4N553.mjs +0 -2
- package/dist/chunk-ZKT4N553.mjs.map +0 -1
- package/dist/chunk-ZM5T4TQW.mjs +0 -2
- package/dist/methods-7DWKFCPK.js +0 -2
- package/dist/methods-7DWKFCPK.js.map +0 -1
- package/dist/methods-DQTADIN4.mjs +0 -2
- /package/dist/{CartProvider-ZL65WZN6.mjs.map → BitsnapCart-Z6JFYNH2.mjs.map} +0 -0
- /package/dist/{methods-DQTADIN4.mjs.map → CartProvider-G7FQUPXL.mjs.map} +0 -0
- /package/dist/{chunk-62WDFH7K.mjs.map → chunk-BTERIY6N.mjs.map} +0 -0
- /package/dist/{chunk-UTUPPMLK.mjs.map → chunk-URQBHNJK.mjs.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as i}from"./chunk-LHNTSQYO.mjs";import{b as t}from"./chunk-CUPG4B5W.mjs";import{l as o,n as r}from"./chunk-TW25G7XX.mjs";import{createContext as p,useContext as P}from"react";import{jsx as e}from"react/jsx-runtime";var a=p(t()),u=({children:c,analytics:s})=>{let n=t(),l=r(n.projectID,s,"panel");return e(i,{children:e(a.Provider,{value:{...n},children:e(o,{value:l,children:e("div",{className:"bitsnap-react",children:c})})})})},C=()=>P(a);export{u as a,C as b};
|
|
2
|
+
//# sourceMappingURL=chunk-LHQEM3CU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/panel/PanelProvider.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport {\n InstrumentProvider,\n useInstrument,\n type AnalyticsOption,\n} from \"../analytics/instrument\";\nimport { RpcProvider } from \"../rpc-provider\";\nimport { getPanelConfig, type PanelConfig } from \"./config\";\n\nconst PanelContext = createContext<PanelConfig>(getPanelConfig());\n\nexport const PanelProvider: React.FC<{\n children: React.ReactNode;\n /**\n * Usage statistics for your Bitsnap dashboard (panel logins, orders viewed,\n * downloads, course progress). On by default; `false` turns it off. An\n * object lets you forward every event: `{ onEvent }`. Nothing is stored on\n * the visitor's device.\n */\n analytics?: AnalyticsOption;\n}> = ({ children, analytics }) => {\n const config = getPanelConfig();\n const instrument = useInstrument(config.projectID, analytics, \"panel\");\n return (\n <RpcProvider>\n <PanelContext.Provider value={{ ...config }}>\n <InstrumentProvider value={instrument}>\n <div className=\"bitsnap-react\">{children}</div>\n </InstrumentProvider>\n </PanelContext.Provider>\n </RpcProvider>\n );\n};\n\nexport const usePanelConfig = () => useContext(PanelContext);\n"],"mappings":"kIAAA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QA2BhC,cAAAC,MAAA,oBAlBV,IAAMC,EAAeC,EAA2BC,EAAe,CAAC,EAEnDC,EASR,CAAC,CAAE,SAAAC,EAAU,UAAAC,CAAU,IAAM,CAChC,IAAMC,EAASJ,EAAe,EACxBK,EAAaC,EAAcF,EAAO,UAAWD,EAAW,OAAO,EACrE,OACEN,EAACU,EAAA,CACC,SAAAV,EAACC,EAAa,SAAb,CAAsB,MAAO,CAAE,GAAGM,CAAO,EACxC,SAAAP,EAACW,EAAA,CAAmB,MAAOH,EACzB,SAAAR,EAAC,OAAI,UAAU,gBAAiB,SAAAK,EAAS,EAC3C,EACF,EACF,CAEJ,EAEaO,EAAiB,IAAMC,EAAWZ,CAAY","names":["createContext","useContext","jsx","PanelContext","createContext","getPanelConfig","PanelProvider","children","analytics","config","instrument","useInstrument","RpcProvider","InstrumentProvider","usePanelConfig","useContext"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var t={projectID:void 0,loginURL:"/panel/login",theme:void 0,host:void 0,allowedReturnOrigins:[]},l=[];function g(n){t={...t,...n}}function d(){return t}function a(n){t.projectID=n}function u(n){t.theme=n}function f(n){t.loginURL=n}function p(n){t.host=n}function c(n){l=n,t={...t,allowedReturnOrigins:n}}function w(){return l}var i=(n,e)=>`bitsnap-panel-session:${encodeURIComponent(_nullishCoalesce(e, () => ("https://bitsnap.pl")))}:${encodeURIComponent(n)}`,o=(n,e)=>`bitsnap-panel-email:${encodeURIComponent(_nullishCoalesce(e, () => ("https://bitsnap.pl")))}:${encodeURIComponent(n)}`;function R(n,e){return typeof window>"u"||!n?void 0:_nullishCoalesce(window.localStorage.getItem(i(n,e)), () => (void 0))}function x(n,e,r,s){typeof window>"u"||!n||(window.localStorage.setItem(i(n,s),e),window.localStorage.setItem(o(n,s),r))}function P(n,e){return typeof window>"u"||!n?null:window.localStorage.getItem(o(n,e))}function h(n,e){typeof window>"u"||!n||(window.localStorage.removeItem(i(n,e)),window.localStorage.removeItem(o(n,e)))}exports.a = g; exports.b = d; exports.c = a; exports.d = u; exports.e = f; exports.f = p; exports.g = c; exports.h = w; exports.i = R; exports.j = x; exports.k = P; exports.l = h;
|
|
2
|
+
//# sourceMappingURL=chunk-MDAFPGPA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/panel/config.ts","../src/panel/session-storage.ts"],"names":["config","allowedReturnOrigins","setPanelConfig","newConfig","getPanelConfig","setProjectID","projectID","setTheme","theme","setLoginURL","loginURL","setHost","host","setAllowedReturnOrigins","origins","getAllowedReturnOrigins","panelSessionKey"],"mappings":"AAEA,iLAAIA,CAAAA,CAAsB,CACxB,SAAA,CAAW,KAAA,CAAA,CACX,QAAA,CAAU,cAAA,CACV,KAAA,CAAO,KAAA,CAAA,CACP,IAAA,CAAM,KAAA,CAAA,CACN,oBAAA,CAAsB,CAAC,CACzB,CAAA,CAEIC,CAAAA,CAAiC,CAAC,CAAA,CAU/B,SAASC,CAAAA,CAAeC,CAAAA,CAAuC,CACpEH,CAAAA,CAAS,CAAE,GAAGA,CAAAA,CAAQ,GAAGG,CAAU,CACrC,CAEO,SAASC,CAAAA,CAAAA,CAA8B,CAC5C,OAAOJ,CACT,CAEO,SAASK,CAAAA,CAAaC,CAAAA,CAAyB,CACpDN,CAAAA,CAAO,SAAA,CAAYM,CACrB,CAEO,SAASC,CAAAA,CAASC,CAAAA,CAA6B,CACpDR,CAAAA,CAAO,KAAA,CAAQQ,CACjB,CAEO,SAASC,CAAAA,CAAYC,CAAAA,CAAwB,CAClDV,CAAAA,CAAO,QAAA,CAAWU,CACpB,CAEO,SAASC,CAAAA,CAAQC,CAAAA,CAAoB,CAC1CZ,CAAAA,CAAO,IAAA,CAAOY,CAChB,CAEO,SAASC,CAAAA,CAAwBC,CAAAA,CAAyB,CAC/Db,CAAAA,CAAuBa,CAAAA,CACvBd,CAAAA,CAAS,CAAE,GAAGA,CAAAA,CAAQ,oBAAA,CAAsBc,CAAQ,CACtD,CAEO,SAASC,CAAAA,CAAAA,CAAoC,CAClD,OAAOd,CACT,CCnDA,IAAMe,CAAAA,CAAkB,CAACV,CAAAA,CAAmBM,CAAAA,CAAAA,EAC1C,CAAA,sBAAA,EAAyB,kBAAA,kBAAmBA,CAAAA,SAAQ,sBAAoB,CAAC,CAAA,CAAA,EAAI,kBAAA,CAAmBN,CAAS,CAAC,CAAA,CAAA","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/chunk-MDAFPGPA.js","sourcesContent":["import type { GetThemeOutput } from \"./types\";\n\nlet config: PanelConfig = {\n projectID: undefined,\n loginURL: \"/panel/login\",\n theme: undefined,\n host: undefined,\n allowedReturnOrigins: [],\n};\n\nlet allowedReturnOrigins: string[] = [];\n\nexport interface PanelConfig {\n projectID?: string;\n loginURL?: string;\n theme?: GetThemeOutput;\n host?: string;\n allowedReturnOrigins: string[];\n}\n\nexport function setPanelConfig(newConfig: Partial<PanelConfig>): void {\n config = { ...config, ...newConfig };\n}\n\nexport function getPanelConfig(): PanelConfig {\n return config;\n}\n\nexport function setProjectID(projectID: string): void {\n config.projectID = projectID;\n}\n\nexport function setTheme(theme: GetThemeOutput): void {\n config.theme = theme;\n}\n\nexport function setLoginURL(loginURL: string): void {\n config.loginURL = loginURL;\n}\n\nexport function setHost(host: string): void {\n config.host = host;\n}\n\nexport function setAllowedReturnOrigins(origins: string[]): void {\n allowedReturnOrigins = origins;\n config = { ...config, allowedReturnOrigins: origins };\n}\n\nexport function getAllowedReturnOrigins(): string[] {\n return allowedReturnOrigins;\n}\n","const panelSessionKey = (projectID: string, host?: string) =>\n `bitsnap-panel-session:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nconst panelEmailKey = (projectID: string, host?: string) =>\n `bitsnap-panel-email:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nexport function getPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return undefined;\n const token = window.localStorage.getItem(panelSessionKey(projectID, host));\n return token ?? undefined;\n}\n\nexport function savePanelSession(projectID: string | undefined, token: string, email: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.setItem(panelSessionKey(projectID, host), token);\n window.localStorage.setItem(panelEmailKey(projectID, host), email);\n}\n\nexport function getPanelEmail(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return null;\n return window.localStorage.getItem(panelEmailKey(projectID, host));\n}\n\nexport function clearPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.removeItem(panelSessionKey(projectID, host));\n window.localStorage.removeItem(panelEmailKey(projectID, host));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/texts.ts","../src/components/checkout/texts.ts","../src/components/checkout/locale.ts"],"names":["pickLocaleTable","tables","locale","mergeTexts","table","overrides","result","key","value","resolveTexts","lookupText","texts","CHECKOUT_TEXT_TABLES","resolveCheckoutTexts","getCheckoutText","DEFAULT_LOCALE","localeStorageKey","activeLocale","setLocale","getLocale"],"mappings":"AAoBO,0rBAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgB,CAChB,OAAOA,CAAAA,CAAO,WAAA,CAAY,CAAA,CAAE,UAAA,CAAW,IAAI,CAAA,CAAID,CAAAA,CAAO,EAAA,CAAKA,CAAAA,CAAO,EACpE,CAMO,SAASE,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgB,CAChB,IAAMC,CAAAA,CAAiC,CAAE,GAAGF,CAAM,CAAA,CAElD,EAAA,CAAIC,CAAAA,EAAa,IAAA,CACf,GAAA,CAAA,GAAW,CAACE,CAAAA,CAAKC,CAAK,CAAA,GAAK,MAAA,CAAO,OAAA,CAA4BH,CAAS,CAAA,CACjEG,CAAAA,EAAS,IAAA,EAAA,CACXF,CAAAA,CAAOC,CAAG,CAAA,CAAIC,CAAAA,CAAAA,CAKpB,OAAOF,CACT,CAGO,SAASG,CAAAA,CACdR,CAAAA,CACAC,CAAAA,CACAG,CAAAA,CACgB,CAChB,OAAOF,CAAAA,CAAWH,CAAAA,CAAgBC,CAAAA,CAAQC,CAAM,CAAA,CAAGG,CAAS,CAC9D,CAGO,SAASK,CAAAA,CACdC,CAAAA,CACAJ,CAAAA,CACQ,CACR,wBAAQI,CAAAA,CAA6CJ,CAAG,CAAA,SAAKA,GAC/D,CC6DO,IAAMK,CAAAA,CAAsD,CACjE,EAAA,CAAI,CACF,IAAA,CAAM,MAAA,CACN,SAAA,CAAW,qBAAA,CACX,KAAA,CAAO,QAAA,CACP,QAAA,CAAU,YAAA,CACV,aAAA,CAAe,kBAAA,CACf,QAAA,CAAU,WAAA,CACV,mBAAA,CAAqB,iCAAA,CACrB,cAAA,CAAgB,+CAAA,CAChB,gBAAA,CACE,sFAAA,CACF,oBAAA,CACE,wFAAA,CACF,qBAAA,CACE,qFAAA,CACF,cAAA,CACE,mGAAA,CACF,mBAAA,CACE,wEAAA,CACF,YAAA,CAAc,2EAAA,CACd,KAAA,CAAO,YAAA,CACP,MAAA,CAAQ,QAAA,CACR,QAAA,CAAU,UAAA,CACV,gBAAA,CAAkB,mBAAA,CAClB,gBAAA,CAAkB,mBAAA,CAClB,QAAA,CAAU,WAAA,CACV,cAAA,CAAgB,eAAA,CAChB,iBAAA,CAAmB,mCAAA,CACnB,cAAA,CAAgB,oCAAA,CAChB,cAAA,CAAgB,4DAAA,CAChB,uBAAA,CAAyB,gDAAA,CACzB,aAAA,CAAe,gBAAA,CACf,gBAAA,CAAkB,oBAAA,CAClB,eAAA,CAAiB,+BAAA,CACjB,cAAA,CAAgB,cAAA,CAChB,MAAA,CAAQ,QAAA,CACR,oBAAA,CACE,+DAAA,CACF,UAAA,CAAY,2BAAA,CACZ,KAAA,CAAO,WAAA,CACP,mBAAA,CAAqB,4BAAA,CACrB,mBAAA,CAAqB,YAAA,CACrB,8BAAA,CACE,8DAAA,CACF,2BAAA,CAA6B,eAAA,CAC7B,uBAAA,CAAyB,wCAAA,CACzB,uBAAA,CAAyB,yCAAA,CACzB,8BAAA,CACE,0HAAA,CACF,2BAAA,CACE,8EAAA,CACF,gBAAA,CAAkB,kBAAA,CAClB,2BAAA,CACE,qEAAA,CACF,2BAAA,CACE,8EAAA,CACF,cAAA,CAAgB,+BAAA,CAChB,gBAAA,CAAkB,+BAAA,CAClB,aAAA,CAAe,6CAAA,CACf,gBAAA,CAAkB,4CAAA,CAClB,kBAAA,CACE,4FAAA,CACF,iBAAA,CACE,kFAAA,CACF,sBAAA,CACE,uEAAA,CACF,mBAAA,CACE,iGAAA,CACF,mBAAA,CACE,6DAAA,CACF,yBAAA,CACE,6DACJ,CAAA,CACA,EAAA,CAAI,CACF,IAAA,CAAM,QAAA,CACN,SAAA,CAAW,8BAAA,CACX,KAAA,CAAO,OAAA,CACP,QAAA,CAAU,WAAA,CACV,aAAA,CAAe,cAAA,CACf,QAAA,CAAU,oBAAA,CACV,mBAAA,CAAqB,2DAAA,CACrB,cAAA,CAAgB,oEAAA,CAChB,gBAAA,CACE,6IAAA,CACF,oBAAA,CACE,yJAAA,CACF,qBAAA,CACE,wIAAA,CACF,cAAA,CACE,iIAAA,CACF,mBAAA,CACE,gGAAA,CACF,YAAA,CAAc,iHAAA,CACd,KAAA,CAAO,gBAAA,CACP,MAAA,CAAQ,WAAA,CACR,QAAA,CAAU,iBAAA,CACV,gBAAA,CAAkB,8BAAA,CAClB,gBAAA,CAAkB,0BAAA,CAClB,QAAA,CAAU,kBAAA,CACV,cAAA,CAAgB,wBAAA,CAChB,iBAAA,CAAmB,+BAAA,CACnB,cAAA,CAAgB,wCAAA,CAChB,cAAA,CACE,wGAAA,CACF,uBAAA,CAAyB,2DAAA,CACzB,aAAA,CAAe,kBAAA,CACf,gBAAA,CAAkB,0BAAA,CAClB,eAAA,CAAiB,4CAAA,CACjB,cAAA,CAAgB,mCAAA,CAChB,MAAA,CAAQ,OAAA,CACR,oBAAA,CAAsB,kDAAA,CACtB,UAAA,CAAY,+CAAA,CACZ,KAAA,CAAO,qBAAA,CACP,mBAAA,CAAqB,gCAAA,CACrB,mBAAA,CAAqB,yBAAA,CACrB,8BAAA,CACE,2DAAA,CACF,2BAAA,CAA6B,iBAAA,CAC7B,uBAAA,CAAyB,gCAAA,CACzB,uBAAA,CAAyB,6BAAA,CACzB,8BAAA,CACE,kLAAA,CACF,2BAAA,CACE,4FAAA,CACF,gBAAA,CAAkB,uCAAA,CAClB,2BAAA,CACE,8FAAA,CACF,2BAAA,CACE,wIAAA,CACF,cAAA,CAAgB,4CAAA,CAChB,gBAAA,CAAkB,wDAAA,CAClB,aAAA,CAAe,kFAAA,CACf,gBAAA,CAAkB,iFAAA,CAClB,kBAAA,CACE,oHAAA,CACF,iBAAA,CACE,kJAAA,CACF,sBAAA,CACE,+GAAA,CACF,mBAAA,CACE,+HAAA,CACF,mBAAA,CACE,8FAAA,CACF,yBAAA,CACE,8FACJ,CACF,CAAA,CAGO,SAASC,CAAAA,CACdX,CAAAA,CACAG,CAAAA,CACe,CACf,OAAOI,CAAAA,CAAaG,CAAAA,CAAsBV,CAAAA,CAAQG,CAAS,CAC7D,CAEO,SAASS,CAAAA,CACdP,CAAAA,CACAL,CAAAA,CACAG,CAAAA,CACQ,CACR,OAAOK,CAAAA,CAAWG,CAAAA,CAAqBX,CAAAA,CAAQG,CAAS,CAAA,CAAGE,CAAG,CAChE,CC5RO,IAAMQ,CAAAA,CAAiB,OAAA,CACxBC,CAAAA,CAAmB,gBAAA,CAErBC,CAAAA,CAEG,SAASC,CAAAA,CAAUhB,CAAAA,CAAuB,CAC/C,IAAMM,CAAAA,iBAAQN,CAAAA,2BAAQ,IAAA,mBAAK,GAAA,CAC3Be,CAAAA,CAAeT,CAAAA,CACXA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtB,OAAA,CACAA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtBO,CAAAA,CACAP,CAAAA,CACJ,KAAA,CAAA,CACA,OAAO,YAAA,CAAiB,GAAA,EAAA,CACtBS,CAAAA,EAAgB,IAAA,CAClB,YAAA,CAAa,UAAA,CAAWD,CAAgB,CAAA,CAExC,YAAA,CAAa,OAAA,CAAQA,CAAAA,CAAkBC,CAAY,CAAA,CAGzD,CAEO,SAASE,CAAAA,CAAAA,CAAoB,CAClC,wBAAIF,CAAAA,SAAAA,CAGA,OAAO,YAAA,CAAiB,GAAA,kBACnB,YAAA,CAAa,OAAA,CAAQD,CAAgB,CAAA,SAAKD,GAAAA,CAE5CA,CAAAA,GACT,CAAA,yFAAA","file":"/home/user/bitsnap-react-payment-release/dist/chunk-Q337IQNA.js","sourcesContent":["/**\n * Shared text machinery: typed string tables per locale, the locale fallback\n * and a merge with caller overrides. Each module (checkout, later returns)\n * supplies its own key type and default tables.\n */\n\n/** Strings of one locale, keyed by text key. */\nexport type TextTable<Key extends string> = Record<Key, string>;\n\n/** Default tables for the supported locales. */\nexport type LocaleTables<Key extends string> = {\n en: TextTable<Key>;\n pl: TextTable<Key>;\n};\n\n/**\n * Picks the table for a locale. Any locale starting with `en` (case\n * insensitive, so `en`, `en-US`, `EN-gb`) gets English; everything else,\n * including unknown locales, gets the Polish default.\n */\nexport function pickLocaleTable<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n): TextTable<Key> {\n return locale.toLowerCase().startsWith(\"en\") ? tables.en : tables.pl;\n}\n\n/**\n * Merges caller overrides over a table. Overrides apply regardless of the\n * locale; `undefined`/`null` entries are ignored so the default stays.\n */\nexport function mergeTexts<Key extends string>(\n table: TextTable<Key>,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n const result: Record<string, string> = { ...table };\n\n if (overrides != null) {\n for (const [key, value] of Object.entries<string | undefined>(overrides)) {\n if (value != null) {\n result[key] = value;\n }\n }\n }\n\n return result as TextTable<Key>;\n}\n\n/** Locale table merged with the caller overrides. */\nexport function resolveTexts<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n return mergeTexts(pickLocaleTable(tables, locale), overrides);\n}\n\n/** Looks up a single text. Unknown keys return the key itself. */\nexport function lookupText<Key extends string>(\n texts: TextTable<Key>,\n key: Key,\n): string {\n return (texts as Record<string, string | undefined>)[key] ?? key;\n}\n","import {\n lookupText,\n resolveTexts,\n type LocaleTables,\n} from \"@/src/lib/texts\";\n\n/**\n * Every string the checkout renders. Pass a partial object through the\n * `texts` prop of `BitsnapCheckout` to override any of them, whatever the\n * locale.\n */\nexport type CheckoutTexts = {\n /** Drawer title. */\n cart: string;\n /** Shown when the cart has no products. */\n emptyCart: string;\n /** Label next to the total price. */\n total: string;\n /** Delivery note next to the total price. */\n delivery: string;\n /** Country selector placeholder. */\n chooseCountry: string;\n /** Checkout button label. */\n nextStep: string;\n /** Error shown when some products are out of stock. */\n unavailableProducts: string;\n /** Error shown when the checkout fails and the server gave no reason. */\n checkoutFailed: string;\n /** Error shown when the shop has no payment gateway connected. */\n noPaymentGateway: string;\n /** Error shown when the payment gateway of the shop is not set up. */\n gatewayNotConfigured: string;\n /** Error shown when delivery of the shop is not set up. */\n shippingNotConfigured: string;\n /** Error shown when the cart mixes subscriptions with one-time products. */\n mixedRecurring: string;\n /** Error shown when the cart currency cannot be paid in. */\n currencyUnsupported: string;\n /** Error shown when a price changed after the product was added. */\n priceChanged: string;\n /** Accessible name of the close button of the drawer. */\n close: string;\n /** Remove button of a cart line (also read together with the product name). */\n remove: string;\n /** Accessible name of the quantity control and its input. */\n quantity: string;\n /** Accessible name of the \"+\" quantity button. */\n increaseQuantity: string;\n /** Accessible name of the \"-\" quantity button. */\n decreaseQuantity: string;\n /** Accessible name of the cart button when it only shows an icon. */\n openCart: string;\n /** Hidden label of the number of products badge; the number is appended after a colon. */\n cartItemsCount: string;\n /** Label before the lowest price of the last 30 days; the price is appended. */\n lowestPrice30Days: string;\n /** Shown instead of the lowest price when the price has no history. */\n noPriceHistory: string;\n /** Error shown when redirecting to the payment failed. */\n redirectFailed: string;\n /** Error shown when a subscription is added to the cart. */\n subscriptionUnsupported: string;\n /** Country search placeholder. */\n searchCountry: string;\n /** Shown when the country search has no match. */\n noCountriesFound: string;\n /** Hint under the checkout button when no country is chosen. */\n countryRequired: string;\n /** Title of the Apple Pay and Google Pay sheet total. */\n paymentForCart: string;\n /** Coupon label in the Google Pay sheet; the code is appended. */\n coupon: string;\n /** Note under the cart total. */\n extrasCalculatedNext: string;\n /** Error shown when the products of the cart could not be loaded. */\n loadFailed: string;\n /** Button that loads the cart again. */\n retry: string;\n /** Heading of the payment method choice (shown only when the shop offers paying by hand). */\n paymentMethodLegend: string;\n /** Option that pays through the shop's online gateway. */\n paymentMethodOnline: string;\n /** Hint under the online option. */\n paymentMethodOnlineDescription: string;\n /** Manual option when the seller takes bank transfers only. */\n paymentMethodManualTransfer: string;\n /** Manual option when the seller takes BLIK transfers to a phone number only. */\n paymentMethodManualBlik: string;\n /** Manual option when the seller takes both. */\n paymentMethodManualBoth: string;\n /** What paying by hand means: the details come after the order is placed. */\n paymentMethodManualDescription: string;\n /** Shown with a selected manual option that includes BLIK to a phone number. */\n paymentMethodManualBlikNote: string;\n /** Cash on delivery option. */\n paymentMethodCod: string;\n /** Hint under the cash on delivery option. */\n paymentMethodCodDescription: string;\n /** Error shown when the shop refused cash on delivery for the order. */\n paymentMethodCodUnavailable: string;\n /** Status while the provider confirms a payment started from an express button. */\n expressPending: string;\n /** Status after the provider confirmed the payment. */\n expressConfirmed: string;\n /** Status when the provider reports a failed payment. */\n expressFailed: string;\n /** Status when the buyer cancelled the provider's payment flow. */\n expressCancelled: string;\n /** Shown while the payment is still unconfirmed after a page return. */\n expressPendingLong: string;\n /** Error shown when the provider's button could not be loaded. */\n expressLoadFailed: string;\n /** Error shown when the cart cannot be paid with this provider right now. */\n expressCartUnavailable: string;\n /** Error shown when another tab/provider changed the same cart line. */\n expressCartConflict: string;\n /** Shown when the server total changed between mounting and paying. */\n expressPriceChanged: string;\n /** Error shown when a product could not be added before the InPost binding. */\n expressProductUnavailable: string;\n};\n\nexport type CheckoutTextKey = keyof CheckoutTexts;\n\nexport const CHECKOUT_TEXT_TABLES: LocaleTables<CheckoutTextKey> = {\n en: {\n cart: \"Cart\",\n emptyCart: \"Your cart is empty.\",\n total: \"Total:\",\n delivery: \"+ delivery\",\n chooseCountry: \"Choose a country\",\n nextStep: \"Next step\",\n unavailableProducts: \"Not all products are available.\",\n checkoutFailed: \"Something went wrong. Please try again later.\",\n noPaymentGateway:\n \"This shop doesn't accept online payments yet. Try again later or contact the seller.\",\n gatewayNotConfigured:\n \"Payments in this shop are not set up correctly. Try again later or contact the seller.\",\n shippingNotConfigured:\n \"Delivery in this shop is not configured yet. Try again later or contact the seller.\",\n mixedRecurring:\n \"Subscriptions and one-time products cannot be paid for together. Pay for them in separate orders.\",\n currencyUnsupported:\n \"The shop doesn't accept payments in this currency. Contact the seller.\",\n priceChanged: \"The product price has changed. Refresh the page to see the current price.\",\n close: \"Close cart\",\n remove: \"Remove\",\n quantity: \"Quantity\",\n increaseQuantity: \"Increase quantity\",\n decreaseQuantity: \"Decrease quantity\",\n openCart: \"Open cart\",\n cartItemsCount: \"Items in cart\",\n lowestPrice30Days: \"Lowest price in the last 30 days:\",\n noPriceHistory: \"No price data for the last 30 days\",\n redirectFailed: \"Could not redirect to the payment. Please try again later.\",\n subscriptionUnsupported: \"Subscriptions cannot be added to the cart yet.\",\n searchCountry: \"Find a country\",\n noCountriesFound: \"No countries found\",\n countryRequired: \"Choose a country to continue.\",\n paymentForCart: \"Cart payment\",\n coupon: \"Coupon\",\n extrasCalculatedNext:\n \"Discounts, shipping and taxes are calculated at the next step\",\n loadFailed: \"Could not load your cart.\",\n retry: \"Try again\",\n paymentMethodLegend: \"How would you like to pay?\",\n paymentMethodOnline: \"Pay online\",\n paymentMethodOnlineDescription:\n \"Card, BLIK code or instant bank payment. You pay right away.\",\n paymentMethodManualTransfer: \"Bank transfer\",\n paymentMethodManualBlik: \"BLIK – transfer to a phone number\",\n paymentMethodManualBoth: \"Bank transfer or BLIK to a phone number\",\n paymentMethodManualDescription:\n \"You pay in your bank's app. We show the payment details after you place the order, and the order waits for your payment.\",\n paymentMethodManualBlikNote:\n \"This is not a BLIK code payment – you do not enter a 6‑digit code.\",\n paymentMethodCod: \"Cash on delivery\",\n paymentMethodCodDescription:\n \"You pay the courier in cash or by card when you receive the parcel.\",\n paymentMethodCodUnavailable:\n \"Cash on delivery is not available for this order. Choose another way to pay.\",\n expressPending: \"Confirming your payment…\",\n expressConfirmed: \"Payment confirmed. Thank you!\",\n expressFailed: \"The payment failed. Your cart is unchanged.\",\n expressCancelled: \"Payment cancelled. Your cart is unchanged.\",\n expressPendingLong:\n \"We are still confirming your payment. We will check again when you come back to this page.\",\n expressLoadFailed:\n \"Could not load this payment button. Try again later or use the regular checkout.\",\n expressCartUnavailable:\n \"This cart cannot be paid with this method right now. Try again later.\",\n expressCartConflict:\n \"Your cart changed in another tab or in the provider's app. Review the quantities and try again.\",\n expressPriceChanged:\n \"Your cart total changed. Check the new total and try again.\",\n expressProductUnavailable:\n \"This product cannot be paid for right now. Try again later.\",\n },\n pl: {\n cart: \"Koszyk\",\n emptyCart: \"Brak produktów w koszyku.\",\n total: \"Suma:\",\n delivery: \"+ dostawa\",\n chooseCountry: \"Wybierz kraj\",\n nextStep: \"Następny krok\",\n unavailableProducts: \"Nie wszystkie produkty są dostępne w magazynie.\",\n checkoutFailed: \"Coś poszło nie tak. Spróbuj ponownie później.\",\n noPaymentGateway:\n \"Ten sklep nie przyjmuje jeszcze płatności online. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n gatewayNotConfigured:\n \"Płatności w tym sklepie nie są poprawnie skonfigurowane. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n shippingNotConfigured:\n \"Dostawa w tym sklepie nie jest jeszcze skonfigurowana. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n mixedRecurring:\n \"Subskrypcji i produktów jednorazowych nie można opłacić razem. Opłać je w osobnych zamówieniach.\",\n currencyUnsupported:\n \"Sklep nie przyjmuje płatności w tej walucie. Skontaktuj się ze sprzedawcą.\",\n priceChanged: \"Cena produktu się zmieniła. Odśwież stronę, aby zobaczyć aktualną cenę.\",\n close: \"Zamknij koszyk\",\n remove: \"Usuń\",\n quantity: \"Ilość\",\n increaseQuantity: \"Zwiększ ilość\",\n decreaseQuantity: \"Zmniejsz ilość\",\n openCart: \"Otwórz koszyk\",\n cartItemsCount: \"Produktów w koszyku\",\n lowestPrice30Days: \"Najniższa cena z 30 dni:\",\n noPriceHistory: \"Brak danych o cenie z ostatnich 30 dni\",\n redirectFailed:\n \"Nie udało się przekierować do płatności. Spróbuj ponownie później.\",\n subscriptionUnsupported: \"Subskrypcji nie można jeszcze dodać do koszyka.\",\n searchCountry: \"Znajdź kraj\",\n noCountriesFound: \"Nie znaleziono krajów\",\n countryRequired: \"Wybierz kraj, aby przejść dalej.\",\n paymentForCart: \"Płatność za koszyk\",\n coupon: \"Kupon\",\n extrasCalculatedNext: \"Rabaty, dostawa i podatki w następnym kroku\",\n loadFailed: \"Nie udało się wczytać koszyka.\",\n retry: \"Spróbuj ponownie\",\n paymentMethodLegend: \"Jak chcesz zapłacić?\",\n paymentMethodOnline: \"Zapłać online\",\n paymentMethodOnlineDescription:\n \"Karta, kod BLIK lub szybki przelew. Płacisz od razu.\",\n paymentMethodManualTransfer: \"Przelew bankowy\",\n paymentMethodManualBlik: \"BLIK – przelew na telefon\",\n paymentMethodManualBoth: \"Przelew lub BLIK na telefon\",\n paymentMethodManualDescription:\n \"Zapłacisz w aplikacji swojego banku. Dane do płatności pokażemy po złożeniu zamówienia, a zamówienie poczeka na Twoją wpłatę.\",\n paymentMethodManualBlikNote:\n \"To nie jest płatność kodem BLIK – nie wpisujesz 6‑cyfrowego kodu.\",\n paymentMethodCod: \"Płatność przy odbiorze\",\n paymentMethodCodDescription:\n \"Zapłacisz kurierowi gotówką lub kartą, gdy odbierzesz przesyłkę.\",\n paymentMethodCodUnavailable:\n \"Płatność przy odbiorze nie jest dostępna dla tego zamówienia. Wybierz inną formę płatności.\",\n expressPending: \"Potwierdzamy płatność…\",\n expressConfirmed: \"Płatność potwierdzona. Dziękujemy!\",\n expressFailed: \"Płatność się nie udała. Koszyk pozostał bez zmian.\",\n expressCancelled: \"Płatność została anulowana. Koszyk pozostał bez zmian.\",\n expressPendingLong:\n \"Nadal potwierdzamy Twoją płatność. Sprawdzimy ponownie, gdy wrócisz na tę stronę.\",\n expressLoadFailed:\n \"Nie udało się wczytać przycisku płatności. Spróbuj ponownie później lub skorzystaj ze zwykłego koszyka.\",\n expressCartUnavailable:\n \"Tego koszyka nie można teraz opłacić tą metodą. Spróbuj ponownie później.\",\n expressCartConflict:\n \"Koszyk zmienił się w innej karcie lub w aplikacji przewoźnika. Sprawdź ilości i spróbuj ponownie.\",\n expressPriceChanged:\n \"Suma koszyka się zmieniła. Sprawdź nową sumę i spróbuj ponownie.\",\n expressProductUnavailable:\n \"Nie można teraz zapłacić za ten produkt. Spróbuj ponownie później.\",\n },\n};\n\n/** Default texts for a locale merged with the caller overrides. */\nexport function resolveCheckoutTexts(\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): CheckoutTexts {\n return resolveTexts(CHECKOUT_TEXT_TABLES, locale, overrides);\n}\n\nexport function getCheckoutText(\n key: CheckoutTextKey,\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): string {\n return lookupText(resolveCheckoutTexts(locale, overrides), key);\n}\n","import { pickLocaleTable } from \"@/src/lib/texts\";\nimport { CHECKOUT_TEXT_TABLES } from \"./texts\";\n\nexport const DEFAULT_LOCALE = \"pl-PL\" as const;\nconst localeStorageKey = \"bitsnap-locale\";\n\nlet activeLocale: string | undefined;\n\nexport function setLocale(locale?: string): void {\n const value = locale?.trim();\n activeLocale = value\n ? value.toLowerCase() === \"en\"\n ? \"en-US\"\n : value.toLowerCase() === \"pl\"\n ? DEFAULT_LOCALE\n : value\n : undefined;\n if (typeof localStorage !== \"undefined\") {\n if (activeLocale == null) {\n localStorage.removeItem(localeStorageKey);\n } else {\n localStorage.setItem(localeStorageKey, activeLocale);\n }\n }\n}\n\nexport function getLocale(): string {\n if (activeLocale != null) {\n return activeLocale;\n }\n if (typeof localStorage !== \"undefined\") {\n return localStorage.getItem(localeStorageKey) ?? DEFAULT_LOCALE;\n }\n return DEFAULT_LOCALE;\n}\n\nexport function translate(key: string, locale: string = getLocale()): string {\n return (\n (pickLocaleTable(CHECKOUT_TEXT_TABLES, locale) as Record<string, string>)[\n key\n ] ?? key\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/texts.ts","../src/components/checkout/texts.ts","../src/components/checkout/locale.ts"],"names":["pickLocaleTable","tables","locale","mergeTexts","table","overrides","result","key","value","resolveTexts","lookupText","texts","CHECKOUT_TEXT_TABLES","resolveCheckoutTexts","getCheckoutText","DEFAULT_LOCALE","localeStorageKey","activeLocale","setLocale","getLocale"],"mappings":"AAoBO,0rBAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgB,CAChB,OAAOA,CAAAA,CAAO,WAAA,CAAY,CAAA,CAAE,UAAA,CAAW,IAAI,CAAA,CAAID,CAAAA,CAAO,EAAA,CAAKA,CAAAA,CAAO,EACpE,CAMO,SAASE,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgB,CAChB,IAAMC,CAAAA,CAAiC,CAAE,GAAGF,CAAM,CAAA,CAElD,EAAA,CAAIC,CAAAA,EAAa,IAAA,CACf,GAAA,CAAA,GAAW,CAACE,CAAAA,CAAKC,CAAK,CAAA,GAAK,MAAA,CAAO,OAAA,CAA4BH,CAAS,CAAA,CACjEG,CAAAA,EAAS,IAAA,EAAA,CACXF,CAAAA,CAAOC,CAAG,CAAA,CAAIC,CAAAA,CAAAA,CAKpB,OAAOF,CACT,CAGO,SAASG,CAAAA,CACdR,CAAAA,CACAC,CAAAA,CACAG,CAAAA,CACgB,CAChB,OAAOF,CAAAA,CAAWH,CAAAA,CAAgBC,CAAAA,CAAQC,CAAM,CAAA,CAAGG,CAAS,CAC9D,CAGO,SAASK,CAAAA,CACdC,CAAAA,CACAJ,CAAAA,CACQ,CACR,wBAAQI,CAAAA,CAA6CJ,CAAG,CAAA,SAAKA,GAC/D,CC6DO,IAAMK,CAAAA,CAAsD,CACjE,EAAA,CAAI,CACF,IAAA,CAAM,MAAA,CACN,SAAA,CAAW,qBAAA,CACX,KAAA,CAAO,QAAA,CACP,QAAA,CAAU,YAAA,CACV,aAAA,CAAe,kBAAA,CACf,QAAA,CAAU,WAAA,CACV,mBAAA,CAAqB,iCAAA,CACrB,cAAA,CAAgB,+CAAA,CAChB,gBAAA,CACE,sFAAA,CACF,oBAAA,CACE,wFAAA,CACF,qBAAA,CACE,qFAAA,CACF,cAAA,CACE,mGAAA,CACF,mBAAA,CACE,wEAAA,CACF,YAAA,CAAc,2EAAA,CACd,KAAA,CAAO,YAAA,CACP,MAAA,CAAQ,QAAA,CACR,QAAA,CAAU,UAAA,CACV,gBAAA,CAAkB,mBAAA,CAClB,gBAAA,CAAkB,mBAAA,CAClB,QAAA,CAAU,WAAA,CACV,cAAA,CAAgB,eAAA,CAChB,iBAAA,CAAmB,mCAAA,CACnB,cAAA,CAAgB,oCAAA,CAChB,cAAA,CAAgB,4DAAA,CAChB,uBAAA,CAAyB,gDAAA,CACzB,aAAA,CAAe,gBAAA,CACf,gBAAA,CAAkB,oBAAA,CAClB,eAAA,CAAiB,+BAAA,CACjB,cAAA,CAAgB,cAAA,CAChB,MAAA,CAAQ,QAAA,CACR,oBAAA,CACE,+DAAA,CACF,UAAA,CAAY,2BAAA,CACZ,KAAA,CAAO,WAAA,CACP,mBAAA,CAAqB,4BAAA,CACrB,mBAAA,CAAqB,YAAA,CACrB,8BAAA,CACE,8DAAA,CACF,2BAAA,CAA6B,eAAA,CAC7B,uBAAA,CAAyB,wCAAA,CACzB,uBAAA,CAAyB,yCAAA,CACzB,8BAAA,CACE,0HAAA,CACF,2BAAA,CACE,8EAAA,CACF,gBAAA,CAAkB,kBAAA,CAClB,2BAAA,CACE,qEAAA,CACF,2BAAA,CACE,8EAAA,CACF,cAAA,CAAgB,+BAAA,CAChB,gBAAA,CAAkB,+BAAA,CAClB,aAAA,CAAe,6CAAA,CACf,gBAAA,CAAkB,4CAAA,CAClB,kBAAA,CACE,4FAAA,CACF,iBAAA,CACE,kFAAA,CACF,sBAAA,CACE,uEAAA,CACF,mBAAA,CACE,iGAAA,CACF,mBAAA,CACE,6DAAA,CACF,yBAAA,CACE,6DACJ,CAAA,CACA,EAAA,CAAI,CACF,IAAA,CAAM,QAAA,CACN,SAAA,CAAW,8BAAA,CACX,KAAA,CAAO,OAAA,CACP,QAAA,CAAU,WAAA,CACV,aAAA,CAAe,cAAA,CACf,QAAA,CAAU,oBAAA,CACV,mBAAA,CAAqB,2DAAA,CACrB,cAAA,CAAgB,oEAAA,CAChB,gBAAA,CACE,6IAAA,CACF,oBAAA,CACE,yJAAA,CACF,qBAAA,CACE,wIAAA,CACF,cAAA,CACE,iIAAA,CACF,mBAAA,CACE,gGAAA,CACF,YAAA,CAAc,iHAAA,CACd,KAAA,CAAO,gBAAA,CACP,MAAA,CAAQ,WAAA,CACR,QAAA,CAAU,iBAAA,CACV,gBAAA,CAAkB,8BAAA,CAClB,gBAAA,CAAkB,0BAAA,CAClB,QAAA,CAAU,kBAAA,CACV,cAAA,CAAgB,wBAAA,CAChB,iBAAA,CAAmB,+BAAA,CACnB,cAAA,CAAgB,wCAAA,CAChB,cAAA,CACE,wGAAA,CACF,uBAAA,CAAyB,2DAAA,CACzB,aAAA,CAAe,kBAAA,CACf,gBAAA,CAAkB,0BAAA,CAClB,eAAA,CAAiB,4CAAA,CACjB,cAAA,CAAgB,mCAAA,CAChB,MAAA,CAAQ,OAAA,CACR,oBAAA,CAAsB,kDAAA,CACtB,UAAA,CAAY,+CAAA,CACZ,KAAA,CAAO,qBAAA,CACP,mBAAA,CAAqB,gCAAA,CACrB,mBAAA,CAAqB,yBAAA,CACrB,8BAAA,CACE,2DAAA,CACF,2BAAA,CAA6B,iBAAA,CAC7B,uBAAA,CAAyB,gCAAA,CACzB,uBAAA,CAAyB,6BAAA,CACzB,8BAAA,CACE,kLAAA,CACF,2BAAA,CACE,4FAAA,CACF,gBAAA,CAAkB,uCAAA,CAClB,2BAAA,CACE,8FAAA,CACF,2BAAA,CACE,wIAAA,CACF,cAAA,CAAgB,4CAAA,CAChB,gBAAA,CAAkB,wDAAA,CAClB,aAAA,CAAe,kFAAA,CACf,gBAAA,CAAkB,iFAAA,CAClB,kBAAA,CACE,oHAAA,CACF,iBAAA,CACE,kJAAA,CACF,sBAAA,CACE,+GAAA,CACF,mBAAA,CACE,+HAAA,CACF,mBAAA,CACE,8FAAA,CACF,yBAAA,CACE,8FACJ,CACF,CAAA,CAGO,SAASC,CAAAA,CACdX,CAAAA,CACAG,CAAAA,CACe,CACf,OAAOI,CAAAA,CAAaG,CAAAA,CAAsBV,CAAAA,CAAQG,CAAS,CAC7D,CAEO,SAASS,CAAAA,CACdP,CAAAA,CACAL,CAAAA,CACAG,CAAAA,CACQ,CACR,OAAOK,CAAAA,CAAWG,CAAAA,CAAqBX,CAAAA,CAAQG,CAAS,CAAA,CAAGE,CAAG,CAChE,CC5RO,IAAMQ,CAAAA,CAAiB,OAAA,CACxBC,CAAAA,CAAmB,gBAAA,CAErBC,CAAAA,CAEG,SAASC,CAAAA,CAAUhB,CAAAA,CAAuB,CAC/C,IAAMM,CAAAA,iBAAQN,CAAAA,2BAAQ,IAAA,mBAAK,GAAA,CAC3Be,CAAAA,CAAeT,CAAAA,CACXA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtB,OAAA,CACAA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtBO,CAAAA,CACAP,CAAAA,CACJ,KAAA,CAAA,CACA,OAAO,YAAA,CAAiB,GAAA,EAAA,CACtBS,CAAAA,EAAgB,IAAA,CAClB,YAAA,CAAa,UAAA,CAAWD,CAAgB,CAAA,CAExC,YAAA,CAAa,OAAA,CAAQA,CAAAA,CAAkBC,CAAY,CAAA,CAGzD,CAEO,SAASE,CAAAA,CAAAA,CAAoB,CAClC,wBAAIF,CAAAA,SAAAA,CAGA,OAAO,YAAA,CAAiB,GAAA,kBACnB,YAAA,CAAa,OAAA,CAAQD,CAAgB,CAAA,SAAKD,GAAAA,CAE5CA,CAAAA,GACT,CAAA,yFAAA","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/chunk-Q337IQNA.js","sourcesContent":["/**\n * Shared text machinery: typed string tables per locale, the locale fallback\n * and a merge with caller overrides. Each module (checkout, later returns)\n * supplies its own key type and default tables.\n */\n\n/** Strings of one locale, keyed by text key. */\nexport type TextTable<Key extends string> = Record<Key, string>;\n\n/** Default tables for the supported locales. */\nexport type LocaleTables<Key extends string> = {\n en: TextTable<Key>;\n pl: TextTable<Key>;\n};\n\n/**\n * Picks the table for a locale. Any locale starting with `en` (case\n * insensitive, so `en`, `en-US`, `EN-gb`) gets English; everything else,\n * including unknown locales, gets the Polish default.\n */\nexport function pickLocaleTable<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n): TextTable<Key> {\n return locale.toLowerCase().startsWith(\"en\") ? tables.en : tables.pl;\n}\n\n/**\n * Merges caller overrides over a table. Overrides apply regardless of the\n * locale; `undefined`/`null` entries are ignored so the default stays.\n */\nexport function mergeTexts<Key extends string>(\n table: TextTable<Key>,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n const result: Record<string, string> = { ...table };\n\n if (overrides != null) {\n for (const [key, value] of Object.entries<string | undefined>(overrides)) {\n if (value != null) {\n result[key] = value;\n }\n }\n }\n\n return result as TextTable<Key>;\n}\n\n/** Locale table merged with the caller overrides. */\nexport function resolveTexts<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n return mergeTexts(pickLocaleTable(tables, locale), overrides);\n}\n\n/** Looks up a single text. Unknown keys return the key itself. */\nexport function lookupText<Key extends string>(\n texts: TextTable<Key>,\n key: Key,\n): string {\n return (texts as Record<string, string | undefined>)[key] ?? key;\n}\n","import {\n lookupText,\n resolveTexts,\n type LocaleTables,\n} from \"@/src/lib/texts\";\n\n/**\n * Every string the checkout renders. Pass a partial object through the\n * `texts` prop of `BitsnapCheckout` to override any of them, whatever the\n * locale.\n */\nexport type CheckoutTexts = {\n /** Drawer title. */\n cart: string;\n /** Shown when the cart has no products. */\n emptyCart: string;\n /** Label next to the total price. */\n total: string;\n /** Delivery note next to the total price. */\n delivery: string;\n /** Country selector placeholder. */\n chooseCountry: string;\n /** Checkout button label. */\n nextStep: string;\n /** Error shown when some products are out of stock. */\n unavailableProducts: string;\n /** Error shown when the checkout fails and the server gave no reason. */\n checkoutFailed: string;\n /** Error shown when the shop has no payment gateway connected. */\n noPaymentGateway: string;\n /** Error shown when the payment gateway of the shop is not set up. */\n gatewayNotConfigured: string;\n /** Error shown when delivery of the shop is not set up. */\n shippingNotConfigured: string;\n /** Error shown when the cart mixes subscriptions with one-time products. */\n mixedRecurring: string;\n /** Error shown when the cart currency cannot be paid in. */\n currencyUnsupported: string;\n /** Error shown when a price changed after the product was added. */\n priceChanged: string;\n /** Accessible name of the close button of the drawer. */\n close: string;\n /** Remove button of a cart line (also read together with the product name). */\n remove: string;\n /** Accessible name of the quantity control and its input. */\n quantity: string;\n /** Accessible name of the \"+\" quantity button. */\n increaseQuantity: string;\n /** Accessible name of the \"-\" quantity button. */\n decreaseQuantity: string;\n /** Accessible name of the cart button when it only shows an icon. */\n openCart: string;\n /** Hidden label of the number of products badge; the number is appended after a colon. */\n cartItemsCount: string;\n /** Label before the lowest price of the last 30 days; the price is appended. */\n lowestPrice30Days: string;\n /** Shown instead of the lowest price when the price has no history. */\n noPriceHistory: string;\n /** Error shown when redirecting to the payment failed. */\n redirectFailed: string;\n /** Error shown when a subscription is added to the cart. */\n subscriptionUnsupported: string;\n /** Country search placeholder. */\n searchCountry: string;\n /** Shown when the country search has no match. */\n noCountriesFound: string;\n /** Hint under the checkout button when no country is chosen. */\n countryRequired: string;\n /** Title of the Apple Pay and Google Pay sheet total. */\n paymentForCart: string;\n /** Coupon label in the Google Pay sheet; the code is appended. */\n coupon: string;\n /** Note under the cart total. */\n extrasCalculatedNext: string;\n /** Error shown when the products of the cart could not be loaded. */\n loadFailed: string;\n /** Button that loads the cart again. */\n retry: string;\n /** Heading of the payment method choice (shown only when the shop offers paying by hand). */\n paymentMethodLegend: string;\n /** Option that pays through the shop's online gateway. */\n paymentMethodOnline: string;\n /** Hint under the online option. */\n paymentMethodOnlineDescription: string;\n /** Manual option when the seller takes bank transfers only. */\n paymentMethodManualTransfer: string;\n /** Manual option when the seller takes BLIK transfers to a phone number only. */\n paymentMethodManualBlik: string;\n /** Manual option when the seller takes both. */\n paymentMethodManualBoth: string;\n /** What paying by hand means: the details come after the order is placed. */\n paymentMethodManualDescription: string;\n /** Shown with a selected manual option that includes BLIK to a phone number. */\n paymentMethodManualBlikNote: string;\n /** Cash on delivery option. */\n paymentMethodCod: string;\n /** Hint under the cash on delivery option. */\n paymentMethodCodDescription: string;\n /** Error shown when the shop refused cash on delivery for the order. */\n paymentMethodCodUnavailable: string;\n /** Status while the provider confirms a payment started from an express button. */\n expressPending: string;\n /** Status after the provider confirmed the payment. */\n expressConfirmed: string;\n /** Status when the provider reports a failed payment. */\n expressFailed: string;\n /** Status when the buyer cancelled the provider's payment flow. */\n expressCancelled: string;\n /** Shown while the payment is still unconfirmed after a page return. */\n expressPendingLong: string;\n /** Error shown when the provider's button could not be loaded. */\n expressLoadFailed: string;\n /** Error shown when the cart cannot be paid with this provider right now. */\n expressCartUnavailable: string;\n /** Error shown when another tab/provider changed the same cart line. */\n expressCartConflict: string;\n /** Shown when the server total changed between mounting and paying. */\n expressPriceChanged: string;\n /** Error shown when a product could not be added before the InPost binding. */\n expressProductUnavailable: string;\n};\n\nexport type CheckoutTextKey = keyof CheckoutTexts;\n\nexport const CHECKOUT_TEXT_TABLES: LocaleTables<CheckoutTextKey> = {\n en: {\n cart: \"Cart\",\n emptyCart: \"Your cart is empty.\",\n total: \"Total:\",\n delivery: \"+ delivery\",\n chooseCountry: \"Choose a country\",\n nextStep: \"Next step\",\n unavailableProducts: \"Not all products are available.\",\n checkoutFailed: \"Something went wrong. Please try again later.\",\n noPaymentGateway:\n \"This shop doesn't accept online payments yet. Try again later or contact the seller.\",\n gatewayNotConfigured:\n \"Payments in this shop are not set up correctly. Try again later or contact the seller.\",\n shippingNotConfigured:\n \"Delivery in this shop is not configured yet. Try again later or contact the seller.\",\n mixedRecurring:\n \"Subscriptions and one-time products cannot be paid for together. Pay for them in separate orders.\",\n currencyUnsupported:\n \"The shop doesn't accept payments in this currency. Contact the seller.\",\n priceChanged: \"The product price has changed. Refresh the page to see the current price.\",\n close: \"Close cart\",\n remove: \"Remove\",\n quantity: \"Quantity\",\n increaseQuantity: \"Increase quantity\",\n decreaseQuantity: \"Decrease quantity\",\n openCart: \"Open cart\",\n cartItemsCount: \"Items in cart\",\n lowestPrice30Days: \"Lowest price in the last 30 days:\",\n noPriceHistory: \"No price data for the last 30 days\",\n redirectFailed: \"Could not redirect to the payment. Please try again later.\",\n subscriptionUnsupported: \"Subscriptions cannot be added to the cart yet.\",\n searchCountry: \"Find a country\",\n noCountriesFound: \"No countries found\",\n countryRequired: \"Choose a country to continue.\",\n paymentForCart: \"Cart payment\",\n coupon: \"Coupon\",\n extrasCalculatedNext:\n \"Discounts, shipping and taxes are calculated at the next step\",\n loadFailed: \"Could not load your cart.\",\n retry: \"Try again\",\n paymentMethodLegend: \"How would you like to pay?\",\n paymentMethodOnline: \"Pay online\",\n paymentMethodOnlineDescription:\n \"Card, BLIK code or instant bank payment. You pay right away.\",\n paymentMethodManualTransfer: \"Bank transfer\",\n paymentMethodManualBlik: \"BLIK – transfer to a phone number\",\n paymentMethodManualBoth: \"Bank transfer or BLIK to a phone number\",\n paymentMethodManualDescription:\n \"You pay in your bank's app. We show the payment details after you place the order, and the order waits for your payment.\",\n paymentMethodManualBlikNote:\n \"This is not a BLIK code payment – you do not enter a 6‑digit code.\",\n paymentMethodCod: \"Cash on delivery\",\n paymentMethodCodDescription:\n \"You pay the courier in cash or by card when you receive the parcel.\",\n paymentMethodCodUnavailable:\n \"Cash on delivery is not available for this order. Choose another way to pay.\",\n expressPending: \"Confirming your payment…\",\n expressConfirmed: \"Payment confirmed. Thank you!\",\n expressFailed: \"The payment failed. Your cart is unchanged.\",\n expressCancelled: \"Payment cancelled. Your cart is unchanged.\",\n expressPendingLong:\n \"We are still confirming your payment. We will check again when you come back to this page.\",\n expressLoadFailed:\n \"Could not load this payment button. Try again later or use the regular checkout.\",\n expressCartUnavailable:\n \"This cart cannot be paid with this method right now. Try again later.\",\n expressCartConflict:\n \"Your cart changed in another tab or in the provider's app. Review the quantities and try again.\",\n expressPriceChanged:\n \"Your cart total changed. Check the new total and try again.\",\n expressProductUnavailable:\n \"This product cannot be paid for right now. Try again later.\",\n },\n pl: {\n cart: \"Koszyk\",\n emptyCart: \"Brak produktów w koszyku.\",\n total: \"Suma:\",\n delivery: \"+ dostawa\",\n chooseCountry: \"Wybierz kraj\",\n nextStep: \"Następny krok\",\n unavailableProducts: \"Nie wszystkie produkty są dostępne w magazynie.\",\n checkoutFailed: \"Coś poszło nie tak. Spróbuj ponownie później.\",\n noPaymentGateway:\n \"Ten sklep nie przyjmuje jeszcze płatności online. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n gatewayNotConfigured:\n \"Płatności w tym sklepie nie są poprawnie skonfigurowane. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n shippingNotConfigured:\n \"Dostawa w tym sklepie nie jest jeszcze skonfigurowana. Spróbuj ponownie później lub skontaktuj się ze sprzedawcą.\",\n mixedRecurring:\n \"Subskrypcji i produktów jednorazowych nie można opłacić razem. Opłać je w osobnych zamówieniach.\",\n currencyUnsupported:\n \"Sklep nie przyjmuje płatności w tej walucie. Skontaktuj się ze sprzedawcą.\",\n priceChanged: \"Cena produktu się zmieniła. Odśwież stronę, aby zobaczyć aktualną cenę.\",\n close: \"Zamknij koszyk\",\n remove: \"Usuń\",\n quantity: \"Ilość\",\n increaseQuantity: \"Zwiększ ilość\",\n decreaseQuantity: \"Zmniejsz ilość\",\n openCart: \"Otwórz koszyk\",\n cartItemsCount: \"Produktów w koszyku\",\n lowestPrice30Days: \"Najniższa cena z 30 dni:\",\n noPriceHistory: \"Brak danych o cenie z ostatnich 30 dni\",\n redirectFailed:\n \"Nie udało się przekierować do płatności. Spróbuj ponownie później.\",\n subscriptionUnsupported: \"Subskrypcji nie można jeszcze dodać do koszyka.\",\n searchCountry: \"Znajdź kraj\",\n noCountriesFound: \"Nie znaleziono krajów\",\n countryRequired: \"Wybierz kraj, aby przejść dalej.\",\n paymentForCart: \"Płatność za koszyk\",\n coupon: \"Kupon\",\n extrasCalculatedNext: \"Rabaty, dostawa i podatki w następnym kroku\",\n loadFailed: \"Nie udało się wczytać koszyka.\",\n retry: \"Spróbuj ponownie\",\n paymentMethodLegend: \"Jak chcesz zapłacić?\",\n paymentMethodOnline: \"Zapłać online\",\n paymentMethodOnlineDescription:\n \"Karta, kod BLIK lub szybki przelew. Płacisz od razu.\",\n paymentMethodManualTransfer: \"Przelew bankowy\",\n paymentMethodManualBlik: \"BLIK – przelew na telefon\",\n paymentMethodManualBoth: \"Przelew lub BLIK na telefon\",\n paymentMethodManualDescription:\n \"Zapłacisz w aplikacji swojego banku. Dane do płatności pokażemy po złożeniu zamówienia, a zamówienie poczeka na Twoją wpłatę.\",\n paymentMethodManualBlikNote:\n \"To nie jest płatność kodem BLIK – nie wpisujesz 6‑cyfrowego kodu.\",\n paymentMethodCod: \"Płatność przy odbiorze\",\n paymentMethodCodDescription:\n \"Zapłacisz kurierowi gotówką lub kartą, gdy odbierzesz przesyłkę.\",\n paymentMethodCodUnavailable:\n \"Płatność przy odbiorze nie jest dostępna dla tego zamówienia. Wybierz inną formę płatności.\",\n expressPending: \"Potwierdzamy płatność…\",\n expressConfirmed: \"Płatność potwierdzona. Dziękujemy!\",\n expressFailed: \"Płatność się nie udała. Koszyk pozostał bez zmian.\",\n expressCancelled: \"Płatność została anulowana. Koszyk pozostał bez zmian.\",\n expressPendingLong:\n \"Nadal potwierdzamy Twoją płatność. Sprawdzimy ponownie, gdy wrócisz na tę stronę.\",\n expressLoadFailed:\n \"Nie udało się wczytać przycisku płatności. Spróbuj ponownie później lub skorzystaj ze zwykłego koszyka.\",\n expressCartUnavailable:\n \"Tego koszyka nie można teraz opłacić tą metodą. Spróbuj ponownie później.\",\n expressCartConflict:\n \"Koszyk zmienił się w innej karcie lub w aplikacji przewoźnika. Sprawdź ilości i spróbuj ponownie.\",\n expressPriceChanged:\n \"Suma koszyka się zmieniła. Sprawdź nową sumę i spróbuj ponownie.\",\n expressProductUnavailable:\n \"Nie można teraz zapłacić za ten produkt. Spróbuj ponownie później.\",\n },\n};\n\n/** Default texts for a locale merged with the caller overrides. */\nexport function resolveCheckoutTexts(\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): CheckoutTexts {\n return resolveTexts(CHECKOUT_TEXT_TABLES, locale, overrides);\n}\n\nexport function getCheckoutText(\n key: CheckoutTextKey,\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): string {\n return lookupText(resolveCheckoutTexts(locale, overrides), key);\n}\n","import { pickLocaleTable } from \"@/src/lib/texts\";\nimport { CHECKOUT_TEXT_TABLES } from \"./texts\";\n\nexport const DEFAULT_LOCALE = \"pl-PL\" as const;\nconst localeStorageKey = \"bitsnap-locale\";\n\nlet activeLocale: string | undefined;\n\nexport function setLocale(locale?: string): void {\n const value = locale?.trim();\n activeLocale = value\n ? value.toLowerCase() === \"en\"\n ? \"en-US\"\n : value.toLowerCase() === \"pl\"\n ? DEFAULT_LOCALE\n : value\n : undefined;\n if (typeof localStorage !== \"undefined\") {\n if (activeLocale == null) {\n localStorage.removeItem(localeStorageKey);\n } else {\n localStorage.setItem(localeStorageKey, activeLocale);\n }\n }\n}\n\nexport function getLocale(): string {\n if (activeLocale != null) {\n return activeLocale;\n }\n if (typeof localStorage !== \"undefined\") {\n return localStorage.getItem(localeStorageKey) ?? DEFAULT_LOCALE;\n }\n return DEFAULT_LOCALE;\n}\n\nexport function translate(key: string, locale: string = getLocale()): string {\n return (\n (pickLocaleTable(CHECKOUT_TEXT_TABLES, locale) as Record<string, string>)[\n key\n ] ?? key\n );\n}\n"]}
|
|
@@ -0,0 +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; } 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 _chunkKZWCVKLUjs = require('./chunk-KZWCVKLU.js');var _chunkHP3I6D2Rjs = require('./chunk-HP3I6D2R.js');var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunkYPA6MMGJjs = require('./chunk-YPA6MMGJ.js');var _chunk4Y233NIIjs = require('./chunk-4Y233NII.js');var _chunkIRZJIPUFjs = require('./chunk-IRZJIPUF.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');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 Ee = _interopRequireWildcard(_reactdialog); var ae = _interopRequireWildcard(_reactdialog);var _reactdom = require('react-dom');var Ta=["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"],Na={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"},Ra={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)"}},Aa=[{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 Da(e){return{"--popover":_nullishCoalesce(e.surface, () => ("var(--color-neutral-800)")),"--popover-foreground":_nullishCoalesce(e.foreground, () => ("var(--color-neutral-200)"))}}function Sn(e){let t=_chunkKOYBZORLjs.a.call(void 0, e,{defaultTheme:"dark",presets:Ra,variables:Na,shadcnVariables:Aa});return{theme:t.theme,isCustomized:t.isCustomized,tokens:t.tokens,elements:t.elements,boundaryClassName:t.theme,boundaryStyle:t.boundaryStyle,dropdownStyle:Da(t.tokens)}}function qo(e,t){return _chunkKOYBZORLjs.b.call(void 0, e.elements,t)}var _jsxruntime = require('react/jsx-runtime');var zo=_react.createContext.call(void 0, Sn());function ct({appearance:e,children:t}){let n=_react.useMemo.call(void 0, ()=>Sn(e),[e]);return _jsxruntime.jsx.call(void 0, zo.Provider,{value:n,children:t})}function kt(){return _react.useContext.call(void 0, zo)}function L(e){let t=kt();return _nullishCoalesce(qo(t,e), () => ({}))}var _reactselect = require('@radix-ui/react-select'); var G = _interopRequireWildcard(_reactselect);var _lucidereact = require('lucide-react');function Fo({...e}){return _jsxruntime.jsx.call(void 0, G.Root,{"data-slot":"select",...e})}function Wo({...e}){return _jsxruntime.jsx.call(void 0, G.Value,{"data-slot":"select-value",...e})}var ja="border-input dark:bg-input/30 dark:hover:bg-input/50 bg-transparent";function Ho({className:e,size:t="default",theme:n="default",children:o,...r}){return _jsxruntime.jsxs.call(void 0, G.Trigger,{"data-slot":"select-trigger","data-size":t,className:_chunk4Y233NIIjs.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",n==="bare"?"":ja,e),...r,children:[o,_jsxruntime.jsx.call(void 0, G.Icon,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Ko({className:e,children:t,position:n="popper",align:o="center",...r}){return _jsxruntime.jsx.call(void 0, G.Portal,{children:_jsxruntime.jsxs.call(void 0, G.Content,{"data-slot":"select-content",className:_chunk4Y233NIIjs.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",n==="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",e),position:n,align:o,...r,children:[_jsxruntime.jsx.call(void 0, qa,{}),_jsxruntime.jsx.call(void 0, G.Viewport,{className:_chunk4Y233NIIjs.g.call(void 0, "p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),_jsxruntime.jsx.call(void 0, za,{})]})})}function Vo({className:e,children:t,...n}){return _jsxruntime.jsxs.call(void 0, G.Item,{"data-slot":"select-item",className:_chunk4Y233NIIjs.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",e),...n,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:t})]})}function qa({className:e,...t}){return _jsxruntime.jsx.call(void 0, G.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:_chunk4Y233NIIjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",e),...t,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronUpIcon,{className:"size-4"})})}function za({className:e,...t}){return _jsxruntime.jsx.call(void 0, G.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:_chunk4Y233NIIjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",e),...t,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4"})})}function Wa({id:e,open:t,disabled:n=!1,onToggle:o,onChange:r,selectedValue:a,countries:i}){let[l,c]=_react.useState.call(void 0, ""),{isCustomized:p,boundaryClassName:s,boundaryStyle:y,dropdownStyle:v}=kt(),m=L("countryTrigger"),g=L("countryDropdown"),d=L("countrySearch"),I=L("countryOption"),R=_chunkKZWCVKLUjs.z.call(void 0, "searchCountry"),h=_chunkKZWCVKLUjs.z.call(void 0, "noCountriesFound");_react.useEffect.call(void 0, ()=>{a==null&&i.length>0&&r(i[0].code)},[]);let b=i.filter(x=>x.name.toLowerCase().startsWith(l.toLowerCase())),A=i.find(x=>x.code===a);return _jsxruntime.jsxs.call(void 0, Fo,{value:a,onValueChange:x=>{r(x),c("")},open:t,onOpenChange:x=>{x!==t&&o(),x||c("")},disabled:n,children:[_jsxruntime.jsx.call(void 0, Ho,{"data-bitsnap-checkout-slot":"countryTrigger",theme:"bare",className:_chunk4Y233NIIjs.g.call(void 0, n?"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, Wo,{children:A&&_jsxruntime.jsxs.call(void 0, "span",{className:"truncate flex items-center",children:[_jsxruntime.jsx.call(void 0, "img",{alt:a,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${a}.svg`,className:"inline mr-2 h-4 rounded-sm"}),A.name]})})}),_jsxruntime.jsxs.call(void 0, Ko,{"data-bitsnap-checkout":p?"dropdown":void 0,"data-bitsnap-checkout-slot":p?"countryDropdown":void 0,className:_chunk4Y233NIIjs.g.call(void 0, p?"bitsnap-react":"",s,"w-full max-h-80 max-w-[350px] z-[999999]",g.className),style:{...p?{...y,...v}:void 0,...g.style},position:"popper",children:[_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"countrySearch",className:_chunk4Y233NIIjs.g.call(void 0, "sticky top-0 z-10 p-1 border-b",d.className),style:d.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:l,onChange:x=>c(x.target.value),onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation()})}),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-64 overflow-y-auto",children:b.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"cursor-default select-none relative py-2 pl-3 pr-9 text-sm",children:h}):b.map(x=>_jsxruntime.jsxs.call(void 0, Vo,{"data-bitsnap-checkout-slot":"countryOption",value:x.code,className:_chunk4Y233NIIjs.g.call(void 0, "cursor-default select-none relative py-2 pl-3 pr-9 flex items-center transition",I.className),style:I.style,children:[_jsxruntime.jsx.call(void 0, "img",{alt:x.code,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${x.code}.svg`,className:"inline mr-2 h-4 rounded-sm"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-normal truncate",children:x.name})]},`${e}-${x.code}`))})]})]})}var $o=Wa;var _reactslot = require('@radix-ui/react-slot');var _classvarianceauthority = require('class-variance-authority');var Ka=_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 Qo({className:e,orientation:t,...n}){return _jsxruntime.jsx.call(void 0, "div",{role:"group","data-slot":"button-group","data-orientation":t,className:_chunk4Y233NIIjs.g.call(void 0, Ka({orientation:t}),e),...n})}function Xo({price:e,currency:t,pricing:n,quantity:o=1}){let r=_chunkKZWCVKLUjs.z.call(void 0, "lowestPrice30Days"),a=_chunkKZWCVKLUjs.z.call(void 0, "noPriceHistory"),i=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _2 => _2.regularPrice]), () => (e)),l=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _3 => _3.effectivePrice]), () => (e)),c=_optionalChain([n, 'optionalAccess', _4 => _4.discount, 'optionalAccess', _5 => _5.status])==="ACTIVE"&&l<i;return _jsxruntime.jsx.call(void 0, "span",{children:c?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-2 text-neutral-500 line-through",children:_chunkKZWCVKLUjs.C.call(void 0, i*o,t)}),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold text-red-700",children:_chunkKZWCVKLUjs.C.call(void 0, l*o,t)}),_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block text-xs text-neutral-600",children:_optionalChain([n, 'optionalAccess', _6 => _6.referencePrice, 'access', _7 => _7.historyAvailable])&&n.referencePrice.amount!=null?`${r} ${_chunkKZWCVKLUjs.C.call(void 0, n.referencePrice.amount,t)}`:a})]}):_chunkKZWCVKLUjs.C.call(void 0, l*o,t)})}function Wt(e){return Number.isFinite(e)?Math.min(99,Math.max(1,Math.trunc(e))):1}function Tn(e,t){let n=parseInt(e,10);return Number.isNaN(n)?t:Wt(n)}var Ja=({isNotAvailable:e,quantity:t,details:n,url:o,shouldUpdate:r})=>{let a=L("product"),i=L("productImage"),l=L("productName"),c=L("productPrice"),p=L("removeButton"),s=_chunkKZWCVKLUjs.z.call(void 0, "remove"),y=_nullishCoalesce(n.image_url, () => (_optionalChain([n, 'access', _8 => _8.images, 'optionalAccess', _9 => _9[0]]))),[v,m]=_react.useState.call(void 0, ),g=y!=null&&y.length>0&&y!==v,d=_nullishCoalesce(n.baseName, () => (n.name));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"product","data-bitsnap-checkout-unavailable":e?"":void 0,className:_chunk4Y233NIIjs.g.call(void 0, "flex items-center gap-3 mx-3",e?"outline outline-1 rounded-md m-1":"",a.className),style:a.style,children:[g&&_jsxruntime.jsx.call(void 0, Zo,{url:o,tabIndex:-1,"aria-hidden":"true",className:"contents",children:_jsxruntime.jsx.call(void 0, "img",{"data-bitsnap-checkout-slot":"productImage",className:_chunk4Y233NIIjs.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:y,alt:"",onError:()=>m(y)})}),_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:_chunk4Y233NIIjs.g.call(void 0, "font-medium",l.className),style:l.style,children:_jsxruntime.jsx.call(void 0, Zo,{url:o,className:"text-inherit no-underline hover:underline",children:d})}),n.variantName!=null&&n.variantName.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm opacity-70",children:n.variantName}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productPrice",className:_chunk4Y233NIIjs.g.call(void 0, "text-sm",c.className),style:c.style,suppressHydrationWarning:!0,children:_jsxruntime.jsx.call(void 0, Xo,{price:n.price,currency:n.currency,pricing:n.pricing,quantity:t})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between",children:[_jsxruntime.jsx.call(void 0, ei,{className:"",quantity:t,shouldUpdate:r}),_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{"data-bitsnap-checkout-slot":"removeButton",type:"button",variant:"ghost",size:"sm",className:p.className,style:p.style,"aria-label":`${s}: ${n.name}`,onClick:()=>{Promise.resolve(r(0)).catch(()=>{})},children:s})]})]})]})},er=Ja,Zo=({url:e,children:t,...n})=>e==null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t}):_jsxruntime.jsx.call(void 0, "a",{href:e,...n,children:t}),ei=({quantity:e,shouldUpdate:t,className:n})=>{let[o,r]=_react.useState.call(void 0, e.toString()),a=_react.useRef.call(void 0, e),i=L("quantityControl"),l=L("quantityInput"),c=L("quantityButton"),p=_chunkKZWCVKLUjs.z.call(void 0, "quantity"),s=_chunkKZWCVKLUjs.z.call(void 0, "increaseQuantity"),y=_chunkKZWCVKLUjs.z.call(void 0, "decreaseQuantity"),v=_react.useRef.call(void 0, e);v.current=e,_react.useEffect.call(void 0, ()=>{a.current=e,r(e.toString())},[e]);function m(g){r(g.toString()),g!==a.current&&(a.current=g,Promise.resolve(t(g)).catch(()=>{a.current===g&&(a.current=v.current,r(v.current.toString()))}))}return _jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"quantityControl",className:_chunk4Y233NIIjs.g.call(void 0, "flex",n,i.className),style:i.style,children:_jsxruntime.jsxs.call(void 0, Qo,{"aria-label":p,children:[_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:c.className,style:c.style,"aria-label":y,onClick:()=>m(Wt(a.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:_chunk4Y233NIIjs.g.call(void 0, "w-8 bg-transparent text-center",l.className),style:l.style,value:o,"aria-label":p,inputMode:"numeric",pattern:"[0-9]*",onChange:g=>r(g.currentTarget.value),onBlur:g=>m(Tn(g.currentTarget.value,a.current)),onKeyDown:g=>{g.key==="Enter"&&m(Tn(g.currentTarget.value,a.current))},type:"text"}),_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:c.className,style:c.style,"aria-label":s,onClick:()=>m(Wt(a.current+1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon,{"aria-hidden":"true"})})]})})};function Nn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"skeleton",className:"bg-neutral-700 animate-pulse rounded-md "+e,...t})}var _applepaybutton = require('apple-pay-button'); var _applepaybutton2 = _interopRequireDefault(_applepaybutton);function ke(){try{return _chunkKZWCVKLUjs.K.call(void 0, )}catch (e2){return}}var _reactquery = require('@tanstack/react-query');var oi=_nullishCoalesce(_applepaybutton2.default.default, () => (_applepaybutton2.default));function ri({style:e,buttonType:t,colorType:n,items:o,onClick:r}){let{checkIfApplePayIsAvailable:a,getApplePayPaymentRequest:i,completeApplePayPayment:l,setCountry:c,setCouponCodeIfPossible:p,setDeliveryMethod:s,setEmail:y,setPostalCode:v,clearCart:m,getApplePayPreview:g}=_chunkKZWCVKLUjs.O.call(void 0, ),d=_chunkIRZJIPUFjs.m.call(void 0, ),I=_chunkKZWCVKLUjs.z.call(void 0, "paymentForCart"),{data:R}=_reactquery.useQuery.call(void 0, {queryKey:["is-apple-pay-available"],queryFn:a}),h=o.map(S=>`${S.id}:${S.quantity}`).join(","),b=_chunkKZWCVKLUjs.L.call(void 0, ),{data:A}=_reactquery.useQuery.call(void 0, {queryKey:["apple-pay-preview",h,_nullishCoalesce(b.country, () => ("")),_nullishCoalesce(b.couponCode, () => ("")),_nullishCoalesce(b.selectedDeliveryMethod, () => ("")),_nullishCoalesce(b.postalCode, () => (""))],queryFn:()=>g({items:o.map(S=>({productID:S.id,quantity:S.quantity,metadata:S.metadata}))}),enabled:R===!0});if(R!=!0)return null;let x=A!=null&&!_chunkKZWCVKLUjs.l.call(void 0, A)?A:{countryCode:b.country||"PL",currencyCode:_nullishCoalesce(_optionalChain([o, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.currency]), () => ("PLN")),totalAmount:`${_chunkKZWCVKLUjs.B.call(void 0, o.reduce((S,T)=>S+T.price*T.quantity,0)/100,2)}`},E=o.map(S=>({productID:S.id,quantity:S.quantity,metadata:S.metadata}));async function D(){let S=!1,T=f=>{S||(S=!0,d.track("apple_pay_result",{outcome:f}))};d.track("apple_pay_clicked",{}),d.track("payment_method_selected",{gateway:"apple_pay",method:"apple_pay"}),_chunkKZWCVKLUjs.D.call(void 0, {event:"initiateCheckout",items:o.map(f=>({id:f.id,name:f.name,price:f.price,quantity:f.quantity,currency:x.currencyCode}))});let w=o.find(f=>f.isDeliverable===!0)!=null,C=new ApplePaySession(14,{countryCode:x.countryCode,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard"],currencyCode:x.currencyCode,total:{amount:x.totalAmount,label:I,type:"pending"},lineItems:o.map(f=>({amount:`${_chunkKZWCVKLUjs.B.call(void 0, f.price*f.quantity/100,2)}`,label:f.name,type:"final"})),...w?{shippingMethods:[],supportsCouponCode:!0,requiredBillingContactFields:["name","email","postalAddress","phone"],requiredShippingContactFields:["name","email","postalAddress","phone"]}:{}});await _optionalChain([r, 'optionalCall', _12 => _12()]);let U=await i({expectedItems:E});if(_chunkKZWCVKLUjs.l.call(void 0, U)){console.error("Error creating ApplePaySession:",U.error),T("fail");return}C.oncancel=f=>{console.log("ApplePaySession cancelled",f),T("cancel")},C.onvalidatemerchant=async f=>{try{let k=await _chunkKZWCVKLUjs.a.get(_chunk4Y233NIIjs.e).applePayValidateMerchant({validationUrl:f.validationURL,projectId:_chunkKZWCVKLUjs.K.call(void 0, )});console.log("merchantSession",k.merchantSession),k.merchantSession.length>0?(console.log("completing merchant session"),C.completeMerchantValidation(JSON.parse(k.merchantSession))):C.abort()}catch (e3){C.abort()}},C.onshippingmethodselected=async f=>{console.log("shipping method selected",f),d.track("delivery_method_selected",{method:f.shippingMethod.identifier}),await s(f.shippingMethod.identifier);let k=await i({expectedItems:E});if(console.log("apRequest",k),_chunkKZWCVKLUjs.l.call(void 0, k))throw C.abort(),new Error("Failed to get Apple Pay payment request");C.completeShippingMethodSelection({newTotal:k.total,newLineItems:k.lineItems,newShippingMethods:k.shippingMethods})},C.onshippingcontactselected=async f=>{try{f.shippingContact.countryCode!=null&&await c(f.shippingContact.countryCode),f.shippingContact.postalCode!=null&&await v(f.shippingContact.postalCode),f.shippingContact.phoneNumber!=null&&await y(f.shippingContact.emailAddress);let k=await i({expectedItems:E});if(_chunkKZWCVKLUjs.l.call(void 0, k))throw C.abort(),new Error("Failed to get Apple Pay payment request");console.log("apRequest",k),C.completeShippingContactSelection({newLineItems:k.lineItems,newTotal:k.total,newShippingMethods:k.shippingMethods})}catch(k){console.log("shipping contact selected error",k),C.abort()}},C.oncouponcodechanged=async f=>{try{console.log("coupon code changed",f);let k=await p(f.couponCode),X=await i({expectedItems:E});if(console.log("apRequest",X),_chunkKZWCVKLUjs.l.call(void 0, X))throw C.abort(),new Error("Failed to get Apple Pay payment request");C.completeCouponCodeChange({errors:_chunkKZWCVKLUjs.l.call(void 0, k)?[new ApplePayError("couponCodeInvalid")]:void 0,newTotal:X.total,newLineItems:X.lineItems,newShippingMethods:X.shippingMethods})}catch(k){console.log("coupon code changed error",k),C.abort()}},C.onpaymentauthorized=async f=>{d.track("payment_submitted",{gateway:"apple_pay",method:"apple_pay"});try{let k=await l({token:f.payment.token,billingContact:f.payment.billingContact,shippingContact:f.payment.shippingContact});if(_chunkKZWCVKLUjs.l.call(void 0, k)){console.log("apple pay error",k),T("fail"),C.completePayment({status:ApplePaySession.STATUS_FAILURE});return}k.redirectURL&&setTimeout(()=>{open(k.redirectURL,"_self")},2e3),T(k.isSuccess?"success":"fail"),C.completePayment({status:k.isSuccess?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE}),k.isSuccess&&m()}catch (e4){T("fail"),C.completePayment({status:ApplePaySession.STATUS_FAILURE})}},C.begin()}return _jsxruntime.jsx.call(void 0, oi,{style:e,buttonStyle:n,type:t,onClick:D})}function ai(e){let t=_chunkIRZJIPUFjs.n.call(void 0, ke(),e.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkIRZJIPUFjs.l,{value:t,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.P,{children:_jsxruntime.jsx.call(void 0, ri,{...e})})})}var Rn=ai;var _buttonreact = require('@google-pay/button-react'); var _buttonreact2 = _interopRequireDefault(_buttonreact);function ci({items:e,style:t,buttonColor:n,buttonSizeMode:o,test:r}){let{getGooglePayConfiguration:a,completeGooglePayPayment:i,setCountry:l,setCouponCodeIfPossible:c,setDeliveryMethod:p,setEmail:s,setPostalCode:y,clearCart:v}=_chunkKZWCVKLUjs.O.call(void 0, ),m=_chunkIRZJIPUFjs.m.call(void 0, ),{data:g}=_reactquery.useQuery.call(void 0, {queryKey:["get-google-pay-configuration",e.map(R=>R.id).join(",")],queryFn:()=>a({items:e.map(R=>({...R,id:void 0,productID:R.id}))})}),{mutateAsync:d,isPending:I}=_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:o,buttonColor:n,style:t,existingPaymentMethodRequired:!0,onClick:()=>m.track("payment_method_selected",{gateway:"google_pay",method:"google_pay"}),environment:r===!0?"TEST":"PRODUCTION",onPaymentDataChanged:async R=>{_chunkKZWCVKLUjs.D.call(void 0, {event:"initiateCheckout",items:e.map(b=>({id:b.id,name:b.name,price:b.price,quantity:b.quantity,currency:"PLN"}))}),console.log("payment data changed",R),_optionalChain([R, 'access', _13 => _13.shippingAddress, 'optionalAccess', _14 => _14.postalCode])!=null&&await y(_optionalChain([R, 'access', _15 => _15.shippingAddress, 'optionalAccess', _16 => _16.postalCode])),_optionalChain([R, 'access', _17 => _17.shippingAddress, 'optionalAccess', _18 => _18.countryCode])!=null&&await l(_optionalChain([R, 'access', _19 => _19.shippingAddress, 'optionalAccess', _20 => _20.countryCode])),_optionalChain([R, 'access', _21 => _21.shippingOptionData, 'optionalAccess', _22 => _22.id])!=null&&await p(R.shippingOptionData.id);let h=await a({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 d({paymentData:R});if(_chunkKZWCVKLUjs.l.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)}}}),I?_jsxruntime.jsx.call(void 0, _chunkHP3I6D2Rjs.e,{}):null]})}function ui(e){let t=_chunkIRZJIPUFjs.n.call(void 0, ke(),e.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkIRZJIPUFjs.l,{value:t,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.P,{children:_jsxruntime.jsx.call(void 0, ci,{...e})})})}var An=ui;var mi="x-bitsnap-cart-token",or=new Set;function Dn(e,t,n){or.has(e)||(or.add(e),console.warn(t,n))}function fi(e,t,n){return`${e.replace(/\/+$/,"")}/api/integrations/${encodeURIComponent(t)}/public-commerce/express${n}`}async function It(e,t,n,o){let r=_nullishCoalesce(e.fetch, () => (((a,i)=>globalThis.fetch(a,i))));try{let a=await r(fi(e.host,e.projectID,t),{method:"POST",headers:{..._chunk4Y233NIIjs.a,"Content-Type":"application/json",...o!=null?{[mi]:o}:{}},body:JSON.stringify(n),cache:"no-store",signal:e.signal}),i=await a.text().catch(()=>""),l;try{l=i.length>0?JSON.parse(i):void 0}catch (e5){l=void 0}return{status:a.status,json:l,text:i}}catch(a){return{transportError:a}}}function we(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function rr(e){return gi(e)?{ok:!1,code:"network",message:"aborted"}:{ok:!1,code:"network",message:"The server could not be reached."}}function gi(e){return typeof e=="object"&&e!=null&&e.name==="AbortError"}function ut(e){return e===404||e===405||e===501||e===502}function Ln(e,t){return typeof e=="string"&&e.length>0?e:t}async function ar(e,t){let n=await It(e,"/availability",t);if("transportError"in n){Dn(`availability:${e.host}:${e.projectID}`,"Bitsnap express availability is not reachable; express buttons stay hidden.",n.transportError);return}if(ut(n.status)||n.status!==200){Dn(`availability-status:${e.host}:${e.projectID}`,"Bitsnap express availability is not available on this backend; express buttons stay hidden.",n.status);return}let o=n.json;if(!we(o)||o.success!==!0||!we(o.providers)){Dn(`availability-shape:${e.host}:${e.projectID}`,"Bitsnap express availability returned an unknown shape; express buttons stay hidden.",void 0);return}return o}async function ir(e,t,n){let o=await It(e,"/cart",{...t,...n!=null?{cartId:n.cartId,expectedRevision:n.expectedRevision}:{}},_optionalChain([n, 'optionalAccess', _23 => _23.cartToken]));if("transportError"in o)return{ok:!1,code:"internal",message:"The cart could not be saved."};let r=o.json;if(!we(r)||typeof r.success!="boolean")return{ok:!1,code:o.status===403?"cart-forbidden":"internal",message:"The cart endpoint returned an unknown answer."};if(r.success===!0){let a=r.snapshot;return a==null||typeof a.revision!="number"?{ok:!1,code:"internal",message:"The cart endpoint returned no snapshot."}:{ok:!0,...typeof r.cartToken=="string"?{cartToken:r.cartToken}:{},snapshot:a}}return{ok:!1,code:Ln(r.code,"internal"),message:typeof r.message=="string"?r.message:"The cart could not be saved.",...typeof r.currentRevision=="number"?{currentRevision:r.currentRevision}:{},...we(r.snapshot)?{snapshot:r.snapshot}:{},...Array.isArray(r.conflicts)?{conflicts:r.conflicts}:{}}}function yi(e){let t=Ln(e.code,"internal");return{code:t,message:Ln(e.message,t)}}async function sr(e,t,n){let o=await It(e,"/cart-snapshot",{cartId:t},n);if("transportError"in o)return rr(o.transportError);let r=o.json;return o.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found",status:404}:o.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden",status:403}:!we(r)||r.success!==!0||!we(r.snapshot)?{ok:!1,code:ut(o.status)?"not-implemented":"invalid-response",message:"The cart snapshot is not available.",status:o.status}:{ok:!0,value:r.snapshot}}async function lr(e,t,n){let r=await It(e,t==="inpostPay"?"/inpost/start":t==="revolutPay"?"/revolut/start":"/adyen/start",{cartId:n.cartId,...n.returnUrl!=null?{returnUrl:n.returnUrl}:{},...n.cancelUrl!=null?{cancelUrl:n.cancelUrl}:{},...n.embedOrigin!=null?{embedOrigin:n.embedOrigin}:{}},n.cartToken);if("transportError"in r)return rr(r.transportError);let a=r.json;if(!we(a)||typeof a.success!="boolean")return{ok:!1,code:ut(r.status)?"not-implemented":"invalid-response",message:"The provider start is not available.",status:r.status};if(a.success===!0)return typeof a.redirectUrl!="string"||typeof a.providerOrderId!="string"?{ok:!1,code:"invalid-response",message:"The provider start returned no redirect.",status:r.status}:{ok:!0,value:{ok:!0,provider:t,redirectUrl:a.redirectUrl,providerOrderId:a.providerOrderId,...we(a.publicConfig)?{publicConfig:a.publicConfig}:{},cartRevision:typeof a.cartRevision=="number"?a.cartRevision:0}};let i=a;return{ok:!1,code:ut(r.status)?"not-implemented":i.code,message:typeof i.message=="string"?i.message:"The provider start failed.",status:r.status}}function cr(e,t,n){return dr(e,"/revolut/status",t,n)}function ur(e,t,n){return dr(e,"/inpost/status",t,n)}async function dr(e,t,n,o){let r=await It(e,t,{cartId:n},o);if("transportError"in r)return{ok:!1,code:"network",message:"The status is not available."};let a=r.json;return r.status===401||r.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden"}:r.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found"}:!we(a)||typeof a.success!="boolean"?{ok:!1,code:ut(r.status)?"not-implemented":"provider-error",message:"The status is not available."}:a.success===!0?a.status==="pending"||a.status==="completed"||a.status==="failed"||a.status==="cancelled"?{ok:!0,status:a.status,...typeof a.orderId=="string"?{orderId:a.orderId}:{}}:{ok:!1,code:"provider-error",message:"Unknown status."}:{ok:!1,code:ut(r.status)?"not-implemented":"provider-error",message:we(a)?yi(a).message:"The status failed."}}var hi="bitsnap-express-cart";function pr(e,t=Date.now()){let n=_optionalChain([e, 'optionalAccess', _24 => _24.pending]);if(n!=null)return t-n.ts<=864e5?n:void 0}function _n(){try{return typeof localStorage>"u"?void 0:localStorage}catch (e6){return}}function Un(e,t){return`${hi}:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function mr(e){let t=_nullishCoalesce(e.storage, () => (_n()));if(t==null)return;let n=Un(e.host,e.projectID),o;try{let r=t.getItem(n);if(r==null)return;o=JSON.parse(r)}catch (e7){Ie(e);return}if(!Vt(o)){Ie(e);return}if(o.projectID!==e.projectID||o.host!==e.host||typeof o.cartId!="string"||o.cartId.length===0||typeof o.cartToken!="string"||o.cartToken.length===0||typeof o.revision!="number"||o.environment!=="test"&&o.environment!=="production"){Ie(e);return}return{projectID:o.projectID,host:o.host,environment:o.environment,cartId:o.cartId,cartToken:o.cartToken,revision:o.revision,updatedAt:typeof o.updatedAt=="number"?o.updatedAt:0,...Array.isArray(o.syncedLines)?{syncedLines:o.syncedLines.filter(r=>Vt(r)&&typeof r.id=="string"&&typeof r.quantity=="number")}:{},...typeof o.inpostBindingApiKey=="string"?{inpostBindingApiKey:o.inpostBindingApiKey}:{},...vi(o.pending)?{pending:o.pending}:{}}}function Qe(e,t=_n()){if(t==null)return!1;try{return t.setItem(Un(e.host,e.projectID),JSON.stringify(e)),!0}catch (e8){return!1}}function Ie(e){let t=_nullishCoalesce(e.storage, () => (_n()));if(t!=null)try{t.removeItem(Un(e.host,e.projectID))}catch (e9){}}function Vt(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function vi(e){return!Vt(e)||e.provider!=="inpostPay"&&e.provider!=="revolutPay"||typeof e.ts!="number"||!Array.isArray(e.lines)?!1:e.lines.every(t=>Vt(t)&&typeof t.id=="string"&&typeof t.quantity=="number")}var bi=3,$t= (_class =class{__init() {this.running=Promise.resolve()}constructor(t){;_class.prototype.__init.call(this);this.options=t}getRecord(){return mr(this.options)}getInpostBindingApiKey(){return _optionalChain([this, 'access', _25 => _25.getRecord, 'call', _26 => _26(), 'optionalAccess', _27 => _27.inpostBindingApiKey])}previewUpload(t){return this.options.local.upload(t)}getPendingAttempt(){return _optionalChain([this, 'access', _28 => _28.getRecord, 'call', _29 => _29(), 'optionalAccess', _30 => _30.pending])}ensure(t){return this.serialize(()=>this.ensureNow(t))}async ensureNow(t){let n=this.getRecord();n!=null&&t.environment!=null&&n.environment!==t.environment&&(Ie(this.options),n=void 0);let o,r=_nullishCoalesce(this.options.maxAttempts, () => (bi));for(let a=0;a<r;a++){let i=this.options.local.upload(t.locale);if(i==null)return{ok:!1,code:"invalid-cart",message:"The cart is empty."};let l=this.options.local.signature(),c=await this.options.write(i,n!=null?{cartId:n.cartId,cartToken:n.cartToken,expectedRevision:n.revision}:void 0);if(c.ok){let p=_nullishCoalesce(c.cartToken, () => (_optionalChain([n, 'optionalAccess', _31 => _31.cartToken])));if(p==null)return{ok:!1,code:"internal",message:"The created cart has no access token."};let s=c.snapshot;if(n={projectID:this.options.projectID,host:this.options.host,environment:s.environment,cartId:s.cartId,cartToken:p,revision:s.revision,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),syncedLines:i.items.map(v=>({id:v.id,quantity:v.quantity})),..._optionalChain([n, 'optionalAccess', _32 => _32.inpostBindingApiKey])!=null?{inpostBindingApiKey:n.inpostBindingApiKey}:{}},Qe(n,this.options.storage),this.options.local.signature()===l)return{ok:!0,value:{record:n,snapshot:s}};continue}switch(o=c,c.code){case"revision-conflict":{let p=_nullishCoalesce(_optionalChain([c, 'access', _33 => _33.snapshot, 'optionalAccess', _34 => _34.revision]), () => (c.currentRevision));if(n==null||p==null)return c;let s=Pi({base:n.syncedLines,local:this.options.local.lines(),server:fr(_optionalChain([c, 'access', _35 => _35.snapshot, 'optionalAccess', _36 => _36.lines]))});if(!s.ok)return{...c,currentRevision:p,snapshot:c.snapshot,conflicts:s.conflicts};if(!Ci(s.lines,this.options.local.lines())){if(this.options.local.replaceLines==null)return{...c,currentRevision:p,snapshot:c.snapshot,conflicts:s.conflicts};this.options.local.replaceLines(s.lines)}n={...n,revision:p},_optionalChain([c, 'access', _37 => _37.snapshot, 'optionalAccess', _38 => _38.environment])!=null&&(n.environment=c.snapshot.environment),c.snapshot!=null&&(n.syncedLines=fr(c.snapshot.lines)),Qe(n,this.options.storage);continue}case"cart-locked":{Ie(this.options),n=void 0;continue}case"cart-not-found":case"cart-forbidden":{Ie(this.options),n=void 0;continue}case"invalid-request":case"product-not-available":case"currency-unsupported":return c;default:return c}}return _nullishCoalesce(o, () => ({ok:!1,code:"internal",message:"The cart could not be saved."}))}reconcileFromServer(){return this.serialize(async()=>{let t=this.getRecord();if(t==null)return{ok:!1,code:"cart-not-found",message:"There is no cart to read."};let n=qe(this.options.local.lines()),o=await this.options.read(t.cartId,t.cartToken);if(!o.ok)return(o.code==="cart-not-found"||o.code==="cart-forbidden")&&Ie(this.options),o;let r=o.value,a=qe(this.options.local.lines()),i=qe(_nullishCoalesce(t.syncedLines, () => ([]))),l=t.syncedLines!=null?i:n;this.options.local.adoptSnapshot(r);let c=xi(a,l);c.length>0&&this.options.local.appendLines(c);let p=this.getRecord();if(p!=null&&p.cartId===r.cartId&&Qe({...p,revision:r.revision,environment:r.environment,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage),c.length>0){let s=await this.ensureNow({locale:r.locale,environment:r.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:r}})}async start(t,n){let o=await this.ensure({locale:n.locale,...n.environment!=null?{environment:n.environment}:{}});if(!o.ok)return o;let{record:r,snapshot:a}=o.value,i=await n.start({cartId:r.cartId,cartToken:r.cartToken,...n.returnUrl!=null?{returnUrl:n.returnUrl}:{},...n.cancelUrl!=null?{cancelUrl:n.cancelUrl}:{},...n.embedOrigin!=null?{embedOrigin:n.embedOrigin}:{}});if(!i.ok)return(i.code==="cart-locked"||i.code==="cart-not-found"||i.code==="cart-forbidden")&&Ie(this.options),i;let l=this.getRecord();return l!=null&&l.cartId===r.cartId&&Qe({...l,revision:Math.max(l.revision,i.value.cartRevision),updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),..._optionalChain([i, 'access', _39 => _39.value, 'access', _40 => _40.publicConfig, 'optionalAccess', _41 => _41.basketBindingApiKey])!=null?{inpostBindingApiKey:i.value.publicConfig.basketBindingApiKey}:{},pending:{provider:t,...i.value.providerOrderId.length>0?{providerOrderId:i.value.providerOrderId}:{},lines:a.lines.map(c=>({id:c.productId,quantity:c.quantity})),ts:(_nullishCoalesce(this.options.now, () => (Date.now)))()}},this.options.storage),{ok:!0,value:{start:i.value,snapshot:a}}}storeInpostBindingApiKey(t){let n=this.getRecord();n==null||t.length===0||Qe({...n,inpostBindingApiKey:t,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage)}completePurchase(t){let n=this.getRecord(),o=_nullishCoalesce(_nullishCoalesce(t, () => (_optionalChain([n, 'optionalAccess', _42 => _42.pending, 'optionalAccess', _43 => _43.lines]))), () => ([]));o.length>0&&this.options.local.removeLines(o),Ie(this.options)}keepCart(){}clearPending(){let t=this.getRecord();if(t==null||t.pending==null)return;let{pending:n,...o}=t;Qe(o,this.options.storage)}status(t){let n=this.getRecord();return n==null?Promise.resolve({ok:!1,code:"cart-not-found",message:"There is no cart to check."}):t(n.cartId,n.cartToken)}serialize(t){let n=this.running.then(t,t);return this.running=n.then(()=>{},()=>{}),n}}, _class);function qe(e){let t=new Map;for(let n of e)t.set(n.id,(_nullishCoalesce(t.get(n.id), () => (0)))+n.quantity);return t}function fr(e){return(_nullishCoalesce(e, () => ([]))).map(t=>({id:t.productId,quantity:t.quantity}))}function Ci(e,t){let n=qe(e),o=qe(t);if(n.size!==o.size)return!1;for(let[r,a]of n)if(o.get(r)!==a)return!1;return!0}function Pi(e){if(e.base==null||e.server==null)return{ok:!1,lines:e.local,conflicts:[]};let t=qe(e.base),n=qe(e.local),o=qe(e.server),r=new Set([...t.keys(),...n.keys(),...o.keys()]),a=[],i=[];for(let l of r){let c=_nullishCoalesce(t.get(l), () => (0)),p=_nullishCoalesce(n.get(l), () => (0)),s=_nullishCoalesce(o.get(l), () => (0)),y=p!==c,v=s!==c,m;y?(v&&(p===s||i.push({id:l,base:c,local:p,server:s})),m=p):m=s,m>0&&!i.some(g=>g.id===l)&&a.push({id:l,quantity:m})}return{ok:i.length===0,lines:a,conflicts:i}}function xi(e,t){let n=[];for(let[o,r]of e){let a=r-(_nullishCoalesce(t.get(o), () => (0)));a>0&&n.push({id:o,quantity:a})}return n}var On=new Map,ki=5*60*1e3;function gr(e,t,n){let o=_chunkKZWCVKLUjs.L.call(void 0, );return[e,t,n.items.map(r=>`${r.id}:${r.quantity}`).sort().join(","),(_nullishCoalesce(n.countries, () => ([]))).slice().sort().join(","),_nullishCoalesce(n.couponCode, () => ("")),_nullishCoalesce(n.deliveryMethod, () => ("")),_nullishCoalesce(o.postalCode, () => (""))].join("|")}function dt(e,t,n){let o=gr(e,t,n),r=On.get(o);if(r!=null){if(Date.now()-r.at>ki){On.delete(o);return}return r.quote}}function wi(e,t,n,o){On.set(gr(e,t,n),{quote:o,at:Date.now()})}function Xe(e,t){return t==null||t.delivery.length===0?e:{...e,delivery:e.delivery!=null&&e.delivery.length>0?e.delivery:t.delivery,...e.deliveryMethod==null&&t.deliveryMethod!=null?{deliveryMethod:t.deliveryMethod}:{}}}async function Ii(e){if(e.upload.items.length===0)return{delivery:[]};let t=_chunkKZWCVKLUjs.L.call(void 0, );try{let n=await _chunkKZWCVKLUjs.a.get(e.host).getPreOrderDetails({projectId:e.projectID,items:e.upload.items.map(i=>({id:i.id,quantity:i.quantity})),..._optionalChain([e, 'access', _44 => _44.upload, 'access', _45 => _45.countries, 'optionalAccess', _46 => _46[0]])!=null?{countryCode:e.upload.countries[0]}:{},...e.upload.couponCode!=null?{couponCode:e.upload.couponCode}:{},...e.upload.deliveryMethod!=null?{selectedDeliveryMethod:e.upload.deliveryMethod}:t.selectedDeliveryMethod!=null?{selectedDeliveryMethod:t.selectedDeliveryMethod}:{},...t.postalCode!=null?{postCode:t.postalCode}:{}}),o=n.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})),r=_nullishCoalesce(_nullishCoalesce(n.selectedDeliveryMethod, () => (_optionalChain([o, 'access', _47 => _47[0], 'optionalAccess', _48 => _48.name]))), () => (void 0)),a={delivery:o,...r!=null?{deliveryMethod:r}:{}};return wi(e.host,e.projectID,e.upload,a),a}catch(n){console.warn("cannot resolve the express delivery quote",n);return}}async function Qt(e){if(e.upload.delivery!=null&&e.upload.delivery.length>0)return{ok:!0,upload:e.upload,quote:{delivery:e.upload.delivery,...e.upload.deliveryMethod!=null?{deliveryMethod:e.upload.deliveryMethod}:{}}};let t=dt(e.host,e.projectID,e.upload);if(t!=null)return{ok:!0,upload:Xe(e.upload,t),quote:t};let n=await Ii(e);return n==null?{ok:!1,message:"The delivery quote for this cart is not available. Use the regular checkout."}:{ok:!0,upload:Xe(e.upload,n),quote:n}}function Mn(e){return{lines:()=>_chunkKZWCVKLUjs.Q.call(void 0, ).map(t=>({id:t.productID,quantity:t.quantity})),signature:_chunkKZWCVKLUjs.R,upload:t=>{let n=_chunkKZWCVKLUjs.S.call(void 0, t);if(n!=null)return Xe(n,dt(e.host,e.projectID,n))},adoptSnapshot:t=>{_chunkKZWCVKLUjs.T.call(void 0, t.lines.map(n=>({productId:n.productId,quantity:n.quantity})))},appendLines:_chunkKZWCVKLUjs.V,removeLines:_chunkKZWCVKLUjs.U,replaceLines:t=>{_chunkKZWCVKLUjs.T.call(void 0, t.map(n=>({productId:n.id,quantity:n.quantity})))}}}function Ye(e){let t=_nullishCoalesce(e.host, () => (_chunk4Y233NIIjs.e)),n={projectID:e.projectID,host:t,...e.fetch!=null?{fetch:e.fetch}:{},...e.signal!=null?{signal:e.signal}:{}};return new $t({projectID:e.projectID,host:t,local:_nullishCoalesce(e.local, () => (Mn({host:t,projectID:e.projectID}))),...e.storage!=null?{storage:e.storage}:{},...e.now!=null?{now:e.now}:{},write:(o,r)=>ir(n,o,r),read:(o,r)=>sr(n,o,r)})}async function Xt(e,t,n=Ye(e)){let o=_nullishCoalesce(e.host, () => (_chunk4Y233NIIjs.e)),r=n.previewUpload(e.locale);if(r!=null){let a=await Qt({host:o,projectID:e.projectID,upload:r});if(!a.ok)return{ok:!1,code:"invalid-cart",message:a.message}}return n.start(t,{locale:e.locale,...e.environment!=null?{environment:e.environment}:{},...e.returnUrl!=null?{returnUrl:e.returnUrl}:{},...e.cancelUrl!=null?{cancelUrl:e.cancelUrl}:{},...e.embedOrigin!=null?{embedOrigin:e.embedOrigin}:{},start:a=>lr({projectID:e.projectID,host:o,...e.fetch!=null?{fetch:e.fetch}:{},...e.signal!=null?{signal:e.signal}:{}},t,a)})}function yr(e,t){return vr(e,"revolutPay",t)}function hr(e,t){return vr(e,"inpostPay",t)}function vr(e,t,n){let o=_nullishCoalesce(e.host, () => (_chunk4Y233NIIjs.e));return(_nullishCoalesce(n, () => (Ye(e)))).status((a,i)=>(t==="inpostPay"?ur:cr)({projectID:e.projectID,host:o,...e.fetch!=null?{fetch:e.fetch}:{},...e.signal!=null?{signal:e.signal}:{}},a,i))}function br(){return typeof window>"u"?void 0:window}var jn="inpost-izi-button",qn="inpost-thank-you";function xr(e){return e!=null&&/^pl\b/i.test(e)?"pl":"en"}var Si="https://sandbox-inpostpay-widget-api.inpost.pl",Ei="https://inpostpay-widget-api.inpost.pl",Cr={test:"https://sandbox-inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js",production:"https://inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js"},Pr={test:Si,production:Ei};function Ti(e,t){return e==="test"||e==="production"?e:e==="prod"||e==="live"?"production":_nullishCoalesce(t, () => ("production"))}function Yt(e){return e.includes("sandbox")}function kr(e,t){if(e==null)return;let n=e.merchantClientId;if(n==null||n.length===0)return;let o=_nullishCoalesce(t, () => (Ti(e.environment,void 0))),r=_nullishCoalesce(e.widgetApiBaseUrl, () => (e.apiBaseUrl)),a=e.widgetScriptUrl,i=o==="test"?r!=null&&Yt(r)?r:Pr.test:r!=null&&!Yt(r)?r:Pr.production,l=o==="test"?a!=null&&Yt(a)?a:Cr.test:a!=null&&!Yt(a)?a:Cr.production;return{merchantClientId:n,environment:o,apiBaseUrl:i,scriptUrl:l,...e.basketBindingApiKey!=null&&e.basketBindingApiKey.length>0?{basketBindingApiKey:e.basketBindingApiKey}:{},...e.basketId!=null&&e.basketId.length>0?{basketId:e.basketId}:{}}}var Bn;function wr(){if(typeof window>"u")return Promise.reject(new Error("InPost Pay needs a browser."));let e=_optionalChain([br, 'call', _49 => _49(), 'optionalAccess', _50 => _50.InPostPayWidget]);return e!=null?Promise.resolve(e):(Bn??=Promise.resolve().then(() => _interopRequireWildcard(require("@inpost-pay/widget"))).then(t=>{let n=t,o=typeof n.initialiseInpostPayWidget=="function"?n.initialiseInpostPayWidget:typeof n.default=="function"?n.default:typeof _optionalChain([n, 'access', _51 => _51.default, 'optionalAccess', _52 => _52.initialiseInpostPayWidget])=="function"?n.default.initialiseInpostPayWidget:void 0,r=_optionalChain([br, 'call', _53 => _53(), 'optionalAccess', _54 => _54.InPostPayWidget]);if(r!=null)return r;if(o!=null)return{init:o};throw new Error("The InPost Pay widget exposed no init function.")}).catch(t=>{throw Bn=void 0,t}),Bn)}function Ir(e){if(typeof window>"u")return;let t=window,n=t.__bitsnapInpostOwner,o=t.__INPOST_PAY_WIDGET__;if(o!=null){if(n!=null&&n.projectID===e.owner.projectID&&n.host===e.owner.host&&n.merchantClientId===e.owner.merchantClientId)return o.refresh(e.options),o;if(Ni()){_optionalChain([e, 'access', _55 => _55.warn, 'optionalCall', _56 => _56("InPost Pay already runs for another project on this page; mount one InPost Pay button per page.")]);return}delete t.__INPOST_PAY_WIDGET__,delete t.__bitsnapInpostOwner}let r=e.namespace.init(e.options);return t.__INPOST_PAY_WIDGET__=r,t.__bitsnapInpostOwner=e.owner,r}function Ni(){return typeof document>"u"?!1:document.querySelector(`${jn}, ${qn}`)!=null}function Sr(e){return{binding_place:e.bindingPlace,...e.productId!=null?{"data-product-id":e.productId}:{},...e.variation!=null?{variation:e.variation}:{}}}function pt(e){let t=Math.max(1,Math.trunc(_nullishCoalesce(e.quantity, () => (1)))),n={...e.country!=null?{country:e.country}:{},...e.couponCode!=null?{couponCode:e.couponCode}:{},productQuantity:t};if(e.items!=null&&e.items.length>0)return{...n,items:e.items.map(r=>({id:r.id,quantity:Math.max(1,Math.trunc(r.quantity))})),source:"items"};let o=_chunkKZWCVKLUjs.Q.call(void 0, ).map(r=>({id:r.productID,quantity:r.quantity}));if(e.productId!=null&&e.productId.length>0){let r=o.some(a=>a.id===e.productId);return{...n,items:r?o:[...o,{id:e.productId,quantity:t}],source:"product",productId:e.productId}}return{...n,items:o,source:"cart"}}function Zt(e){let t=e.items.map(n=>`${n.id}:${n.quantity}`).sort().join(",");return[e.source,t,_nullishCoalesce(e.country, () => ("")),_nullishCoalesce(e.couponCode, () => ("")),_nullishCoalesce(e.productId, () => (""))].join("|")}function Jt(e,t,n){if(e.source==="cart")return Mn(n);let o={items:e.items.map(r=>({id:r.id,quantity:r.quantity})),...e.country!=null?{countries:[e.country]}:{},...e.couponCode!=null?{couponCode:e.couponCode}:{},locale:t};return{lines:()=>e.items,signature:()=>Zt(e),upload:()=>Xe(o,dt(n.host,n.projectID,o)),adoptSnapshot:()=>{},appendLines:()=>{},removeLines:()=>{}}}function St(){return _react.useSyncExternalStore.call(void 0, _chunkKZWCVKLUjs.W,_chunkKZWCVKLUjs.X,()=>0)}function en(e){let t=_react.useRef.call(void 0, e);t.current=e;let n=pt(e),o=Zt(n),r=St(),[a,i]=_react.useState.call(void 0, {loading:!1,provider:void 0,environment:void 0,failed:!1});return _react.useEffect.call(void 0, ()=>{let l=t.current;if(l.enabled===!1||l.projectID==null||l.projectID.length===0||typeof window>"u"){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let c=pt(l);if(c.items.length===0){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let p=new AbortController,s=!0;return i(y=>({...y,loading:!0})),Ui({projectID:l.projectID,...l.host!=null?{host:l.host}:{},locale:l.locale,cart:c,...l.fetch!=null?{fetch:l.fetch}:{},signal:p.signal}).then(y=>{if(!s)return;let v=_optionalChain([y, 'optionalAccess', _57 => _57.providers, 'optionalAccess', _58 => _58[l.provider]]);i({loading:!1,provider:v,environment:_nullishCoalesce(_optionalChain([y, 'optionalAccess', _59 => _59.environment]), () => (_optionalChain([v, 'optionalAccess', _60 => _60.environment]))),failed:y==null})}).catch(()=>{s&&i({loading:!1,provider:void 0,environment:void 0,failed:!0})}),()=>{s=!1,p.abort()}},[o,r,e.projectID,e.host,e.provider,e.locale,e.enabled]),a}function tn(e){return _nullishCoalesce(e, () => (_chunk4Y233NIIjs.e))}function _i(e,t,n){let o=e.source==="cart"?_chunkKZWCVKLUjs.S.call(void 0, t):e.items.length===0?void 0:{items:e.items.map(r=>({id:r.id,quantity:r.quantity})),...e.country!=null?{countries:[e.country]}:{},...e.couponCode!=null?{couponCode:e.couponCode}:{},locale:t};if(o!=null)return _optionalChain([n, 'optionalAccess', _61 => _61.host])==null||n.projectID==null?o:Xe(o,dt(n.host,n.projectID,o))}async function Ui(e){let t=_nullishCoalesce(e.host, () => (_chunk4Y233NIIjs.e)),n=_i(e.cart,e.locale);if(n==null)return;let o=await Qt({host:t,projectID:e.projectID,upload:n});if(!o.ok)return;let r=await ar({projectID:e.projectID,host:t,...e.fetch!=null?{fetch:e.fetch}:{},...e.signal!=null?{signal:e.signal}:{}},o.upload);if(r==null)return;if(o.quote.delivery.length===0)return r;let a=r.providers.revolutPay;return a==null||a.available!==!0?r:{...r,providers:{...r.providers,revolutPay:{...a,available:!1,reasons:[...a.reasons,"delivery-unsupported"]}}}}function Er(e){if(e==null)return;let t=_nullishCoalesce(e.publicKey, () => (e.publicToken)),n=e.mode;if(!(t==null||t.length===0)&&!(n!=="sandbox"&&n!=="prod"))return{publicKey:t,mode:n,...e.orderToken!=null&&e.orderToken.length>0?{orderToken:e.orderToken}:{}}}function Tr(e){let t=_optionalChain([e, 'access', _62 => _62.publicConfig, 'optionalAccess', _63 => _63.orderToken]);return t!=null&&t.length>0?t:e.providerOrderId}function Nr(e){return e!=null&&/^pl\b/i.test(e)?"pl":"en"}var Oi=6e4,Mi=2e3;function Bi(e){return new Promise(t=>setTimeout(t,e))}async function zn(e){let t=_nullishCoalesce(e.timeoutMs, () => (Oi)),n=_nullishCoalesce(e.intervalMs, () => (Mi)),o=_nullishCoalesce(e.sleep, () => (Bi)),r=(_nullishCoalesce(e.now, () => (Date.now)))(),a=Math.min(1e4,Math.max(1,Math.ceil(t/Math.max(1,n))+1)),i=0,l;for(;;){if(i+=1,_optionalChain([e, 'access', _64 => _64.signal, 'optionalAccess', _65 => _65.aborted])===!0)return l;try{l=await e.check()}catch (e10){l=void 0}if(_optionalChain([l, 'optionalAccess', _66 => _66.ok])===!0&&l.status!=="pending"||_optionalChain([l, 'optionalAccess', _67 => _67.ok])===!1&&l.code==="not-implemented"||i>=a||(_nullishCoalesce(e.now, () => (Date.now)))()-r>=t)return l;await o(n)}}var Rr=zn;var ji={pending:"expressPending",confirmed:"expressConfirmed",failed:"expressFailed",cancelled:"expressCancelled","load-failed":"expressLoadFailed","cart-unavailable":"expressCartUnavailable","cart-conflict":"expressCartConflict","price-changed":"expressPriceChanged","product-unavailable":"expressProductUnavailable"},qi=["failed","cancelled","load-failed","cart-unavailable","cart-conflict","price-changed","product-unavailable"];function Et({phase:e}){let t=_chunkKZWCVKLUjs.A.call(void 0, ),n=L("error");if(e==="idle")return null;let o=qi.includes(e);return _jsxruntime.jsx.call(void 0, "p",{role:o?"alert":"status","aria-live":o?"assertive":"polite","data-bitsnap-express-status":e,className:_chunk4Y233NIIjs.g.call(void 0, "w-full px-2 text-center text-sm",o&&"opacity-90",n.className),style:n.style,children:t(ji[e])})}function Lr(e){return typeof e=="object"&&e!=null&&e.undeliverable===!0}function Gn(e){let{projectID:t}=e,n=tn(e.host),o=_nullishCoalesce(e.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),r=_chunkIRZJIPUFjs.m.call(void 0, ),a=_optionalChain([e, 'access', _68 => _68.confirmation, 'optionalAccess', _69 => _69.timeoutMs]),i=_optionalChain([e, 'access', _70 => _70.confirmation, 'optionalAccess', _71 => _71.intervalMs]),l=_optionalChain([e, 'access', _72 => _72.confirmation, 'optionalAccess', _73 => _73.sleep]),c=_optionalChain([e, 'access', _74 => _74.confirmation, 'optionalAccess', _75 => _75.now]),p=St(),s=_react.useMemo.call(void 0, ()=>pt({...e.items!=null?{items:e.items}:{},...e.productId!=null?{productId:e.productId}:{},...e.quantity!=null?{quantity:e.quantity}:{}}),[e.items,e.productId,e.quantity,p]),y=Zt(s),v=en({provider:"inpostPay",projectID:t,host:n,locale:o,...e.items!=null?{items:e.items}:{},...e.productId!=null?{productId:e.productId}:{},...e.quantity!=null?{quantity:e.quantity}:{},...e.fetch!=null?{fetch:e.fetch}:{}}),m=v.provider,g=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _76 => _76.environment]), () => (v.environment)),d=_optionalChain([m, 'optionalAccess', _77 => _77.available])===!0?kr(m.publicConfig,g):void 0,I=_optionalChain([d, 'optionalAccess', _78 => _78.merchantClientId]),R=_optionalChain([d, 'optionalAccess', _79 => _79.apiBaseUrl]),h=_react.useMemo.call(void 0, ()=>Ye({projectID:t,host:n,...s.source==="items"?{local:Jt(s,o,{host:n,projectID:t})}:{},...e.fetch!=null?{fetch:e.fetch}:{}}),[t,n,e.fetch,s,o]),[b,A]=_react.useState.call(void 0, "idle"),x=_react.useRef.call(void 0, void 0),E=_react.useRef.call(void 0, void 0),D=_react.useRef.call(void 0, !0),S=_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 w=_react.useRef.call(void 0, {cart:s,locale:o,environment:g,session:h,onOrderCreated:e.onOrderCreated,onBasketChanged:e.onBasketChanged});w.current={cart:s,locale:o,environment:g,session:h,onOrderCreated:e.onOrderCreated,onBasketChanged:e.onBasketChanged};let C=_react.useCallback.call(void 0, async()=>{if(E.current!=null)return E.current;let M=Xt({projectID:t,host:n,locale:w.current.locale,...w.current.environment!=null?{environment:w.current.environment}:{},...typeof window<"u"?{returnUrl:window.location.href,cancelUrl:window.location.href,embedOrigin:window.location.origin}:{},...e.fetch!=null?{fetch:e.fetch}:{}},"inpostPay",w.current.session).then(O=>{if(!O.ok)throw A(O.code==="revision-conflict"?"cart-conflict":"cart-unavailable"),new Error(`inpost-start-${O.code}`);return r.track("payment_submitted",{gateway:"inpost_pay",method:"inpost_pay"}),O.value.start}).finally(()=>{E.current=void 0});return E.current=M,M},[t,n,r,e.fetch]),U=_react.useCallback.call(void 0, async M=>{if(_chunkKZWCVKLUjs.Q.call(void 0, ).some(_=>_.productID===M)||w.current.cart.source==="items")return;if(await _chunkKZWCVKLUjs.s.addProductToCart(M,w.current.cart.productQuantity)!=null)throw{undeliverable:!0}},[]),f=_react.useCallback.call(void 0, async M=>{r.track("payment_method_selected",{gateway:"inpost_pay",method:"inpost_pay"});try{M!=null&&await U(M);let N=await _asyncOptionalChain([(await C()), 'access', async _80 => _80.publicConfig, 'optionalAccess', async _81 => _81.basketBindingApiKey]);if(N==null||N.length===0)throw new Error("inpost-start-without-basket-key");return w.current.session.storeInpostBindingApiKey(N),A("idle"),N}catch(O){throw Lr(O)?(A("product-unavailable"),new Error("UNDELIVERABLE_PRODUCT")):(A(O instanceof Error&&O.message==="inpost-start-revision-conflict"?"cart-conflict":"cart-unavailable"),O instanceof Error?O:new Error("inpost-pay-failed"))}},[U,r,C]),k=_react.useCallback.call(void 0, async M=>{let O=_nullishCoalesce(M, () => (w.current.cart.productId));if(O!=null)try{if(await _chunkKZWCVKLUjs.s.addProductToCart(O,w.current.cart.productQuantity)!=null)throw{undeliverable:!0};await w.current.session.ensure({locale:w.current.locale,...w.current.environment!=null?{environment:w.current.environment}:{}})}catch(N){throw A("product-unavailable"),Lr(N)?new Error("UNDELIVERABLE_PRODUCT"):N instanceof Error?N:new Error("inpost-pay-failed")}},[]),X=_react.useCallback.call(void 0, async()=>{if(!S.current){S.current=!0;try{let M=w.current.session,O=M.getPendingAttempt();if(_optionalChain([O, 'optionalAccess', _82 => _82.provider])!=="inpostPay")return;D.current&&A("pending");let N=await zn({check:()=>hr({projectID:t,host:n,...e.fetch!=null?{fetch:e.fetch}:{}},M),timeoutMs:_nullishCoalesce(a, () => (2e4)),intervalMs:_nullishCoalesce(i, () => (1500)),...l!=null?{sleep:l}:{},...c!=null?{now:c}:{}});if(!D.current)return;let _=O.providerOrderId;if(_optionalChain([N, 'optionalAccess', _83 => _83.ok])===!0&&N.status==="completed"){let W=await M.reconcileFromServer(),F=W.ok?W.value.lines.map(V=>({id:V.productId,quantity:V.quantity})):O.lines;F.length>0&&M.completePurchase(F),A("confirmed"),r.track("payment_returned",{gateway:"inpost_pay",method:"inpost_pay",outcome:"pending"}),T.current||(T.current=!0,_optionalChain([w, 'access', _84 => _84.current, 'access', _85 => _85.onOrderCreated, 'optionalCall', _86 => _86({..._!=null?{providerOrderId:_}:{},status:"completed"})]));return}if(_optionalChain([N, 'optionalAccess', _87 => _87.ok])===!0&&N.status==="failed"){M.clearPending(),A("failed"),T.current||(T.current=!0,_optionalChain([w, 'access', _88 => _88.current, 'access', _89 => _89.onOrderCreated, 'optionalCall', _90 => _90({..._!=null?{providerOrderId:_}:{},status:"failed"})]));return}if(_optionalChain([N, 'optionalAccess', _91 => _91.ok])===!0&&N.status==="cancelled"){M.clearPending(),A("cancelled"),T.current||(T.current=!0,_optionalChain([w, 'access', _92 => _92.current, 'access', _93 => _93.onOrderCreated, 'optionalCall', _94 => _94({..._!=null?{providerOrderId:_}:{},status:"cancelled"})]));return}A("pending"),T.current||(T.current=!0,_optionalChain([w, 'access', _95 => _95.current, 'access', _96 => _96.onOrderCreated, 'optionalCall', _97 => _97({..._!=null?{providerOrderId:_}:{},status:"pending"})]))}finally{S.current=!1}}},[i,c,l,a,n,r,t,e.fetch]),be=_react.useCallback.call(void 0, async M=>{if(M==="basketProductChanged"){let O=await w.current.session.reconcileFromServer();return O.ok&&_optionalChain([w, 'access', _98 => _98.current, 'access', _99 => _99.onBasketChanged, 'optionalCall', _100 => _100(O.value)]),!0}return M==="orderCreated"&&X(),!0},[X]);if(_react.useEffect.call(void 0, ()=>{_optionalChain([m, 'optionalAccess', _101 => _101.available])===!0&&_optionalChain([h, 'access', _102 => _102.getPendingAttempt, 'call', _103 => _103(), 'optionalAccess', _104 => _104.provider])==="inpostPay"&&X()},[_optionalChain([m, 'optionalAccess', _105 => _105.available]),h,X]),_react.useEffect.call(void 0, ()=>{if(_optionalChain([m, 'optionalAccess', _106 => _106.available])!==!0||I==null||I.length===0||typeof window>"u")return;let M=!1;return wr().then(O=>{if(M)return;let N=Ir({namespace:O,owner:{projectID:t,host:n,merchantClientId:I},options:{merchantClientId:I,basketBindingApiKey:h.getInpostBindingApiKey(),unboundWidgetClicked:f,...s.source==="product"||e.productId!=null?{addToBasketClicked:k}:{},handleBasketEvent:be,...R!=null?{apiBaseUrl:R}:{},language:xr(o)}});if(N==null){A("cart-unavailable");return}x.current=N,N.rerender()}).catch(()=>{M||A("load-failed")}),()=>{M=!0,x.current=void 0}},[_optionalChain([m, 'optionalAccess', _107 => _107.available]),I,R,o,t,n,h,f,k,be,s.source,e.productId]),_react.useEffect.call(void 0, ()=>{_optionalChain([x, 'access', _108 => _108.current, 'optionalAccess', _109 => _109.refresh, 'call', _110 => _110({basketBindingApiKey:h.getInpostBindingApiKey()})])},[y,h]),_optionalChain([m, 'optionalAccess', _111 => _111.available])!==!0||I==null||I.length===0)return _jsxruntime.jsx.call(void 0, Et,{phase:b==="idle"?"idle":b});let Me=_nullishCoalesce(e.bindingPlace, () => ((e.productId!=null?"PRODUCT_CARD":"BASKET_SUMMARY")));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"inpostPay","aria-busy":b==="pending"?!0:void 0,className:e.className,style:e.style,children:[Me==="THANK_YOU_PAGE"?_react.createElement.call(void 0, qn,{...e.variation!=null?{variation:e.variation}:{}}):_react.createElement.call(void 0, jn,Sr({bindingPlace:Me,...e.productId!=null?{productId:e.productId}:{},...e.variation!=null?{variation:e.variation}:{}})),_jsxruntime.jsx.call(void 0, Et,{phase:b})]})}function Fi(e){let t=_nullishCoalesce(e.projectID, () => (ke())),n=_chunkIRZJIPUFjs.n.call(void 0, t,e.analytics,"cart");return _react.useEffect.call(void 0, ()=>{e.projectID!=null&&_chunkKZWCVKLUjs.J.call(void 0, e.projectID)},[e.projectID]),_jsxruntime.jsx.call(void 0, _chunkIRZJIPUFjs.l,{value:n,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.y,{locale:e.locale,texts:e.texts,children:_jsxruntime.jsx.call(void 0, ct,{appearance:e.appearance,children:t==null?null:_jsxruntime.jsx.call(void 0, Gn,{...e,projectID:t})})})})}var Wi=Fi;var Ki={prod:"https://merchant.revolut.com/embed.js",sandbox:"https://sandbox-merchant.revolut.com/embed.js"},_r={prod:"revolut-checkout",sandbox:"revolut-checkout-sandbox"},Fn=new Map;function Ur(e,t={}){if(typeof window>"u")return Promise.reject(new Error("Revolut Checkout needs a browser."));let n=window.RevolutCheckout;if(n!=null)return Promise.resolve(n);let o=Fn.get(e);if(o!=null)return o;let r=_nullishCoalesce(t.document, () => (document)),a=_nullishCoalesce(t.timeoutMs, () => (15e3)),i=new Promise((l,c)=>{let p=!1,s=r.getElementById(_r[e]),y,v=()=>{y!=null&&clearTimeout(y),_optionalChain([s, 'optionalAccess', _112 => _112.removeEventListener, 'call', _113 => _113("load",g)]),_optionalChain([s, 'optionalAccess', _114 => _114.removeEventListener, 'call', _115 => _115("error",d)])},m=I=>{p||(p=!0,v(),I())},g=()=>{m(()=>{let I=window.RevolutCheckout;I!=null?l(I):c(new Error("Revolut Checkout did not initialise."))})},d=()=>{m(()=>c(new Error("Revolut Checkout could not be loaded.")))};s==null?(s=r.createElement("script"),s.id=_r[e],s.src=Ki[e],s.async=!0,s.addEventListener("load",g),s.addEventListener("error",d),r.head.appendChild(s)):(s.addEventListener("load",g),s.addEventListener("error",d)),y=setTimeout(()=>{m(()=>c(new Error("Revolut Checkout timed out while loading.")))},a)});return Fn.set(e,i),i.catch(()=>Fn.delete(e)),i}function Or(e,t){return e.payments({publicToken:t.publicKey,mode:t.mode,locale:t.locale})}var Wn="bitsnap_express",Hn="bitsnap_express_cart",Kn="bitsnap_express_result",Mr="_rp_oid";function Br(e){let t;try{t=new URLSearchParams(e.startsWith("?")?e:`?${e}`)}catch (e11){return{returned:!1}}let n=t.get(Wn),o=_nullishCoalesce(t.get(Mr), () => (void 0)),r=_nullishCoalesce(t.get(Hn), () => (void 0)),a=t.get(Kn),i=a==="success"||a==="failure"||a==="cancel"?a:void 0,l=n==="inpostPay"||n==="revolutPay";return{returned:l||o!=null,...l?{provider:n}:{},...r!=null?{cartId:r}:{},...o!=null?{orderToken:o}:{},...i!=null?{result:i}:{}}}function nn(e,t){let n=typeof window<"u"?window.location.href:"https://localhost/",o=new URL(e,n);return o.searchParams.set(Wn,t.provider),o.searchParams.set(Hn,t.cartId),o.searchParams.set(Kn,t.result),o.toString()}function jr(e){let t=typeof window<"u"?window.location.href:"https://localhost/",n=new URL(e,t);return n.searchParams.delete(Wn),n.searchParams.delete(Hn),n.searchParams.delete(Kn),n.searchParams.delete(Mr),n.pathname+n.search+n.hash}function $n(e){let{projectID:t}=e,n=tn(e.host),o=_nullishCoalesce(e.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),r=_chunkIRZJIPUFjs.m.call(void 0, ),a=_optionalChain([e, 'access', _116 => _116.confirmation, 'optionalAccess', _117 => _117.timeoutMs]),i=_optionalChain([e, 'access', _118 => _118.confirmation, 'optionalAccess', _119 => _119.intervalMs]),l=_optionalChain([e, 'access', _120 => _120.confirmation, 'optionalAccess', _121 => _121.sleep]),c=_optionalChain([e, 'access', _122 => _122.confirmation, 'optionalAccess', _123 => _123.now]),p=JSON.stringify(_nullishCoalesce(e.buttonStyle, () => (null))),s=St(),y=_react.useMemo.call(void 0, ()=>pt({...e.items!=null?{items:e.items}:{},...e.productId!=null?{productId:e.productId}:{},...e.quantity!=null?{quantity:e.quantity}:{},...e.country!=null?{country:e.country}:{},...e.couponCode!=null?{couponCode:e.couponCode}:{}}),[e.items,e.productId,e.quantity,e.country,e.couponCode,s]),v=[y.source,y.items.map(S=>`${S.id}:${S.quantity}`).sort().join(",")].join("|"),m=en({provider:"revolutPay",projectID:t,host:n,locale:o,...e.items!=null?{items:e.items}:{},...e.productId!=null?{productId:e.productId}:{},...e.quantity!=null?{quantity:e.quantity}:{},...e.country!=null?{country:e.country}:{},...e.couponCode!=null?{couponCode:e.couponCode}:{},...e.fetch!=null?{fetch:e.fetch}:{}}),g=_optionalChain([m, 'access', _124 => _124.provider, 'optionalAccess', _125 => _125.available])===!0?Er(m.provider.publicConfig):void 0,d=_nullishCoalesce(_optionalChain([m, 'access', _126 => _126.provider, 'optionalAccess', _127 => _127.environment]), () => (m.environment)),I=_react.useRef.call(void 0, null),[R,h]=_react.useState.call(void 0, "idle"),[b,A]=_react.useState.call(void 0, 0),x=_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, ()=>(x.current=!0,()=>{x.current=!1}),[]),_react.useEffect.call(void 0, ()=>{if(g==null||typeof window>"u"||I.current==null)return;let S=new AbortController,T=!1,w,C=Jt(y,o,{host:n,projectID:t}),U=Ye({projectID:t,host:n,local:C,...e.fetch!=null?{fetch:e.fetch}:{},signal:S.signal}),f=_nullishCoalesce(e.returnUrl, () => (window.location.href)),k=!1,X=!1,be=async N=>{if(!x.current||X)return;h("pending");let _=await Rr({check:()=>yr({projectID:t,host:n,...e.fetch!=null?{fetch:e.fetch}:{},signal:S.signal},N),signal:S.signal,...a!=null?{timeoutMs:a}:{},...i!=null?{intervalMs:i}:{},...l!=null?{sleep:l}:{},...c!=null?{now:c}:{}});if(!(T||!x.current)){if(_optionalChain([_, 'optionalAccess', _128 => _128.ok])===!0&&_.status==="completed"){X=!0,N.completePurchase(),h("confirmed"),_optionalChain([e, 'access', _129 => _129.onPaymentResult, 'optionalCall', _130 => _130({status:"completed",..._.orderId!=null?{orderId:_.orderId}:{}})]);return}if(_optionalChain([_, 'optionalAccess', _131 => _131.ok])===!0&&_.status==="failed"){X=!0,N.clearPending(),h("failed"),_optionalChain([e, 'access', _132 => _132.onPaymentResult, 'optionalCall', _133 => _133({status:"failed"})]);return}if(_optionalChain([_, 'optionalAccess', _134 => _134.ok])===!0&&_.status==="cancelled"){X=!0,N.clearPending(),h("cancelled"),_optionalChain([e, 'access', _135 => _135.onPaymentResult, 'optionalCall', _136 => _136({status:"cancelled"})]);return}h("pending"),_optionalChain([e, 'access', _137 => _137.onPaymentResult, 'optionalCall', _138 => _138({status:"pending"})])}},Me=N=>{k||(k=!0,be(N).finally(()=>{k=!1}))},M=N=>{if(N.type==="cancel"){r.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"cancel"}),U.clearPending(),h("cancelled"),_optionalChain([e, 'access', _139 => _139.onPaymentResult, 'optionalCall', _140 => _140({status:"cancelled"})]);return}if(N.type==="error"){r.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([e, 'access', _141 => _141.onPaymentResult, 'optionalCall', _142 => _142({status:"failed"})]);return}r.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"pending"}),Me(U)};return(async()=>{let N=await U.ensure({locale:o,...d!=null?{environment:d}:{}});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 Ur(g.mode);if(T)return;let F=await Or(W,{publicKey:g.publicKey,mode:g.mode,locale:Nr(o)});if(T){_optionalChain([F, 'access', _143 => _143.destroy, 'optionalCall', _144 => _144()]);return}let{revolutPay:V}=F,We,mn=async()=>(We!=null||(We=(async()=>{let Y=await U.ensure({locale:o,...d!=null?{environment:d}:{}});if(!Y.ok)throw D.current=Y.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-cart-${Y.code}`);if(!zr(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(bt=>bt+1),new Error("revolut-amount-changed");let oe=await Xt({projectID:t,host:n,locale:o,...d!=null?{environment:d}:{},returnUrl:f,cancelUrl:_nullishCoalesce(e.cancelUrl, () => (f)),embedOrigin:window.location.origin,...e.fetch!=null?{fetch:e.fetch}:{}},"revolutPay",U);if(!oe.ok)throw D.current=oe.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-start-${oe.code}`);if(!zr(oe.value.snapshot,E.current))throw E.current={cartId:oe.value.snapshot.cartId,currency:oe.value.snapshot.currency,totalMinor:oe.value.snapshot.totalMinor},D.current="price-changed",h("price-changed"),A(bt=>bt+1),new Error("revolut-amount-changed");return r.track("payment_submitted",{gateway:"revolut_pay",method:"revolut_pay"}),{publicId:Tr(oe.value.start)}})().finally(()=>{We=void 0})),We);V.mount(I.current,{currency:_.currency,totalAmount:_.totalMinor,createOrder:mn,mobileRedirectUrls:{success:nn(f,{provider:"revolutPay",cartId:_.cartId,result:"success"}),failure:nn(f,{provider:"revolutPay",cartId:_.cartId,result:"failure"}),cancel:nn(f,{provider:"revolutPay",cartId:_.cartId,result:"cancel"})},...e.buttonStyle!=null?{buttonStyle:e.buttonStyle}:{}}),V.on("click",()=>{r.track("payment_method_selected",{gateway:"revolut_pay",method:"revolut_pay"})}),V.on("payment",M),!T&&x.current&&h(Y=>Y==="price-changed"||Y==="cart-conflict"||Y==="confirmed"||Y==="failed"||Y==="cancelled"?Y:"idle"),w=()=>{try{V.destroy()}catch (e12){}try{_optionalChain([F, 'access', _145 => _145.destroy, 'optionalCall', _146 => _146()])}catch (e13){}};let Te=Br(window.location.search),gn=_optionalChain([pr, 'call', _147 => _147(U.getRecord()), 'optionalAccess', _148 => _148.provider])==="revolutPay"&&(Te.cartId==null||Te.cartId===_.cartId)||Te.returned&&Te.provider==="revolutPay";Te.returned&&window.history.replaceState({},"",jr(window.location.href)),gn&&await be(U)})().catch(()=>{!T&&x.current&&h("load-failed")}),()=>{T=!0,S.abort(),_optionalChain([w, 'optionalCall', _149 => _149()])}},[_optionalChain([g, 'optionalAccess', _150 => _150.publicKey]),_optionalChain([g, 'optionalAccess', _151 => _151.mode]),d,o,v,t,n,e.fetch,e.returnUrl,e.cancelUrl,p,a,i,l,c,b]),_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"revolutPay","aria-busy":R==="pending"?!0:void 0,className:e.className,style:e.style,children:[_jsxruntime.jsx.call(void 0, "div",{ref:I}),_jsxruntime.jsx.call(void 0, Et,{phase:R})]})}function zr(e,t){return t!=null&&e.cartId===t.cartId&&e.currency===t.currency&&e.totalMinor===t.totalMinor}function $i(e){let t=_nullishCoalesce(e.projectID, () => (ke())),n=_chunkIRZJIPUFjs.n.call(void 0, t,e.analytics,"cart");return _react.useEffect.call(void 0, ()=>{e.projectID!=null&&_chunkKZWCVKLUjs.J.call(void 0, e.projectID)},[e.projectID]),_jsxruntime.jsx.call(void 0, _chunkIRZJIPUFjs.l,{value:n,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.y,{locale:e.locale,texts:e.texts,children:_jsxruntime.jsx.call(void 0, ct,{appearance:e.appearance,children:t==null?null:_jsxruntime.jsx.call(void 0, $n,{...e,projectID:t})})})})}var Qi=$i;var J=_chunkHP3I6D2Rjs.g.pl,j={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:J.resendIn,loginResentMessage:J.resent,loginExpiredError:J.expired,loginTooManyAttemptsError:J.tooManyAttempts,loginRateLimitedError:J.rateLimited,loginNetworkError:J.network,loginSpamHint:J.spamHint,loginValidityHint:J.validity,loginVerifyingButton:J.verifying,loginStepEmailHint:J.stepEmail,loginStepCodeHint:J.stepCode,loginAlreadySentMessage:J.alreadySent,loginEmailNotFoundError:J.emailNotFound,loginDeliveryUnavailableError:J.deliveryUnavailable,loginResendNewCodeButton:J.resendNew,loginNoCodeButton:J.noCode,loginCodeIncompleteError:J.codeIncomplete};function Fr({projectName:e,projectLogo:t,projectLogoDark:n,description:o,className:r,onLogout:a}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[t!=null||e!=null&&_jsxruntime.jsxs.call(void 0, "h2",{className:_chunk4Y233NIIjs.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([r, 'optionalAccess', _152 => _152.headerTitle])),children:[t!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:t,alt:"",className:_chunk4Y233NIIjs.g.call(void 0, "h-12 w-auto dark:hidden",_optionalChain([r, 'optionalAccess', _153 => _153.headerLogo]))}),_jsxruntime.jsx.call(void 0, "img",{src:_nullishCoalesce(n, () => (t)),alt:"",className:_chunk4Y233NIIjs.g.call(void 0, "hidden h-12 w-auto dark:inline",_optionalChain([r, 'optionalAccess', _154 => _154.headerLogo]))})]}),_jsxruntime.jsx.call(void 0, "span",{children:e})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[o&&_jsxruntime.jsx.call(void 0, "p",{className:_chunk4Y233NIIjs.g.call(void 0, "mt-4 font-medium text-left",_optionalChain([r, 'optionalAccess', _155 => _155.headerDescription])),children:o}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),a&&_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{variant:"ghost",size:"icon-sm",onClick:a,children:_jsxruntime.jsx.call(void 0, _lucidereact.LogOutIcon,{className:"h-5 w-5"})})]})]})}var _reactswitch = require('@radix-ui/react-switch'); var an = _interopRequireWildcard(_reactswitch);function ht({className:e,...t}){return _jsxruntime.jsx.call(void 0, an.Root,{"data-slot":"switch",className:_chunk4Y233NIIjs.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",e),...t,children:_jsxruntime.jsx.call(void 0, an.Thumb,{"data-slot":"switch-thumb",className:_chunk4Y233NIIjs.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 Le = _interopRequireWildcard(_reactpopover);function Hr({...e}){return _jsxruntime.jsx.call(void 0, Le.Root,{"data-slot":"popover",...e})}function Kr({...e}){return _jsxruntime.jsx.call(void 0, Le.Trigger,{"data-slot":"popover-trigger",...e})}function Vr({className:e,align:t="center",sideOffset:n=4,...o}){return _jsxruntime.jsx.call(void 0, Le.Portal,{children:_jsxruntime.jsx.call(void 0, Le.Content,{"data-slot":"popover-content",align:t,sideOffset:n,className:_chunk4Y233NIIjs.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",e),...o})})}function $r({regularity:e}){let t="";switch(e){case"rarely":t="rzadko";break;case"often":t="cz\u0119sto";break;case"very_often":t="codzienne";break}return _jsxruntime.jsxs.call(void 0, Hr,{children:[_jsxruntime.jsx.call(void 0, Kr,{onClick:n=>{n.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:t})]})}),_jsxruntime.jsx.call(void 0, Vr,{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 ln({groups:e=[],isManaging:t,onToggle:n,onCheckAll:o,onUpdate:r,isUpdating:a,wasChanged:i,isUserGroupsUpdated:l,className:c,texts:p}){let[s]=_react3.useAutoAnimate.call(void 0, ),[y]=_react3.useAutoAnimate.call(void 0, ),v=e.filter(d=>d.isOn===!1).length>0,m=e.filter(d=>d.isOn===!1).length>0;if(e.length<=1&&t!=!0)return null;let g=_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:_chunk4Y233NIIjs.g.call(void 0, "my-5 flex flex-col gap-3",_optionalChain([c, 'optionalAccess', _156 => _156.groupsList])),children:[e.map(d=>_jsxruntime.jsxs.call(void 0, "div",{id:d.id,role:"button",className:_chunk4Y233NIIjs.g.call(void 0, d.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([c, 'optionalAccess', _157 => _157.groupItem])),onClick:I=>{I.target instanceof HTMLButtonElement||n(d.id)},children:[_jsxruntime.jsx.call(void 0, ht,{checked:d.isOn,className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",onCheckedChange:()=>{n(d.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:d.name}),d.description&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-light",children:d.description})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),d.howOften&&_jsxruntime.jsx.call(void 0, $r,{regularity:d.howOften})]},d.id)),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[t===!0&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:y,className:"flex flex-col items-start justify-start",children:[i&&_jsxruntime.jsxs.call(void 0, _chunkYPA6MMGJjs.k,{variant:"default",size:"sm",className:"relative",disabled:a,onClick:r,children:[_nullishCoalesce(_optionalChain([p, 'optionalAccess', _158 => _158.groupsUpdateButton]), () => (j.groupsUpdateButton)),a&&_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, _chunkHP3I6D2Rjs.e,{})})]}),l&&_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([p, 'optionalAccess', _159 => _159.groupsUpdateSuccess]), () => (j.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, _chunkYPA6MMGJjs.k,{className:"cursor-pointer dark:bg-neutral-700",onClick:o,size:"sm",variant:"secondary",type:"button",children:_nullishCoalesce(_optionalChain([p, 'optionalAccess', _160 => _160.groupsSelectAllButton]), () => (j.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([p, 'optionalAccess', _161 => _161.groupsNoSelectionWarning]), () => (j.groupsNoSelectionWarning))]})]});return t==!0?_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.b,{className:"mt-5 text-left",children:[_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.c,{children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.d,{children:_nullishCoalesce(_optionalChain([p, 'optionalAccess', _162 => _162.groupsTitle]), () => (j.groupsTitle))})}),_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.e,{children:g})]}):g}function Xr({showQRCode:e=!0,isManaging:t,className:n,texts:o}){let r=typeof window<"u",a=r?!!_optionalChain([window, 'access', _163 => _163.matchMedia, 'optionalCall', _164 => _164("(prefers-color-scheme: dark)"), 'access', _165 => _165.matches]):!1;function i(l){return l?window.location.href:""}return e?_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.b,{className:_chunk4Y233NIIjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([n, 'optionalAccess', _166 => _166.qrCodeSection])),children:[_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.c,{children:_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.d,{className:_chunk4Y233NIIjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([n, 'optionalAccess', _167 => _167.qrCodeTitle])),children:[_nullishCoalesce(_optionalChain([o, 'optionalAccess', _168 => _168.qrCodeSubtitle]), () => (j.qrCodeSubtitle))," "+(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _169 => _169.qrCodeTitle]), () => (j.qrCodeTitle)))]})}),_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.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:_chunk4Y233NIIjs.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:_chunk4Y233NIIjs.e+"/google-play-logo.png",alt:"Get in on Google Play"})})]}),r&&_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunk4Y233NIIjs.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([n, 'optionalAccess', _170 => _170.qrCodeContainer])),children:[_jsxruntime.jsx.call(void 0, "img",{className:"mt-3 w-[80%] p-1 pt-3",src:_chunk4Y233NIIjs.e+`/api/qr-gen?url=${i(r)}&bgColor=${a?"171717":"F6F4F0"}&textColor=${a?"ffffff":"000000"}&margin=0`}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs md:text-sm",children:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _171 => _171.qrCodeScanText]), () => (j.qrCodeScanText))})]})})]})]}):null}var _reactphonenumberinput = require('react-phone-number-input');var _reactlabel = require('@radix-ui/react-label');function Zr({submit:e,isLoading:t,errMsg:n,emailLack:o,warnMsg:r,isSubmited:a,agreementLack:i,showPhoneInput:l=!1,agreementText:c,className:p,texts:s}){let[y,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[d,I]=_react.useState.call(void 0, !1),[R]=_react3.useAutoAnimate.call(void 0, );function h(b){b.preventDefault(),e(y,m,d)}return _jsxruntime.jsxs.call(void 0, "form",{ref:R,onSubmit:h,className:_chunk4Y233NIIjs.g.call(void 0, "flex flex-col gap-3 text-left",_optionalChain([p, 'optionalAccess', _172 => _172.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', _173 => _173.formEmailLabel]), () => (j.formEmailLabel))}),_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.l,{value:y,onChange:b=>{v(b.currentTarget.value)},id:"bts-notifications-form-email",className:_chunk4Y233NIIjs.g.call(void 0, o===!0?"border-red-400":""),type:"email",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _174 => _174.formEmailPlaceholder]), () => (j.formEmailPlaceholder))})]}),l&&_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', _175 => _175.formPhoneLabel]), () => (j.formPhoneLabel))," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-neutral-500 dark:text-neutral-500",children:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _176 => _176.formPhoneOptional]), () => (j.formPhoneOptional))})]}),_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.l,{value:m,onChange:b=>{g(b.currentTarget.value)},id:"bts-notifications-form-phone",className:"",type:"tel",autoComplete:"tel",autoCorrect:"off",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _177 => _177.formPhonePlaceholder]), () => (j.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:d,onChange:()=>{I(!d)}}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"bts-notifications-form-marketing-consent",className:_chunk4Y233NIIjs.g.call(void 0, "cursor-pointer text-xs leading-4 transition-colors md:text-sm md:leading-4",i===!0?"text-yellow-700":""),children:c})]}),n.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})," ",n]}),r.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})," ",r]}),a==!1&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsxs.call(void 0, _chunkYPA6MMGJjs.k,{variant:"default",disabled:t,className:_chunk4Y233NIIjs.g.call(void 0, t?"cursor-not-allowed text-transparent":"","relative"),children:[_nullishCoalesce(_optionalChain([s, 'optionalAccess', _178 => _178.formSubmitButton]), () => (j.formSubmitButton)),t&&_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, _chunkHP3I6D2Rjs.e,{})})]})}),a&&_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', _179 => _179.formSuccessMessage]), () => (j.formSuccessMessage))]})]})}var cs=/^(([^<>()\[\]\\.,;:\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 Jr({groups:e,onToggle:t,onCheckAll:n,slug:o,showPhoneInput:r=!1,agreementText:a,className:i,texts:l,isUpdating:c,wasChanged:p,onSuccess:s}){let[y,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[d,I]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[b,A]=_react.useState.call(void 0, !1),{mutateAsync:x,isPending:E}=_chunkYPA6MMGJjs.g.call(void 0, _chunkYPA6MMGJjs.e.notifications.createNotificationUser);function D(w){return w==null?!1:_reactphonenumberinput.isValidPhoneNumber.call(void 0, w,"PL")}async function S(w,C,U){if(v(""),g(""),A(!1),I(!1),h(!1),!U){h(!0),v("Zgoda w tym przypadku jest wymagana.");return}if(cs.test(w)===!1){v("Email jest nieprawid\u0142owy."),A(!0);return}C.length>0&&D(C)===!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 f=await x({slug:o,email:w,phone:C,groups:e.filter(k=>k.isOn==!0).map(k=>k.id),mobileNotificationEnabled:!0,emailNotificationEnabled:!0,smsNotificationEnabled:!0});if(f.result.case==="success"){I(!0),setTimeout(()=>{_optionalChain([s, 'optionalCall', _180 => _180(!1,f.userId,f.accessToken)])},1e3);return}else{I(!0);let k=f.result.value;if(k!=null){if(k==32){_optionalChain([s, 'optionalCall', _181 => _181(!0,void 0,void 0)]);return}console.log(`Code error: ${_chunkYPA6MMGJjs.a[k]}`),v("Wyst\u0105pi\u0142 b\u0142\u0105d: "+_chunkYPA6MMGJjs.a[k]);return}return}}catch(f){v("Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisywania. Spr\xF3buj ponownie."),console.log(`Error: ${f}`)}}let T=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _182 => _182.formTitle]), () => (j.formTitle));return _jsxruntime.jsxs.call(void 0, "div",{className:_chunk4Y233NIIjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([i, 'optionalAccess', _183 => _183.formSection])),children:[T.length>0&&_jsxruntime.jsx.call(void 0, "h3",{className:_chunk4Y233NIIjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([i, 'optionalAccess', _184 => _184.formTitle])),children:T}),_jsxruntime.jsx.call(void 0, ln,{groups:e,isManaging:!1,onToggle:_nullishCoalesce(t, () => ((()=>{}))),onCheckAll:_nullishCoalesce(n, () => ((()=>{}))),isUpdating:_nullishCoalesce(c, () => (!1)),wasChanged:_nullishCoalesce(p, () => (!1)),isUserGroupsUpdated:!1,className:i,texts:l}),_jsxruntime.jsx.call(void 0, Zr,{errMsg:y,emailLack:b,warnMsg:m,submit:S,isLoading:E,isSubmited:d,agreementLack:R,showPhoneInput:r,agreementText:_nullishCoalesce(_nullishCoalesce(a, () => (_optionalChain([l, 'optionalAccess', _185 => _185.agreementText]))), () => (j.agreementText)),className:i,texts:l})]})}var _usedebounce = require('use-debounce');function ta({open:e,onOpenChange:t,onConfirm:n,isDeleting:o=!1}){let[r,a]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>(a(!0),()=>a(!1)),[]),_react.useEffect.call(void 0, ()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!r||!e)return null;let i=c=>{c.target===c.currentTarget&&t(!1)},l=()=>{n()};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:_chunk4Y233NIIjs.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:c=>c.stopPropagation(),children:[_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>t(!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, _chunkYPA6MMGJjs.k,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:o,className:"sm:min-w-[100px]",children:"Anuluj"}),_jsxruntime.jsxs.call(void 0, _chunkYPA6MMGJjs.k,{type:"button",variant:"destructive",onClick:l,disabled:o,className:_chunk4Y233NIIjs.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 oa({accessToken:e,slug:t,userID:n,className:o,texts:r}){let[a]=_react3.useAutoAnimate.call(void 0, ),[i]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:l,isPending:c}=_chunkYPA6MMGJjs.g.call(void 0, _chunkYPA6MMGJjs.e.notifications.deleteNotificationUser),{mutateAsync:p,isPending:s}=_chunkYPA6MMGJjs.g.call(void 0, _chunkYPA6MMGJjs.e.notifications.updateNotificationUser),{data:y,isFetching:v}=_chunkYPA6MMGJjs.f.call(void 0, _chunkYPA6MMGJjs.e.notifications.getNotificationUserSettings,{userId:n,slug:t,accessToken:e}),[m,g]=_react.useState.call(void 0, !1),[d,I]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[b,A]=_react.useState.call(void 0, !1),[x,E]=_react.useState.call(void 0, !1),D=_optionalChain([y, 'optionalAccess', _186 => _186.result, 'access', _187 => _187.case])==="success"?_optionalChain([y, 'optionalAccess', _188 => _188.result, 'optionalAccess', _189 => _189.value]):void 0;function S(){E(!0)}async function T(){await l({accessToken:e,slug:t,userId:n}),E(!1)}async function w(){await p({accessToken:e,slug:t,notificationUserId:n,mobileNotificationEnabled:b,emailNotificationEnabled:m,smsNotificationEnabled:d}),h(!0),setTimeout(()=>{h(!1)},3e3)}let C=_usedebounce.useDebouncedCallback.call(void 0, f=>{w()},300);_react.useEffect.call(void 0, ()=>{let f=_optionalChain([y, 'optionalAccess', _190 => _190.result, 'access', _191 => _191.case])==="success"?_optionalChain([y, 'optionalAccess', _192 => _192.result, 'optionalAccess', _193 => _193.value]):void 0;g(_nullishCoalesce(_optionalChain([f, 'optionalAccess', _194 => _194.emailNotificationEnabled]), () => (!1))),I(_nullishCoalesce(_optionalChain([f, 'optionalAccess', _195 => _195.smsNotificationEnabled]), () => (!1))),A(_nullishCoalesce(_optionalChain([f, 'optionalAccess', _196 => _196.mobileNotificationEnabled]), () => (!1)))},[y]);function U(f,k){f==="email"&&g(k),f==="phone"&&I(k),f==="push"&&A(k),C(!0)}return _jsxruntime.jsxs.call(void 0, "div",{className:_chunk4Y233NIIjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([o, 'optionalAccess', _197 => _197.manageDataSection])),children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, "h3",{className:_chunk4Y233NIIjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([o, 'optionalAccess', _198 => _198.manageDataTitle])),children:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _199 => _199.manageDataTitle]), () => (j.manageDataTitle))})}),v?_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.o,{className:"h-64 w-full"}):_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.b,{ref:i,className:_chunk4Y233NIIjs.g.call(void 0, s&&"relative"),children:[_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.c,{children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.d,{children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-left",children:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _200 => _200.manageDataDescription]), () => (j.manageDataDescription))})})}),_jsxruntime.jsxs.call(void 0, _chunkKZWCVKLUjs.e,{ref:a,children:[_jsxruntime.jsx.call(void 0, "div",{className:_chunk4Y233NIIjs.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', _201 => _201.emailNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, ht,{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', _202 => _202.smsNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, ht,{id:"sms-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:d,onCheckedChange:()=>{U("phone",!d)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"sms-enabled",className:"text-sm",children:"SMS"})]}),_optionalChain([D, 'optionalAccess', _203 => _203.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, ht,{id:"push-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:b,onCheckedChange:()=>{U("push",!b)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"push-enabled",className:"text-sm",children:"Powiadomienia na telefon"})]}),_optionalChain([D, 'optionalAccess', _204 => _204.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([r, 'optionalAccess', _205 => _205.manageDataUpdatedMessage]), () => (j.manageDataUpdatedMessage))}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-x-2",children:_jsxruntime.jsxs.call(void 0, _chunkYPA6MMGJjs.k,{size:"sm",variant:"link",className:_chunk4Y233NIIjs.g.call(void 0, "pl-0 ml-0",c&&"cursor-not-allowed"),onClick:S,children:[_nullishCoalesce(_optionalChain([r, 'optionalAccess', _206 => _206.manageDataUnsubscribeButton]), () => (j.manageDataUnsubscribeButton)),c&&_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, _chunkHP3I6D2Rjs.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, _chunkHP3I6D2Rjs.e,{})})})]}),_jsxruntime.jsx.call(void 0, ta,{open:x,onOpenChange:E,onConfirm:T,isDeleting:c})]})}function ra({...e}){return _jsxruntime.jsx.call(void 0, ae.Root,{"data-slot":"dialog",...e})}function Cs({...e}){return _jsxruntime.jsx.call(void 0, ae.Portal,{"data-slot":"dialog-portal",...e})}function Ps({className:e,...t}){return _jsxruntime.jsx.call(void 0, ae.Overlay,{"data-slot":"dialog-overlay",className:_chunk4Y233NIIjs.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",e),...t})}function aa({className:e,children:t,showCloseButton:n=!0,...o}){return _jsxruntime.jsxs.call(void 0, Cs,{"data-slot":"dialog-portal",children:[_jsxruntime.jsx.call(void 0, Ps,{}),_jsxruntime.jsxs.call(void 0, ae.Content,{"data-slot":"dialog-content",className:_chunk4Y233NIIjs.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",e),...o,children:[t,n&&_jsxruntime.jsxs.call(void 0, ae.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 ia({className:e,...t}){return _jsxruntime.jsx.call(void 0, ae.Title,{"data-slot":"dialog-title",className:_chunk4Y233NIIjs.g.call(void 0, "text-lg leading-none font-semibold",e),...t})}function sa({className:e,...t}){return _jsxruntime.jsx.call(void 0, ae.Description,{"data-slot":"dialog-description",className:_chunk4Y233NIIjs.g.call(void 0, "text-muted-foreground text-sm",e),...t})}var _connect = require('@connectrpc/connect');function ua(e,t="pl"){let n=e.loginCodeSentMessage,o={emailLabel:e.loginEmailLabel,emailPlaceholder:e.loginEmailPlaceholder,sendCode:e.loginSendCodeButton,sending:e.loginSendingButton,invalidEmail:e.loginInvalidEmailError,codeSentTo:n!=null?`${n} {email}.`:void 0,changeEmail:e.loginChangeEmailButton,verify:e.loginVerifyButton,spamHint:e.loginSpamHint,validity:e.loginValidityHint,resend:e.loginResendCodeButton,resendIn:e.loginResendInText,resent:e.loginResentMessage,haveCodePrompt:"",haveCode:e.loginIHaveCode,wrongCode:e.loginInvalidCodeError,expired:e.loginExpiredError,tooManyAttempts:e.loginTooManyAttemptsError,rateLimited:e.loginRateLimitedError,network:e.loginNetworkError,generic:e.loginVerifyCodeError,deliveryFailed:e.loginSendEmailError,verifying:e.loginVerifyingButton,stepEmail:e.loginStepEmailHint,stepCode:e.loginStepCodeHint,alreadySent:e.loginAlreadySentMessage,emailNotFound:e.loginEmailNotFoundError,deliveryUnavailable:e.loginDeliveryUnavailableError,resendNew:e.loginResendNewCodeButton,noCode:e.loginNoCodeButton,codeIncomplete:e.loginCodeIncompleteError};return _chunkHP3I6D2Rjs.h.call(void 0, t,o)}function ca(e){let t=_connect.ConnectError.from(e),n=t.rawMessage||t.message;return t.code===_connect.Code.ResourceExhausted?/too many attempts/i.test(n)?"tooManyAttempts":"rateLimited":/invalid code/i.test(n)?"wrongCode":/expired/i.test(n)?"expired":t.code===_connect.Code.Unavailable?"unknown":_chunkHP3I6D2Rjs.a.call(void 0, e)}function da(e,t,n){return{async send(o,{resend:r}){if(!t)return{ok:!1,kind:"unknown",message:n.loginSlugRequiredError};try{let a=await e({email:o,slug:t});return a.ok===!1?a.retryIn!=null&&a.retryIn>0?{ok:!1,kind:"rateLimited",retryIn:a.retryIn}:{ok:!1,kind:"deliveryFailed",message:r?n.loginResendEmailError:n.loginSendEmailError}:a.sent===!1?{ok:!1,kind:"alreadySent",retryIn:a.retryIn||void 0}:{ok:!0,retryIn:a.retryIn||void 0}}catch(a){let i=ca(a);return{ok:!1,kind:i,cause:a,message:i==="unknown"?r?n.loginResendEmailError:n.loginSendEmailError:void 0}}},async verify({email:o,code:r}){try{let a=await e({email:o,code:r,slug:t});return a.ok&&a.accessToken?{ok:!0,value:{userId:a.userId,accessToken:a.accessToken}}:{ok:!1,kind:"wrongCode",message:n.loginVerificationFailedError}}catch(a){return{ok:!1,kind:ca(a),cause:a}}}}}function Ss({slug:e,onSuccess:t,onError:n,texts:o,projectName:r,projectLogo:a,projectLogoDark:i,showLogo:l}){let[c]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:p}=_chunkYPA6MMGJjs.g.call(void 0, _chunkYPA6MMGJjs.e.notifications.verifyUserEmail),s=_react.useMemo.call(void 0, ()=>ua(o),[o]),[y,v]=s.codeSentTo.split("{email}"),m=_react.useRef.call(void 0, n);m.current=n;let g=_react.useMemo.call(void 0, ()=>{let h=da(b=>p(b),e,o);return{...h,async verify(b){let A=await h.verify(b);return!A.ok&&A.kind==="wrongCode"&&_optionalChain([m, 'access', _207 => _207.current, 'optionalCall', _208 => _208(A.cause instanceof Error?A.cause:new Error(_nullishCoalesce(A.message, () => ("wrongCode"))))]),A}}},[p,e,o]),d=_chunkHP3I6D2Rjs.j.call(void 0, {adapter:g,texts:s,storageKey:e?_chunkHP3I6D2Rjs.f.call(void 0, "notifications",e):void 0,onVerified:({userId:h,accessToken:b})=>_optionalChain([t, 'optionalCall', _209 => _209(h,b)]),onFailure:(h,b)=>_optionalChain([n, 'optionalCall', _210 => _210(b instanceof Error?b:new Error(h))])}),I=d.step==="code",R=I&&!d.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, _chunkHP3I6D2Rjs.c,{projectId:e,name:r,showLogo:l,logoUrl:a,logoDarkUrl:i,className:"text-foreground mb-3"}),_jsxruntime.jsxs.call(void 0, "div",{ref:c,className:"mb-2 flex items-start gap-2",children:[I&&_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{type:"button",variant:"ghost",size:"icon-sm",className:"-mt-2 -ml-2 size-11 shrink-0","aria-label":s.changeEmail,disabled:d.isBusy,onClick:d.changeEmail,children:_jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeft,{className:"h-5 w-5","aria-hidden":!0})}),_jsxruntime.jsx.call(void 0, ia,{className:"text-lg leading-6 font-semibold",children:R})]}),_jsxruntime.jsx.call(void 0, sa,{className:I?"sr-only":"mb-4",children:I?`${y}${d.email}${_nullishCoalesce(v, () => (""))}`:_nullishCoalesce(o.loginDescription, () => (""))}),_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.f,{login:d,texts:s})]})}function fa({slug:e,onSuccess:t,onError:n,className:o,isOpen:r,onClose:a,texts:i,projectName:l,projectLogo:c,projectLogoDark:p,showLogo:s}){return _jsxruntime.jsx.call(void 0, ra,{open:r,onOpenChange:a,children:_jsxruntime.jsx.call(void 0, aa,{className:"max-h-[100dvh] overflow-y-auto sm:max-w-[425px]",children:_jsxruntime.jsx.call(void 0, Ss,{slug:e,onSuccess:t,onError:n,texts:i,projectName:l,projectLogo:c,projectLogoDark:p,showLogo:s})})})}function Ds(e,t){switch(t.type){case"SET_IS_LOGGED_IN":return{...e,isLoggedIn:t.value};case"SET_USER_ID":return{...e,userID:t.value};case"SET_LOADING":return{...e,isLoading:t.value};case"SET_PUBLIC_GROUPS":return{...e,groupsProvided:t.value,groups:t.value!=null&&t.value.length>0?e.groups.filter(n=>_optionalChain([t, 'access', _211 => _211.value, 'optionalAccess', _212 => _212.find, 'call', _213 => _213(o=>o.id===n.id)])!=null):e.groups};case"SET_GROUPS":{let n=e.isLoggedIn==!1||e.groupsProvided!=null,o=t.value.map(r=>e.isLoggedIn==!0?r:{...r,isOn:_nullishCoalesce(_optionalChain([e, 'access', _214 => _214.groupsProvided, 'optionalAccess', _215 => _215.find, 'call', _216 => _216(a=>a.id===r.id), 'optionalAccess', _217 => _217.isOn]), () => (n))});return{...e,groups:o}}case"TOGGLE_GROUP":{let n=e.groups.map(o=>o.id===t.groupID?{...o,isOn:!o.isOn}:o);return{...e,wasChanged:!0,groups:n}}case"CHECK_ALL_GROUPS":{let n=e.groups.map(o=>({...o,isOn:!0}));return{...e,groups:n,wasChanged:!0}}case"SET_WAS_CHANGED":return{...e,wasChanged:t.value};case"SET_IS_USER_GROUPS_UPDATED":return{...e,isUserGroupsUpdated:t.value};case"RESET_UPDATE_STATE":return{...e,wasChanged:!1,isUserGroupsUpdated:!0};case"SHOW_SETTINGS":return{...e,showSettings:!0};case"HIDE_SETTINGS":return{...e,showSettings:!1};default:return e}}function Ls({slug:e,userID:t,productID:n,projectID:o,analytics:r,projectName:a,projectLogo:i,projectLogoDark:l,showLoginLogo:c,groups:p,isManaging:s=!1,texts:y,showQRCode:v=!1,showPhoneInput:m=!1,hiddenGroupIds:g=[],className:d}){let[I]=_react3.useAutoAnimate.call(void 0, ),R=_chunkIRZJIPUFjs.n.call(void 0, _nullishCoalesce(o, () => (ke())),r),h=_nullishCoalesce(_nullishCoalesce(e, () => (_chunkKZWCVKLUjs.K.call(void 0, ))), () => ((typeof window<"u"?window.location.hostname:"")));_chunkHP3I6D2Rjs.b.call(void 0, h.trim(),c!==!1&&!i&&!l&&h.trim()!=="");let{mutateAsync:b,isPending:A}=_chunkYPA6MMGJjs.g.call(void 0, _chunkYPA6MMGJjs.e.notifications.updateUserGroups),{data:x,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:S,refetch:T}=_chunkYPA6MMGJjs.f.call(void 0, _chunkYPA6MMGJjs.e.notifications.getUserGroups,{slug:h,accessToken:_optionalChain([x, 'optionalAccess', _218 => _218.accessToken])}),[w,C]=_react.useReducer.call(void 0, Ds,{isLoading:S,isUserGroupsUpdated:!1,wasChanged:!1,groupsProvided:p,groups:[],showSettings:x!=null&&s==!0,isLoggedIn:x!=null,userID:void 0});_react.useEffect.call(void 0, ()=>{C({type:"SET_LOADING",value:A||S})},[A,S]),_react.useEffect.call(void 0, ()=>{C({type:"SET_IS_LOGGED_IN",value:_optionalChain([x, 'optionalAccess', _219 => _219.accessToken])!=null}),C({type:"SET_USER_ID",value:_optionalChain([x, 'optionalAccess', _220 => _220.userID])}),_optionalChain([x, 'optionalAccess', _221 => _221.accessToken])!=null&&s==!0&&C({type:"SHOW_SETTINGS"})},[x,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))}});C({type:"SET_GROUPS",value:W})},[D,S,p]);let U=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{let W=_optionalChain([p, 'optionalAccess', _222 => _222.map, 'call', _223 => _223(F=>(F.id.startsWith("group_")||(F.id=`group_${F.id}`),F))]);C({type:"SET_PUBLIC_GROUPS",value:W})},[p]);let f={...j,...y};async function k(){await b({accessToken:_optionalChain([x, 'optionalAccess', _224 => _224.accessToken]),slug:h,userId:t,groupIds:w.groups.filter(W=>W.isOn===!0).map(W=>W.id)}),C({type:"RESET_UPDATE_STATE"}),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{C({type:"SET_IS_USER_GROUPS_UPDATED",value:!1})},2e3)}function X(W){C({type:"TOGGLE_GROUP",groupID:W})}function be(){C({type:"CHECK_ALL_GROUPS"})}function Me(){C({type:"SHOW_SETTINGS"})}function M(){C({type:"HIDE_SETTINGS"})}function O(){localStorage.removeItem("notifications_accessToken"),localStorage.removeItem("notifications_userID"),E(),C({type:"SET_USER_ID",value:void 0}),C({type:"SET_IS_LOGGED_IN",value:!1}),C({type:"HIDE_SETTINGS"})}async function N(W,F){typeof window<"u"&&(localStorage.setItem("notifications_accessToken",F),W!=null&&localStorage.setItem("notifications_userID",W)),C({type:"SET_USER_ID",value:W});try{await E(),T().then().catch().finally(()=>{s==!0&&C({type:"SHOW_SETTINGS"})})}catch(V){console.log(`Error: ${V}`)}}_react.useEffect.call(void 0, ()=>()=>{U.current&&clearTimeout(U.current)},[]);let _=s==!0&&w.userID!=null&&_optionalChain([x, 'optionalAccess', _225 => _225.accessToken])!=null;return _jsxruntime.jsxs.call(void 0, "main",{className:_chunk4Y233NIIjs.g.call(void 0, "bitsnap-react relative",_optionalChain([d, 'optionalAccess', _226 => _226.container])),children:[f.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:f.title}),!w.showSettings&&s&&_jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.k,{onClick:Me,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:_chunk4Y233NIIjs.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([d, 'optionalAccess', _227 => _227.header])),children:w.showSettings?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-6",children:w.isLoggedIn&&_jsxruntime.jsxs.call(void 0, "div",{className:_chunk4Y233NIIjs.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([d, 'optionalAccess', _228 => _228.groupsContainer]),children:[_jsxruntime.jsx.call(void 0, Fr,{projectName:a,projectLogo:i,projectLogoDark:l,description:f.managingDescription,className:d,onLogout:O}),S&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center items-center py-8",children:_jsxruntime.jsx.call(void 0, _chunkHP3I6D2Rjs.e,{})}),_jsxruntime.jsx.call(void 0, ln,{groups:w.groups,hiddenGroupIds:g,isManaging:s,onToggle:X,onCheckAll:be,onUpdate:k,isUpdating:A,wasChanged:w.wasChanged,isUserGroupsUpdated:w.isUserGroupsUpdated,className:d,texts:f})]}),_&&_jsxruntime.jsx.call(void 0, oa,{accessToken:_nullishCoalesce(x.accessToken, () => ("")),slug:h,userID:_nullishCoalesce(w.userID, () => ("")),className:d,texts:f}),v!=!1&&_jsxruntime.jsx.call(void 0, Xr,{showQRCode:v,isManaging:!0,className:d,texts:f})]})}):_jsxruntime.jsx.call(void 0, "div",{className:_chunk4Y233NIIjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6"),children:_jsxruntime.jsx.call(void 0, Jr,{slug:h,onToggle:W=>{C({type:"TOGGLE_GROUP",groupID:W})},onCheckAll:()=>{C({type:"CHECK_ALL_GROUPS"})},onSuccess:(W,F,V)=>{R.track("availability_signup",{},{product_id:_nullishCoalesce(n, () => (null))}),V!=null&&N(F,V),W&&C({type:"SHOW_SETTINGS"})},groups:w.groups,showPhoneInput:m,agreementText:f.agreementText,className:d,texts:f,wasChanged:w.wasChanged,isUpdating:A})})}),_jsxruntime.jsx.call(void 0, fa,{isOpen:w.showSettings&&!w.isLoggedIn,slug:h,onSuccess:N,texts:f,onClose:M,projectName:a,projectLogo:i,projectLogoDark:l,showLogo:c})]})}function _s({slug:e,userID:t,productID:n,projectID:o,analytics:r,projectName:a,projectLogo:i,projectLogoDark:l,showLoginLogo:c,groups:p,isManaging:s,texts:y,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:d}){return _jsxruntime.jsx.call(void 0, _chunkYPA6MMGJjs.j,{children:_jsxruntime.jsx.call(void 0, Ls,{slug:e,userID:t,productID:n,projectID:o,analytics:r,projectName:a,projectLogo:i,projectLogoDark:l,showLoginLogo:c,groups:p,isManaging:s,texts:y,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:d})})}var Us=_s;function ya({choice:e,selected:t,onChange:n,disabled:o}){let r=_chunkKZWCVKLUjs.A.call(void 0, ),a=L("paymentMethods"),i=L("paymentMethodOption"),l=_react2.default.useId(),c=_react2.default.useId(),p=e.manualAccountTypes.length===0||e.manualAccountTypes.includes("blik"),s={online:{title:r("paymentMethodOnline"),description:r("paymentMethodOnlineDescription")},manual:{title:r(_chunkKZWCVKLUjs.q.call(void 0, e.manualAccountTypes)),description:r("paymentMethodManualDescription"),note:p?r("paymentMethodManualBlikNote"):void 0},cod:{title:r("paymentMethodCod"),description:r("paymentMethodCodDescription")}};return _jsxruntime.jsxs.call(void 0, "fieldset",{"data-bitsnap-checkout-slot":"paymentMethods","aria-labelledby":c,className:_chunk4Y233NIIjs.g.call(void 0, "mx-2 mt-4 mb-2 flex min-w-0 flex-col gap-2 border-0 p-0",a.className),style:a.style,disabled:o,children:[_jsxruntime.jsx.call(void 0, "legend",{id:c,className:"mb-1 px-1 text-sm font-medium",children:r("paymentMethodLegend")}),e.methods.map(y=>{let v=s[y],m=y===t,g=`${l}-${y}-description`;return _jsxruntime.jsxs.call(void 0, "label",{"data-bitsnap-checkout-slot":"paymentMethodOption","data-payment-method":y,"data-selected":m?"":void 0,className:_chunk4Y233NIIjs.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:l,value:y,checked:m,onChange:()=>n(y),"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})]})]})]},y)})]})}var js=({className:e,locale:t})=>{let n=_chunkKZWCVKLUjs.O.call(void 0, ),o=_chunkIRZJIPUFjs.m.call(void 0, ),r=_nullishCoalesce(t, () => (_chunkQ337IQNAjs.f.call(void 0, ))),a=L("productList"),i=L("summary"),l=L("totalLabel"),c=L("totalValue"),p=L("deliveryText"),s=L("summaryNote"),y=L("countryLabel"),v=L("paymentButtons"),m=L("checkoutButton"),g=L("emptyState"),d=L("error"),I=L("skeleton"),R=_chunkKZWCVKLUjs.z.call(void 0, "unavailableProducts"),h=_chunkKZWCVKLUjs.A.call(void 0, ),b=_chunkKZWCVKLUjs.z.call(void 0, "emptyCart"),A=_chunkKZWCVKLUjs.z.call(void 0, "total"),x=_chunkKZWCVKLUjs.z.call(void 0, "delivery"),E=_chunkKZWCVKLUjs.z.call(void 0, "chooseCountry"),D=_chunkKZWCVKLUjs.z.call(void 0, "nextStep"),S=_chunkKZWCVKLUjs.z.call(void 0, "loadFailed"),T=_chunkKZWCVKLUjs.z.call(void 0, "retry"),w=_chunkKZWCVKLUjs.z.call(void 0, "countryRequired"),C=_chunkKZWCVKLUjs.z.call(void 0, "extrasCalculatedNext"),U=_react2.default.useId(),f=_react2.default.useId(),{mutateAsync:k}=_reactquery.useMutation.call(void 0, {mutationFn:n.removeProductFromCart}),{mutateAsync:X}=_reactquery.useMutation.call(void 0, {mutationFn:n.updateQuantity}),{mutateAsync:be}=_reactquery.useMutation.call(void 0, {mutationFn:n.setCountry}),{mutateAsync:Me}=_reactquery.useMutation.call(void 0, {mutationFn:n.clearCart}),[M,O]=_react2.default.useState(""),N=_chunkKZWCVKLUjs.r.call(void 0, P=>P.notice);_react2.default.useEffect(()=>()=>_chunkKZWCVKLUjs.r.getState().setNotice(void 0),[]);let _=M.length>0?M:_nullishCoalesce(N, () => ("")),[W,F]=_react2.default.useState([]),[V,We]=_react2.default.useState(!1),{mutateAsync:mn,isPending:Te}=_reactquery.useMutation.call(void 0, {mutationFn:n.redirectToNextStep}),{data:fn}=_reactquery.useQuery.call(void 0, {queryKey:["cart-available-countries"],queryFn:n.getAvailableCountries}),{data:gn}=_reactquery.useQuery.call(void 0, {queryKey:["cart-one-click-payment"],queryFn:n.checkIfApplePayIsAvailable}),{data:Y,isLoading:oe,isError:bt,refetch:to}=_reactquery.useQuery.call(void 0, {queryKey:["cart",r],queryFn:n.getProducts}),{data:He,refetch:no}=_reactquery.useQuery.call(void 0, {queryKey:["cart-country"],queryFn:n.getCountry}),[Ca]=_react3.useAutoAnimate.call(void 0, ),q=_chunkKZWCVKLUjs.l.call(void 0, Y)?void 0:Y,Be=He!=null&&!_chunkKZWCVKLUjs.l.call(void 0, He)&&He!=""?He:void 0,oo=_reactquery.useQueryClient.call(void 0, ),Ot=q==null||q.length===0||Be==null?void 0:q.map(P=>`${P.productID}:${P.quantity}`).sort().join(","),ro={queryKey:["cart-payment-methods",_chunkKZWCVKLUjs.K.call(void 0, ),r,Be,Ot],queryFn:async()=>n.getPaymentMethodChoice().catch(()=>null),staleTime:6e4,retry:!1},{data:ao,isPlaceholderData:Pa}=_reactquery.useQuery.call(void 0, {...ro,enabled:Ot!=null,placeholderData:P=>P===void 0?void 0:_chunkKZWCVKLUjs.o.call(void 0, P)}),Mt=Ot!=null?_nullishCoalesce(ao, () => (null)):null,[io,xa]=_react2.default.useState(void 0),[so,lo]=_react2.default.useState(!1),co=_react2.default.useRef(null),uo=!oe&&(bt||_chunkKZWCVKLUjs.l.call(void 0, Y)),je=_chunkKZWCVKLUjs.l.call(void 0, fn)?[]:fn,Ct=_nullishCoalesce(_optionalChain([q, 'optionalAccess', _229 => _229.reduce, 'call', _230 => _230((P,K)=>K.details==null?P:P+(_nullishCoalesce(_optionalChain([K, 'access', _231 => _231.details, 'access', _232 => _232.pricing, 'optionalAccess', _233 => _233.effectivePrice]), () => (K.details.price)))*K.quantity,0)]), () => (0)),Pt=_nullishCoalesce(_optionalChain([q, 'optionalAccess', _234 => _234[0], 'optionalAccess', _235 => _235.details, 'optionalAccess', _236 => _236.currency]), () => ("PLN")),ka=_nullishCoalesce(_optionalChain([q, 'optionalAccess', _237 => _237.some, 'call', _238 => _238(P=>_optionalChain([P, 'access', _239 => _239.details, 'optionalAccess', _240 => _240.isDeliverable])===!0)]), () => (!1)),po=He!==void 0&&Be==null,mo=_react2.default.useRef(!1);_react2.default.useEffect(()=>{mo.current||je==null||je.length===0||He==null||Be!=null&&je.some(P=>P.code===Be)||(mo.current=!0,be(je[0].code).then(()=>no()).catch(()=>{}))},[je,He,Be]);let fo=_react2.default.useRef(!1);_react2.default.useEffect(()=>{fo.current||oe||(fo.current=!0,o.track("cart_opened",{item_count:_nullishCoalesce(_optionalChain([q, 'optionalAccess', _241 => _241.reduce, 'call', _242 => _242((P,K)=>P+K.quantity,0)]), () => (0)),value_minor:Ct,currency:Pt}))},[oe,o,q,Ct,Pt]);let yn=_react2.default.useRef(new Map);_react2.default.useEffect(()=>{yn.current.clear()},[q]);function wa(P,K){let se=_optionalChain([q, 'optionalAccess', _243 => _243.find, 'call', _244 => _244(Ea=>Ea.id===P)]);if(_optionalChain([se, 'optionalAccess', _245 => _245.details])==null)return;let le=K-(_nullishCoalesce(yn.current.get(P), () => (se.quantity)));if(yn.current.set(P,K),le===0)return;let Ce=_nullishCoalesce(_optionalChain([se, 'access', _246 => _246.details, 'access', _247 => _247.pricing, 'optionalAccess', _248 => _248.effectivePrice]), () => (se.details.price)),Bt=_nullishCoalesce(se.catalogProductID, () => (se.productID));o.track(le>0?"add_to_cart":"remove_from_cart",{qty:Math.abs(le),value_minor:Math.round(Ce*Math.abs(le)),currency:se.details.currency},{product_id:Bt,variant_id:Bt!==se.productID?se.productID:null})}let go=_react2.default.useRef(!1);async function Ia(P,K){if(K!=null){wa(P,Math.max(0,K));try{let se=K<=0?await k({id:P}):await X({id:P,quantity:K});if(_chunkKZWCVKLUjs.l.call(void 0, se))throw new Error(`cannot change the cart: ${se.error}`)}finally{await to().catch(()=>{})}}}async function Sa(){try{O(""),F([]),_chunkKZWCVKLUjs.r.getState().setNotice(void 0);let P=Mt,K=P!=null?_chunkKZWCVKLUjs.p.call(void 0, P,io):void 0;if(Ot!=null&&(ao===void 0||Pa)){lo(!0);try{P=await oo.fetchQuery(ro).catch(()=>null)}finally{lo(!1)}if(P==null)K=void 0;else if(K==null||!P.methods.includes(K)){window.setTimeout(()=>{_optionalChain([co, 'access', _249 => _249.current, 'optionalAccess', _250 => _250.querySelector, 'call', _251 => _251("input:checked"), 'optionalAccess', _252 => _252.focus, 'call', _253 => _253()])},0);return}}if(q!=null){!go.current&&q.length>0&&(go.current=!0,o.track("checkout_started",{item_count:q.reduce((Ce,Bt)=>Ce+Bt.quantity,0),checkout_type:"cart",value_minor:Ct,currency:Pt}));try{_chunkKZWCVKLUjs.D.call(void 0, {event:"initiateCheckout",items:_optionalChain([q, 'optionalAccess', _254 => _254.map, 'call', _255 => _255(Ce=>({id:Ce.productID,name:_nullishCoalesce(_optionalChain([Ce, 'access', _256 => _256.details, 'optionalAccess', _257 => _257.name]), () => ("")),price:_nullishCoalesce(_optionalChain([Ce, 'access', _258 => _258.details, 'optionalAccess', _259 => _259.price]), () => (0)),quantity:Ce.quantity,currency:_nullishCoalesce(_optionalChain([Ce, 'access', _260 => _260.details, 'optionalAccess', _261 => _261.currency]), () => ("PLN"))}))])})}catch (e14){}}let se=_chunkKZWCVKLUjs.M.call(void 0, ),le=await mn(K!=null?{paymentMethod:K}:void 0);if(_chunkKZWCVKLUjs.l.call(void 0, le)){oo.invalidateQueries({queryKey:["cart-payment-methods"]}),le.error=="item-ids-not-found"?(O(R),"data"in le&&Array.isArray(le.data)&&F(le.data)):K==="cod"&&le.error=="gateway-not-configured"?O(h("paymentMethodCodUnavailable")):O(_chunkKZWCVKLUjs.n.call(void 0, le,h));return}_chunkKZWCVKLUjs.E.call(void 0, le,{cartProjectId:_chunkKZWCVKLUjs.K.call(void 0, ),lines:se})||await Me(),window.location.href=le.url}catch(P){console.warn("checkout failed",P),O(h("checkoutFailed"))}}return _jsxruntime.jsxs.call(void 0, "div",{className:`${e} flex flex-col`,ref:Ca,children:[oe&&_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full justify-center flex-col gap-4",children:[_jsxruntime.jsx.call(void 0, Nn,{"data-bitsnap-checkout-slot":"skeleton",className:_chunk4Y233NIIjs.g.call(void 0, "w-full h-32",I.className),style:I.style}),_jsxruntime.jsx.call(void 0, Nn,{"data-bitsnap-checkout-slot":"skeleton",className:_chunk4Y233NIIjs.g.call(void 0, "w-full h-32",I.className),style:I.style})]}),uo&&_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:_chunk4Y233NIIjs.g.call(void 0, d.className),style:d.style,children:S}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4Y233NIIjs.g.call(void 0, "text-sm",d.className),style:d.style,children:N}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"checkoutButton",onClick:()=>{to().then().catch()},className:_chunk4Y233NIIjs.g.call(void 0, "px-3 py-2 rounded-md transition font-bold",m.className),style:m.style,children:T})]}),!oe&&!uo&&(q==null||q.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:_chunk4Y233NIIjs.g.call(void 0, g.className),style:g.style,children:b}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4Y233NIIjs.g.call(void 0, "text-sm",d.className),style:d.style,children:N})]}),_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"productList",className:_chunk4Y233NIIjs.g.call(void 0, "max-h-[70vh] overflow-clip overflow-y-scroll",a.className),style:a.style,children:q!=null&&q.length>0&&_jsxruntime.jsx.call(void 0, "ul",{className:"mt-5",children:q.map(P=>_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:P.details!=null&&_jsxruntime.jsxs.call(void 0, "li",{className:"mb-3",children:[_jsxruntime.jsx.call(void 0, er,{isNotAvailable:W.includes(P.productID),quantity:P.quantity,details:P.details,url:P.url,shouldUpdate:K=>Ia(P.id,K)}),_jsxruntime.jsx.call(void 0, "hr",{className:"h-1"})]})},P.id))})}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),Ct>0&&Pt!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"summary",className:_chunk4Y233NIIjs.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:_chunk4Y233NIIjs.g.call(void 0, "text-xl",l.className),style:l.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:_chunk4Y233NIIjs.g.call(void 0, "font-medium",c.className),style:c.style,children:_chunkKZWCVKLUjs.C.call(void 0, Ct,Pt)}),ka&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"deliveryText",className:_chunk4Y233NIIjs.g.call(void 0, "opacity-70 text-right text-base",p.className),style:p.style,children:x})]})]}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"summaryNote",className:_chunk4Y233NIIjs.g.call(void 0, "opacity-70 text-sm",s.className),style:s.style,children:C})]}),je&&_optionalChain([je, 'optionalAccess', _262 => _262.length])>1&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h4",{"data-bitsnap-checkout-slot":"countryLabel",className:_chunk4Y233NIIjs.g.call(void 0, "ml-3 text-sm",y.className),style:y.style,children:E}),_jsxruntime.jsx.call(void 0, $o,{id:U,open:V,onToggle:()=>{We(!V)},onChange:P=>{be(P).then(()=>{no().then().catch()})},selectedValue:_nullishCoalesce(Be, () => ("")),countries:je})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-3 flex flex-col",children:[gn&&q!=null&&q.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunk4Y233NIIjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, Rn,{colorType:"white",style:{width:"100%"},items:_optionalChain([q, 'optionalAccess', _263 => _263.map, 'call', _264 => _264(P=>({name:_nullishCoalesce(_optionalChain([P, 'access', _265 => _265.details, 'optionalAccess', _266 => _266.name]), () => ("")),id:P.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([P, 'access', _267 => _267.details, 'optionalAccess', _268 => _268.pricing, 'optionalAccess', _269 => _269.effectivePrice]), () => (_optionalChain([P, 'access', _270 => _270.details, 'optionalAccess', _271 => _271.price]))), () => (0)),currency:_optionalChain([P, 'access', _272 => _272.details, 'optionalAccess', _273 => _273.currency]),quantity:P.quantity,isDeliverable:_nullishCoalesce(_optionalChain([P, 'access', _274 => _274.details, 'optionalAccess', _275 => _275.isDeliverable]), () => (!1)),metadata:P.metadata}))])})}),q!=null&&q.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunk4Y233NIIjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, An,{buttonSizeMode:"fill",buttonColor:"white",style:{width:"100%"},items:_optionalChain([q, 'optionalAccess', _276 => _276.map, 'call', _277 => _277(P=>({name:_nullishCoalesce(_optionalChain([P, 'access', _278 => _278.details, 'optionalAccess', _279 => _279.name]), () => ("")),id:P.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([P, 'access', _280 => _280.details, 'optionalAccess', _281 => _281.pricing, 'optionalAccess', _282 => _282.effectivePrice]), () => (_optionalChain([P, 'access', _283 => _283.details, 'optionalAccess', _284 => _284.price]))), () => (0)),quantity:P.quantity,isDeliverable:_nullishCoalesce(_optionalChain([P, 'access', _285 => _285.details, 'optionalAccess', _286 => _286.isDeliverable]), () => (!1)),metadata:P.metadata}))])})}),q!=null&&q.length>0&&_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunk4Y233NIIjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:[_jsxruntime.jsx.call(void 0, Gn,{projectID:_nullishCoalesce(_chunkKZWCVKLUjs.K.call(void 0, ), () => ("")),locale:r}),_jsxruntime.jsx.call(void 0, $n,{projectID:_nullishCoalesce(_chunkKZWCVKLUjs.K.call(void 0, ), () => ("")),locale:r})]}),Mt!=null&&_jsxruntime.jsx.call(void 0, "div",{ref:co,className:"contents",children:_jsxruntime.jsx.call(void 0, ya,{choice:Mt,selected:_chunkKZWCVKLUjs.p.call(void 0, Mt,io),onChange:xa,disabled:Te})}),_jsxruntime.jsx.call(void 0, "button",{"data-bitsnap-checkout-slot":"checkoutButton",onClick:Sa,disabled:oe||Te||so||Be==null,"aria-describedby":po?f:void 0,className:_chunk4Y233NIIjs.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:Te||so?_jsxruntime.jsx.call(void 0, _chunkHP3I6D2Rjs.e,{}):D}),po&&_jsxruntime.jsx.call(void 0, "p",{id:f,className:"text-sm text-center opacity-70",children:w}),_.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunk4Y233NIIjs.g.call(void 0, "text-sm text-center",d.className),style:d.style,children:_})]})]})]})},ha=js;function Ks({isVisible:e,shouldHide:t,panelId:n,locale:o}){let[r]=_react3.useAutoAnimate.call(void 0, ),[a,i]=_react.useState.call(void 0, null),l=_react.useCallback.call(void 0, b=>{r(b),i(b)},[r]),c=_react.useRef.call(void 0, null),{boundaryClassName:p,boundaryStyle:s}=kt(),y=L("root"),v=L("overlay"),m=L("panel"),g=L("header"),d=L("title"),I=L("closeButton"),R=_chunkKZWCVKLUjs.z.call(void 0, "cart"),h=_chunkKZWCVKLUjs.z.call(void 0, "close");return _jsxruntime.jsx.call(void 0, "div",{ref:l,"data-bitsnap-checkout":"root","data-bitsnap-checkout-slot":"root",className:_chunk4Y233NIIjs.g.call(void 0, "bitsnap-react",p,y.className),style:{zIndex:999999,...s,...y.style},children:a!=null&&_jsxruntime.jsx.call(void 0, Ee.Root,{open:e,onOpenChange:b=>{b||t()},children:_jsxruntime.jsxs.call(void 0, Ee.Portal,{container:a,children:[_jsxruntime.jsx.call(void 0, Ee.Overlay,{"data-bitsnap-checkout-slot":"overlay","aria-hidden":"true",className:_chunk4Y233NIIjs.g.call(void 0, "fixed top-0 right-0 left-0 bottom-0 cursor-pointer z-10",v.className),style:v.style,onClick:t}),_jsxruntime.jsxs.call(void 0, Ee.Content,{id:n,"data-bitsnap-checkout-slot":"panel","aria-modal":"true","aria-describedby":void 0,onOpenAutoFocus:()=>{let b=document.activeElement;c.current=b instanceof HTMLElement?b:null},onCloseAutoFocus:b=>{b.preventDefault(),_optionalChain([c, 'access', _287 => _287.current, 'optionalAccess', _288 => _288.focus, 'call', _289 => _289()]),c.current=null},className:_chunk4Y233NIIjs.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:b=>b.preventDefault(),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"header",className:_chunk4Y233NIIjs.g.call(void 0, "mx-3 mt-7 flex justify-between items-center",g.className),style:g.style,children:[_jsxruntime.jsx.call(void 0, Ee.Title,{asChild:!0,children:_jsxruntime.jsx.call(void 0, "h1",{"data-bitsnap-checkout-slot":"title",className:_chunk4Y233NIIjs.g.call(void 0, "text-2xl font-medium",d.className),style:d.style,children:R})}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"closeButton",className:_chunk4Y233NIIjs.g.call(void 0, "rounded-xl p-2 transition",I.className),style:I.style,"aria-label":h,onClick:t,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, ha,{className:"grow",locale:o})]})]})})})}var Vs=e=>typeof window>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, ct,{appearance:e.appearance,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.y,{texts:e.texts,locale:e.locale,children:_jsxruntime.jsx.call(void 0, _chunkKZWCVKLUjs.P,{locale:e.locale,children:_jsxruntime.jsx.call(void 0, Ks,{...e})})})}),document.body),va=Vs;var Xs=_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()}),Ys={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Zs({projectID:e,locale:t,children:n,onVisibleChange:o,className:r,numberOfProductsInCartOptions:a,appearance:i,texts:l,analytics:c}){let p=_chunkIRZJIPUFjs.n.call(void 0, e,c,"cart");_chunkIRZJIPUFjs.q.call(void 0, p);let{isCartVisible:s,showCart:y,hideCart:v,numberOfProductsInCart:m}=_chunkKZWCVKLUjs.r.call(void 0, ),g=`bitsnap-cart-${_react.useId.call(void 0, )}`,d=E=>_chunkQ337IQNAjs.c.call(void 0, E,_nullishCoalesce(t, () => (_chunkQ337IQNAjs.f.call(void 0, ))),l),I=_react.useRef.call(void 0, d);I.current=d;function R(E){_chunkKZWCVKLUjs.r.getState().setNotice(I.current(E)),y()}function h(E){document.querySelectorAll("iframe").forEach(S=>{_optionalChain([S, 'access', _290 => _290.contentWindow, 'optionalAccess', _291 => _291.postMessage, 'call', _292 => _292(E,"*")])})}_react.useEffect.call(void 0, ()=>{_optionalChain([o, 'optionalCall', _293 => _293(s)]),s&&_chunkKZWCVKLUjs.D.call(void 0, {event:"viewCart"})},[s]),_react.useEffect.call(void 0, ()=>{_chunkKZWCVKLUjs.J.call(void 0, e)},[e]),_react.useEffect.call(void 0, ()=>{_chunkQ337IQNAjs.e.call(void 0, t)},[t]),_react.useEffect.call(void 0, ()=>{if(!("cart"in window)){let E=_chunkKZWCVKLUjs.K.call(void 0, );if(E==null){console.warn("There is no project ID configured.");return}window.cart={buyProduct:async D=>{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(D),T=_chunkKZWCVKLUjs.Z.call(void 0, E);try{let C=await T.getProducts();_chunkKZWCVKLUjs.l.call(void 0, C)==!1&&_chunkKZWCVKLUjs.D.call(void 0, {event:"initiateCheckout",items:C.map(U=>({id:U.productID,name:_nullishCoalesce(_optionalChain([U, 'access', _294 => _294.details, 'optionalAccess', _295 => _295.name]), () => ("")),price:_nullishCoalesce(_optionalChain([U, 'access', _296 => _296.details, 'optionalAccess', _297 => _297.price]), () => (0)),quantity:U.quantity,currency:_nullishCoalesce(_optionalChain([U, 'access', _298 => _298.details, 'optionalAccess', _299 => _299.currency]), () => ("PLN"))}))})}catch (e15){}let w=await T.justRedirectToPayment(S);_chunkKZWCVKLUjs.l.call(void 0, w)==!1?window.location.href=w.url:R("redirectFailed")}catch(S){console.warn(S)}}}}},[]);async function b(E,D){let S=_chunkKZWCVKLUjs.K.call(void 0, );if(S==null){console.warn("There is no project ID configured.");return}try{let T=Xs.parse(D);if(T.isSubscription){await A(S,T);return}await _chunkKZWCVKLUjs.Z.call(void 0, S).addProduct({productID:T.id,quantity:T.quantity,metadata:T.metadata,url:T.url}),h({id:E,type:"ADD_TO_CART",success:!0}),y()}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 x(){"__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:S}=E.data;switch(S){case"ADD_TO_CART".toString():b(D,E.data.payload).then().catch();break;default:break}}}))}return _react.useEffect.call(void 0, ()=>{if(x(),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():y(),"aria-label":n?void 0:m>0?`${d("openCart")}. ${d("cartItemsCount")}: ${m}`:d("openCart"),"aria-expanded":s,"aria-haspopup":"dialog","aria-controls":s?g:void 0,style:{position:"relative"},className:["bitsnap-react",_nullishCoalesce(r, () => ("rounded-full hover:bg-neutral-300 transition p-1"))].join(" "),children:[n?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:n}):_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:Ys,children:[d("cartItemsCount"),": ",m]}),_optionalChain([a, 'optionalAccess', _300 => _300.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([a, 'optionalAccess', _301 => _301.style])},children:m})]}),_jsxruntime.jsx.call(void 0, _chunkIRZJIPUFjs.l,{value:p,children:_jsxruntime.jsx.call(void 0, va,{isVisible:s,locale:t,appearance:i,texts:l,panelId:g,shouldHide:()=>{v()}})})]})}var Os=Zs;exports.a = Ta; exports.b = Wi; exports.c = Qi; exports.d = Os; exports.e = Rn; exports.f = An; exports.g = Us;
|
|
2
|
+
//# sourceMappingURL=chunk-RJPQMDIQ.js.map
|