bitsnap-react 1.22.0 → 1.23.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 +20 -0
- package/dist/BitsnapCart-GK3MQGP7.js +2 -0
- package/dist/BitsnapCart-GK3MQGP7.js.map +1 -0
- package/dist/BitsnapCart-ZC6LMXLO.mjs +2 -0
- package/dist/CartProvider-FJDBDV4N.js +2 -0
- package/dist/CartProvider-FJDBDV4N.js.map +1 -0
- package/dist/{CartProvider-YUV2Q523.mjs → CartProvider-P7BZVK2M.mjs} +2 -2
- 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.js +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/chat.mjs +1 -1
- package/dist/{chunk-SAKZOHU7.js → chunk-2CL4B4KM.js} +2 -2
- package/dist/chunk-2CL4B4KM.js.map +1 -0
- package/dist/chunk-2D2TQK3R.js +2 -0
- package/dist/chunk-2D2TQK3R.js.map +1 -0
- package/dist/{chunk-C2AJ5B32.mjs → chunk-4AU5SEHU.mjs} +2 -2
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/{chunk-ZFZR3CI5.js → chunk-7GSQV4NW.js} +2 -2
- package/dist/chunk-7GSQV4NW.js.map +1 -0
- package/dist/{chunk-WYRECFVW.js → chunk-CA5EJJW7.js} +2 -2
- package/dist/chunk-CA5EJJW7.js.map +1 -0
- package/dist/{chunk-U37ZH4YJ.js → chunk-DCICRN6G.js} +2 -2
- package/dist/chunk-DCICRN6G.js.map +1 -0
- package/dist/{chunk-QQSCVPOG.mjs → chunk-EVV25IKM.mjs} +2 -2
- package/dist/{chunk-QQSCVPOG.mjs.map → chunk-EVV25IKM.mjs.map} +1 -1
- package/dist/{chunk-MBSXTB6G.js → chunk-EVX5SQL2.js} +2 -2
- package/dist/chunk-EVX5SQL2.js.map +1 -0
- package/dist/chunk-FVZ4W7QG.js +5 -0
- package/dist/chunk-FVZ4W7QG.js.map +1 -0
- package/dist/chunk-GMQYQTUM.mjs +2 -0
- package/dist/chunk-GMQYQTUM.mjs.map +1 -0
- package/dist/{chunk-35ZQU353.js → chunk-I6QN3T6K.js} +2 -2
- package/dist/chunk-I6QN3T6K.js.map +1 -0
- package/dist/chunk-ILYJCT5S.js +2 -0
- package/dist/chunk-ILYJCT5S.js.map +1 -0
- package/dist/{chunk-QJOMFK4X.mjs → chunk-JRSQ2IGQ.mjs} +2 -2
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/{chunk-5MXBUGY3.mjs → chunk-M6QFQ3DR.mjs} +2 -2
- package/dist/chunk-MDAFPGPA.js.map +1 -1
- package/dist/{chunk-KFY6IOAA.js → chunk-MY6BPCRV.js} +2 -2
- package/dist/{chunk-ZFUE3AX5.mjs.map → chunk-MY6BPCRV.js.map} +1 -1
- package/dist/{chunk-QCIETNFZ.mjs → chunk-NMXTTD5M.mjs} +2 -2
- package/dist/chunk-PFKZ7KUU.js.map +1 -1
- package/dist/chunk-Q337IQNA.js.map +1 -1
- package/dist/{chunk-IVB3E4V3.mjs → chunk-RA6M3TJ3.mjs} +2 -2
- package/dist/{chunk-NCCP2UDM.mjs → chunk-SKQJESEB.mjs} +2 -2
- package/dist/chunk-STDV54FL.mjs +2 -0
- package/dist/chunk-STDV54FL.mjs.map +1 -0
- package/dist/{chunk-JS3KK56H.js → chunk-SZLSKIYU.js} +2 -2
- package/dist/chunk-SZLSKIYU.js.map +1 -0
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/{chunk-TVZLDLAV.mjs → chunk-W4EUYPJ3.mjs} +2 -2
- package/dist/chunk-Z3YOJ6NZ.js.map +1 -1
- package/dist/chunk-ZMEWUEZJ.mjs +5 -0
- package/dist/chunk-ZMEWUEZJ.mjs.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.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-IEHZTZEY.mjs +2 -0
- package/dist/methods-S4KBRY2I.js +2 -0
- package/dist/methods-S4KBRY2I.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/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/package.json +2 -2
- package/dist/BitsnapCart-AINUJQVF.mjs +0 -2
- package/dist/BitsnapCart-GP2UJSG4.js +0 -2
- package/dist/BitsnapCart-GP2UJSG4.js.map +0 -1
- package/dist/CartProvider-HTKGBPVA.js +0 -2
- package/dist/CartProvider-HTKGBPVA.js.map +0 -1
- package/dist/chunk-35ZQU353.js.map +0 -1
- package/dist/chunk-3TUL63IC.js +0 -2
- package/dist/chunk-3TUL63IC.js.map +0 -1
- package/dist/chunk-4JR74NXR.js +0 -2
- package/dist/chunk-4JR74NXR.js.map +0 -1
- package/dist/chunk-GLKBCVNH.mjs +0 -2
- package/dist/chunk-GLKBCVNH.mjs.map +0 -1
- package/dist/chunk-JS3KK56H.js.map +0 -1
- package/dist/chunk-KFY6IOAA.js.map +0 -1
- package/dist/chunk-MBSXTB6G.js.map +0 -1
- package/dist/chunk-QJBQ45R6.mjs +0 -5
- package/dist/chunk-QJBQ45R6.mjs.map +0 -1
- package/dist/chunk-SAKZOHU7.js.map +0 -1
- package/dist/chunk-SZNTXRFD.js +0 -5
- package/dist/chunk-SZNTXRFD.js.map +0 -1
- package/dist/chunk-U37ZH4YJ.js.map +0 -1
- package/dist/chunk-WYRECFVW.js.map +0 -1
- package/dist/chunk-ZFUE3AX5.mjs +0 -2
- package/dist/chunk-ZFZR3CI5.js.map +0 -1
- package/dist/methods-4Q37ITIM.js +0 -2
- package/dist/methods-4Q37ITIM.js.map +0 -1
- package/dist/methods-JLVRTNPE.mjs +0 -2
- /package/dist/{BitsnapCart-AINUJQVF.mjs.map → BitsnapCart-ZC6LMXLO.mjs.map} +0 -0
- /package/dist/{CartProvider-YUV2Q523.mjs.map → CartProvider-P7BZVK2M.mjs.map} +0 -0
- /package/dist/{chunk-C2AJ5B32.mjs.map → chunk-4AU5SEHU.mjs.map} +0 -0
- /package/dist/{chunk-QJOMFK4X.mjs.map → chunk-JRSQ2IGQ.mjs.map} +0 -0
- /package/dist/{chunk-5MXBUGY3.mjs.map → chunk-M6QFQ3DR.mjs.map} +0 -0
- /package/dist/{chunk-QCIETNFZ.mjs.map → chunk-NMXTTD5M.mjs.map} +0 -0
- /package/dist/{chunk-IVB3E4V3.mjs.map → chunk-RA6M3TJ3.mjs.map} +0 -0
- /package/dist/{chunk-NCCP2UDM.mjs.map → chunk-SKQJESEB.mjs.map} +0 -0
- /package/dist/{chunk-TVZLDLAV.mjs.map → chunk-W4EUYPJ3.mjs.map} +0 -0
- /package/dist/{methods-JLVRTNPE.mjs.map → methods-IEHZTZEY.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-order-history-panel/dist/chunk-EVX5SQL2.js","../src/components/returns/state-machine.ts","../src/components/returns/BitsnapReturns.tsx"],"names":["STEPS_WITH_SESSION","stepRequiresSession","step","initialReturnsStep","hasSession","reduceReturnsStep","event","STEP_NUMBERS","RETURNS_STEP_COUNT","returnsStepNumber","StepIndicator","current","text","useReturnsText","slot","useReturnsSlot","jsx","cn","ReturnsRouter","panelToken","logo","status","challenge","projectID","useReturnsContext","locale","useReturnsLocale","dispatch","useReducer","useEffect","restored","useRef","SkeletonRows","stepNumber","loginStep","jsxs","LoginBrandLogo","ReturnsEmailStep","ReturnsCodeStep","ReturnsOrderList","orderId","ReturnsOrderDetail","items","note","ReturnsConfirmation","returnId","ReturnsResult","ReturnsMyReturnsList","ReturnsMyReturnDetail","BitsnapReturns","showLogo","logoUrl","logoDarkUrl","props","ReturnsProvider"],"mappings":"AAAA,+HAAyI,sDAAwC,IC8C3KA,CAAAA,CAAiD,CACrD,QAAA,CACA,OAAA,CACA,cAAA,CACA,QAAA,CACA,WAAA,CACA,UACF,CAAA,CAGO,SAASC,CAAAA,CAAoBC,CAAAA,CAAgC,CAClE,OAAOF,CAAAA,CAAmB,QAAA,CAASE,CAAI,CACzC,CAGO,SAASC,CAAAA,CAAmBC,CAAAA,CAAkC,CACnE,OAAOA,CAAAA,CAAa,CAAE,IAAA,CAAM,QAAS,CAAA,CAAI,CAAE,IAAA,CAAM,OAAQ,CAC3D,CAMO,SAASC,CAAAA,CACdH,CAAAA,CACAI,CAAAA,CACa,CACb,MAAA,CAAQA,CAAAA,CAAM,IAAA,CAAM,CAClB,IAAK,iBAAA,CAEH,OAAOL,CAAAA,CAAoBC,CAAAA,CAAK,IAAI,CAAA,CAAI,CAAE,IAAA,CAAM,OAAQ,CAAA,CAAIA,CAAAA,CAC9D,IAAK,WAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,OAAA,CAAU,CAAE,IAAA,CAAM,MAAO,CAAA,CAAIA,CAAAA,CACpD,IAAK,eAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,OAAA,EAAWA,CAAAA,CAAK,IAAA,GAAS,MAAA,CAC1C,CAAE,IAAA,CAAM,QAAS,CAAA,CACjBA,CAAAA,CACN,IAAK,cAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,QAAA,CACjB,CAAE,IAAA,CAAM,OAAA,CAAS,OAAA,CAASI,CAAAA,CAAM,OAAQ,CAAA,CACxCJ,CAAAA,CACN,IAAK,QAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,OAAA,CACjB,CACE,IAAA,CAAM,cAAA,CACN,OAAA,CAASA,CAAAA,CAAK,OAAA,CACd,KAAA,CAAOI,CAAAA,CAAM,KAAA,CACb,IAAA,CAAMA,CAAAA,CAAM,IACd,CAAA,CACAJ,CAAAA,CACN,IAAK,WAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,cAAA,CACjB,CAAE,IAAA,CAAM,QAAA,CAAU,QAAA,CAAUI,CAAAA,CAAM,QAAS,CAAA,CAC3CJ,CAAAA,CACN,IAAK,iBAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,QAAA,EAAYA,CAAAA,CAAK,IAAA,GAAS,QAAA,CAC3C,CAAE,IAAA,CAAM,WAAY,CAAA,CACpBA,CAAAA,CACN,IAAK,eAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,WAAA,CACjB,CAAE,IAAA,CAAM,UAAA,CAAY,QAAA,CAAUI,CAAAA,CAAM,QAAS,CAAA,CAC7CJ,CAAAA,CACN,IAAK,UAAA,CACH,OAAOA,CAAAA,CAAK,IAAA,GAAS,QAAA,CAAW,CAAE,IAAA,CAAM,QAAS,CAAA,CAAIA,CAAAA,CACvD,IAAK,MAAA,CACH,MAAA,CAAQA,CAAAA,CAAK,IAAA,CAAM,CACjB,IAAK,MAAA,CACH,MAAO,CAAE,IAAA,CAAM,OAAQ,CAAA,CACzB,IAAK,OAAA,CACL,IAAK,WAAA,CACH,MAAO,CAAE,IAAA,CAAM,QAAS,CAAA,CAC1B,IAAK,cAAA,CACH,MAAO,CACL,IAAA,CAAM,OAAA,CACN,OAAA,CAASA,CAAAA,CAAK,OAAA,CACd,KAAA,CAAOA,CAAAA,CAAK,KAAA,CACZ,IAAA,CAAMA,CAAAA,CAAK,IACb,CAAA,CACF,IAAK,UAAA,CACH,MAAO,CAAE,IAAA,CAAM,WAAY,CAAA,CAC7B,OAAA,CACE,OAAOA,CACX,CACJ,CACF,CAEA,IAAMK,CAAAA,CAAyD,CAC7D,KAAA,CAAO,CAAA,CACP,IAAA,CAAM,CAAA,CACN,MAAA,CAAQ,CAAA,CACR,KAAA,CAAO,CAAA,CACP,YAAA,CAAc,CAAA,CACd,MAAA,CAAQ,CACV,CAAA,CAEaC,CAAAA,CAAqB,CAAA,CAG3B,SAASC,CAAAA,CAAkBP,CAAAA,CAA2C,CAC3E,OAAOK,CAAAA,CAAaL,CAAI,CAC1B,CClJA,8BAA8C,+CA0C1C,SALKQ,CAAAA,CAAc,CAAE,OAAA,CAAAC,CAAQ,CAAA,CAAwB,CACvD,IAAMC,CAAAA,CAAOC,gCAAAA,CAAe,CACtBC,CAAAA,CAAOC,gCAAAA,eAA8B,CAAA,CAE3C,OACEC,6BAAAA,GAAC,CAAA,CACC,2BAAA,CAA0B,eAAA,CAC1B,SAAA,CAAWC,gCAAAA,SAAG,CAAWH,CAAAA,CAAK,SAAS,CAAA,CACvC,KAAA,CAAOA,CAAAA,CAAK,KAAA,CAEX,QAAA,CAAAF,CAAAA,CAAK,eAAA,CAAiB,CAAE,OAAA,CAAAD,CAAAA,CAAS,KAAA,CAAOH,CAAmB,CAAC,CAAA,CAC/D,CAEJ,CAGA,SAASU,CAAAA,CAAc,CACrB,UAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CACF,CAAA,CAGG,CACD,GAAM,CAAE,MAAA,CAAAC,CAAAA,CAAQ,SAAA,CAAAC,CAAAA,CAAW,SAAA,CAAAC,CAAU,CAAA,CAAIC,gCAAAA,gBAAkC,CAAA,CACrEC,CAAAA,CAASC,gCAAAA,CAAiB,CAC1B,CAACxB,CAAAA,CAAMyB,CAAQ,CAAA,CAAIC,+BAAAA,CACvBvB,CACAF,CAAAA,CAAmB,CAAA,CAAK,CAC1B,CAAA,CAIA0B,8BAAAA,CAAU,CAAA,EAAM,CACVR,CAAAA,GAAW,eAAA,CACbM,CAAAA,CAAS,CAAE,IAAA,CAAM,eAAgB,CAAC,CAAA,CACzBN,CAAAA,GAAW,WAAA,EACpBM,CAAAA,CAAS,CAAE,IAAA,CAAM,iBAAkB,CAAC,CAExC,CAAA,CAAG,CAACN,CAAM,CAAC,CAAA,CAIX,IAAMS,CAAAA,CAAWC,2BAAAA,CAAO,CAAK,CAAA,CAa7B,EAAA,CAZAF,8BAAAA,CAAU,CAAA,EAAM,CACVC,CAAAA,CAAS,OAAA,EAAWT,CAAAA,GAAW,WAAA,EAAA,CAGnCS,CAAAA,CAAS,OAAA,CAAU,CAAA,CAAA,CACfT,CAAAA,GAAW,WAAA,EAAeC,CAAAA,EAAa,IAAA,EACzCK,CAAAA,CAAS,CAAE,IAAA,CAAM,WAAY,CAAC,CAAA,CAElC,CAAA,CAAG,CAACN,CAAAA,CAAQC,CAAS,CAAC,CAAA,CAIlBD,CAAAA,GAAW,YAAA,EAAiBA,CAAAA,GAAW,WAAA,EAAeF,CAAAA,CACxD,OAAOH,6BAAAA,kBAACgB,CAAA,CAAA,CAAa,CAAA,CAGvB,IAAMC,CAAAA,CAAaxB,CAAAA,CAAkBP,CAAAA,CAAK,IAAI,CAAA,CAIxCgC,CAAAA,CAAYhC,CAAAA,CAAK,IAAA,GAAS,OAAA,EAAWA,CAAAA,CAAK,IAAA,GAAS,MAAA,CAEzD,OACEiC,8BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,qBAAA,CACZ,QAAA,CAAA,CAAAD,CAAAA,EACClB,6BAAAA,kBAACoB,CAAA,CAAe,SAAA,CAAWb,CAAAA,CAAW,MAAA,CAAQE,CAAAA,CAAS,GAAGL,CAAAA,CAAM,CAAA,CAEjEa,CAAAA,EAAc,IAAA,EAAQjB,6BAAAA,CAACN,CAAA,CAAc,OAAA,CAASuB,CAAAA,CAAY,CAAA,CAC1D/B,CAAAA,CAAK,IAAA,GAAS,OAAA,EACbc,6BAAAA,kBAACqB,CAAA,CACC,QAAA,CAAU,CAAA,CAAA,CACV,WAAA,CAAa,CAAA,CAAA,EAAMV,CAAAA,CAAS,CAAE,IAAA,CAAM,WAAY,CAAC,CAAA,CACnD,CAAA,CAEDzB,CAAAA,CAAK,IAAA,GAAS,MAAA,EACbc,6BAAAA,kBAACsB,CAAA,CACC,QAAA,CAAU,CAAA,CAAA,CACV,UAAA,CAAY,CAAA,CAAA,EAAMX,CAAAA,CAAS,CAAE,IAAA,CAAM,eAAgB,CAAC,CAAA,CACpD,MAAA,CAAQ,CAAA,CAAA,EAAMA,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAO,CAAC,CAAA,CACzC,CAAA,CAEDzB,CAAAA,CAAK,IAAA,GAAS,QAAA,EACbc,6BAAAA,kBAACuB,CAAA,CACC,UAAA,CAAY,CAACpB,CAAAA,CACb,aAAA,CAAgBqB,CAAAA,EACdb,CAAAA,CAAS,CAAE,IAAA,CAAM,cAAA,CAAgB,OAAA,CAAAa,CAAQ,CAAC,CAAA,CAE5C,eAAA,CAAiB,CAAA,CAAA,EAAMb,CAAAA,CAAS,CAAE,IAAA,CAAM,iBAAkB,CAAC,CAAA,CAC7D,CAAA,CAEDzB,CAAAA,CAAK,IAAA,GAAS,OAAA,EACbc,6BAAAA,kBAACyB,CAAA,CACC,OAAA,CAASvC,CAAAA,CAAK,OAAA,CACd,YAAA,CAAcA,CAAAA,CAAK,KAAA,CACnB,WAAA,CAAaA,CAAAA,CAAK,IAAA,CAClB,MAAA,CAAQ,CAAA,CAAA,EAAMyB,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAO,CAAC,CAAA,CACvC,UAAA,CAAY,CAAC,CAAE,KAAA,CAAAe,CAAAA,CAAO,IAAA,CAAAC,CAAK,CAAA,CAAA,EACzBhB,CAAAA,CAAS,CAAE,IAAA,CAAM,QAAA,CAAU,KAAA,CAAAe,CAAAA,CAAO,IAAA,CAAAC,CAAK,CAAC,CAAA,CAE5C,CAAA,CAEDzC,CAAAA,CAAK,IAAA,GAAS,cAAA,EACbc,6BAAAA,kBAAC4B,CAAA,CACC,OAAA,CAAS1C,CAAAA,CAAK,OAAA,CACd,KAAA,CAAOA,CAAAA,CAAK,KAAA,CACZ,IAAA,CAAMA,CAAAA,CAAK,IAAA,CACX,MAAA,CAAQ,CAAA,CAAA,EAAMyB,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAO,CAAC,CAAA,CACvC,WAAA,CAAckB,CAAAA,EACZlB,CAAAA,CAAS,CAAE,IAAA,CAAM,WAAA,CAAa,QAAA,CAAAkB,CAAS,CAAC,CAAA,CAE5C,CAAA,CAED3C,CAAAA,CAAK,IAAA,GAAS,QAAA,EACbc,6BAAAA,kBAAC8B,CAAA,CACC,QAAA,CAAU5C,CAAAA,CAAK,QAAA,CACf,UAAA,CAAY,CAAA,CAAA,EAAMyB,CAAAA,CAAS,CAAE,IAAA,CAAM,UAAW,CAAC,CAAA,CAC/C,eAAA,CAAiB,CAAA,CAAA,EAAMA,CAAAA,CAAS,CAAE,IAAA,CAAM,iBAAkB,CAAC,CAAA,CAC7D,CAAA,CAEDzB,CAAAA,CAAK,IAAA,GAAS,WAAA,EACbc,6BAAAA,kBAAC+B,CAAA,CACC,cAAA,CAAiBF,CAAAA,EACflB,CAAAA,CAAS,CAAE,IAAA,CAAM,eAAA,CAAiB,QAAA,CAAAkB,CAAS,CAAC,CAAA,CAE9C,MAAA,CAAQ,CAAA,CAAA,EAAMlB,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAO,CAAC,CAAA,CACzC,CAAA,CAEDzB,CAAAA,CAAK,IAAA,GAAS,UAAA,EACbc,6BAAAA,kBAACgC,CAAA,CACC,QAAA,CAAU9C,CAAAA,CAAK,QAAA,CACf,MAAA,CAAQ,CAAA,CAAA,EAAMyB,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAO,CAAC,CAAA,CACzC,CAAA,CAAA,CAEJ,CAEJ,CAYO,SAASsB,EAAAA,CAAe,CAC7B,QAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAwB,CACtB,OACErC,6BAAAA,kBAACsC,CAAA,CAAiB,GAAGD,CAAAA,CACnB,QAAA,CAAArC,6BAAAA,CAACE,CAAA,CACC,UAAA,CAAYmC,CAAAA,CAAM,gBAAA,EAAoB,IAAA,EAAQA,CAAAA,CAAM,gBAAA,GAAqB,EAAA,CACzE,IAAA,CAAM,CAAE,QAAA,CAAAH,CAAAA,CAAU,OAAA,CAAAC,CAAAA,CAAS,WAAA,CAAAC,CAAY,CAAA,CACzC,CAAA,CACF,CAEJ,CAAA,eAAA","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-order-history-panel/dist/chunk-EVX5SQL2.js","sourcesContent":[null,"/** One line chosen for return. */\nexport type SelectedReturnLine = {\n lineId: string;\n quantity: number;\n};\n\n/** Where the default flow of `BitsnapReturns` currently is. */\nexport type ReturnsStep =\n | { name: \"email\" }\n | { name: \"code\" }\n | { name: \"orders\" }\n | {\n name: \"order\";\n orderId: string;\n /** Selection to restore when coming back from the confirmation. */\n items?: SelectedReturnLine[];\n note?: string;\n }\n | {\n name: \"confirmation\";\n orderId: string;\n items: SelectedReturnLine[];\n note: string;\n }\n | { name: \"result\"; returnId: string }\n | { name: \"myReturns\" }\n | { name: \"myReturn\"; returnId: string };\n\nexport type ReturnsStepName = ReturnsStep[\"name\"];\n\nexport type ReturnsStepEvent =\n /** A verification code was requested. */\n | { type: \"CODE_SENT\" }\n /** The session became valid: code verified, stored session or panel token. */\n | { type: \"AUTHENTICATED\" }\n /** The session was dropped by the backend, expiry or logout. */\n | { type: \"SESSION_EXPIRED\" }\n | { type: \"SELECT_ORDER\"; orderId: string }\n | { type: \"REVIEW\"; items: SelectedReturnLine[]; note: string }\n | { type: \"SUBMITTED\"; returnId: string }\n | { type: \"OPEN_MY_RETURNS\" }\n | { type: \"SELECT_RETURN\"; returnId: string }\n | { type: \"BACK\" }\n /** Leave the result screen for the order list. */\n | { type: \"CONTINUE\" };\n\nconst STEPS_WITH_SESSION: readonly ReturnsStepName[] = [\n \"orders\",\n \"order\",\n \"confirmation\",\n \"result\",\n \"myReturns\",\n \"myReturn\",\n];\n\n/** Steps that cannot be shown without a returns session. */\nexport function stepRequiresSession(step: ReturnsStepName): boolean {\n return STEPS_WITH_SESSION.includes(step);\n}\n\n/** Starts at the orders when a session exists, otherwise at the email. */\nexport function initialReturnsStep(hasSession: boolean): ReturnsStep {\n return hasSession ? { name: \"orders\" } : { name: \"email\" };\n}\n\n/**\n * Pure transition function of the default flow. Events that do not apply to\n * the current step leave it unchanged.\n */\nexport function reduceReturnsStep(\n step: ReturnsStep,\n event: ReturnsStepEvent,\n): ReturnsStep {\n switch (event.type) {\n case \"SESSION_EXPIRED\":\n // Email and code do not need a session; keep a pending verification.\n return stepRequiresSession(step.name) ? { name: \"email\" } : step;\n case \"CODE_SENT\":\n return step.name === \"email\" ? { name: \"code\" } : step;\n case \"AUTHENTICATED\":\n return step.name === \"email\" || step.name === \"code\"\n ? { name: \"orders\" }\n : step;\n case \"SELECT_ORDER\":\n return step.name === \"orders\"\n ? { name: \"order\", orderId: event.orderId }\n : step;\n case \"REVIEW\":\n return step.name === \"order\"\n ? {\n name: \"confirmation\",\n orderId: step.orderId,\n items: event.items,\n note: event.note,\n }\n : step;\n case \"SUBMITTED\":\n return step.name === \"confirmation\"\n ? { name: \"result\", returnId: event.returnId }\n : step;\n case \"OPEN_MY_RETURNS\":\n return step.name === \"orders\" || step.name === \"result\"\n ? { name: \"myReturns\" }\n : step;\n case \"SELECT_RETURN\":\n return step.name === \"myReturns\"\n ? { name: \"myReturn\", returnId: event.returnId }\n : step;\n case \"CONTINUE\":\n return step.name === \"result\" ? { name: \"orders\" } : step;\n case \"BACK\":\n switch (step.name) {\n case \"code\":\n return { name: \"email\" };\n case \"order\":\n case \"myReturns\":\n return { name: \"orders\" };\n case \"confirmation\":\n return {\n name: \"order\",\n orderId: step.orderId,\n items: step.items,\n note: step.note,\n };\n case \"myReturn\":\n return { name: \"myReturns\" };\n default:\n return step;\n }\n }\n}\n\nconst STEP_NUMBERS: Partial<Record<ReturnsStepName, number>> = {\n email: 1,\n code: 2,\n orders: 3,\n order: 4,\n confirmation: 5,\n result: 6,\n};\n\nexport const RETURNS_STEP_COUNT = 6;\n\n/** Position of a step in the return flow, `undefined` for the \"my returns\" views. */\nexport function returnsStepNumber(step: ReturnsStepName): number | undefined {\n return STEP_NUMBERS[step];\n}\n","import { useEffect, useReducer, useRef } from \"react\";\nimport { cn } from \"@/src/lib/utils\";\nimport {\n LoginBrandLogo,\n type LoginLogoOptions,\n} from \"@/src/ui/email-code-login/LoginBrandLogo\";\nimport { useReturnsSlot } from \"./appearance.context\";\nimport { ReturnsCodeStep, ReturnsEmailStep } from \"./AuthSteps\";\nimport { SkeletonRows } from \"./internal\";\nimport { ReturnsMyReturnDetail, ReturnsMyReturnsList } from \"./MyReturns\";\nimport {\n ReturnsConfirmation,\n ReturnsOrderDetail,\n ReturnsOrderList,\n ReturnsResult,\n} from \"./OrderSteps\";\nimport {\n ReturnsProvider,\n useReturnsContext,\n type ReturnsProviderProps,\n} from \"./ReturnsProvider\";\nimport {\n initialReturnsStep,\n reduceReturnsStep,\n RETURNS_STEP_COUNT,\n returnsStepNumber,\n} from \"./state-machine\";\nimport { useReturnsLocale, useReturnsText } from \"./texts.context\";\n\n/**\n * Props of {@link BitsnapReturns}. `showLogo`, `logoUrl` and `logoDarkUrl` set\n * the shop logo above the e-mail and code steps: by default the logo from the\n * shop settings, or Bitsnap's when the shop has none.\n */\nexport type BitsnapReturnsProps = Omit<ReturnsProviderProps, \"children\"> &\n LoginLogoOptions;\n\nfunction StepIndicator({ current }: { current: number }) {\n const text = useReturnsText();\n const slot = useReturnsSlot(\"stepIndicator\");\n\n return (\n <p\n data-bitsnap-returns-slot=\"stepIndicator\"\n className={cn(\"text-xs\", slot.className)}\n style={slot.style}\n >\n {text(\"stepIndicator\", { current, total: RETURNS_STEP_COUNT })}\n </p>\n );\n}\n\n/** Default step router. All transitions come from the pure state machine. */\nfunction ReturnsRouter({\n panelToken,\n logo,\n}: {\n panelToken: boolean;\n logo: LoginLogoOptions;\n}) {\n const { status, challenge, projectID } = useReturnsContext(\"BitsnapReturns\");\n const locale = useReturnsLocale();\n const [step, dispatch] = useReducer(\n reduceReturnsStep,\n initialReturnsStep(false),\n );\n\n // A valid session (verified code, stored session, exchanged panel token)\n // moves on to the orders; a dropped one returns to the start.\n useEffect(() => {\n if (status === \"authenticated\") {\n dispatch({ type: \"AUTHENTICATED\" });\n } else if (status === \"anonymous\") {\n dispatch({ type: \"SESSION_EXPIRED\" });\n }\n }, [status]);\n\n // A verification that was pending before a reload or an app switch returns\n // to the code step once, when the stored state has been read.\n const restored = useRef(false);\n useEffect(() => {\n if (restored.current || status === \"hydrating\") {\n return;\n }\n restored.current = true;\n if (status === \"anonymous\" && challenge != null) {\n dispatch({ type: \"CODE_SENT\" });\n }\n }, [status, challenge]);\n\n // Without a panel token the server render and the first client render show\n // the email step; a stored session switches to the orders after hydration.\n if (status === \"exchanging\" || (status === \"hydrating\" && panelToken)) {\n return <SkeletonRows />;\n }\n\n const stepNumber = returnsStepNumber(step.name);\n\n // The logo sits above the step indicator, and stays mounted between the\n // e-mail and the code step; the steps themselves then show none.\n const loginStep = step.name === \"email\" || step.name === \"code\";\n\n return (\n <div className=\"flex flex-col gap-4\">\n {loginStep && (\n <LoginBrandLogo projectId={projectID} locale={locale} {...logo} />\n )}\n {stepNumber != null && <StepIndicator current={stepNumber} />}\n {step.name === \"email\" && (\n <ReturnsEmailStep\n showLogo={false}\n onSubmitted={() => dispatch({ type: \"CODE_SENT\" })}\n />\n )}\n {step.name === \"code\" && (\n <ReturnsCodeStep\n showLogo={false}\n onVerified={() => dispatch({ type: \"AUTHENTICATED\" })}\n onBack={() => dispatch({ type: \"BACK\" })}\n />\n )}\n {step.name === \"orders\" && (\n <ReturnsOrderList\n showLogout={!panelToken}\n onSelectOrder={(orderId) =>\n dispatch({ type: \"SELECT_ORDER\", orderId })\n }\n onOpenMyReturns={() => dispatch({ type: \"OPEN_MY_RETURNS\" })}\n />\n )}\n {step.name === \"order\" && (\n <ReturnsOrderDetail\n orderId={step.orderId}\n initialItems={step.items}\n initialNote={step.note}\n onBack={() => dispatch({ type: \"BACK\" })}\n onContinue={({ items, note }) =>\n dispatch({ type: \"REVIEW\", items, note })\n }\n />\n )}\n {step.name === \"confirmation\" && (\n <ReturnsConfirmation\n orderId={step.orderId}\n items={step.items}\n note={step.note}\n onBack={() => dispatch({ type: \"BACK\" })}\n onSubmitted={(returnId) =>\n dispatch({ type: \"SUBMITTED\", returnId })\n }\n />\n )}\n {step.name === \"result\" && (\n <ReturnsResult\n returnId={step.returnId}\n onContinue={() => dispatch({ type: \"CONTINUE\" })}\n onOpenMyReturns={() => dispatch({ type: \"OPEN_MY_RETURNS\" })}\n />\n )}\n {step.name === \"myReturns\" && (\n <ReturnsMyReturnsList\n onSelectReturn={(returnId) =>\n dispatch({ type: \"SELECT_RETURN\", returnId })\n }\n onBack={() => dispatch({ type: \"BACK\" })}\n />\n )}\n {step.name === \"myReturn\" && (\n <ReturnsMyReturnDetail\n returnId={step.returnId}\n onBack={() => dispatch({ type: \"BACK\" })}\n />\n )}\n </div>\n );\n}\n\n/**\n * Customer return flow: email, code, orders, line selection, confirmation and\n * result, plus the list of earlier returns. It is `ReturnsProvider` with the\n * default step router; compose your own page from the step components to\n * change the layout.\n *\n * ```tsx\n * <BitsnapReturns projectID=\"…\" appearance={brand} texts={{ emailStepTitle: \"Return a product\" }} />\n * ```\n */\nexport function BitsnapReturns({\n showLogo,\n logoUrl,\n logoDarkUrl,\n ...props\n}: BitsnapReturnsProps) {\n return (\n <ReturnsProvider {...props}>\n <ReturnsRouter\n panelToken={props.panelAccessToken != null && props.panelAccessToken !== \"\"}\n logo={{ showLogo, logoUrl, logoDarkUrl }}\n />\n </ReturnsProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkDCICRN6Gjs = require('./chunk-DCICRN6G.js');var _chunk2D2TQK3Rjs = require('./chunk-2D2TQK3R.js');var _chunkMY6BPCRVjs = require('./chunk-MY6BPCRV.js');var _chunkZ3YOJ6NZjs = require('./chunk-Z3YOJ6NZ.js');var _chunkMDAFPGPAjs = require('./chunk-MDAFPGPA.js');var _chunkILYJCT5Sjs = require('./chunk-ILYJCT5S.js');var _chunkSZLSKIYUjs = require('./chunk-SZLSKIYU.js');var _chunk2CL4B4KMjs = require('./chunk-2CL4B4KM.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');var _react = require('@formkit/auto-animate/react');var _react3 = require('react');var _jsxruntime = require('react/jsx-runtime');function De({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card",className:_chunkSZLSKIYUjs.g.call(void 0, "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function He({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-header",className:_chunkSZLSKIYUjs.g.call(void 0, "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function qe({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-title",className:_chunkSZLSKIYUjs.g.call(void 0, "leading-none font-semibold",e),...t})}function Wn({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-description",className:_chunkSZLSKIYUjs.g.call(void 0, "text-muted-foreground text-sm",e),...t})}function Me({className:e,...t}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"card-content",className:_chunkSZLSKIYUjs.g.call(void 0, "px-6",e),...t})}var _lucidereact = require('lucide-react');var La="text-muted-foreground text-xs leading-5",Ra="dark:border-foreground/30 dark:focus-visible:border-foreground/70 dark:focus-visible:ring-foreground/25 dark:aria-invalid:border-destructive-foreground dark:aria-invalid:ring-destructive-foreground/30",Aa=new Set(["invalidEmail","emailNotFound","deliveryUnavailable"]),yr="inline-flex min-h-11 items-center px-1 text-sm underline underline-offset-4 hover:no-underline focus-visible:ring-[3px] focus-visible:ring-ring/50 rounded-sm outline-none disabled:opacity-50 disabled:no-underline";function Vn({login:e,texts:t,allowHaveCode:n=!0,emailPlaceholder:a,emailInputId:r,codeInputId:o,className:i,buttonClassName:d,children:u}){let l=_react3.useId.call(void 0, ),m=_nullishCoalesce(r, () => (`${l}-email`)),P=_nullishCoalesce(o, () => (`${l}-code`)),b=`${l}-notice`,k=`${l}-hint`,{notice:f}=e,c=_optionalChain([f, 'optionalAccess', _2 => _2.kind])==="error",p=e.busy==="send",g=e.busy==="verify",v=e.busy==="resend",I=_chunkSZLSKIYUjs.g.call(void 0, "h-11 w-full",d),U=_optionalChain([f, 'optionalAccess', _3 => _3.kind])==="success",S=_jsxruntime.jsxs.call(void 0, "div",{id:b,className:"min-h-10 text-sm leading-5",children:[_jsxruntime.jsx.call(void 0, "p",{role:"alert",className:"font-medium text-red-700 dark:text-red-400",children:c?f.text:null}),_jsxruntime.jsxs.call(void 0, "p",{role:"status",className:_chunkSZLSKIYUjs.g.call(void 0, "flex items-start gap-1.5",U?"font-medium text-emerald-700 dark:text-emerald-400":"text-foreground"),children:[U&&_jsxruntime.jsx.call(void 0, _lucidereact.CircleCheck,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0"}),_jsxruntime.jsx.call(void 0, "span",{children:f!=null&&!c?f.text:null})]})]}),pe=c&&e.step==="email"&&(f.failure==null||Aa.has(f.failure)),Te=_jsxruntime.jsx.call(void 0, "p",{className:"sr-only",role:"status","aria-live":"polite",children:e.announcement}),ae=_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.d,{htmlFor:m,children:t.emailLabel}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.m,{id:m,ref:e.emailRef,name:"email",type:"email",autoComplete:"email",inputMode:"email",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0,required:!0,className:_chunkSZLSKIYUjs.g.call(void 0, "h-11 text-base disabled:opacity-100 disabled:text-foreground/70",Ra),placeholder:_nullishCoalesce(a, () => (t.emailPlaceholder)),value:e.email,disabled:e.isBusy,"aria-invalid":pe?!0:void 0,"aria-describedby":b,onChange:J=>e.setEmail(J.target.value)})]});if(e.step==="email")return _jsxruntime.jsxs.call(void 0, "form",{noValidate:!0,className:_chunkSZLSKIYUjs.g.call(void 0, "flex flex-col gap-4",i),onSubmit:J=>{J.preventDefault(),e.sendCode()},children:[Te,ae,S,_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{type:"submit",disabled:e.isBusy,"aria-busy":p,className:I,children:[p&&_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.e,{"aria-hidden":!0}),p?t.sending:t.sendCode]}),n&&_jsxruntime.jsxs.call(void 0, "p",{className:"flex flex-wrap items-center justify-center text-center text-sm",children:[t.haveCodePrompt!==""&&_jsxruntime.jsx.call(void 0, "span",{children:t.haveCodePrompt}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:yr,disabled:e.isBusy,onClick:e.haveCode,children:t.haveCode})]})]});let[re,ye]=t.codeSentTo.split("{email}"),T=e.dead!=null,he=T?t.resendNew:e.secondsLeft>0?_chunkDCICRN6Gjs.i.call(void 0, t.resendIn,{seconds:e.secondsLeft}):t.resend;return _jsxruntime.jsxs.call(void 0, "form",{noValidate:!0,className:_chunkSZLSKIYUjs.g.call(void 0, "flex flex-col gap-4",i),onSubmit:J=>{J.preventDefault(),e.submitCode()},children:[Te,e.needsEmail?ae:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center justify-between gap-x-2",children:[_jsxruntime.jsxs.call(void 0, "p",{className:"min-w-0 flex-[1_1_14rem] text-sm leading-5 break-words",children:[re,_jsxruntime.jsx.call(void 0, "strong",{className:"font-semibold",children:e.email}),"\u2060",ye]}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:_chunkSZLSKIYUjs.g.call(void 0, yr,"-ml-1 shrink-0"),disabled:e.isBusy,onClick:e.changeEmail,children:t.changeEmail})]}),u,_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.d,{htmlFor:P,children:t.codeLabel}),_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.k,{id:P,name:"code",inputRef:e.codeRef,value:e.code,onChange:e.setCode,onComplete:J=>void e.submitCode(J),disabled:e.isBusy||T,invalid:c&&!e.needsEmail,"aria-describedby":`${b} ${k}`}),_jsxruntime.jsxs.call(void 0, "p",{id:k,className:La,children:[t.validity," ",t.spamHint]})]}),S,_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{type:"submit",disabled:e.isBusy||T,"aria-busy":g,className:I,children:[g&&_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.e,{"aria-hidden":!0}),g?t.verifying:t.verify]}),e.needsEmail?_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",className:yr,disabled:e.isBusy,onClick:e.changeEmail,children:t.noCode})}):_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{type:"button",variant:T?"default":"outline",disabled:e.isBusy||!T&&e.secondsLeft>0,"aria-busy":v,className:T?I:"h-11 w-full",onClick:()=>void e.resend(),children:[v&&_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.e,{"aria-hidden":!0}),he]})]})}function hr(e){switch(e){case 1:return"emailNotFound";case 2:return"invalidEmail";case 3:return"wrongCode";case 14:return"expired";case 15:return"tooManyAttempts";case 13:return"rateLimited";case 16:return"captchaRequired";case 17:return"captchaInvalid";case 12:return"deliveryFailed";case 11:return"deliveryUnavailable";default:return"unknown"}}var Da={pl:{title:"Zaloguj si\u0119",description:"Wy\u015Blemy do Ciebie kod na maila, dzi\u0119ki kt\xF3remu si\u0119 zalogujesz.",codeTitle:"Wpisz kod z maila",codeDescription:"Kod ma 6 cyfr."},en:{title:"Sign in",description:"We will email you a code that signs you in.",codeTitle:"Enter the code from the email",codeDescription:"The code has 6 digits."}};function Zn(e=_chunkQ337IQNAjs.f.call(void 0, ),t){return{..._chunkDCICRN6Gjs.h.call(void 0, e,t),..._chunkQ337IQNAjs.a.call(void 0, Da,e),...Ma(t,["title","description","codeTitle","codeDescription"])}}function Ma(e,t){let n={};for(let a of t){let r=_optionalChain([e, 'optionalAccess', _4 => _4[a]]);r!=null&&(n[a]=r)}return n}var Oa="return_url",br="__return_url",Ua="accessToken";function Pt(e){let t=new URLSearchParams(e).get(Oa);return t?Yn(t):null}function vt(e){typeof window>"u"||(e?window.sessionStorage.setItem(br,e):window.sessionStorage.removeItem(br))}function tt(){if(typeof window>"u")return null;let e=window.sessionStorage.getItem(br);return e?Yn(e):null}function _a(e,t){return t.some(n=>{if(e===n)return!0;let a=new URL(n).hostname,r=new URL(e).hostname;return r.endsWith(`.${a}`)||r===a})}function Yn(e){try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"||!_a(t.origin,_chunkMDAFPGPAjs.h.call(void 0, ))?null:t.toString()}catch (e2){return null}}function rt(e,t){let n=new URL(e);return n.searchParams.set(Ua,t),n.toString()}if(typeof window<"u"){let t=[window.location.origin,"https://bitsnap.pl","https://kursy.bitsnap.pl"];_chunkMDAFPGPAjs.h.call(void 0, ).length===0&&_chunkMDAFPGPAjs.g.call(void 0, Array.from(new Set(t)))}var Fa=({texts:e,projectID:t,host:n,locale:a,logo:r})=>{let[o,i]=_react3.useState.call(void 0, !1),d=_react3.useRef.call(void 0, void 0),u=_react3.useRef.call(void 0, ""),l=_react3.useMemo.call(void 0, ()=>()=>new Promise(v=>{i(!0);let I=window.setTimeout(()=>{d.current=void 0,i(!1),v(!1)},5*60*1e3);d.current=U=>{window.clearTimeout(I),d.current=void 0,i(!1),u.current=_nullishCoalesce(U, () => ("")),v(U!==null)}}),[]),m=_chunk2CL4B4KMjs.m.call(void 0, ),{mutateAsync:P}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelLogin),{mutateAsync:b}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelLoginWithCode),k=_react3.useMemo.call(void 0, ()=>({async send(v){try{let I=await P({email:v,turnstileToken:u.current});return u.current="",I.result.case==="success"?{ok:!0,retryIn:I.result.value.retryIn||void 0,challengeId:I.result.value.challengeId||void 0}:{ok:!1,kind:hr(I.result.case==="failure"?I.result.value:0)}}catch(I){return{ok:!1,kind:_chunkDCICRN6Gjs.a.call(void 0, I),cause:I}}},async verify({email:v,code:I,challengeId:U}){try{let S=await b({code:parseInt(I,10),email:v,challengeId:U});return S.result.case==="accessToken"&&S.result.value?{ok:!0,value:{accessToken:S.result.value}}:{ok:!1,kind:hr(S.result.case==="failure"?S.result.value:0)}}catch(S){return{ok:!1,kind:_chunkDCICRN6Gjs.a.call(void 0, S),cause:S}}}}),[P,b]),f=_chunkDCICRN6Gjs.j.call(void 0, {adapter:k,texts:e,beforeSend:l,storageKey:_chunkDCICRN6Gjs.f.call(void 0, "panel",t,n),onVerified:({accessToken:v},I)=>{m.track("panel_login",{}),_chunkMDAFPGPAjs.j.call(void 0, t,v,I,n);let U=typeof window<"u"?tt():null;setTimeout(()=>{if(U){window.location.href=rt(U,v);return}window.location.reload()},100)}}),c=f.step==="code",p=c&&!f.needsEmail?e.codeTitle:e.title,g=c&&!f.needsEmail?e.codeDescription:e.description;return _jsxruntime.jsx.call(void 0, "main",{className:"mx-auto flex w-full max-w-sm flex-1 flex-col justify-start pt-4 sm:pt-[12vh]",children:_jsxruntime.jsxs.call(void 0, De,{children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.c,{projectId:t,locale:a,className:"px-4 sm:px-6",...r}),_jsxruntime.jsxs.call(void 0, He,{className:"px-4 sm:px-6",children:[_jsxruntime.jsx.call(void 0, qe,{role:"heading","aria-level":1,className:"text-2xl",children:p}),_jsxruntime.jsx.call(void 0, Wn,{children:g})]}),_jsxruntime.jsxs.call(void 0, Me,{className:"px-4 sm:px-6",children:[_jsxruntime.jsx.call(void 0, Vn,{login:f,texts:e,emailInputId:"email",codeInputId:"verify-code"}),o&&_jsxruntime.jsx.call(void 0, _chunkZ3YOJ6NZjs.a,{action:"panel_login",locale:a,onToken:v=>_optionalChain([d, 'access', _5 => _5.current, 'optionalCall', _6 => _6(v)]),onFailure:()=>_optionalChain([d, 'access', _7 => _7.current, 'optionalCall', _8 => _8(null)])})]})]})})},Ha=({analytics:e,texts:t,locale:n,showLogo:a,logoUrl:r,logoDarkUrl:o})=>{let{theme:i,allowedReturnOrigins:d,projectID:u,host:l}=_chunk2D2TQK3Rjs.b.call(void 0, ),m=_chunk2CL4B4KMjs.n.call(void 0, u,e,"panel"),P=_react3.useMemo.call(void 0, ()=>Zn(_nullishCoalesce(n, () => (_chunkQ337IQNAjs.f.call(void 0, ))),t),[n,t]),b={"--button-background-color":_nullishCoalesce(_optionalChain([i, 'optionalAccess', _9 => _9.colors, 'optionalAccess', _10 => _10.brand]), () => ("#FFFFFF")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([i, 'optionalAccess', _11 => _11.colors, 'optionalAccess', _12 => _12.brandDark]), () => ("#000000")),"--button-text-color":_nullishCoalesce(_optionalChain([i, 'optionalAccess', _13 => _13.colors, 'optionalAccess', _14 => _14.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([i, 'optionalAccess', _15 => _15.colors, 'optionalAccess', _16 => _16.brand]), () => ("#FFFFFF"))},[k]=_react.useAutoAnimate.call(void 0, {duration:300,easing:"ease-in-out",disrespectUserMotionPreference:!1});return _react3.useEffect.call(void 0, ()=>{typeof window>"u"||_chunkMDAFPGPAjs.i.call(void 0, u,l)!=null&&(window.location.href=window.location.href.replaceAll("login",""))},[u,l]),_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window)return;let f=Pt(window.location.search);f&&vt(f);let c=_nullishCoalesce(f, () => (tt()));if(!c)return;let p=_chunkMDAFPGPAjs.i.call(void 0, u,l);p&&(window.location.href=rt(c,p))},[d,u,l]),_jsxruntime.jsx.call(void 0, _chunk2CL4B4KMjs.l,{value:m,children:_jsxruntime.jsx.call(void 0, "div",{className:"bg-white text-black dark:bg-black dark:text-white",children:_jsxruntime.jsx.call(void 0, "div",{className:"font-inter flex min-h-screen w-full flex-col p-4",style:b,ref:k,children:_jsxruntime.jsx.call(void 0, Fa,{texts:P,projectID:u,host:l,locale:n,logo:{showLogo:a,logoUrl:_nullishCoalesce(r, () => (_optionalChain([i, 'optionalAccess', _17 => _17.logoURL]))),logoDarkUrl:_nullishCoalesce(o, () => (_optionalChain([i, 'optionalAccess', _18 => _18.logoDarkURL])))}})})})})},qa= exports.k =(e={})=>_jsxruntime.jsx.call(void 0, Ha,{...e});function Xn(e){let[t,n]=_react3.useState.call(void 0, ()=>{if(typeof window>"u")return e;let r=new URLSearchParams(window.location.search),o={};return Object.keys(e).forEach(i=>{let d=r.get(i);if(d!==null)try{o[i]=JSON.parse(d)}catch (e3){o[i]=d}}),{...e,...o}}),a=_react3.useCallback.call(void 0, r=>{n(o=>{let i={...o,...r};if(typeof window<"u"){let d=new URLSearchParams;Object.keys(i).forEach(l=>{let m=i[l];m!=null&&d.set(l,JSON.stringify(m))});let u=`${window.location.pathname}?${d.toString()}`;window.history.pushState({},"",u)}return i})},[]);return _react3.useEffect.call(void 0, ()=>{let r=()=>{let o=new URLSearchParams(window.location.search),i={};Object.keys(e).forEach(d=>{let u=o.get(d);if(u!==null)try{i[d]=JSON.parse(u)}catch (e4){i[d]=u}}),n({...e,...i})};return window.addEventListener("popstate",r),()=>window.removeEventListener("popstate",r)},[e]),[t,a]}function eo(e,t){if(e!=null)return e;let n=_optionalChain([t, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()]);if(!(n==null||n===""))return{tokens:_chunkMY6BPCRVjs.o.call(void 0, n)}}var Ga={pl:{returnsNavLabel:"Zwroty",openCourse:"Otw\xF3rz kurs",libraryNavLabel:"Biblioteka",messagesNavLabel:"Wiadomo\u015Bci",ordersNavLabel:"Zam\xF3wienia",accountNavLabel:"Konto",navigationLabel:"Panel klienta",logout:"Wyloguj si\u0119",profileHeading:"Profil",emailLabel:"E-mail",noData:"Brak danych",languageLabel:"J\u0119zyk",polishLanguage:"Polski",englishLanguage:"English",plansHeading:"Plany",plansUnavailable:"Plany nie s\u0105 obecnie dost\u0119pne w panelu.",notificationsHeading:"Powiadomienia",notificationsUnavailable:"Ustawienia powiadomie\u0144 nie s\u0105 obecnie dost\u0119pne w panelu.",ordersHeading:"Historia zam\xF3wie\u0144",ordersDescription:"Twoje zam\xF3wienia",ordersEmpty:"Brak zam\xF3wie\u0144.",ordersError:"Nie uda\u0142o si\u0119 pobra\u0107 zam\xF3wie\u0144.",retry:"Spr\xF3buj ponownie",orderLabel:"Zam\xF3wienie",customerLabel:"Klient",dateLabel:"Data",ordersEnd:"To ju\u017C wszystkie Twoje zam\xF3wienia.",previousPage:"Poprzednia strona",nextPage:"Nast\u0119pna strona",paginationLabel:"Strony zam\xF3wie\u0144",statusDraft:"Szkic",statusUnpaid:"Nieop\u0142acone",statusPaid:"Op\u0142acone",statusOverdue:"Zaleg\u0142e",statusCancelled:"Anulowane",statusCompleted:"Zako\u0144czone",statusProcessing:"Przetwarzane",statusRefunded:"Zwr\xF3cone",statusCreated:"Utworzone",statusSent:"Wys\u0142ane",statusIssue:"Wymaga uwagi",statusReturned:"Zwr\xF3cone"},en:{returnsNavLabel:"Returns",openCourse:"Open the course",libraryNavLabel:"Library",messagesNavLabel:"Messages",ordersNavLabel:"Orders",accountNavLabel:"Account",navigationLabel:"Customer panel",logout:"Log out",profileHeading:"Profile",emailLabel:"Email",noData:"No data",languageLabel:"Language",polishLanguage:"Polski",englishLanguage:"English",plansHeading:"Plans",plansUnavailable:"Plans are currently unavailable in the panel.",notificationsHeading:"Notifications",notificationsUnavailable:"Notification settings are currently unavailable in the panel.",ordersHeading:"Order history",ordersDescription:"Your orders",ordersEmpty:"No orders yet.",ordersError:"Could not load your orders.",retry:"Try again",orderLabel:"Order",customerLabel:"Customer",dateLabel:"Date",ordersEnd:"You\u2019ve reached the end of your orders.",previousPage:"Previous page",nextPage:"Next page",paginationLabel:"Order pages",statusDraft:"Draft",statusUnpaid:"Unpaid",statusPaid:"Paid",statusOverdue:"Overdue",statusCancelled:"Cancelled",statusCompleted:"Completed",statusProcessing:"Processing",statusRefunded:"Refunded",statusCreated:"Created",statusSent:"Shipped",statusIssue:"Needs attention",statusReturned:"Returned"}};function ee(e=_chunkQ337IQNAjs.f.call(void 0, )){return _chunkQ337IQNAjs.a.call(void 0, Ga,e)}var Wa={draft:"statusDraft",created:"statusCreated",unpaid:"statusUnpaid",paid:"statusPaid",overdue:"statusOverdue",cancelled:"statusCancelled",canceled:"statusCancelled",completed:"statusCompleted",processing:"statusProcessing",refunded:"statusRefunded",sent:"statusSent",issue:"statusIssue",returned:"statusReturned"};function Ot(e,t=ee()){let n=Wa[e.trim().toLowerCase()];return n==null?void 0:t[n]}function kr({}){let e=ee();return _jsxruntime.jsxs.call(void 0, "section",{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:e.notificationsHeading}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:e.notificationsUnavailable})]})}var Ya=e=>new Date(e*1e3).toLocaleDateString(_chunkQ337IQNAjs.f.call(void 0, ),{year:"numeric",month:"short",day:"numeric"}),Ja=(e,t)=>new Intl.NumberFormat(_chunkQ337IQNAjs.f.call(void 0, ),{style:"currency",currency:t.toUpperCase()}).format(e/100),Qa={draft:"text-neutral-600 dark:text-neutral-400",unpaid:"text-amber-700 dark:text-amber-300",paid:"text-green-700 dark:text-green-400",overdue:"text-red-700 dark:text-red-400",cancelled:"text-neutral-600 line-through dark:text-neutral-400",completed:"text-green-700 dark:text-green-400",processing:"text-blue-700 dark:text-blue-400",refunded:"text-purple-700 dark:text-purple-400"};function Xa({openOrderDetails:e,projectID:t,accessToken:n}){let a=ee(),[r,o]=_react3.useState.call(void 0, 0),i=20,{data:d,isFetching:u,isError:l,refetch:m}=_chunkMY6BPCRVjs.f.call(void 0, _chunkMY6BPCRVjs.e.publicApi.getOrders,{projectId:t,accessToken:n,offset:r,limit:i}),P=_nullishCoalesce(_optionalChain([d, 'optionalAccess', _21 => _21.orders]), () => ([])),b=_nullishCoalesce(_optionalChain([d, 'optionalAccess', _22 => _22.totalCount]), () => (0)),k=Math.floor(r/i)+1,f=Math.ceil(b/i),c=p=>{o(p)};return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:a.ordersHeading}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:a.ordersDescription}),u?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex w-full flex-col gap-3",children:[...Array(5)].map((p,g)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-xl bg-white p-4 shadow-sm dark:bg-neutral-800",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.p,{className:"h-4 w-24"}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.p,{className:"h-3 w-32"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2 text-right",children:[_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.p,{className:"ml-auto h-4 w-16"}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.p,{className:"ml-auto h-3 w-12"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-3",children:_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.p,{className:"h-3 w-40"})})]},g))}):l?_jsxruntime.jsxs.call(void 0, "div",{role:"alert",className:"mt-6 space-y-3",children:[_jsxruntime.jsx.call(void 0, "p",{children:a.ordersError}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{onClick:()=>void m(),className:"min-h-11 focus-visible:outline-2 focus-visible:outline-current",children:a.retry})]}):P.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:a.ordersEmpty}):_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 flex w-full flex-col gap-3",children:P.map(p=>_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(p.id),className:"block min-h-11 focus-visible:outline-2 focus-visible:outline-current rounded-xl bg-white p-4 text-left shadow-sm transition-colors hover:bg-neutral-50 dark:bg-neutral-800 dark:hover:bg-neutral-700",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"min-w-0 break-words",children:[_jsxruntime.jsxs.call(void 0, "p",{className:"font-medium",children:[a.orderLabel," #",p.id]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:p.customerName||a.customerLabel})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"shrink-0 text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-semibold",children:Ja(p.totalAmount,p.currency)}),_jsxruntime.jsx.call(void 0, "p",{className:`text-xs font-medium ${_nullishCoalesce(Qa[p.status], () => ("text-neutral-400"))}`,children:_nullishCoalesce(Ot(p.status,a), () => (p.status))})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 flex items-center justify-between gap-3 text-xs text-neutral-500 dark:text-neutral-400",children:_jsxruntime.jsxs.call(void 0, "span",{children:[a.dateLabel,":"," ",p.createdAt?Ya(Number(p.createdAt.seconds)):"-"]})})]},p.id))}),k>=f&&_jsxruntime.jsx.call(void 0, "p",{className:"mt-6 text-center text-sm text-neutral-600 dark:text-neutral-400",children:a.ordersEnd}),f>1&&_jsxruntime.jsxs.call(void 0, "nav",{"aria-label":a.paginationLabel,className:"mt-4 flex flex-wrap items-center justify-center gap-2",children:[k>1&&_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",className:"min-h-11",onClick:()=>c(r-i),children:a.previousPage}),Array.from(new Set([1,k-1,k,k+1,f])).filter(p=>p>0&&p<=f).sort((p,g)=>p-g).map(p=>_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:p===k?"secondary":"ghost",className:"min-h-11 min-w-11","aria-current":p===k?"page":void 0,onClick:()=>c((p-1)*i),children:p},p)),k<f&&_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",className:"min-h-11",onClick:()=>c(r+i),children:a.nextPage})]})]})]})}var ro=Xa;function wr({projectID:e}){let t=ee();return _jsxruntime.jsxs.call(void 0, "section",{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:t.plansHeading}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-6 text-sm text-neutral-600 dark:text-neutral-400",children:t.plansUnavailable})]})}function ni(e,t,n,a){typeof window>"u"||(t&&_chunkMDAFPGPAjs.l.call(void 0, n,a),window.location.href=e)}function oi({projectID:e,host:t,loginURL:n,screen:a,params:r,setParams:o,setActiveScreen:i}){let{status:d,exchangeError:u}=_chunkDCICRN6Gjs.v.call(void 0, "PanelReturns"),l=_chunkDCICRN6Gjs.t.call(void 0, ),m=d==="anonymous"&&(u==null||_chunkDCICRN6Gjs.p.call(void 0, u));_react3.useEffect.call(void 0, ()=>{m&&ni(n,u!=null,e,t)},[m,n,u,e,t]);let[P,b]=_react3.useState.call(void 0, "orders"),[k,f]=_react3.useState.call(void 0, {items:[],note:""}),[c,p]=_react3.useState.call(void 0, );if(d==="anonymous"&&!m)return _jsxruntime.jsxs.call(void 0, "div",{role:"alert",className:"flex flex-col items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:l(_chunkDCICRN6Gjs.q.call(void 0, u))}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{type:"button",onClick:()=>window.location.reload(),children:l("errorRetry")})]});if(d!=="authenticated")return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.E,{});let g=v=>{b(v),o({state:"returns",orderId:void 0,returnId:void 0}),i("returns")};if(a==="return-details"&&r.returnId)return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.M,{returnId:r.returnId,onBack:()=>g("myReturns")});if(P==="myReturns")return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.L,{onBack:()=>g("orders"),onSelectReturn:v=>{o({state:"return-details",returnId:v,orderId:void 0}),i("return-details")}});if(P==="result"&&c!=null)return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.K,{returnId:c,onContinue:()=>g("orders"),onOpenMyReturns:()=>g("myReturns")});if(r.orderId){let v=r.orderId;return P==="confirmation"?_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.J,{orderId:v,items:k.items,note:k.note,onBack:()=>b("orders"),onSubmitted:I=>{p(I),f({items:[],note:""}),b("result"),o({orderId:void 0})}}):_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.I,{orderId:v,initialItems:k.items.length>0?k.items:void 0,initialNote:k.note,onBack:()=>{f({items:[],note:""}),o({orderId:void 0})},onContinue:I=>{f(I),b("confirmation")}})}return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.H,{showLogout:!1,onSelectOrder:v=>{f({items:[],note:""}),b("orders"),o({orderId:v})},onOpenMyReturns:()=>g("myReturns")})}function Cr({accessToken:e,appearance:t,texts:n,...a}){return _jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.w,{projectID:a.projectID,host:a.host,appearance:t,texts:n,panelAccessToken:e,children:_jsxruntime.jsx.call(void 0, oi,{...a})})}var ii={hello:"Hej \u{1F44B}",intro:"Poni\u017Cej znajdziesz swoje produkty",loading:"\u0141adowanie produkt\xF3w\u2026",empty:"Nie masz jeszcze produkt\xF3w w tym sklepie. Twoje zakupy pojawi\u0105 si\u0119 tutaj.",audio:"Audio",files:"Pliki",course:"Kurs",ticket:"Bilet",chat:"Czat",community:"Spo\u0142eczno\u015B\u0107",openMessages:"Otw\xF3rz wiadomo\u015Bci",listen:"S\u0142uchaj",openCourse:"Otw\xF3rz kurs",downloadFiles:"Pobierz pliki",showTicket:"Poka\u017C bilet",back:"Wr\xF3\u0107",yourFiles:"Twoje pliki",download:"Pobierz",retry:"Spr\xF3buj ponownie",fileError:"Nie uda\u0142o si\u0119 wczyta\u0107 plik\xF3w.",noFiles:"Brak plik\xF3w do pobrania.",ticketInfo:"Tw\xF3j zakupiony bilet",file:"Plik"},si={hello:"Hi \u{1F44B}",intro:"Your products are below",loading:"Loading products\u2026",empty:"You have no products in this shop yet. Your purchases will show up here.",audio:"Audio",files:"Files",course:"Course",ticket:"Ticket",chat:"Chat",community:"Community",openMessages:"Open messages",listen:"Listen",openCourse:"Open course",downloadFiles:"Download files",showTicket:"Show ticket",back:"Back",yourFiles:"Your files",download:"Download",retry:"Try again",fileError:"Your files could not be loaded.",noFiles:"No files to download.",ticketInfo:"Your purchased ticket",file:"File"};function nt(){return _chunkQ337IQNAjs.f.call(void 0, ).toLowerCase().startsWith("en")?si:ii}var li=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g,di=e=>[...e.matchAll(li)].map(n=>({url:n[0],startIndex:n.index,endIndex:n.index+n[0].length-1})),ui=(e,t)=>{let n="",a=0;t.sort((r,o)=>r.startIndex-o.startIndex);for(let{startIndex:r,endIndex:o,replacementText:i}of t)n+=e.slice(a,r),n+=i,a=o+1;return n+=e.slice(a),n},oo=e=>{let t=di(e);return _jsxruntime.jsx.call(void 0, "p",{dangerouslySetInnerHTML:{__html:ui(e,t.map(n=>(n.replacementText=`<a key=${n.url} href=${n.url} style="text-decoration: underline;" target="_blank">
|
|
2
|
+
${n.url}
|
|
3
|
+
</a>`,n)))}})};var _protobuf = require('@bufbuild/protobuf');var _hlsjs = require('hls.js'); var _hlsjs2 = _interopRequireDefault(_hlsjs);function pi(){return _jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.3s]"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.15s]"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-3 animate-bounce rounded-full bg-current"})]})}var we=pi;var gi=[401,403],ao="networkError",io="mediaError";function yi(e,t){if(e==null||e.fatal!==!0)return{action:"ignore"};let n=_optionalChain([e, 'access', _23 => _23.response, 'optionalAccess', _24 => _24.code]),a=e.type===ao?"network":e.type===io?"media":"unknown",r=n==null?{kind:a}:{kind:a,status:n};return n!=null&&gi.includes(n)?{action:"expired",error:{kind:"network",status:n}}:e.type===ao&&!t.network?{action:"restart-load"}:e.type===io&&!t.media?{action:"recover-media"}:{action:"fail",error:r}}function so(e){let t=_nullishCoalesce(e.HlsCtor, () => (_hlsjs2.default)),n=new t,a,r=!1,o=!1;return n.attachMedia(e.media),n.on(t.Events.ERROR,(i,d)=>{let u=yi(d,{network:r,media:o});switch(u.action){case"expired":_optionalChain([e, 'access', _25 => _25.handlers, 'optionalAccess', _26 => _26.onExpiredUrl, 'optionalCall', _27 => _27()]),_optionalChain([e, 'access', _28 => _28.handlers, 'optionalAccess', _29 => _29.onError, 'optionalCall', _30 => _30(u.error)]);break;case"restart-load":r=!0,n.startLoad();break;case"recover-media":o=!0,n.recoverMediaError();break;case"fail":_optionalChain([e, 'access', _31 => _31.handlers, 'optionalAccess', _32 => _32.onError, 'optionalCall', _33 => _33(u.error)]);break;case"ignore":break}}),{load(i){a=i,r=!1,o=!1,n.loadSource(i)},retry(){a!=null&&(r=!1,o=!1,n.loadSource(a))},destroy(){n.destroy()},get src(){return a}}}function lo(e){try{return e.canPlayType("application/vnd.apple.mpegurl")!==""}catch (e5){return!1}}function uo(e){switch(_optionalChain([e, 'optionalAccess', _34 => _34.code])){case 2:return{kind:"network"};case 3:case 4:return{kind:"media"};default:return{kind:"unknown"}}}var hi={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",svg:"image/svg+xml"},Sr="512x512";function ot(){return typeof navigator<"u"&&typeof navigator.mediaSession<"u"}function bi(e){if(typeof e!="string"||e.length===0)return{src:e,sizes:Sr};let t=e.split(/[?#]/)[0],n=t.includes(".")?t.slice(t.lastIndexOf(".")+1).toLowerCase():"",a=hi[n],r={src:e,sizes:Sr};return a!=null&&(r.type=a),r}function Pi(e){if(e==null)return;let t=Array.isArray(e)?e:[e],n=[];for(let a of t){if(typeof a=="string"){a.length>0&&n.push(bi(a));continue}a!=null&&a.src.length>0&&n.push({src:a.src,sizes:_nullishCoalesce(a.sizes, () => (Sr)),...a.type!=null?{type:a.type}:{}})}return n.length>0?n:void 0}function Ir(e){!ot()||typeof MediaMetadata>"u"||(navigator.mediaSession.metadata=new MediaMetadata({title:e.title,album:e.album,artist:e.artist,artwork:Pi(e.artwork)}))}function co(){ot()&&(navigator.mediaSession.playbackState="playing")}function po(){ot()&&(navigator.mediaSession.playbackState="paused")}function mo(e,t,n=1){if(!ot()||e==null||!Number.isFinite(e)||e<=0||t!=null&&isNaN(t))return;let a=Math.min(Math.max(_nullishCoalesce(t, () => (0)),0),e),r=Number.isFinite(n)&&n>0?n:1;try{navigator.mediaSession.setPositionState({playbackRate:r,duration:e,position:a})}catch (e6){}}var fo=["play","pause","stop","seekbackward","seekforward","seekto","previoustrack","nexttrack"];function go(e){if(ot()){Ir({title:e.title,album:e.album,artist:e.artist,artwork:e.artwork});for(let t of fo)try{navigator.mediaSession.setActionHandler(t,n=>{e.action(n)})}catch (e7){}}}function yo(){if(ot()){navigator.mediaSession.metadata=null;for(let e of fo)try{navigator.mediaSession.setActionHandler(e,null)}catch (e8){}}}var wi={play:"Odtw\xF3rz",pause:"Wstrzymaj",previous:"Poprzedni rozdzia\u0142",next:"Nast\u0119pny rozdzia\u0142",rewind:"Cofnij o 10 sekund",forward:"Przewi\u0144 o 10 sekund",progress:"Post\u0119p odtwarzania",of:"z",speed:"Pr\u0119dko\u015B\u0107",sleep:"Wy\u0142\u0105cznik czasowy",off:"Wy\u0142\u0105czony",end:"Koniec rozdzia\u0142u",cancel:"Anuluj wy\u0142\u0105cznik",error:"Nie uda\u0142o si\u0119 odtworzy\u0107 nagrania.",retry:"Spr\xF3buj ponownie",left:"zosta\u0142o",book:"ca\u0142a ksi\u0105\u017Cka",chapter:"rozdzia\u0142",chapters:"Rozdzia\u0142y",loading:"\u0141adowanie rozdzia\u0142\xF3w\u2026",empty:"Brak rozdzia\u0142\xF3w do wy\u015Bwietlenia.",resume:"Kontynuuj",chapterName:"Rozdzia\u0142",download:"Pobierz rozdzia\u0142",playing:"Teraz odtwarzane",played:"Ods\u0142uchane"},xi={play:"Play",pause:"Pause",previous:"Previous chapter",next:"Next chapter",rewind:"Rewind 10 seconds",forward:"Forward 10 seconds",progress:"Playback progress",of:"of",speed:"Speed",sleep:"Sleep timer",off:"Off",end:"End of chapter",cancel:"Cancel timer",error:"The recording could not be played.",retry:"Try again",left:"left",book:"whole book",chapter:"chapter",chapters:"Chapters",loading:"Loading chapters\u2026",empty:"No chapters to display.",resume:"Continue",chapterName:"Chapter",download:"Download chapter",playing:"Now playing",played:"Played"};function Ut(e){let[t,n]=_react3.useState.call(void 0, "pl");return _react3.useEffect.call(void 0, ()=>{try{n(_chunkQ337IQNAjs.f.call(void 0, ))}catch (e9){}},[]),(_nullishCoalesce(e, () => (t))).toLowerCase().startsWith("en")?xi:wi}function xe(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${t>=3600?`${Math.floor(t/3600)}:`:""}${String(Math.floor(t/60)%60).padStart(2,"0")}:${String(t%60).padStart(2,"0")}`}var Z={get(e){try{return localStorage.getItem(e)}catch (e10){return null}},set(e,t){try{localStorage.setItem(e,t)}catch (e11){}},remove(e){try{localStorage.removeItem(e)}catch (e12){}}},Tr="__player__speed",_t=[.75,1,1.25,1.5,1.75,2];var Ai=_react3.forwardRef.call(void 0, ({chapters:e,locale:t,styles:n,updateCurrentTime:a,setCurrentTimeHandler:r,title:o,imageURL:i,coverShownBeside:d,author:u,uniqueProductID:l,onChapterChange:m,onError:P,onExpiredUrl:b,onFinished:k},f)=>{let c=Ut(t),[p,g]=_react3.useState.call(void 0, 1),v=_react3.useRef.call(void 0, 1),[I,U]=_react3.useState.call(void 0, ),[S,pe]=_react3.useState.call(void 0, "off"),[Te,ae]=_react3.useState.call(void 0, 0),re=_react3.useRef.call(void 0, {mode:"off",deadline:0});function ye(){re.current={mode:"off",deadline:0},pe("off"),ae(0)}function T(s){let h=Number(s)*60;re.current={mode:s,deadline:Number.isFinite(h)?Date.now()+h*1e3:0},pe(s),ae(Number.isFinite(h)?h:0)}function he(s){_t.includes(s)&&(g(s),v.current=s,Z.set(Tr,String(s)),j.current&&(j.current.playbackRate=s),K())}_react3.useEffect.call(void 0, ()=>{let s=Number(Z.get(Tr));_t.includes(s)&&he(s);let h=setInterval(()=>{let{mode:x,deadline:D}=re.current;if(x==="off"||x==="chapter")return;let ke=Math.max(0,Math.ceil((D-Date.now())/1e3));ae(ke),ke===0&&(je.current=!1,St(),ye())},1e3);return()=>clearInterval(h)},[]);let J;(x=>(x[x.Playing=0]="Playing",x[x.Paused=1]="Paused"))(J||={});let[ze,mt]=_react3.useState.call(void 0, 1),[Zt,Ee]=_react3.useState.call(void 0, void 0),[C,be]=_react3.useState.call(void 0, void 0),[We,me]=_react3.useState.call(void 0, !1),[Ct,Xr]=_react3.useState.call(void 0, null),j=_react3.useRef.call(void 0, null),Pe=_react3.useRef.call(void 0, null),Nt=_react3.useRef.call(void 0, void 0),va=_react3.useRef.call(void 0, null),ne=_react3.useRef.call(void 0, null),Yt=_react3.useRef.call(void 0, null),je=_react3.useRef.call(void 0, !1),Ve=_react3.useRef.call(void 0, !1),ft=_react3.useRef.call(void 0, null),Jt=_react3.useRef.call(void 0, null),Qt=_react3.useRef.call(void 0, e),en=_react3.useRef.call(void 0, null),oe=_react3.useRef.call(void 0, {onChapterChange:m,onError:P,onExpiredUrl:b,onFinished:k,updateCurrentTime:a,title:o,imageURL:i,author:u});oe.current={onChapterChange:m,onError:P,onExpiredUrl:b,onFinished:k,updateCurrentTime:a,title:o,imageURL:i,author:u};function Xt(s){!Ve.current||!Number.isFinite(s)||s<0||Z.set(`__player__${l}_${_optionalChain([ne, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.id])}`,`${Math.floor(s)}`)}function ka(){let s=Z.get(`__player__${l}_${_optionalChain([ne, 'access', _37 => _37.current, 'optionalAccess', _38 => _38.id])}`);if(s!=null)try{let h=parseInt(s);return isNaN(h)||h<0?void 0:h}catch (e13){return}}function wa(){let s=Z.get(`__player__${l}_last_chapter`);if(s!=null)return s}function tn(s){Z.set(`__player__${l}_last_chapter`,s)}function rn(s){Z.remove(`__player__${l}_${s}`)}function er(s){Ir({title:_nullishCoalesce(_nullishCoalesce(_optionalChain([s, 'optionalAccess', _39 => _39.name]), () => (oe.current.title)), () => ("")),album:oe.current.title,artist:oe.current.author,artwork:oe.current.imageURL})}function nn(s){Yt.current=s,Xr(s),me(!1),_optionalChain([oe, 'access', _40 => _40.current, 'access', _41 => _41.onError, 'optionalCall', _42 => _42(s)])}function on(){Yt.current=null,Xr(null)}function an(){let s=j.current;if(s==null)return;let h=s.play();h!=null&&typeof h.catch=="function"&&h.catch(()=>{}),K()}function sn(){an()}function St(){_optionalChain([j, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.pause, 'call', _45 => _45()]),K()}function xa(){if(ze===0){St();return}sn()}function Le(s){let h=j.current;if(h==null||!Number.isFinite(s))return;let x=Number.isFinite(h.duration)?h.duration:0,D=x>0?Math.min(Math.max(s,0),x):Math.max(s,0);Ee(D),h.currentTime=D,K()}function It(s){let h=j.current;if(h==null)return;let x=Number.isFinite(h.duration)?h.duration:void 0,D=Math.max(h.currentTime+s,0);x!=null&&D>x&&(D=x),Le(D)}function tr(s){let h=j.current;if(h!=null){if(on(),me(!0),lo(h)){rr(),h.src=s,h.load();return}if(_hlsjs2.default.isSupported()){Pe.current==null&&(Pe.current=so({media:h,handlers:{onError:x=>{nn(x)},onExpiredUrl:()=>{_optionalChain([oe, 'access', _46 => _46.current, 'access', _47 => _47.onExpiredUrl, 'optionalCall', _48 => _48()])}}})),Pe.current.load(s);return}rr(),h.src=s,h.load()}}function rr(){_optionalChain([Pe, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.destroy, 'call', _51 => _51()]),Pe.current=null}function Tt(s,h){let x=_optionalChain([h, 'optionalAccess', _52 => _52.play])===!0;ne.current&&j.current&&!j.current.ended&&Xt(j.current.currentTime),Ve.current=!1,ft.current=null,je.current=x,ne.current=s,U(s.id),Ee(0),be(s.duration),tr(s.publicUrl),er(s),_optionalChain([oe, 'access', _53 => _53.current, 'access', _54 => _54.onChapterChange, 'optionalCall', _55 => _55(s)]),tn(s.id)}function nr(s){if(s.length===0)return;let h=wa(),x=_nullishCoalesce((h!=null?s.find(D=>D.id===h):void 0), () => (s[0]));Tt(x,{play:!1})}function or(){let s=Qt.current,h=ne.current;if(s==null||s.length===0||h==null)return;let x=s.findIndex(ke=>ke.id===h.id);if(x===-1)return;let D=x+1;if(D>=s.length){Ca(h);return}Tt(s[D],{play:!0})}function ln(){let s=Qt.current,h=ne.current;if(h==null)return;let x=j.current;if(x!=null&&x.currentTime>3){Le(0);return}let D=s==null?-1:s.findIndex(ke=>ke.id===h.id);if(D>0){Tt(s[D-1],{play:!0});return}Le(0)}function Ca(s){rn(s.id),je.current=!1,_optionalChain([j, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.pause, 'call', _58 => _58()]),mt(1),_optionalChain([oe, 'access', _59 => _59.current, 'access', _60 => _60.onFinished, 'optionalCall', _61 => _61()])}function dn(){let s=ne.current;if(s!=null){if(Z.set(`__player__${l}_${s.id}_completed`,"true"),rn(s.id),re.current.mode==="chapter"){je.current=!1,St(),ye();return}or(),K()}}function un(){let s=j.current;if(s!=null){if(me(!1),s.playbackRate=v.current,Jt.current=null,!Ve.current){Ve.current=!0;let h=ft.current;if(ft.current=null,h!=null)Le(h);else{let x=ka();x!=null&&Le(x)}}je.current&&(je.current=!1,an())}}function cn(){let s=_optionalChain([j, 'access', _62 => _62.current, 'optionalAccess', _63 => _63.error]),h=_optionalChain([ne, 'access', _64 => _64.current, 'optionalAccess', _65 => _65.publicUrl]);(_optionalChain([s, 'optionalAccess', _66 => _66.code])===2||_optionalChain([s, 'optionalAccess', _67 => _67.code])===4)&&Pe.current==null&&h!=null&&Jt.current!==h&&(Jt.current=h,_optionalChain([oe, 'access', _68 => _68.current, 'access', _69 => _69.onExpiredUrl, 'optionalCall', _70 => _70()])),nn(uo(s))}function pn(){let h=_nullishCoalesce(_optionalChain([ne, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.publicUrl]), () => (_optionalChain([Pe, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.src])));if(h==null)return;let D=_nullishCoalesce(_optionalChain([j, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.currentTime]), () => (0));on(),Ve.current=!1,ft.current=D>0?D:null,Ee(D),Pe.current!=null?Pe.current.retry():tr(h)}function Na(s){switch(s.action){case"play":sn();break;case"pause":case"stop":St();break;case"seekbackward":It(-(_nullishCoalesce(s.seekOffset, () => (10))));break;case"seekforward":It(_nullishCoalesce(s.seekOffset, () => (10)));break;case"seekto":s.seekTime!=null&&Le(s.seekTime);break;case"previoustrack":ln();break;case"nexttrack":or();break;default:break}}_react3.useImperativeHandle.call(void 0, f,()=>({selectChapter:s=>{Tt(s,{play:!0})},retry:pn,getError:()=>Yt.current}));function K(){let s=j.current;s!=null&&(mt(s.paused?1:0),be(s.duration),Ee(s.currentTime),s.ended||Xt(s.currentTime),mo(s.duration,s.currentTime,s.playbackRate),s.networkState===s.NETWORK_LOADING&&s.readyState<=s.HAVE_FUTURE_DATA?me(!0):me(!1),_optionalChain([oe, 'access', _77 => _77.current, 'access', _78 => _78.updateCurrentTime, 'optionalCall', _79 => _79(s.currentTime)]))}_react3.useEffect.call(void 0, ()=>(go({title:_nullishCoalesce(o, () => ("")),album:o,artist:u,artwork:i,action:Na}),()=>{yo()}),[]),_react3.useEffect.call(void 0, ()=>{er(ne.current)},[o,u,i]),_react3.useEffect.call(void 0, ()=>{let s=j.current;if(s!=null)return s.addEventListener("loadeddata",un),s.addEventListener("ended",dn),s.addEventListener("error",cn),s.addEventListener("timeupdate",K),s.addEventListener("play",K),s.addEventListener("pause",K),s.addEventListener("ratechange",K),K(),Nt.current=setInterval(K,500),()=>{s.removeEventListener("loadeddata",un),s.removeEventListener("ended",dn),s.removeEventListener("error",cn),s.removeEventListener("timeupdate",K),s.removeEventListener("play",K),s.removeEventListener("pause",K),s.removeEventListener("ratechange",K),Nt.current!=null&&(clearInterval(Nt.current),Nt.current=void 0),s.ended||Xt(s.currentTime),Ee(void 0),s.pause(),rr(),s.removeAttribute("src"),s.load()}},[]),_react3.useEffect.call(void 0, ()=>{_optionalChain([r, 'optionalCall', _80 => _80(Le)])},[]);let ar=e.map(s=>`${s.id}|${_nullishCoalesce(s.publicUrl, () => (""))}`).join(`
|
|
4
|
+
`);_react3.useEffect.call(void 0, ()=>{Qt.current=e;let s=en.current;if(s===ar)return;if(en.current=ar,s==null){nr(e);return}let h=ne.current;if(h==null){nr(e);return}let x=e.find(D=>D.id===h.id);if(!(x!=null&&x.publicUrl===h.publicUrl)){if(x!=null){let D=j.current,ke=_nullishCoalesce(_optionalChain([D, 'optionalAccess', _81 => _81.currentTime]), () => (0)),Ia=D!=null&&!D.paused;ne.current=x,Ve.current=!1,ft.current=ke>0?ke:null,je.current=Ia,tr(x.publicUrl),er(x),_optionalChain([oe, 'access', _82 => _82.current, 'access', _83 => _83.onChapterChange, 'optionalCall', _84 => _84(x)]),tn(x.id);return}nr(e)}},[ar]),_react3.useEffect.call(void 0, ()=>{switch(ze){case 0:co();break;case 1:po();break}},[ze]);let Ze=e.findIndex(s=>s.id===I),ve=Number.isFinite(C)&&C>0?C:_nullishCoalesce(_optionalChain([e, 'access', _85 => _85[Ze], 'optionalAccess', _86 => _86.duration]), () => (0)),gt=Math.min(Math.max(_nullishCoalesce(Zt, () => (0)),0),ve||1/0),mn=e.length>0&&e.every(s=>Number.isFinite(s.duration)&&s.duration>0),Sa=Math.max(0,ve-gt+(mn?e.slice(Ze+1).reduce((s,h)=>s+h.duration,0):0))/p,ir=Math.ceil(Sa/60),fn=`${Math.floor(ir/60)>0?`${Math.floor(ir/60)} h `:""}${ir%60} min`;return _jsxruntime.jsxs.call(void 0, "div",{id:"audio-player-container",className:"bitsnap-audio-player flex min-w-0 flex-col gap-3 text-neutral-900 dark:text-neutral-100",style:{...n,"--seek-before-width":`${ve>0?gt/ve*100:0}%`},ref:va,"data-player-error":_optionalChain([Ct, 'optionalAccess', _87 => _87.kind]),children:[_jsxruntime.jsx.call(void 0, "video",{ref:j,className:"hidden",poster:i,title:o}),_jsxruntime.jsxs.call(void 0, "div",{className:_chunkSZLSKIYUjs.g.call(void 0, "flex min-w-0 items-center gap-3",d&&"lg:hidden"),children:[i&&_jsxruntime.jsx.call(void 0, "img",{src:i,alt:"",className:"h-16 w-16 shrink-0 rounded object-contain"}),_jsxruntime.jsxs.call(void 0, "div",{className:"min-w-0 break-words",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-semibold",children:_nullishCoalesce(_optionalChain([e, 'access', _88 => _88[Ze], 'optionalAccess', _89 => _89.name]), () => (o))}),u&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:u})]})]}),Ct&&_jsxruntime.jsxs.call(void 0, "div",{role:"alert",className:"rounded-lg bg-red-50 p-3 text-red-800 dark:bg-red-950 dark:text-red-200",children:[_jsxruntime.jsx.call(void 0, "p",{children:c.error}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:pn,children:c.retry})]}),_jsxruntime.jsx.call(void 0, "input",{type:"range",min:"0",max:ve||100,value:gt,disabled:!ve,"aria-label":c.progress,"aria-valuetext":`${xe(gt)} ${c.of} ${xe(ve)}`,onChange:s=>Le(Number(s.target.value))}),_jsxruntime.jsxs.call(void 0, "section",{className:"flex w-full justify-between text-sm tabular-nums",children:[_jsxruntime.jsx.call(void 0, "span",{id:"current-time",children:xe(gt)}),_jsxruntime.jsx.call(void 0, "span",{id:"duration",children:xe(ve)})]}),ve>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:[c.left==="left"?`${fn} ${c.left}`:`${c.left} ${fn}`," ","\xB7 ",mn?c.book:c.chapter," (",p,"\xD7)"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center justify-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:ln,disabled:Ze<0,"aria-label":c.previous,children:_jsxruntime.jsx.call(void 0, _lucidereact.SkipBack,{className:"h-5 w-5"})}),_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:()=>It(-10),"aria-label":c.rewind,children:["\u2212",10]}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:xa,"aria-label":ze===1?c.play:c.pause,children:ze===1?_jsxruntime.jsx.call(void 0, _lucidereact.Play,{className:"h-5 w-5"}):_jsxruntime.jsx.call(void 0, _lucidereact.Pause,{className:"h-5 w-5"})}),_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:()=>It(10),"aria-label":c.forward,children:["+",10]}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:or,disabled:Ze<0||Ze>=e.length-1,"aria-label":c.next,children:_jsxruntime.jsx.call(void 0, _lucidereact.SkipForward,{className:"h-5 w-5"})})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap gap-3 md:grid md:grid-cols-2",children:[_jsxruntime.jsxs.call(void 0, "label",{className:"flex flex-1 items-center gap-2 text-sm md:flex-col md:items-start md:whitespace-nowrap",children:[c.speed,_jsxruntime.jsx.call(void 0, "select",{"aria-label":c.speed,value:p,onChange:s=>he(Number(s.target.value)),children:_t.map(s=>_jsxruntime.jsxs.call(void 0, "option",{value:s,children:[s,"\xD7"]},s))})]}),_jsxruntime.jsxs.call(void 0, "label",{className:"flex flex-1 items-center gap-2 text-sm md:flex-col md:items-start md:whitespace-nowrap",children:[c.sleep,_jsxruntime.jsxs.call(void 0, "select",{"aria-label":c.sleep,value:S,onChange:s=>T(s.target.value),children:[_jsxruntime.jsx.call(void 0, "option",{value:"off",children:c.off}),[15,30,45,60].map(s=>_jsxruntime.jsxs.call(void 0, "option",{value:s,children:[s," min"]},s)),_jsxruntime.jsx.call(void 0, "option",{value:"chapter",children:c.end})]})]})]}),S!=="off"&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between gap-2 text-sm",children:[_jsxruntime.jsx.call(void 0, "span",{role:"timer",children:S==="chapter"?c.end:xe(Te)}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:ye,children:c.cancel})]}),We&&_jsxruntime.jsx.call(void 0, "div",{role:"status",className:"flex justify-center",children:_jsxruntime.jsx.call(void 0, we,{})})]})}),ho=Ai;function Er({chapters:e,currentID:t,productID:n,onSelect:a,downloadable:r,onDownload:o,loading:i,locale:d}){let u=Ut(d),[l,m]=_react3.useState.call(void 0, null),[P,b]=_react3.useState.call(void 0, []);_react3.useEffect.call(void 0, ()=>{let c=`__player__${n}_`,p=Z.get(`${c}last_chapter`),g=Number(p&&Z.get(`${c}${p}`));m(p&&g>0&&Number.isFinite(g)?{id:p,time:g}:null),b((_nullishCoalesce(e, () => ([]))).filter(v=>Z.get(`${c}${v.id}_completed`)==="true"||Number(Z.get(`${c}${v.id}`))>0).map(v=>v.id))},[e,n,t]);let k=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _90 => _90.findIndex, 'call', _91 => _91(c=>c.id===_optionalChain([l, 'optionalAccess', _92 => _92.id]))]), () => (-1)),f=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _93 => _93.findIndex, 'call', _94 => _94(c=>c.id===t)]), () => (-1));return _jsxruntime.jsxs.call(void 0, "div",{className:"max-h-96 w-full overflow-y-auto",children:[_jsxruntime.jsx.call(void 0, "h2",{className:"mb-3 text-xl font-semibold",children:u.chapters}),i?_jsxruntime.jsx.call(void 0, "p",{role:"status",children:u.loading}):_optionalChain([e, 'optionalAccess', _95 => _95.length])?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[l&&k>=0&&_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"mb-3 min-h-11 rounded-lg border border-neutral-300 px-3 py-2 text-left dark:border-neutral-600",onClick:()=>a(e[k]),children:[u.resume,": ",u.chapterName," ",k+1,","," ",xe(l.time)]}),_jsxruntime.jsx.call(void 0, "ul",{className:"flex w-full flex-col gap-2",children:e.map((c,p)=>{let g=c.id===t,v=p<f||P.includes(c.id);return _jsxruntime.jsxs.call(void 0, "li",{className:"flex min-w-0 items-center gap-2",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button","aria-current":g?"true":void 0,className:`min-h-11 min-w-0 flex-1 rounded-lg p-3 text-left hover:bg-neutral-200 dark:hover:bg-neutral-700 ${g?"bg-neutral-200 dark:bg-neutral-700":"bg-neutral-100 dark:bg-neutral-800"}`,onClick:()=>a(c),children:[_jsxruntime.jsxs.call(void 0, "span",{className:"flex items-center gap-2",children:[g?_jsxruntime.jsx.call(void 0, _lucidereact.Play,{className:"size-4 shrink-0","aria-label":u.playing}):v?_jsxruntime.jsx.call(void 0, _lucidereact.Check,{className:"size-4 shrink-0","aria-label":u.played}):null,_jsxruntime.jsx.call(void 0, "span",{className:"min-w-0 flex-1 break-words text-sm font-medium",children:c.name}),!!c.duration&&_jsxruntime.jsx.call(void 0, "span",{className:"shrink-0 text-xs tabular-nums text-neutral-600 dark:text-neutral-300",children:xe(c.duration)})]}),c.description&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-2 block text-xs",children:c.description})]}),r&&c.downloadableUrl&&_jsxruntime.jsx.call(void 0, "a",{href:c.downloadableUrl,onClick:o,"aria-label":`${u.download} ${p+1}`,className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",children:_jsxruntime.jsx.call(void 0, _lucidereact.Download,{className:"size-4","aria-hidden":"true"})})]},c.id)})})]}):_jsxruntime.jsx.call(void 0, "p",{children:u.empty})]})}function Ne(e,...t){console.warn(e,...t)}function Lr(e){console.error(e)}var Hi=({accessToken:e,product:t,styles:n,reveal:a})=>{let r=nt(),o=t.productType,i=_chunk2CL4B4KMjs.m.call(void 0, ),d=()=>i.track("panel_download",{},{product_id:t.productId.length<=64?t.productId:null}),u=_react3.useRef.call(void 0, null),[l]=_react.useAutoAnimate.call(void 0, ),[m,P]=_react3.useState.call(void 0, !1),[b,k]=_react3.useState.call(void 0, null),{mutateAsync:f,isPending:c}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelGetFileDetails),p=_react3.useRef.call(void 0, void 0),[g,v]=_react3.useState.call(void 0, null),[I,U]=_react3.useState.call(void 0, null),[S,pe]=_react3.useState.call(void 0, !1),{mutateAsync:Te,isPending:ae}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelGetAudiobookDetails),{mutateAsync:re,isPending:ye}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelGetAudiobookDetailsDownloadURLs),[T,he]=_react3.useState.call(void 0, null),[J,ze]=_react3.useState.call(void 0, null);async function mt(){P(!1);try{let C=await f({accessId:t.accessId,accessToken:e});if(C.result.case==="success"){k(C.result.value.files);return}else P(!0),Ne("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ne("Kod b\u0142\u0119du: ",C.result.value)}catch(C){P(!0),Ne("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Lr("B\u0142\u0105d podczas pobierania danych:"+C)}}async function Zt(){try{let C=await Te({accessId:t.accessId,accessToken:e});if(C.result.case==="audiobook"){v(C.result.value);return}else Ne("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ne("Kod b\u0142\u0119du: ",C.result.value)}catch(C){Ne("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Lr("B\u0142\u0105d podczas pobierania danych:"+C)}}async function Ee(){try{let C=await re({accessId:t.accessId,accessToken:e,isBrowser:!0});if(C.result.case==="success"){U(C.result.value.audiobookDownloadDetails),pe(C.result.value.isAvailableToDownloadInMobileApp===!0);return}else Ne("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),Ne("Kod b\u0142\u0119du: ",C.result.value)}catch(C){Ne("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),Lr("B\u0142\u0105d podczas pobierania danych:"+C)}}return _react3.useEffect.call(void 0, ()=>{o===2&&mt(),o===1&&(Zt().then().catch(),Ee().then().catch())},[]),_react3.useEffect.call(void 0, ()=>{if(g!=null&&I!=null){let C=g.chapters;if(!C)return;let be=C.map(We=>{let me=_optionalChain([I, 'optionalAccess', _96 => _96.find, 'call', _97 => _97(Ct=>Ct.chapterId===We.id)]);if(me!=null)return{...We,publicUrl:me.publicUrl,downloadableUrl:me.downloadableUrl,duration:me.duration}}).filter(We=>We!=null);be!=null&&be.length>0&&ze(be)}},[g,I]),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mb-3 space-y-4 rounded bg-white p-4 dark:bg-black",children:_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{onClick:()=>a(),variant:"ghost",className:"min-h-11 w-fit",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ChevronLeft,{className:"h-6 w-6"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-inter text-sm font-medium",children:r.back})]})}),_jsxruntime.jsxs.call(void 0, "main",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[_jsxruntime.jsxs.call(void 0, "header",{className:"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900 lg:row-span-2 lg:self-start",children:[_jsxruntime.jsx.call(void 0, "img",{src:t.productImageUrl,alt:t.productName,width:384,height:384,draggable:!1,className:"aspect-square max-h-72 w-full object-contain"}),_jsxruntime.jsx.call(void 0, "h2",{className:"text-2xl font-semibold",children:t.productName})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex min-w-0 flex-col gap-6",children:[o===2&&_jsxruntime.jsxs.call(void 0, "section",{ref:l,className:"flex flex-col gap-4 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-xl font-semibold",children:r.yourFiles}),c&&_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-label":r.loading,children:_jsxruntime.jsx.call(void 0, we,{})}),m&&_jsxruntime.jsxs.call(void 0, "div",{role:"alert",children:[_jsxruntime.jsx.call(void 0, "p",{children:r.fileError}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{className:"min-h-11",onClick:mt,children:r.retry})]}),_optionalChain([b, 'optionalAccess', _98 => _98.length])===0&&_jsxruntime.jsx.call(void 0, "p",{children:r.noFiles}),b&&_jsxruntime.jsx.call(void 0, "ul",{className:"flex flex-col gap-3",children:b.map((C,be)=>_jsxruntime.jsxs.call(void 0, "li",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[_jsxruntime.jsx.call(void 0, "span",{className:"min-w-0 break-all text-sm",children:ko(C)||`${r.file} ${be+1}`}),_jsxruntime.jsxs.call(void 0, "a",{target:"_blank",rel:"noopener noreferrer",href:C,download:!0,onClick:d,className:"inline-flex min-h-11 items-center gap-2 rounded-md bg-neutral-900 px-3 py-2 text-sm text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 dark:bg-neutral-100 dark:text-neutral-900","aria-label":`${r.download}: ${ko(C)||`${r.file} ${be+1}`}`,children:[r.download,_jsxruntime.jsx.call(void 0, _lucidereact.Download,{className:"size-4","aria-hidden":"true"})]})]},C))})]}),o===3&&_jsxruntime.jsxs.call(void 0, "section",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-lg font-semibold",children:r.ticket}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 font-medium",children:t.productName}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-300",children:r.ticketInfo})]}),o===1&&_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col space-y-6 rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:[_jsxruntime.jsx.call(void 0, "h4",{className:"text-xl font-semibold",children:_nullishCoalesce(_optionalChain([T, 'optionalAccess', _99 => _99.name]), () => ("Odtwarzacz"))}),_optionalChain([T, 'optionalAccess', _100 => _100.description])&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",children:_optionalChain([T, 'optionalAccess', _101 => _101.description])}),_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:ae?_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, we,{}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-semibold",children:"Trwa pobierania audiobooka..."})]}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:J!=null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsx.call(void 0, ho,{ref:u,coverShownBeside:!0,chapters:J,author:typeof _optionalChain([g, 'optionalAccess', _102 => _102.author])=="string"?g.author:void 0,onExpiredUrl:()=>{Ee()},title:_nullishCoalesce(_nullishCoalesce(_optionalChain([g, 'optionalAccess', _103 => _103.name]), () => (t.productName)), () => (void 0)),imageURL:_nullishCoalesce(_nullishCoalesce(_optionalChain([g, 'optionalAccess', _104 => _104.coverImage]), () => (t.productImageUrl)), () => (void 0)),styles:n,setCurrentTimeHandler:C=>{p.current=C},uniqueProductID:t.productId,onChapterChange:C=>{he(C)}})}):_jsxruntime.jsx.call(void 0, "p",{className:"mt-2",children:"Wybierz rozdzia\u0142, kt\xF3ry ci\u0119 interesuje."})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-xl bg-neutral-100 p-3 dark:bg-neutral-800",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mt-3 mb-3 text-xs",children:S?"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji r\xF3wnie\u017C bez dost\u0119pu do internetu.":"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-3",children:[_jsxruntime.jsx.call(void 0, "a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",children:_jsxruntime.jsx.call(void 0, "img",{width:"100",src:"https://bitsnap.pl/appstore.svg",alt:"Pobierz aplikacje z AppStore"})}),_jsxruntime.jsx.call(void 0, "a",{href:"https://play.google.com/store/apps/details?id=com.bitsnap.Bitsnap",children:_jsxruntime.jsx.call(void 0, "img",{width:"100",src:"https://bitsnap.pl/playstore.svg",alt:"Pobierz aplikacj\u0119 z GooglePlay"})})]})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:o===1&&_jsxruntime.jsx.call(void 0, Er,{chapters:J,currentID:_optionalChain([T, 'optionalAccess', _105 => _105.id]),productID:t.productId,loading:ae,downloadable:_optionalChain([g, 'optionalAccess', _106 => _106.isDownloadable])===!0,onDownload:d,onSelect:C=>_optionalChain([u, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.selectChapter, 'call', _109 => _109(C)])})})]}),_jsxruntime.jsx.call(void 0, "section",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-pre-wrap text-sm text-neutral-600 dark:text-neutral-300",children:t.productDescription})})]})]})},wo=Hi;function ko(e){try{return decodeURIComponent(new URL(e,"https://bitsnap.pl").pathname.split("/").pop()||"")}catch (e14){return""}}var _connectquery = require('@connectrpc/connect-query');function xo(e,t){let n=_connectquery.useTransport.call(void 0, ),[a,r]=_react3.useState.call(void 0, {status:"loading"});return _react3.useEffect.call(void 0, ()=>{if(!e){r({status:"hidden"});return}let o=!1;return r({status:"loading"}),Promise.resolve().then(() => _interopRequireWildcard(require("./model-files-client-P4PORZJ6.js"))).then(({listModelFiles:i})=>i(n,e,t)).catch(()=>({status:"hidden"})).then(i=>{o||r(i)}),()=>{o=!0}},[n,e,t]),a}var ts=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./PanelModelFiles-EKQRLF46.js")))),rs=({accessToken:e,projectID:t,loginURL:n,styles:a,activeScreen:r,params:o,setParams:i,openCourse:d,openMessages:u})=>{let{host:l}=_chunk2D2TQK3Rjs.b.call(void 0, ),{data:m,isLoading:P,error:b,refetch:k}=_chunkMY6BPCRVjs.f.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelGetProducts,{accessToken:e}),f=xo(e,t),c=ns({products:P?{status:"loading"}:b!=null?{status:"error"}:_optionalChain([m, 'optionalAccess', _110 => _110.result, 'access', _111 => _111.case])==="success"?{status:"ok",count:m.result.value.products.length}:_optionalChain([m, 'optionalAccess', _112 => _112.result, 'access', _113 => _113.case])==="failure"?{status:"failure",unauthorized:m.result.value===9}:{status:"error"},modelFiles:f});if(_react3.useEffect.call(void 0, ()=>{c.kind==="signed-out"&&(_chunkMDAFPGPAjs.l.call(void 0, t,l),window.location.href=n)},[c.kind,t,l,n]),c.kind==="loading"||c.kind==="signed-out")return _jsxruntime.jsx.call(void 0, "div",{role:"status","aria-label":nt().loading,"aria-busy":"true",className:"grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:Array.from({length:6},(I,U)=>_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",className:"h-72 rounded-xl bg-neutral-100 motion-safe:animate-pulse dark:bg-neutral-800"},U))});let p=m&&m.result.case==="success"?m.result.value.products:[],g=f.status==="ready"?f.models:[],v=g.length>0?_jsxruntime.jsx.call(void 0, _react3.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, ts,{accessToken:e,models:g,buttonStyle:a})}):null;return c.kind==="error"?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, as,{onRetry:()=>void k()}),v]}):c.kind==="empty"?_jsxruntime.jsx.call(void 0, os,{}):_jsxruntime.jsx.call(void 0, is,{accessToken:e,products:p,styles:a,activeScreen:r,params:o,setParams:i,openCourse:d,openMessages:u,filesSection:v})};function ns({products:e,modelFiles:t}){if(e.status==="failure"&&e.unauthorized)return{kind:"signed-out"};if(e.status==="loading")return{kind:"loading"};if(e.status==="ok"&&e.count>0)return{kind:"list"};if(t.status==="loading")return{kind:"loading"};if(e.status==="failure"||e.status==="error")return t.status==="unauthorized"?{kind:"signed-out"}:{kind:"error"};let n=t.status==="ready"?t.models.length:0;return e.count===0&&n===0?{kind:"empty"}:{kind:"list"}}function os(){let e=nt();return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-1","data-testid":"panel-empty",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:e.hello}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500",children:e.empty})]})}function as({onRetry:e}){let t=_chunkQ337IQNAjs.f.call(void 0, ).toLowerCase().startsWith("en");return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-3",role:"alert","data-testid":"panel-error",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:t?"Your products could not be loaded.":"Nie uda\u0142o si\u0119 wczyta\u0107 Twoich produkt\xF3w."}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{type:"button",onClick:e,className:"text-sm",children:t?"Try again":"Spr\xF3buj ponownie"})]})}var So=rs;function Co(e){return e.productType===5||e.productType===6}var is=({accessToken:e,products:t,styles:n,filesSection:a,activeScreen:r,params:o,setParams:i,openCourse:d,openMessages:u})=>{let l=nt(),[m,P]=_react3.useState.call(void 0, ()=>No(o.product,t));_react3.useEffect.call(void 0, ()=>{P(No(o.product,t))},[o.product,t]);let b=f=>{P(f),i({product:f?Ar(f):void 0,state:"products"})};_react3.useEffect.call(void 0, ()=>{r==="products"&&_optionalChain([m, 'optionalAccess', _114 => _114.productType])===4?d(m.accessId):r==="products"&&m&&Co(m)&&u&&u()},[r,m,d,u]);function k(f){if(Co(f)&&u){u();return}if(f.productType===4){d(f.accessId);return}b(f)}return r==="products"&&_optionalChain([m, 'optionalAccess', _115 => _115.productType])===4?null:r==="products"&&m!=null?_jsxruntime.jsx.call(void 0, wo,{accessToken:e,product:m,styles:n,reveal:b,onOpenCourse:d}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:l.hello}),t.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:l.intro}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-6 grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:t.map(f=>{let[c,p,g]=f.productType===1?[l.audio,l.listen,_lucidereact.Headphones]:f.productType===4?[l.course,l.openCourse,_lucidereact.BookOpen]:f.productType===5?[l.chat,l.openMessages,_lucidereact.MessageCircle]:f.productType===6?[l.community,l.openMessages,_lucidereact.Users]:f.productType===3?[l.ticket,l.showTicket,_lucidereact.Ticket]:[l.files,l.downloadFiles,_lucidereact.Files];return _jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>k(f),className:"flex min-h-11 min-w-0 flex-col overflow-hidden rounded-xl border border-neutral-200 bg-white text-left text-neutral-900 transition-colors hover:border-neutral-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-neutral-500 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-50 dark:hover:border-neutral-500",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"flex w-full flex-col gap-3 bg-neutral-100 p-3 dark:bg-neutral-800",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"flex w-fit items-center gap-1.5 rounded-md bg-white px-2 py-1 text-xs font-medium dark:bg-neutral-900",children:[_jsxruntime.jsx.call(void 0, g,{className:"size-4","aria-hidden":"true"}),c]}),_jsxruntime.jsx.call(void 0, "img",{src:f.productImageUrl,alt:f.productName,draggable:!1,className:"aspect-square w-full object-contain"})]}),_jsxruntime.jsxs.call(void 0, "span",{className:"flex flex-1 flex-col gap-3 p-3",children:[_jsxruntime.jsx.call(void 0, "span",{className:"line-clamp-2 font-semibold",children:f.productName}),_jsxruntime.jsx.call(void 0, "span",{className:"line-clamp-2 text-sm text-neutral-600 dark:text-neutral-300",children:oo(f.productDescription)}),_jsxruntime.jsx.call(void 0, "span",{className:"mt-auto pt-2 text-sm font-medium underline underline-offset-4",children:p})]})]},Ar(f))})}),a]})};function Ar(e){return`${_nullishCoalesce(_optionalChain([_chunkILYJCT5Sjs.g, 'access', _116 => _116[e.productType], 'optionalAccess', _117 => _117.toLowerCase, 'call', _118 => _118()]), () => ("product"))}-${e.accessId||e.productId}`}function No(e,t){if(!e)return;let n=t.find(r=>Ar(r)===e);if(n)return n;let a=t.find(r=>(r.accessId||r.productId)===e||r.productId===e);if(a)return a;try{let r=_protobuf.fromJsonString.call(void 0, _chunkILYJCT5Sjs.f,e);return t.find(o=>(r.accessId?o.accessId===r.accessId:o.productId===r.productId)&&(r.productType===0||o.productType===r.productType))}catch (e15){return}}var To=[{screen:"products",label:"libraryNavLabel",icon:_lucidereact.Library},{screen:"messages",label:"messagesNavLabel",icon:_lucidereact.MessageCircle},{screen:"orders",label:"ordersNavLabel",icon:_lucidereact.Receipt},{screen:"returns",label:"returnsNavLabel",icon:_lucidereact.Undo2},{screen:"profile",label:"accountNavLabel",icon:_lucidereact.User}];function Eo(e){return e==="course"?"products":e==="order-details"?"orders":e==="return-details"?"returns":e}function Dr({activeScreen:e,setActiveScreen:t,setParams:n,theme:a,logout:r,email:o,projectID:i,showMessages:d=!1}){let u=ee(),{data:l}=_chunkDCICRN6Gjs.b.call(void 0, _nullishCoalesce(i, () => ("")),!!i);return _jsxruntime.jsxs.call(void 0, "header",{className:"flex h-14 shrink-0 items-center border-b border-neutral-200 bg-white px-4 md:h-dvh md:w-56 md:flex-col md:items-stretch md:border-r md:border-b-0 md:py-5 dark:border-neutral-800 dark:bg-neutral-900",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex min-w-0 items-center gap-3 md:mb-6 md:flex-col md:items-start",children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.c,{projectId:i,logoUrl:_optionalChain([a, 'optionalAccess', _119 => _119.logoURL]),logoDarkUrl:_optionalChain([a, 'optionalAccess', _120 => _120.logoDarkURL]),name:_optionalChain([l, 'optionalAccess', _121 => _121.name]),className:"shrink-0"}),_optionalChain([l, 'optionalAccess', _122 => _122.name])&&_jsxruntime.jsx.call(void 0, "span",{title:l.name,className:"truncate text-sm font-medium md:line-clamp-2 md:whitespace-normal",children:l.name})]}),_jsxruntime.jsx.call(void 0, "nav",{"aria-label":u.navigationLabel,className:"fixed inset-x-0 bottom-0 z-10 flex h-[calc(56px+env(safe-area-inset-bottom))] items-start justify-around border-t border-neutral-200 bg-white pb-[env(safe-area-inset-bottom)] md:static md:h-auto md:flex-1 md:flex-col md:justify-start md:gap-2 md:border-0 md:bg-transparent md:pb-0 dark:border-neutral-800 dark:bg-neutral-900",children:To.filter(({screen:m})=>m!=="messages"||d).map(({screen:m,label:P,icon:b})=>{let k=Eo(e)===m;return _jsxruntime.jsxs.call(void 0, "button",{type:"button","aria-current":k?"page":void 0,onClick:()=>{t(m),n({product:void 0,state:m})},className:_chunkSZLSKIYUjs.g.call(void 0, "flex h-14 min-h-11 min-w-0 flex-1 flex-col items-center justify-center gap-1 px-1 text-[11px] focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-current md:h-11 md:w-full md:flex-none md:flex-row md:justify-start md:gap-3 md:rounded-md md:px-3 md:text-sm",k?"bg-neutral-100 font-semibold text-black dark:bg-neutral-800 dark:text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800"),children:[_jsxruntime.jsx.call(void 0, b,{className:"h-5 w-5 shrink-0","aria-hidden":"true"}),_jsxruntime.jsx.call(void 0, "span",{children:u[P]})]},m)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"hidden border-t border-neutral-200 pt-4 md:block dark:border-neutral-800",children:[o&&_jsxruntime.jsx.call(void 0, "p",{title:o,className:"mb-3 truncate text-sm text-neutral-600 dark:text-neutral-400",children:o}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:r,className:"flex min-h-11 w-full items-center gap-3 rounded-md px-3 text-sm text-red-700 hover:bg-red-50 focus-visible:outline-2 focus-visible:outline-current dark:text-red-400 dark:hover:bg-neutral-800",children:[_jsxruntime.jsx.call(void 0, _lucidereact.LogOut,{className:"h-4 w-4","aria-hidden":"true"}),u.logout]})]})]})}function Mr({email:e,logout:t,onLocaleChange:n}){let[a,r]=_react3.useState.call(void 0, _chunkQ337IQNAjs.f),o=ee(a);return _jsxruntime.jsxs.call(void 0, "section",{className:"w-full max-w-xl",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-2xl",children:o.accountNavLabel}),_jsxruntime.jsx.call(void 0, "h4",{className:"mt-6 mb-2 text-sm font-medium text-neutral-600 dark:text-neutral-400",children:o.profileHeading}),_jsxruntime.jsxs.call(void 0, "div",{className:"divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"p-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:o.emailLabel}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-1 break-words",children:e||o.noData})]}),_jsxruntime.jsxs.call(void 0, "label",{className:"flex min-h-11 flex-wrap items-center justify-between gap-3 p-4",children:[_jsxruntime.jsx.call(void 0, "span",{children:o.languageLabel}),_jsxruntime.jsxs.call(void 0, "select",{value:a.toLowerCase().startsWith("en")?"en-US":"pl-PL",onChange:i=>{_chunkQ337IQNAjs.e.call(void 0, i.target.value),r(i.target.value),_optionalChain([n, 'optionalCall', _123 => _123()])},className:"min-h-11 rounded-md border border-neutral-300 bg-white px-3 focus-visible:outline-2 focus-visible:outline-current dark:border-neutral-700 dark:bg-neutral-900",children:[_jsxruntime.jsx.call(void 0, "option",{value:"pl-PL",children:o.polishLanguage}),_jsxruntime.jsx.call(void 0, "option",{value:"en-US",children:o.englishLanguage})]})]})]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:t,className:"mt-6 flex min-h-11 w-full items-center gap-3 rounded-lg border border-neutral-200 bg-white px-4 py-3 text-red-700 hover:bg-red-50 focus-visible:outline-2 focus-visible:outline-current dark:border-neutral-800 dark:bg-neutral-900 dark:text-red-400 dark:hover:bg-neutral-800",children:[_jsxruntime.jsx.call(void 0, _lucidereact.LogOut,{className:"h-5 w-5","aria-hidden":"true"}),o.logout]})]})}var hs=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./course.js"))).then(e=>({default:e.PanelCourse})));function Or(e){return _jsxruntime.jsx.call(void 0, _react3.Suspense,{fallback:_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 p-2",role:"status",children:_jsxruntime.jsx.call(void 0, we,{})}),children:_jsxruntime.jsx.call(void 0, "div",{className:"[--course-mobile-bottom:calc(56px+env(safe-area-inset-bottom))] md:[--course-mobile-bottom:0px]",children:_jsxruntime.jsx.call(void 0, hs,{...e})})})}var vs=_react3.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./chat.js"))).then(e=>({default:e.PanelMessages})));function Ur(e){return _jsxruntime.jsx.call(void 0, _react3.Suspense,{fallback:_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 p-2",role:"status",children:_jsxruntime.jsx.call(void 0, we,{})}),children:_jsxruntime.jsx.call(void 0, vs,{...e})})}function ks(e,t){return!!t||e.some(n=>n.productType===5||n.productType===6)}function Lo(e){let{data:t}=_chunkMY6BPCRVjs.f.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelGetProducts,{accessToken:_nullishCoalesce(e, () => (""))},{enabled:!!e}),n=_optionalChain([t, 'optionalAccess', _124 => _124.result, 'access', _125 => _125.case])==="success"?t.result.value:void 0,a=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _126 => _126.products]), () => ([])),r=_optionalChain([n, 'optionalAccess', _127 => _127.chatApiUrl])||void 0;return{visible:ks(a,r),products:a,chatApiUrl:r}}var _wkt = require('@bufbuild/protobuf/wkt');var ws={pl:{heading:"Historia zam\xF3wienia",showMore:"Poka\u017C wi\u0119cej",loadingMore:"\u0141adowanie\u2026",paid:"Zam\xF3wienie op\u0142acone",paidWith:"Zam\xF3wienie op\u0142acone przez {provider}",shipped:"Zam\xF3wienie wys\u0142ane",statusChangedTo:"Status zam\xF3wienia: {status}",statusChanged:"Zmieniono status zam\xF3wienia",trackingNumber:"Numer przesy\u0142ki: {number}",trackingNumberCarrier:"Numer przesy\u0142ki: {number} ({carrier})",accessEmailSentTo:"Wys\u0142ano e-mail z dost\u0119pem na {email}",accessEmailSent:"Wys\u0142ano e-mail z dost\u0119pem",emailSentTo:"Wys\u0142ano e-mail na {email}",emailSent:"Wys\u0142ano e-mail",accessGrantedProduct:"Przyznano dost\u0119p: {product}",accessGranted:"Przyznano dost\u0119p",invoiceIssuedNumber:"Wystawiono faktur\u0119 {number}",invoiceIssued:"Wystawiono faktur\u0119",invoiceLink:"Pobierz faktur\u0119",refundedAmount:"Zwr\xF3cono {amount}",refunded:"Zwr\xF3cono pieni\u0105dze",returnRequested:"Zg\u0142oszono zwrot",returnStatusChangedTo:"Status zwrotu: {status}",returnStatusChanged:"Zmieniono status zwrotu"},en:{heading:"Order history",showMore:"Show more",loadingMore:"Loading\u2026",paid:"Order paid",paidWith:"Order paid with {provider}",shipped:"Order shipped",statusChangedTo:"Order status: {status}",statusChanged:"Order status changed",trackingNumber:"Tracking number: {number}",trackingNumberCarrier:"Tracking number: {number} ({carrier})",accessEmailSentTo:"Access e-mail sent to {email}",accessEmailSent:"Access e-mail sent",emailSentTo:"E-mail sent to {email}",emailSent:"E-mail sent",accessGrantedProduct:"Access granted: {product}",accessGranted:"Access granted",invoiceIssuedNumber:"Invoice {number} issued",invoiceIssued:"Invoice issued",invoiceLink:"Download the invoice",refundedAmount:"Refunded {amount}",refunded:"Money refunded",returnRequested:"Return requested",returnStatusChangedTo:"Return status: {status}",returnStatusChanged:"Return status changed"}};function Ft(e){return _chunkQ337IQNAjs.a.call(void 0, ws,e)}var xs={stripe:"Stripe",payu:"PayU",przelewy24:"Przelewy24",p24:"Przelewy24",tpay:"Tpay",paynow:"Paynow",paypal:"PayPal",revolut:"Revolut",revolutpay:"Revolut Pay",inpost:"InPost Pay",inpostpay:"InPost Pay",applepay:"Apple Pay",googlepay:"Google Pay",imoje:"imoje",autopay:"Autopay",blik:"BLIK"},Ro=(e,t)=>e.replace(/\{(\w+)\}/g,(n,a)=>_nullishCoalesce(t[a], () => (n))),fe=(e,t)=>(_nullishCoalesce(e.params[t], () => (""))).trim();function Cs(e,t){let n=/^(-?\d+(?:[.,]\d+)?)\s*([A-Za-z]{3})$/.exec(e.trim());if(n==null)return e.trim();try{return new Intl.NumberFormat(t,{style:"currency",currency:n[2].toUpperCase()}).format(Number(n[1].replace(",",".")))}catch (e16){return e.trim()}}function Ns(e){if(!(e==null||e.trim()===""))try{let t=new URL(e.trim());return t.protocol==="https:"?t.toString():void 0}catch (e17){return}}function Do(e,t,n=Ft(t)){let a=(r,o,i,d,u)=>({icon:r,text:o===""?d:Ro(i,{[u]:o})});switch(e.kind){case"order.paid":{let r=_nullishCoalesce(xs[fe(e,"provider").toLowerCase().replace(/[^a-z0-9]/g,"")], () => (""));return a("paid",r,n.paidWith,n.paid,"provider")}case"order.status_changed":{let r=fe(e,"to").toLowerCase();if(r==="sent")return{icon:"shipped",text:n.shipped};let o=_nullishCoalesce(Ot(r,ee(t)), () => (""));return a("status",o,n.statusChangedTo,n.statusChanged,"status")}case"order.tracking_set":{let r=fe(e,"number");if(r==="")return null;let o=fe(e,"carrier");return{icon:"tracking",text:Ro(o===""?n.trackingNumber:n.trackingNumberCarrier,{number:r,carrier:o})}}case"email.sent":{let r=fe(e,"template")==="access";return a("email",fe(e,"email"),r?n.accessEmailSentTo:n.emailSentTo,r?n.accessEmailSent:n.emailSent,"email")}case"access.granted":return a("access",fe(e,"product"),n.accessGrantedProduct,n.accessGranted,"product");case"invoice.issued":{let r=a("invoice",fe(e,"number"),n.invoiceIssuedNumber,n.invoiceIssued,"number"),o=Ns(e.linkUrl);return o==null?r:{...r,link:{url:o,label:n.invoiceLink}}}case"refund.succeeded":{let r=fe(e,"amount");return a("refund",r===""?"":Cs(r,t),n.refundedAmount,n.refunded,"amount")}case"return.requested":return{icon:"return",text:n.returnRequested};case"return.status_changed":{let r=fe(e,"to").toLowerCase(),o=_chunkDCICRN6Gjs.s.call(void 0, r),i=o==="statusFallback"?"":_chunkDCICRN6Gjs.r.call(void 0, t)[o];return a("return",i,n.returnStatusChangedTo,n.returnStatusChanged,"status")}default:return null}}var Ao=[{unit:"second",seconds:1,below:45},{unit:"minute",seconds:60,below:45*60},{unit:"hour",seconds:3600,below:22*3600},{unit:"day",seconds:86400,below:26*86400},{unit:"month",seconds:30*86400,below:320*86400},{unit:"year",seconds:365*86400,below:Number.POSITIVE_INFINITY}];function Mo(e,t,n=new Date){let a=(e.getTime()-n.getTime())/1e3,r=new Intl.RelativeTimeFormat(t,{numeric:"auto"}),o=Math.abs(a);if(o<45)return r.format(0,"second");let i=_nullishCoalesce(Ao.find(d=>o<d.below), () => (Ao[5]));return r.format(Math.round(a/i.seconds),i.unit)}function Oo(e,t){return e.toLocaleString(t,{dateStyle:"long",timeStyle:"short"})}var Us=10,_s={paid:_lucidereact.CheckCircle2,shipped:_lucidereact.Truck,status:_lucidereact.RefreshCw,tracking:_lucidereact.Truck,email:_lucidereact.Mail,access:_lucidereact.KeyRound,invoice:_lucidereact.FileText,refund:_lucidereact.Undo2,return:_lucidereact.RotateCcw};function _o({orderId:e}){let{projectID:t,host:n}=_chunk2D2TQK3Rjs.b.call(void 0, ),a=_chunkMDAFPGPAjs.i.call(void 0, t,n),r=_chunkQ337IQNAjs.f.call(void 0, ),o=Ft(r),i=!!t&&!!a&&!!e,d=_chunkMY6BPCRVjs.h.call(void 0, _chunkMY6BPCRVjs.e.publicApi.getOrderHistory,{projectId:_nullishCoalesce(t, () => ("")),accessToken:_nullishCoalesce(a, () => ("")),orderId:e,pageToken:"",pageSize:Us},{pageParamKey:"pageToken",getNextPageParam:b=>b.result.case==="success"&&b.result.value.nextPageToken!==""?b.result.value.nextPageToken:void 0,enabled:i,retry:!1,refetchOnWindowFocus:!1}),u=_react3.useMemo.call(void 0, ()=>{let b=[],k=new Set;for(let f of _nullishCoalesce(_optionalChain([d, 'access', _128 => _128.data, 'optionalAccess', _129 => _129.pages]), () => ([])))if(f.result.case==="success")for(let c of f.result.value.entries){if(k.has(c.id))continue;k.add(c.id);let p=Do(c,r,o);p!=null&&b.push({...p,id:c.id,date:c.occurredAt?_wkt.timestampDate.call(void 0, c.occurredAt):void 0})}return b},[d.data,r,o]),l=_optionalChain([d, 'access', _130 => _130.data, 'optionalAccess', _131 => _131.pages, 'access', _132 => _132[0], 'optionalAccess', _133 => _133.result, 'access', _134 => _134.case])==="success";if(!i||!l||u.length===0)return null;let m=d.hasNextPage&&!d.isFetchNextPageError,P=new Date;return _jsxruntime.jsxs.call(void 0, "section",{"aria-labelledby":`bitsnap-order-history-${e}`,className:"border-t pt-4","data-bitsnap-order-history":"",children:[_jsxruntime.jsx.call(void 0, "h3",{id:`bitsnap-order-history-${e}`,className:"mb-3 font-semibold",children:o.heading}),_jsxruntime.jsx.call(void 0, "ol",{className:"space-y-3",children:u.map(b=>{let k=_s[b.icon];return _jsxruntime.jsxs.call(void 0, "li",{className:"flex items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:_jsxruntime.jsx.call(void 0, k,{className:"h-4 w-4"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"min-w-0 flex-1",children:[_jsxruntime.jsxs.call(void 0, "p",{className:"break-words text-sm leading-snug",children:[b.text,b.link&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[" \xB7 ",_jsxruntime.jsx.call(void 0, "a",{href:b.link.url,target:"_blank",rel:"noopener noreferrer",className:"font-medium underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-current",children:b.link.label})]})]}),b.date&&_jsxruntime.jsx.call(void 0, "time",{dateTime:b.date.toISOString(),title:Oo(b.date,r),className:"text-xs text-muted-foreground",children:Mo(b.date,r,P)})]})]},b.id)})}),m&&_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,className:"mt-3 inline-flex min-h-11 items-center gap-2 rounded-md px-1 text-sm font-medium underline underline-offset-2 disabled:opacity-60 focus-visible:outline-2 focus-visible:outline-current",children:[d.isFetchingNextPage&&_jsxruntime.jsx.call(void 0, _lucidereact.Loader2,{"aria-hidden":"true",className:"h-4 w-4 animate-spin"}),d.isFetchingNextPage?o.loadingMore:o.showMore]})]})}function qs({status:e}){let t={created:{color:"bg-neutral-100 text-neutral-700",icon:null},paid:{color:"bg-green-100 text-green-700",icon:_lucidereact.CheckCircle2},completed:{color:"bg-blue-100 text-blue-700",icon:_lucidereact.CheckCircle2},canceled:{color:"bg-red-100 text-red-700",icon:_lucidereact.AlertCircle},sent:{color:"bg-purple-100 text-purple-700",icon:_lucidereact.Truck},processing:{color:"bg-yellow-100 text-yellow-700",icon:_lucidereact.Loader2}},n=t[e]||t.created,a=n.icon,r={created:"Utworzone",paid:"Op\u0142acone",completed:"Zako\u0144czone",canceled:"Anulowane",sent:"Wys\u0142ane",processing:"Przetwarzane"};return _jsxruntime.jsxs.call(void 0, "span",{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-sm font-medium ${n.color}`,children:[a&&_jsxruntime.jsx.call(void 0, a,{className:"h-4 w-4"}),r[e]||e]})}function $s({orderID:e,email:t}){let[n,a]=_react3.useState.call(void 0, ""),r=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.addPublicOrderComment);return _jsxruntime.jsxs.call(void 0, "form",{onSubmit:async i=>{if(i.preventDefault(),!!n.trim())try{await r.mutateAsync({projectId:"",orderId:e,message:n.trim(),accessToken:t}),a("")}catch(d){console.error("Failed to add comment:",d)}},className:"mt-4 space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.d,{htmlFor:"comment",children:"Dodaj komentarz"}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.q,{id:"comment",value:n,onChange:i=>a(i.target.value),placeholder:"Wpisz komentarz...",rows:3,disabled:r.isPending}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{type:"submit",disabled:!n.trim()||r.isPending,children:r.isPending?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _lucidereact.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Wysy\u0142anie..."]}):"Dodaj komentarz"})]})}function Fo(e){return e?new Date(Number(e.seconds)*1e3).toLocaleDateString("pl-PL",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function Ho(e,t){return new Intl.NumberFormat("pl-PL",{style:"currency",currency:t.toUpperCase()}).format(e/100)}function Bs({orderID:e,initialEmail:t,onBack:n,accessToken:a,analytics:r}){let{theme:o,projectID:i}=_chunk2D2TQK3Rjs.b.call(void 0, ),d=_chunk2CL4B4KMjs.n.call(void 0, i,r,"order"),[u,l]=_react3.useState.call(void 0, t||""),[m,P]=_react3.useState.call(void 0, !1),{data:b,isLoading:k,error:f,refetch:c}=_chunkMY6BPCRVjs.f.call(void 0, _chunkMY6BPCRVjs.e.publicApi.getPublicOrderDetails,{projectId:_nullishCoalesce(i, () => ("")),orderId:e,email:u||void 0,accessToken:a},{enabled:!!e}),p=_optionalChain([b, 'optionalAccess', _135 => _135.result, 'access', _136 => _136.case])==="order"?b.result.value:null,g=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _137 => _137.isVerified]), () => (!1)),v=p!=null;_react3.useEffect.call(void 0, ()=>{v&&d.track("panel_order_viewed",{},{order_ref:null})},[d,v]);let I=()=>{c(),P(!1)},U={"--button-background-color":_nullishCoalesce(_optionalChain([o, 'optionalAccess', _138 => _138.colors, 'optionalAccess', _139 => _139.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([o, 'optionalAccess', _140 => _140.colors, 'optionalAccess', _141 => _141.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([o, 'optionalAccess', _142 => _142.colors, 'optionalAccess', _143 => _143.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([o, 'optionalAccess', _144 => _144.colors, 'optionalAccess', _145 => _145.brand]), () => ("#000000"))};return k?_jsxruntime.jsx.call(void 0, "div",{className:"flex min-h-screen items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Loader2,{className:"mx-auto h-8 w-8 animate-spin text-neutral-400"}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"\u0141adowanie zam\xF3wienia..."})]})}):f||!p?_jsxruntime.jsx.call(void 0, "div",{className:"flex min-h-screen items-center justify-center",children:_jsxruntime.jsx.call(void 0, De,{className:"w-full max-w-md",children:_jsxruntime.jsx.call(void 0, Me,{className:"pt-6",children:_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle,{className:"mx-auto h-12 w-12 text-red-500"}),_jsxruntime.jsx.call(void 0, "h2",{className:"mt-4 text-xl font-semibold",children:"Zam\xF3wienie nie znalezione"}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"Nie znaleziono zam\xF3wienia o podanym numerze."})]})})})}):_jsxruntime.jsx.call(void 0, "div",{className:"w-full bg-white py-8 dark:bg-black",style:U,children:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full px-4",children:[n&&_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{onClick:n,variant:"ghost",className:"mb-4 w-fit",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ChevronLeft,{className:"h-4 w-4"}),"Wr\xF3\u0107 do historii zam\xF3wie\u0144"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-6 flex items-center gap-4",children:[_optionalChain([o, 'optionalAccess', _146 => _146.logoURL])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:o.logoURL,alt:"Project logo",className:`h-12 w-auto ${o.logoDarkURL?"dark:hidden":""}`}),o.logoDarkURL&&_jsxruntime.jsx.call(void 0, "img",{src:o.logoDarkURL,alt:"Project logo",className:"hidden h-12 w-auto dark:block"})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h1",{className:"text-3xl font-bold",children:"Zam\xF3wienie"}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-neutral-600 dark:text-neutral-400",children:["Numer zam\xF3wienia: #",p.orderId]})]})]}),_jsxruntime.jsxs.call(void 0, De,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, He,{children:_jsxruntime.jsxs.call(void 0, qe,{className:"flex items-center",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Package,{className:"mr-2 h-5 w-5"}),"Status zam\xF3wienia"]})}),_jsxruntime.jsxs.call(void 0, Me,{className:"space-y-6",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, qs,{status:p.status}),p.processingStatus&&_jsxruntime.jsxs.call(void 0, "span",{className:"text-sm text-neutral-600",children:["\xB7 ",p.processingStatus]})]}),_jsxruntime.jsxs.call(void 0, "p",{className:"mt-2 text-sm text-neutral-600",children:["Zam\xF3wienie z\u0142o\u017Cone ",Fo(p.createdAt)]})]}),_jsxruntime.jsx.call(void 0, _o,{orderId:e}),_jsxruntime.jsxs.call(void 0, "div",{className:"border-t pt-4",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"mb-3 font-semibold",children:"Dane klienta"}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Imi\u0119 i nazwisko:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:g?"":"text-neutral-500",children:p.customerName})]}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Email:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:g?"":"text-neutral-500",children:p.customerEmail})]}),p.customerPhone&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Telefon:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:g?"":"text-neutral-500",children:p.customerPhone})]})]})]}),!g&&_jsxruntime.jsx.call(void 0, "div",{className:"border-t pt-4",children:_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{onClick:()=>P(!0),variant:"outline",className:"w-full",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Lock,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),_jsxruntime.jsxs.call(void 0, De,{className:"mb-6",children:[_jsxruntime.jsx.call(void 0, He,{children:_jsxruntime.jsx.call(void 0, qe,{children:"Produkty"})}),_jsxruntime.jsxs.call(void 0, Me,{className:"space-y-6",children:[_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:p.items.map((S,pe)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-4",children:[S.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:S.imageUrl,alt:S.name,className:"h-16 w-16 rounded object-cover"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-medium",children:S.name}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-sm text-neutral-600",children:["Ilo\u015B\u0107: ",S.quantity]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"text-right",children:_jsxruntime.jsx.call(void 0, "p",{className:"font-medium",children:Ho(Number(S.price),S.currency)})})]},pe))}),(p.deliveryAddress||p.deliveryMethod)&&_jsxruntime.jsxs.call(void 0, "div",{className:"border-t pt-4",children:[_jsxruntime.jsxs.call(void 0, "h3",{className:"mb-3 flex items-center font-semibold",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Truck,{className:"mr-2 h-5 w-5"}),"Informacje o dostawie"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[p.deliveryAddress&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Adres:"})," ",_jsxruntime.jsx.call(void 0, "span",{className:g?"":"text-neutral-500",children:p.deliveryAddress})]}),p.deliveryMethod&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Metoda:"})," ",p.deliveryMethod]}),p.trackingNumber&&g&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:"Tracking:"})," ",p.trackingNumber]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"border-t pt-4",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-lg font-bold",children:[_jsxruntime.jsx.call(void 0, "span",{children:"Suma:"}),_jsxruntime.jsx.call(void 0, "span",{children:Ho(Number(p.totalAmount),p.currency)})]})})]})]}),_jsxruntime.jsxs.call(void 0, De,{children:[_jsxruntime.jsx.call(void 0, He,{children:_jsxruntime.jsxs.call(void 0, qe,{children:["Komentarze ",p.commentCount>0&&`(${p.commentCount})`]})}),_jsxruntime.jsxs.call(void 0, Me,{children:[p.comments.length>0?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-4",children:p.comments.map(S=>_jsxruntime.jsxs.call(void 0, "div",{className:"border-b pb-4 last:border-b-0",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:S.authorName||"System"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs text-neutral-500",children:Fo(S.createdAt)}),S.authorType==="admin"&&_jsxruntime.jsx.call(void 0, "span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-700",children:"Admin"})]}),_jsxruntime.jsx.call(void 0, "p",{className:g?"":"text-neutral-500",children:S.message})]},S.id))}):_jsxruntime.jsx.call(void 0, "p",{className:"text-neutral-600",children:"Brak komentarzy."}),g?_jsxruntime.jsx.call(void 0, $s,{orderID:p.orderId,email:u}):_jsxruntime.jsx.call(void 0, "div",{className:"mt-4",children:_jsxruntime.jsxs.call(void 0, _chunkMY6BPCRVjs.l,{onClick:()=>P(!0),variant:"outline",className:"w-full",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Lock,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),m&&_jsxruntime.jsx.call(void 0, "div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:_jsxruntime.jsxs.call(void 0, De,{className:"w-full max-w-md",children:[_jsxruntime.jsx.call(void 0, He,{children:_jsxruntime.jsx.call(void 0, qe,{children:"Zweryfikuj sw\xF3j email"})}),_jsxruntime.jsxs.call(void 0, Me,{className:"space-y-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-700",children:"Podaj adres email u\u017Cyty przy sk\u0142adaniu zam\xF3wienia."}),_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, _chunkDCICRN6Gjs.d,{htmlFor:"verify-email",children:"Adres email"}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.m,{id:"verify-email",type:"email",placeholder:"twoj@email.com",value:u,onChange:S=>l(S.target.value)})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{variant:"outline",onClick:()=>P(!1),className:"flex-1",children:"Anuluj"}),_jsxruntime.jsx.call(void 0, _chunkMY6BPCRVjs.l,{onClick:I,className:"flex-1",children:"Zweryfikuj"})]})]})]})})]})})}function Ks(e){return _jsxruntime.jsx.call(void 0, Bs,{...e})}var jr=Ks;var Ws=({returnsAppearance:e,returnsTexts:t,analytics:n}={})=>{let{projectID:a,theme:r,loginURL:o,host:i}=_chunk2D2TQK3Rjs.b.call(void 0, ),[,d]=_react3.useState.call(void 0, 0),u=_chunk2CL4B4KMjs.n.call(void 0, a,n,"panel"),l=_chunkMDAFPGPAjs.i.call(void 0, a,i),m=_chunkMDAFPGPAjs.k.call(void 0, a,i),{mutateAsync:P}=_chunkMY6BPCRVjs.g.call(void 0, _chunkMY6BPCRVjs.e.publicApi.userPanelLogout);async function b(){l&&await P({accessToken:l}),typeof window<"u"&&(_chunkMDAFPGPAjs.l.call(void 0, a,i),window.location.reload())}let[k]=_react.useAutoAnimate.call(void 0, ),f=T=>["products","notifications","profile","plans","orders","order-details","returns","return-details","course","messages"].includes(T),[c,p]=Xn({product:void 0,state:"products",orderId:void 0,returnId:void 0,course:void 0,item:void 0,chatProject:void 0,thread:void 0,channel:void 0}),[g,v]=_react3.useState.call(void 0, f(c.state)?c.state:"products"),I=T=>{p({state:"order-details",orderId:T}),v("order-details")},U=()=>{p({state:"orders",orderId:void 0}),v("orders")},S=T=>p({orderId:void 0,returnId:void 0,course:void 0,item:void 0,chatProject:void 0,thread:void 0,channel:void 0,...T}),pe=T=>{p({state:"course",course:T,item:void 0,product:void 0}),v("course")},Te=()=>{p({state:"products",course:void 0,item:void 0,product:void 0}),v("products")},ae=()=>{p({state:"messages",product:void 0,chatProject:void 0,thread:void 0,channel:void 0}),v("messages")},re=Lo(l);_react3.useEffect.call(void 0, ()=>{f(c.state)&&(c.state==="course"||g==="course"||c.state==="messages"||g==="messages")&&v(c.state)},[c.state]);let ye={"--button-background-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _147 => _147.colors, 'optionalAccess', _148 => _148.brand]), () => ("#000000")),"--button-background-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _149 => _149.colors, 'optionalAccess', _150 => _150.brandDark]), () => ("#ffffff")),"--button-text-color":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.colors, 'optionalAccess', _152 => _152.brandDark]), () => ("#000000")),"--button-text-color-dark":_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.colors, 'optionalAccess', _154 => _154.brand]), () => ("#000000"))};return _react3.useEffect.call(void 0, ()=>{if(l==null||l.length===0){window.location.href=_nullishCoalesce(o, () => ("/panel/login"));return}},[]),_react3.useEffect.call(void 0, ()=>{if(l==null||l.length===0){window.location.href=_nullishCoalesce(o, () => ("/panel/login"));return}},[g]),_react3.useEffect.call(void 0, ()=>{if(typeof window>"u"||window.parent!==window||!l)return;let T=Pt(window.location.search);T&&vt(T);let he=_nullishCoalesce(T, () => (tt()));he&&(window.location.href=rt(he,l))},[l]),_jsxruntime.jsx.call(void 0, _chunk2CL4B4KMjs.l,{value:u,children:_jsxruntime.jsxs.call(void 0, "div",{ref:k,className:"font-inter relative flex h-dvh w-full flex-col bg-beige-100 text-black dark:bg-black dark:text-white md:flex-row",children:[_jsxruntime.jsx.call(void 0, Dr,{activeScreen:g,setActiveScreen:v,setParams:S,styles:ye,theme:r,logout:b,email:m,projectID:a,showMessages:re.visible||g==="messages"}),_jsxruntime.jsxs.call(void 0, "main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto w-full p-5 pb-[calc(76px+env(safe-area-inset-bottom))] md:pb-5",children:[g==="products"&&_jsxruntime.jsx.call(void 0, So,{projectID:_nullishCoalesce(a, () => ("")),accessToken:l,loginURL:_nullishCoalesce(o, () => ("/panel/login")),styles:ye,activeScreen:g,params:c,setParams:p,openCourse:pe,openMessages:ae}),g==="messages"&&l&&_jsxruntime.jsx.call(void 0, Ur,{accessToken:l,products:re.products,chatApiUrl:re.chatApiUrl,projectID:a,host:i,selection:{chatProject:c.chatProject,thread:c.thread,channel:c.channel},onSelect:T=>p({chatProject:T.chatProject,thread:T.thread,channel:T.channel})}),g==="course"&&c.course&&l&&_jsxruntime.jsx.call(void 0, Or,{accessId:c.course,accessToken:l,theme:r,itemId:c.item,onItemChange:T=>p({item:T}),onBack:Te}),g==="notifications"&&_jsxruntime.jsx.call(void 0, kr,{}),g==="plans"&&_jsxruntime.jsx.call(void 0, wr,{projectID:_nullishCoalesce(a, () => (""))}),g==="orders"&&_jsxruntime.jsx.call(void 0, ro,{projectID:_nullishCoalesce(a, () => ("")),accessToken:_nullishCoalesce(l, () => ("")),openOrderDetails:I}),g==="order-details"&&c.orderId&&_jsxruntime.jsx.call(void 0, jr,{orderID:c.orderId,onBack:U}),(g==="returns"||g==="return-details")&&l&&_jsxruntime.jsx.call(void 0, Cr,{projectID:_nullishCoalesce(a, () => ("")),host:i,accessToken:l,loginURL:_nullishCoalesce(o, () => ("/panel/login")),appearance:eo(e,_optionalChain([r, 'optionalAccess', _155 => _155.colors, 'optionalAccess', _156 => _156.brand])),texts:t,screen:g,params:c,setParams:p,setActiveScreen:v}),g==="profile"&&_jsxruntime.jsx.call(void 0, Mr,{email:m,logout:b,onLocaleChange:()=>d(T=>T+1)})]})]})})},Vs= exports.G =Ws;var _reactquery = require('@tanstack/react-query');var _connect = require('@connectrpc/connect');var _connectweb = require('@connectrpc/connect-web');var ge;(a=>{function e(r){return _connect.createClient.call(void 0, _chunkILYJCT5Sjs.h,n(r))}a.get=e;let t=new Map;function n(r){let o=t.get(r);return o==null&&(o=_connectweb.createConnectTransport.call(void 0, {useBinaryFormat:!0,baseUrl:r+"/api/rpc",interceptors:[_chunkSZLSKIYUjs.b]}),t.set(r,o)),o}})(ge = exports.a||={});var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);function F(e,t=2){return+(Math.round(+(e+"e+"+t))+"e-"+t)}function Wo(e,t){let n=typeof navigator>"u"?"pl-PL":navigator.language;return Intl.NumberFormat(n,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e/100)}var pm=_zod2.default.object({event:_zod2.default.enum(["purchase","addToCart","customizeProduct","viewCart","removeFromCart","initiateCheckout","lead"]),step:_zod2.default.string().optional(),value:_zod2.default.number().optional(),currency:_zod2.default.string().optional(),content_name:_zod2.default.string().optional(),items:_zod2.default.array(_zod2.default.object({id:_zod2.default.string(),name:_zod2.default.string(),price:_zod2.default.number().default(0),currency:_zod2.default.string().default("PLN"),quantity:_zod2.default.number().default(1)})).optional()});function Fr(e){typeof window>"u"||(Js(e),Xs(e),el(e))}function Js(e){try{typeof window.dataLayer>"u"&&(window.dataLayer=[]);let t=Qs(e);window.dataLayer.push(t)}catch(t){console.warn("cannot send google analytics event",t)}}function Qs(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _157 => _157.items, 'optionalAccess', _158 => _158.reduce, 'call', _159 => _159((o,i)=>o+(i.price||0)*(i.quantity||1),0)]))), () => (0)),n=_optionalChain([e, 'access', _160 => _160.items, 'optionalAccess', _161 => _161.map, 'call', _162 => _162(o=>({item_id:o.id,item_name:o.name||o.id,price:F((o.price||0)/100,2),quantity:o.quantity||1}))]),a={currency:e.currency||"PLN",value:F(t/100,2)};n&&n.length>0&&(a.items=n);let r;switch(e.event){case"purchase":r="purchase",a.transaction_id=e.step||`txn_${Date.now()}`;break;case"addToCart":r="add_to_cart";break;case"viewCart":r="view_cart";break;case"removeFromCart":r="remove_from_cart";break;case"initiateCheckout":r="begin_checkout";break;case"customizeProduct":r="customize_product";break;default:r=e.event}return{event:r,ecommerce:a,...e.step&&{step:e.step},...e.content_name&&{content_name:e.content_name}}}function Xs(e){if(typeof window.fbq>"u")return;let t="",n="",a={};switch(e.event){case"purchase":t="track",n="Purchase",a={category_name:e.step,...e};break;case"lead":t="track",n="Lead",a={category_name:e.step,...e};break;case"addToCart":t="track",n="Add to Cart",a={category_name:e.step,...e};break;case"customizeProduct":t="track",n="Customize Product",a={category_name:e.step,...e};break;case"viewCart":t="track",n="View Cart",a={category_name:e.step,...e};break;case"removeFromCart":t="track",n="Remove from Cart",a={category_name:e.step,...e};break;case"initiateCheckout":t="track",n="Initiate Checkout",a={category_name:e.step,...e};break;default:break}window.location.search.includes("analytics")&&console.log("Pushing FB event",t,n,a),window.fbq(t,n,a)}function el(e){try{if(typeof window.ttq>"u")return;let t=tl(e);if(!t)return;window.location.search.includes("analytics")&&console.log("Pushing TikTok event",t.eventName,t.eventPayload),window.ttq.track(t.eventName,t.eventPayload)}catch(t){console.warn("cannot send tiktok analytics event",t)}}function tl(e){let t=_nullishCoalesce(_nullishCoalesce(e.value, () => (_optionalChain([e, 'access', _163 => _163.items, 'optionalAccess', _164 => _164.reduce, 'call', _165 => _165((o,i)=>o+(i.price||0)*(i.quantity||1),0)]))), () => (0)),n=_optionalChain([e, 'access', _166 => _166.items, 'optionalAccess', _167 => _167.map, 'call', _168 => _168(o=>({content_id:o.id,content_type:"product",content_name:o.name||o.id,quantity:o.quantity||1,price:F((o.price||0)/100,2)}))])||[];n.length===0&&e.content_name&&n.push({content_id:e.step||"unknown",content_type:"product",content_name:e.content_name,quantity:1,price:F(t/100,2)});let a={currency:e.currency||"PLN",value:F(t/100,2)};n.length>0&&(a.contents=n);let r=null;switch(e.event){case"purchase":r="Purchase";break;case"addToCart":r="AddToCart";break;case"initiateCheckout":r="InitiateCheckout";break;case"customizeProduct":r="CustomizeProduct";break;case"viewCart":return;case"removeFromCart":return;case"lead":return;default:return null}return{eventName:r,eventPayload:a}}function Vo(e){let{items:t,googlePayConfig:n,checkout:a,result:r,cartRequiresShipping:o}=e,i=_nullishCoalesce(e.locale, () => (_chunkQ337IQNAjs.f.call(void 0, )));if(r.totalAmount==null)return;let d=[];return o&&(d.push("SHIPPING_ADDRESS"),d.push("SHIPPING_OPTION")),{apiVersion:2,apiVersionMinor:0,callbackIntents:d,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["MASTERCARD","VISA"]},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:n.gateway,gatewayMerchantId:n.gatewayId}}}],emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:o},shippingAddressRequired:o,shippingOptionRequired:o,shippingOptionParameters:o?{shippingOptions:r.methods.slice(0,5).map(l=>({id:l.id,label:l.name+` - ${Wo(l.amount,r.currency)}`,description:_nullishCoalesce(l.description, () => (""))})),defaultSelectedOptionId:r.selectedDeliveryMethod}:void 0,merchantInfo:{merchantId:n.merchantId+"",merchantName:n.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:_chunkQ337IQNAjs.c.call(void 0, "paymentForCart",i,e.texts),totalPrice:`${F(r.totalAmount/100,2)}`,currencyCode:r.currency,countryCode:r.country,checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:rl(t,r.methods,_nullishCoalesce(r.selectedDeliveryMethod, () => ((r.methods.length>0?r.methods[0].id:void 0))),a.couponCode,r.couponValue,_chunkQ337IQNAjs.c.call(void 0, "coupon",i,e.texts))}}}function rl(e,t,n,a,r,o="Coupon"){let i=[],d=0;for(let l of e){if(l.details==null)continue;let m=_nullishCoalesce(_optionalChain([l, 'access', _169 => _169.details, 'access', _170 => _170.pricing, 'optionalAccess', _171 => _171.effectivePrice]), () => (l.details.price));d+=m*l.quantity,i.push({label:l.details.name+" x "+l.quantity,price:`${F(m/100,2)}`,type:"LINE_ITEM",status:"FINAL"})}let u=t.find(l=>l.id===n);return u!=null&&i.push({label:u.name,price:`${F(u.amount/100,2)}`,type:"SHIPPING_OPTION",status:"FINAL"}),a!=null&&r!=null&&i.push({label:`${o} ${a}`,price:`${F(r/100,2)}`,type:"DISCOUNT",status:"FINAL"}),d>0&&i.push({label:"Subtotal",price:`${F(d/100,2)}`,type:"SUBTOTAL",status:"FINAL"}),i}function dt(e,t){return`${_chunkSZLSKIYUjs.e}/api/integrations/${e}/public-commerce${t}`}function _e(e){return typeof e=="object"&&e!=null&&"ERR"in e}function B(e,t,n){return{ERR:!0,error:e,type:t,data:n}}function Zo(e,t){return _optionalChain([t, 'optionalAccess', _172 => _172.find, 'call', _173 => _173(n=>n.id===e||(_nullishCoalesce(_optionalChain([n, 'access', _174 => _174.variants, 'optionalAccess', _175 => _175.some, 'call', _176 => _176(a=>a.id===e)]), () => (!1))))])}function Yo(e,t){let n=new Set(t.map(a=>a.productID));return Array.from(new Set(e.filter(a=>!n.has(a))))}function Jo(e,t){let n=_optionalChain([e, 'optionalAccess', _177 => _177.trim, 'call', _178 => _178()]);if(!(n==null||n.length===0))try{let a=new URL(n,t);return a.protocol!=="http:"&&a.protocol!=="https:"?void 0:a.href}catch (e18){return}}var _zustand = require('zustand');var ut=_zustand.create.call(void 0, e=>({isCartVisible:!1,notice:void 0,setNotice:t=>e(n=>({...n,notice:t})),numberOfProductsInCart:0,showCart:()=>e(t=>({...t,isCartVisible:!0})),hideCart:()=>e(t=>({...t,isCartVisible:!1})),setNumberOfProductsInCart:t=>e(n=>({...n,numberOfProductsInCart:t}))}));var qt=_react3.createContext.call(void 0, {});function Im({texts:e,locale:t,children:n}){let a=_react3.useMemo.call(void 0, ()=>({texts:e,locale:t}),[e,t]);return _jsxruntime.jsx.call(void 0, qt.Provider,{value:a,children:n})}function Xo(){return _react3.useContext.call(void 0, qt)}function Tm(e){let{texts:t,locale:n}=_react3.useContext.call(void 0, qt);return _chunkQ337IQNAjs.c.call(void 0, e,_nullishCoalesce(n, () => (_chunkQ337IQNAjs.f.call(void 0, ))),t)}function Em(){let{texts:e,locale:t}=_react3.useContext.call(void 0, qt),n=_nullishCoalesce(t, () => (_chunkQ337IQNAjs.f.call(void 0, )));return _react3.useMemo.call(void 0, ()=>a=>_chunkQ337IQNAjs.c.call(void 0, a,n,e),[n,e])}var $r="bitsnap-pending-order";function ra(e,t){let n=new Map;for(let r of t)n.set(r.id,(_nullishCoalesce(n.get(r.id), () => (0)))+r.quantity);let a=[];for(let r of e){let o=n.get(r.id);o==null?a.push(r):r.quantity>o&&a.push({...r,quantity:r.quantity-o})}return a}var il=60*1e3;function na(e,t=Date.now,n=il){let a;return r=>{let o=`${r.orderId}:${r.ts}`,i=t();return _optionalChain([a, 'optionalAccess', _179 => _179.key])===o&&i-a.at<n?Promise.reject(new Error("pending order was asked about recently")):(a={key:o,at:i},e(r))}}function sl(e){if(!(e==null||e.length===0))try{let t=new URL(e,"https://bitsnap.invalid").pathname,n=/\/payment\/common\/([^/]+)\/([^/]+)\/?$/.exec(t);return n==null?void 0:{projectId:decodeURIComponent(n[1]),orderId:decodeURIComponent(n[2])}}catch (e19){return}}function ll(e){if(e==null||e.length===0)return!1;try{let t=new URL(e,"https://bitsnap.invalid").pathname;return/\/payment\/manualPayment\/[^/]+\/[^/]+\/?$/.test(t)}catch (e20){return!1}}function dl(e,t=Date.now(),n={}){if(ll(e.url))return;let a=sl(e.url),r=_nullishCoalesce(ea(e.orderId), () => (_optionalChain([a, 'optionalAccess', _180 => _180.orderId]))),o=_nullishCoalesce(ea(e.projectId), () => (_optionalChain([a, 'optionalAccess', _181 => _181.projectId])));if(!(r==null||o==null))return{orderId:r,projectId:o,...n.cartProjectId!=null?{cartProjectId:n.cartProjectId}:{},lines:_nullishCoalesce(n.lines, () => ([])),ts:t}}function Am(e,t={}){let n=dl(e,t.now,t);return n!=null&&ul(n,t.storage)}function ea(e){return e!=null&&e.length>0?e:void 0}function $t(){try{return typeof localStorage>"u"?void 0:localStorage}catch (e21){return}}function ul(e,t=$t()){try{return _optionalChain([t, 'optionalAccess', _182 => _182.setItem, 'call', _183 => _183($r,JSON.stringify(e))]),t!=null}catch (e22){return!1}}function ta(e=$t()){try{let t=_optionalChain([e, 'optionalAccess', _184 => _184.getItem, 'call', _185 => _185($r)]);if(t==null)return;let n=JSON.parse(t);if(typeof n=="object"&&n!=null&&typeof n.orderId=="string"&&typeof n.projectId=="string"&&typeof n.ts=="number"&&n.orderId.length>0){let{orderId:a,projectId:r,cartProjectId:o,ts:i,lines:d}=n;return{orderId:a,projectId:r,...typeof o=="string"?{cartProjectId:o}:{},lines:Array.isArray(d)?d.filter(u=>typeof _optionalChain([u, 'optionalAccess', _186 => _186.id])=="string"&&typeof u.quantity=="number"):[],ts:i}}}catch (e23){}qr(e)}function qr(e=$t()){try{_optionalChain([e, 'optionalAccess', _187 => _187.removeItem, 'call', _188 => _188($r)])}catch (e24){}}function oa(e){let t=_nullishCoalesce(_optionalChain([e, 'access', _189 => _189.details, 'optionalAccess', _190 => _190.status]), () => (cl(_optionalChain([e, 'access', _191 => _191.details, 'optionalAccess', _192 => _192.$unknown]))));return t==="created"||t==="placed"||t==="paid"||t==="canceled"?t:"unknown"}function cl(e){if(Array.isArray(e)){for(let t of e)if(_optionalChain([t, 'optionalAccess', _193 => _193.no])===3&&t.wireType===2&&t.data instanceof Uint8Array){let n=0,a=0;for(let r=0;a<t.data.length&&r<35;r+=7){let o=t.data[a++];if(n|=(o&127)<<r,!(o&128))break}if(a+n!==t.data.length)return;try{return new TextDecoder().decode(t.data.subarray(a))}catch (e25){return}}}}async function aa(e){let t=_nullishCoalesce(e.storage, () => ($t())),n=ta(t);if(n==null)return"none";if((_nullishCoalesce(e.now, () => (Date.now)))()-n.ts>864e5)return qr(t),"expired";if(e.projectId!=null&&n.cartProjectId!=null&&n.cartProjectId!==e.projectId)return"pending";let r;try{r=await e.fetchStatus(n)}catch (e26){return"pending"}let o=ta(t);if(_optionalChain([o, 'optionalAccess', _194 => _194.orderId])!==n.orderId||o.ts!==n.ts)return"pending";if(r==="paid"||r==="placed"){try{await e.removeLines(n.lines)}catch (e27){return"pending"}return qr(t),"paid"}return"pending"}var hl="__m_a",pa=_react3.createContext.call(void 0, void 0),Wr= exports.I =void 0;function of(e){_chunkMDAFPGPAjs.a.call(void 0, {projectID:e}),Wr= exports.I =e,typeof window<"u"&&_chunkMDAFPGPAjs.g.call(void 0, [window.location.origin])}function pt(){return _nullishCoalesce(_nullishCoalesce(Wr, () => (_optionalChain([document, 'access', _195 => _195.querySelector, 'call', _196 => _196('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _197 => _197.getAttribute, 'call', _198 => _198("data-id")]))), () => (void 0))}function bl(){return _nullishCoalesce(_optionalChain([document, 'access', _199 => _199.querySelector, 'call', _200 => _200('script[data-id][data-name="internal-cart"]'), 'optionalAccess', _201 => _201.getAttribute, 'call', _202 => _202("data-custom-host")]), () => (void 0))}var Pl=({children:e,locale:t})=>{let[n]=_react3.useState.call(void 0, ()=>new _reactquery.QueryClient),a=Xo();_react3.useEffect.call(void 0, ()=>{Ie()},[]);let r=pt();if(_react3.useEffect.call(void 0, ()=>{if(r==null)return;let i=()=>{wl(r).then(u=>{u==="paid"&&n.invalidateQueries({queryKey:["cart"]})})},d=()=>{document.visibilityState==="visible"&&i()};return i(),window.addEventListener("pageshow",i),document.addEventListener("visibilitychange",d),()=>{window.removeEventListener("pageshow",i),document.removeEventListener("visibilitychange",d)}},[r,n]),r==null)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{});let o=Yr(r,_nullishCoalesce(t, () => (a.locale)),a.texts);return _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:n,children:_jsxruntime.jsx.call(void 0, pa.Provider,{value:o,children:e})})},Br,vl=na(async e=>oa(await ge.get(_chunkSZLSKIYUjs.e).getOrder({id:e.orderId,projectId:e.projectId})));function af(){let{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:a}=_nullishCoalesce(R(), () => (Wt));return{country:e,couponCode:t,selectedDeliveryMethod:n,postalCode:a}}function sf(){return(_nullishCoalesce(_optionalChain([R, 'call', _203 => _203(), 'optionalAccess', _204 => _204.products]), () => ([]))).map(e=>({id:e.id,quantity:e.quantity}))}function kl(e){let t=R();W({...t,products:ra(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _205 => _205.products]), () => ([])),e)}),Ie()}function wl(e){return Br??=aa({projectId:e,fetchStatus:vl,removeLines:kl}).catch(t=>{console.warn("cannot check the pending order",t)}).finally(()=>{Br=void 0}),Br}var ct=async(e,t)=>{let n=[];_optionalChain([t, 'optionalAccess', _206 => _206.items])!=null&&t.items.length>0?n=t.items:n=_nullishCoalesce(_optionalChain([R, 'call', _207 => _207(), 'optionalAccess', _208 => _208.products]), () => ([]));let a=Array.from(new Set(n.map(i=>i.productID)));if(a.length===0)return[];let r=new URLSearchParams;r.set("ids",a.join(",")),r.set("locale",_nullishCoalesce(_optionalChain([t, 'optionalAccess', _209 => _209.locale]), () => (_chunkQ337IQNAjs.f.call(void 0, ))));let o;try{let i=await fetch(_chunkSZLSKIYUjs.c.call(void 0, dt(e,`/products?${r.toString()}`)),{method:"GET"});if(i.status!=200)return B("products-load-failed","internal");o=await i.json()}catch(i){return console.warn("cannot load the products of the cart",i),B("products-load-failed","internal")}return n.flatMap(i=>{let d=Zo(i.productID,o.result);return d==null?[]:[{...i,details:El(i.productID,d),catalogProductID:d.id}]})},lf= exports.O =()=>{let e=_react3.useContext.call(void 0, pa);if(e===void 0)throw new Error("useCartProvider must be used within a CartProvider");return e},df= exports.P =Pl,xl=_zod2.default.object({isAvailable:_zod2.default.boolean(),merchantId:_zod2.default.string(),merchantName:_zod2.default.string(),gateway:_zod2.default.string(),gatewayId:_zod2.default.string()}),Cl=_zod2.default.object({id:_zod2.default.string(),productID:_zod2.default.string(),quantity:_zod2.default.number(),priceVersion:_zod2.default.string().optional(),amount:_zod2.default.number().int().nonnegative().optional(),metadata:_zod2.default.record(_zod2.default.string(),_zod2.default.string().optional()).optional(),url:_zod2.default.string().optional()}),Nl=_zod2.default.object({country:_zod2.default.string().optional(),couponCode:_zod2.default.string().optional(),selectedDeliveryMethod:_zod2.default.string().optional(),postalCode:_zod2.default.string().optional(),email:_zod2.default.string().optional(),products:_zod2.default.array(Cl).optional(),googlePayConfig:xl.optional()}),Wt={country:void 0,couponCode:void 0,email:void 0,selectedDeliveryMethod:void 0,postalCode:void 0,products:[],googlePayConfig:void 0},Zr="checkout";function Sl(){return typeof localStorage>"u"?[]:(_nullishCoalesce(R().products, () => ([]))).map(e=>({...e}))}function uf(){return Sl().map(e=>`${e.productID}:${e.quantity}`).sort().join(",")}function cf(e){let t=R();if(!(t.products==null||t.products.length===0))return{items:t.products.map(n=>({id:n.productID,quantity:n.quantity,...n.priceVersion!=null?{priceVersion:n.priceVersion}:{},...n.amount!=null?{amount:n.amount}:{}})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},...t.selectedDeliveryMethod!=null?{deliveryMethod:t.selectedDeliveryMethod}:{},locale:e}}function pf(e){let t=R(),n=new Map;for(let a of _nullishCoalesce(t.products, () => ([]))){let r=_nullishCoalesce(n.get(a.productID), () => ([]));r.push(a),n.set(a.productID,r)}t.products=e.map(a=>{let r=_optionalChain([n, 'access', _210 => _210.get, 'call', _211 => _211(a.productId), 'optionalAccess', _212 => _212.shift, 'call', _213 => _213()]);return{id:Math.random().toString(36).substring(7),productID:a.productId,quantity:a.quantity,..._optionalChain([r, 'optionalAccess', _214 => _214.priceVersion])!=null?{priceVersion:r.priceVersion}:{},..._optionalChain([r, 'optionalAccess', _215 => _215.metadata])!=null?{metadata:r.metadata}:{},..._optionalChain([r, 'optionalAccess', _216 => _216.url])!=null?{url:r.url}:{}}}),W(t),Ie()}function mf(e){let t=new Map;for(let r of e)t.set(r.id,(_nullishCoalesce(t.get(r.id), () => (0)))+r.quantity);let n=R(),a=(_nullishCoalesce(n.products, () => ([]))).flatMap(r=>{let o=t.get(r.productID);return o==null?[r]:r.quantity<=o?[]:[{...r,quantity:r.quantity-o}]});W({...n,products:a}),Ie()}function ff(e){let t=R();t.products=_nullishCoalesce(t.products, () => ([]));for(let n of e)t.products.push({id:Math.random().toString(36).substring(7),productID:n.id,quantity:n.quantity});W(t),Ie()}function R(){try{let e=localStorage.getItem(Zr);return e==null?Wt:Nl.parse(JSON.parse(e))}catch (e28){return Wt}}async function sa(e,t){let n=await ct(e,{items:t.map((o,i)=>({...o,id:`price-check-${i}`}))});if(_e(n))return n;let a=Yo(t.map(o=>o.productID),n);if(a.length>0)return B("item-ids-not-found","notFound",a);let r=R();r.products==null&&(r.products=[]),r.products.push(...t.map(o=>({id:Math.random().toString(36).substring(7),productID:o.productID,quantity:o.quantity,priceVersion:_optionalChain([n, 'access', _217 => _217.find, 'call', _218 => _218(i=>i.productID===o.productID), 'optionalAccess', _219 => _219.details, 'optionalAccess', _220 => _220.pricing, 'optionalAccess', _221 => _221.priceVersion]),amount:o.amount,metadata:o.metadata,url:Jo(o.url,typeof window<"u"?window.location.href:void 0)}))),Il(t,n),Fr({event:"addToCart",currency:"PLN",items:t.map(o=>({id:o.productID,name:_nullishCoalesce(o.name, () => ("")),price:_nullishCoalesce(o.price, () => (0)),quantity:o.quantity,currency:_nullishCoalesce(o.currency, () => ("PLN"))}))}),W(r),Ie()}function Il(e,t){for(let n of e)try{let a=t.find(d=>d.productID===n.productID),r=_nullishCoalesce(_nullishCoalesce(_optionalChain([a, 'optionalAccess', _222 => _222.details, 'optionalAccess', _223 => _223.pricing, 'optionalAccess', _224 => _224.effectivePrice]), () => (_optionalChain([a, 'optionalAccess', _225 => _225.details, 'optionalAccess', _226 => _226.price]))), () => (n.price)),o=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _227 => _227.details, 'optionalAccess', _228 => _228.currency]), () => (n.currency));if(r==null||o==null)continue;let i=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _229 => _229.catalogProductID]), () => (n.productID));(_nullishCoalesce(n.analytics, () => (_chunk2CL4B4KMjs.o.call(void 0, )))).track("add_to_cart",{qty:n.quantity,value_minor:Math.round(r*n.quantity),currency:o},{product_id:i,variant_id:i!==n.productID?n.productID:null})}catch (e29){}}function la(e){let t=R(),n={...t,products:_optionalChain([t, 'optionalAccess', _230 => _230.products, 'optionalAccess', _231 => _231.filter, 'call', _232 => _232(a=>!e.includes(a.productID)&&!e.includes(a.id))])};Fr({event:"removeFromCart",items:e.map(a=>({id:a,name:"",price:0,quantity:1,currency:"PLN"}))}),W(n),Ie()}function W(e){localStorage.setItem(Zr,JSON.stringify(e)),fa()}var Kt=new Set,ma=0,Bt=!1;function da(e){e.key===Zr&&fa()}function gf(e){return Kt.add(e),!Bt&&typeof window<"u"&&(window.addEventListener("storage",da),Bt=!0),()=>{Kt.delete(e),Kt.size===0&&Bt&&(window.removeEventListener("storage",da),Bt=!1)}}function yf(){return ma}function fa(){ma+=1;for(let e of Kt)try{e()}catch (e30){}}function ua(e,t){if(e.products==null||e.products.length==0)return;let n=e.products.reduce((a,r)=>(r.metadata!=null&&Object.keys(r.metadata).forEach(o=>{let i=_optionalChain([r, 'access', _233 => _233.metadata, 'optionalAccess', _234 => _234[o]]);i!=null&&(a[o]=i)}),a),{});return{items:e.products.map(a=>({id:a.productID,quantity:a.quantity,priceVersion:a.priceVersion,...a.amount!=null?{amount:a.amount}:{}})),askForNote:!0,countries:e.country?[e.country]:void 0,metadata:n,locale:t}}var Yr=(e,t=_chunkQ337IQNAjs.f.call(void 0, ),n)=>{let a=bl();return a!=null&&_chunkSZLSKIYUjs.f.call(void 0, a),{async checkIfApplePayIsAvailable(){if(typeof window>"u"||typeof document>"u"||!("ApplePaySession"in window))return!1;try{return(await ge.get(_chunkSZLSKIYUjs.e).isOneClickPaymentAvailable({projectId:e})).applePay}catch(r){return console.error("Error checking if Apple Pay is available",r),!1}},async getGooglePayConfiguration(r){if(typeof window>"u"||typeof document>"u")return{isAvailable:!1};try{let o=await Tl(e);if(_optionalChain([o, 'optionalAccess', _235 => _235.isAvailable])!=!0)return{isAvailable:!1};let i=R();if(i==null)return console.log("checkout is null"),{isAvailable:!1};let d=await ct(e,{locale:t,items:r.items.map(P=>({id:Math.random().toString(36).substring(7),quantity:P.quantity,metadata:P.metadata,productID:P.productID}))});if(_e(d))return{isAvailable:!1};let u=await ge.get(_chunkSZLSKIYUjs.e).getPreOrderDetails({items:d.map(P=>_protobuf.create.call(void 0, _chunkILYJCT5Sjs.d,{id:P.productID,quantity:P.quantity})),projectId:e,postCode:i.postalCode,couponCode:i.couponCode,countryCode:i.country,selectedDeliveryMethod:i.selectedDeliveryMethod});if(u.totalAmount==null)return{isAvailable:!1};let l=d.find(P=>_optionalChain([P, 'access', _236 => _236.details, 'optionalAccess', _237 => _237.isDeliverable])==!0)!=null,m=await Vo({items:d,googlePayConfig:o,checkout:i,cartRequiresShipping:l,result:u,locale:t,texts:n});return m==null?{isAvailable:!1}:{isAvailable:!0,config:m}}catch(o){return console.error("Error resolving Google Pay configuration",o),{isAvailable:!1}}},async clearCart(){let r=structuredClone(Wt);r.country=_optionalChain([R, 'call', _238 => _238(), 'optionalAccess', _239 => _239.country]),W(r),Ie()},async getAvailableCountries(){let r=await fetch(_chunkSZLSKIYUjs.c.call(void 0, dt(e,"/countries")),{method:"GET"});if(r.status!=200)return[];try{return _zod2.default.array(_zod2.default.object({name:_zod2.default.string(),code:_zod2.default.string()})).parse(await r.json())}catch(o){return B(o.toString(),"internal")}},async getCountry(){let r=_optionalChain([R, 'call', _240 => _240(), 'optionalAccess', _241 => _241.country]);if(r==null){r="PL";let o=R();o.country=r,W(o)}return r},async getNumberOfElementsInCart(){return _nullishCoalesce(_optionalChain([R, 'call', _242 => _242(), 'optionalAccess', _243 => _243.products, 'optionalAccess', _244 => _244.reduce, 'call', _245 => _245((r,o)=>r+o.quantity,0)]), () => (0))},async getProducts(){return await ct(e,{locale:t})},async removeProductFromCart(r){return la([r.id])},async setCountry(r){let o=R();o.country=r,W(o)},async setCouponCodeIfPossible(r){let o=R();o.couponCode=r,W(o)},async setPostalCode(r){let o=R();o.postalCode=r,W(o)},async setDeliveryMethod(r){let o=R();o.selectedDeliveryMethod=r,W(o)},async setEmail(r){let o=R();o.email=r,W(o)},async addProduct(r){return await sa(e,[r])},async updateQuantity(r){let o=R();o.products=_optionalChain([o, 'access', _246 => _246.products, 'optionalAccess', _247 => _247.map, 'call', _248 => _248(i=>(i.id===r.id&&(i.quantity=r.quantity),i))]),W(o),Ie()},async getPaymentMethodChoice(){let r=ua(R(),t);return r==null?null:ca(r)},async redirectToNextStep(r){let o=ua(R(),t);if(o==null)return B("cart-is-empty","badInput");_optionalChain([r, 'optionalAccess', _249 => _249.paymentMethod])!=null&&(o.paymentMethod=r.paymentMethod);let i=await Gr(o);return _e(i)?(console.warn("cannot create payment URL",i.error),i):{url:i.url,...i.orderId!=null?{orderId:i.orderId}:{},...i.projectId!=null?{projectId:i.projectId}:{}}},async justRedirectToPayment(r){let o={items:[{id:r.productID,quantity:1}],askForNote:!1,details:r.email||r.name?{name:r.name,email:r.email}:void 0,locale:_nullishCoalesce(r.locale, () => (t))};o=Vr(o),r.country==null&&(r.country="pl"),o.details==null&&(o.details={}),o.details.address==null&&(o.details.address={}),o.details.address.country=r.country,r.marketingAgreement===!0&&(o.additionalAgreements=[{id:hl,name:"",required:!0,answer:!0}]);let i=await Gr(o);return _e(i)?i:{url:i.url}},async getApplePayPreview(r){let o=R();try{let i=await ge.get(_chunkSZLSKIYUjs.e).getPreOrderDetails({items:r.items.map(d=>_protobuf.create.call(void 0, _chunkILYJCT5Sjs.d,{id:d.productID,quantity:d.quantity})),projectId:e,postCode:o.postalCode,couponCode:o.couponCode,countryCode:o.country,selectedDeliveryMethod:o.selectedDeliveryMethod});return i.totalAmount==null||i.currency.length===0?B("pre-order-unavailable","internal"):{countryCode:i.country||o.country||"PL",currencyCode:i.currency,totalAmount:`${F(i.totalAmount/100,2)}`}}catch(i){return console.warn("cannot load the Apple Pay preview",i),B("pre-order-unavailable","internal")}},async completeApplePayPayment(r){let o=R();if(o==null)return B("Checkout not found");let i=await ct(e,{locale:t});if(_e(i))return i;try{let d=_optionalChain([r, 'access', _250 => _250.shippingContact, 'optionalAccess', _251 => _251.givenName]);_optionalChain([r, 'access', _252 => _252.shippingContact, 'optionalAccess', _253 => _253.familyName])!=null?d+=" "+_optionalChain([r, 'access', _254 => _254.shippingContact, 'optionalAccess', _255 => _255.familyName]):_optionalChain([r, 'access', _256 => _256.billingContact, 'optionalAccess', _257 => _257.familyName])!=null&&(d+=" "+_optionalChain([r, 'access', _258 => _258.billingContact, 'optionalAccess', _259 => _259.familyName]));let u={},l=Gt();l!=null&&(u.ref=l);let m=await ge.get(_chunkSZLSKIYUjs.e).authorizeOneClickPayment({gateway:0,paymentData:JSON.stringify(r.token.paymentData),paymentMethod:JSON.stringify(r.token.paymentMethod),transactionIdentifier:r.token.transactionIdentifier,order:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.e,{items:i.map(P=>({id:P.productID,quantity:P.quantity})),couponCode:o.couponCode,email:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([r, 'access', _260 => _260.shippingContact, 'optionalAccess', _261 => _261.emailAddress]), () => (_optionalChain([r, 'access', _262 => _262.billingContact, 'optionalAccess', _263 => _263.emailAddress]))), () => (o.email)), () => (void 0)),phone:_nullishCoalesce(_nullishCoalesce(_optionalChain([r, 'access', _264 => _264.shippingContact, 'optionalAccess', _265 => _265.phoneNumber]), () => (_optionalChain([r, 'access', _266 => _266.billingContact, 'optionalAccess', _267 => _267.phoneNumber]))), () => (void 0)),selectedDeliveryMethod:o.selectedDeliveryMethod,postCode:o.postalCode,projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.a,{line1:_nullishCoalesce(_optionalChain([r, 'access', _268 => _268.shippingContact, 'optionalAccess', _269 => _269.addressLines, 'optionalAccess', _270 => _270[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _271 => _271.shippingContact, 'optionalAccess', _272 => _272.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _273 => _273.shippingContact, 'optionalAccess', _274 => _274.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _275 => _275.shippingContact, 'optionalAccess', _276 => _276.postalCode]), () => ("")),name:d}),billingAddress:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.b,{name:_nullishCoalesce(_optionalChain([r, 'access', _277 => _277.billingContact, 'optionalAccess', _278 => _278.givenName]), () => (" "+(_nullishCoalesce(_optionalChain([r, 'access', _279 => _279.billingContact, 'optionalAccess', _280 => _280.familyName]), () => (""))))),line1:_nullishCoalesce(_optionalChain([r, 'access', _281 => _281.billingContact, 'optionalAccess', _282 => _282.addressLines, 'optionalAccess', _283 => _283[0]]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _284 => _284.billingContact, 'optionalAccess', _285 => _285.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _286 => _286.billingContact, 'optionalAccess', _287 => _287.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _288 => _288.billingContact, 'optionalAccess', _289 => _289.postalCode]), () => (""))}),metadata:Object.keys(u).length>0?JSON.stringify(u):void 0});return{isSuccess:m.isSuccess,redirectURL:m.redirectUrl}}catch(d){return console.error(d),B("Failed to authorize payment")}},async completeGooglePayPayment(r){let o=R();if(o==null)return B("Checkout not found");let i=await ct(e,{locale:t});if(_e(i))return i;try{let d=_optionalChain([r, 'access', _290 => _290.paymentData, 'access', _291 => _291.shippingAddress, 'optionalAccess', _292 => _292.name]),u={},l=Gt();l!=null&&(u.ref=l);let m=await ge.get(_chunkSZLSKIYUjs.e).authorizeOneClickPayment({gateway:1,paymentData:r.paymentData.paymentMethodData.tokenizationData.token,paymentMethod:r.paymentData.paymentMethodData.type,transactionIdentifier:"",order:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.e,{items:i.map(P=>({id:P.productID,quantity:P.quantity})),couponCode:o.couponCode,email:_nullishCoalesce(r.paymentData.email, () => (void 0)),phone:_nullishCoalesce(_optionalChain([r, 'access', _293 => _293.paymentData, 'access', _294 => _294.shippingAddress, 'optionalAccess', _295 => _295.phoneNumber]), () => (void 0)),selectedDeliveryMethod:_nullishCoalesce(_optionalChain([r, 'access', _296 => _296.paymentData, 'access', _297 => _297.shippingOptionData, 'optionalAccess', _298 => _298.id]), () => (o.selectedDeliveryMethod)),postCode:_optionalChain([r, 'access', _299 => _299.paymentData, 'access', _300 => _300.shippingAddress, 'optionalAccess', _301 => _301.postalCode]),projectId:e}),shippingAddress:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.a,{line1:_nullishCoalesce(_optionalChain([r, 'access', _302 => _302.paymentData, 'access', _303 => _303.shippingAddress, 'optionalAccess', _304 => _304.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _305 => _305.paymentData, 'access', _306 => _306.shippingAddress, 'optionalAccess', _307 => _307.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _308 => _308.paymentData, 'access', _309 => _309.shippingAddress, 'optionalAccess', _310 => _310.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _311 => _311.paymentData, 'access', _312 => _312.shippingAddress, 'optionalAccess', _313 => _313.postalCode]), () => ("")),name:d}),billingAddress:_protobuf.create.call(void 0, _chunkILYJCT5Sjs.b,{name:_optionalChain([r, 'access', _314 => _314.paymentData, 'access', _315 => _315.paymentMethodData, 'access', _316 => _316.info, 'optionalAccess', _317 => _317.billingAddress, 'optionalAccess', _318 => _318.name]),line1:_nullishCoalesce(_optionalChain([r, 'access', _319 => _319.paymentData, 'access', _320 => _320.paymentMethodData, 'access', _321 => _321.info, 'optionalAccess', _322 => _322.billingAddress, 'optionalAccess', _323 => _323.address1]), () => ("")),city:_nullishCoalesce(_optionalChain([r, 'access', _324 => _324.paymentData, 'access', _325 => _325.paymentMethodData, 'access', _326 => _326.info, 'optionalAccess', _327 => _327.billingAddress, 'optionalAccess', _328 => _328.locality]), () => ("")),country:_nullishCoalesce(_optionalChain([r, 'access', _329 => _329.paymentData, 'access', _330 => _330.paymentMethodData, 'access', _331 => _331.info, 'optionalAccess', _332 => _332.billingAddress, 'optionalAccess', _333 => _333.countryCode]), () => ("")),zipCode:_nullishCoalesce(_optionalChain([r, 'access', _334 => _334.paymentData, 'access', _335 => _335.paymentMethodData, 'access', _336 => _336.info, 'optionalAccess', _337 => _337.billingAddress, 'optionalAccess', _338 => _338.postalCode]), () => (""))}),metadata:Object.keys(u).length>0?JSON.stringify(u):void 0});return{isSuccess:m.isSuccess,redirectURL:m.redirectUrl}}catch(d){return console.error(d),B("Failed to authorize payment")}return{isSuccess:!0}},async getApplePayPaymentRequest(r){let o=R();if(o==null)return B("Checkout not found");r&&r.expectedItems!=null&&r.expectedItems.length>0&&(o.products&&la(o.products.map(l=>l.productID)),await sa(e,r.expectedItems));let i=await ct(e,{locale:t});if(_e(i))return i;let d=await ge.get(_chunkSZLSKIYUjs.e).getPreOrderDetails({items:i.map(l=>_protobuf.create.call(void 0, _chunkILYJCT5Sjs.d,{id:l.productID,quantity:l.quantity})),projectId:e,postCode:o.postalCode,couponCode:o.couponCode,countryCode:o.country,selectedDeliveryMethod:o.selectedDeliveryMethod}),u=i.map(l=>({amount:`${F(l.quantity*(_nullishCoalesce(_nullishCoalesce(_optionalChain([l, 'access', _339 => _339.details, 'optionalAccess', _340 => _340.pricing, 'optionalAccess', _341 => _341.effectivePrice]), () => (_optionalChain([l, 'access', _342 => _342.details, 'optionalAccess', _343 => _343.price]))), () => (0)))/100,2)}`,label:_optionalChain([l, 'access', _344 => _344.details, 'optionalAccess', _345 => _345.name])+" - "+l.quantity,type:"final"}));if(d.selectedDeliveryMethod!=null){let l=d.methods.find(m=>m.id==d.selectedDeliveryMethod);l!=null&&u.push({amount:`${F(l.amount/100,2)}`,label:l.name,type:"final"})}return d.couponCode!=null&&d.couponValue!=null&&u.push({amount:`-${F(d.couponValue/100,2)}`,label:d.couponCode,type:"final"}),{countryCode:d.country||o.country||"PL",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],total:{amount:`${F((_nullishCoalesce(d.totalAmount, () => (0)))/100,2)}`,label:_chunkQ337IQNAjs.c.call(void 0, "paymentForCart",t,n),type:"final"},shippingMethods:d.methods.map(l=>({amount:`${F(l.amount/100,2)}`,detail:_nullishCoalesce(l.description, () => ("")),identifier:l.id,label:l.name,dateComponentsRange:{startDateComponents:{days:_nullishCoalesce(l.minDays, () => (1)),hours:0,months:0,years:0},endDateComponents:{days:_nullishCoalesce(l.maxDays, () => (14)),hours:0,months:0,years:0}}})),lineItems:u,currencyCode:d.currency||_optionalChain([i, 'access', _346 => _346[0], 'optionalAccess', _347 => _347.details, 'optionalAccess', _348 => _348.currency])||"PLN"}}}};async function Tl(e){let t=R();if(_optionalChain([t, 'access', _349 => _349.googlePayConfig, 'optionalAccess', _350 => _350.isAvailable])!=!0){let n=await ge.get(_chunkSZLSKIYUjs.e).isOneClickPaymentAvailable({projectId:e});n.googlePay==!0&&n.googlePayConfig!=null?t.googlePayConfig={isAvailable:!0,gateway:n.googlePayConfig.gateway,gatewayId:n.googlePayConfig.gatewayMerchantId,merchantName:n.googlePayConfig.merchantName,merchantId:n.googlePayConfig.merchantId}:t.googlePayConfig={isAvailable:!1,gateway:"",gatewayId:"",merchantName:"",merchantId:""}}return W(t),t.googlePayConfig}function El(e,t){if(e==t.id){let a=_optionalChain([t, 'access', _351 => _351.variants, 'optionalAccess', _352 => _352.findIndex, 'call', _353 => _353(r=>r.id===e)]);if(a!=null&&a!=-1){let r=t.variants[a];return{...t,availableQuantity:r.availableQuantity,isDeliverable:r.isDeliverable,images:_nullishCoalesce(r.images, () => (t.images)),name:t.name+" "+r.name,baseName:t.name,variantName:r.name,price:r.price,currency:r.currency,pricing:r.pricing}}return t}let n=_optionalChain([t, 'access', _354 => _354.variants, 'optionalAccess', _355 => _355.find, 'call', _356 => _356(a=>a.id===e)]);return n==null?t:{...t,id:n.id,name:t.name+" "+n.name,baseName:t.name,variantName:n.name,price:n.price,currency:n.currency,pricing:n.pricing,metadata:t.metadata,availableQuantity:n.availableQuantity,isDeliverable:n.isDeliverable,images:_nullishCoalesce(n.images, () => (t.images))}}function Ie(){let e=R(),t=0;if(e==null){ut.setState(n=>({...n,numberOfProductsInCart:t}));return}t=_nullishCoalesce(_optionalChain([e, 'access', _357 => _357.products, 'optionalAccess', _358 => _358.reduce, 'call', _359 => _359((n,a)=>n+a.quantity,0)]), () => (0)),ut.setState(n=>({...n,numberOfProductsInCart:t}))}var Rl=200,Al= exports.m ="item-ids-not-found",xt="internal-error",ga={"no-payment-gateway":"noPaymentGateway","gateway-not-configured":"gatewayNotConfigured","shipping-not-configured":"shippingNotConfigured","mixed-recurring":"mixedRecurring","currency-unsupported":"currencyUnsupported","price-changed":"priceChanged","product-not-found":"unavailableProducts","product-not-available":"unavailableProducts"},Dl=new Set(["internal","invalid-request"]),Ml=new Set(["product-not-available","product-not-found"]);function Ol(e){return typeof e=="string"&&Object.hasOwn(ga,e)?ga[e]:void 0}function Ul(e){return/<\/?[a-z!?][^>]*>/i.test(e)}function _l(e){return/^[A-Za-z][A-Za-z0-9]*(?:[-_.:][A-Za-z0-9]+)*$/.test(e)&&!/^[A-Z][a-z]+$/.test(e)||/^\[object \w+\]$|^(?:undefined|null)$/.test(e)}function zl(e){return/Error:/.test(e)||/\n\s+at /.test(e)}function Jr(e){let t=e.trim();if(!(t.length===0||t.length>Rl||/[\r\n]/.test(t)||Ul(t)||_l(t)||zl(t)))return t}var jl=3;function Vt(e,t=0){if(typeof e=="object"&&e!=null){if(Array.isArray(e)||t>=jl)return{};let n=e,a=Vt(n.error,t+1);if(a.message==null&&n.message!=null){let r=Vt(n.message,t+1);a={...r,code:_nullishCoalesce(a.code, () => (r.code))}}return typeof n.code=="string"&&n.code.length>0&&(a.code=n.code),a}if(typeof e!="string")return{};try{let n=JSON.parse(e);return typeof n=="object"&&n!=null?Vt(n,t+1):{}}catch (e31){}return{message:Jr(e)}}function Fl(e){let t;try{t=JSON.parse(e)}catch (e32){return{code:xt,message:Jr(e)}}if(typeof t=="string")return{code:xt,message:Jr(t)};if(typeof t!="object"||t==null)return{code:xt};let n=t,{message:a,code:r}=Vt(n.error),o={code:typeof n.code=="string"&&n.code.length>0?n.code:_nullishCoalesce(r, () => (xt)),message:a};return Array.isArray(n.itemIds)&&(o.itemIds=n.itemIds.filter(i=>typeof i=="string")),o}function Qr(e,t){let{code:n,message:a,itemIds:r}=Fl(t),o=r!=null&&r.length>0;if(o&&(n===xt||Ml.has(n)))return B(Al,"badInput",r);let i={message:a};return o&&(i.itemIds=r),B(n,e>=500?"internal":"badInput",i)}function kf(e,t){let n=Ol(e.error);if(n!=null)return t(n);if(e.type==="internal"||typeof e.error=="string"&&Dl.has(e.error))return t("checkoutFailed");let a=_optionalChain([e, 'access', _360 => _360.data, 'optionalAccess', _361 => _361.message]);return typeof a=="string"&&a.length>0?a:t("checkoutFailed")}var Hl=["online","manual","cod"],ql=["bankTransfer","blik"];function ya(e,t){if(!Array.isArray(e))return[];let n=[];for(let a of e)t.includes(a)&&!n.includes(a)&&n.push(a);return n}function $l(e){if(typeof e!="object"||e==null)return null;let t=e.choice;if(typeof t!="object"||t==null)return null;let n=ya(t.methods,Hl);return n.length<2?null:{methods:n,manualAccountTypes:ya(t.manualAccountTypes,ql)}}function xf(e){if(e==null)return null;let t=e.methods.filter(n=>n!=="cod");return t.length<2?null:{...e,methods:t}}function Cf(e,t){return t!=null&&e.methods.includes(t)?t:e.methods[0]}function Nf(e){let t=e.includes("bankTransfer"),n=e.includes("blik");return n&&!t?"paymentMethodManualBlik":t&&!n?"paymentMethodManualTransfer":"paymentMethodManualBoth"}async function ha(e,t,n=5e3){let a=typeof AbortController>"u"?void 0:new AbortController,r=setTimeout(()=>_optionalChain([a, 'optionalAccess', _362 => _362.abort, 'call', _363 => _363()]),n);try{let o=await fetch(e,{method:"POST",headers:t.headers,body:t.body,signal:_optionalChain([a, 'optionalAccess', _364 => _364.signal])});return o.ok?$l(await o.json()):null}catch (e33){return null}finally{clearTimeout(r)}}var Bl;(a=>{async function e(r,o=1,i,d){let u=pt();if(u==null)throw new Error("No project ID found");let m=await Yr(u).addProduct({productID:r,quantity:o,metadata:i,...d});if(m!=null)return m}a.addProductToCart=e;function t(){ut.setState({isCartVisible:!0})}a.showCart=t;function n(){ut.setState({isCartVisible:!1})}a.hideCart=n})(Bl = exports.s||={});async function ba(e){try{return await e.text()}catch (e34){return""}}function Pa(e,t){return t=Vr(t),t.locale??=_chunkQ337IQNAjs.f.call(void 0, ),{headers:{..._chunkSZLSKIYUjs.a,..._chunk2CL4B4KMjs.h.call(void 0, e),"Content-Type":"application/json"},body:JSON.stringify(t)}}async function ca(e){let t=pt();return t==null?null:ha(dt(t,"/payment-methods"),Pa(t,e))}async function Gr(e){let t=pt();if(t==null)throw new Error("No project ID found");let n=await fetch(dt(t,"/buy"),{method:"POST",...Pa(t,e)});if(n.status!=200){let r=Qr(n.status,await ba(n));return console.warn("cannot create payment URL",n.status,r.error),r}let a=await n.json();return{url:a.url,...a.orderId!=null?{orderId:a.orderId}:{},...a.projectId!=null?{projectId:a.projectId}:{}}}async function Of(e){let t=pt();if(t==null)throw new Error("No project ID found");let n={..._chunkSZLSKIYUjs.a,..._chunk2CL4B4KMjs.h.call(void 0, t),"Content-Type":"application/json",...e.apiKey!=null?{Authorization:`Bearer ${e.apiKey}`}:{}},a=e.testMode?`/api/payment/link/auto/${t}/test`:`/api/payment/link/auto/${t}`;delete e.apiKey,delete e.testMode,e.locale??=_chunkQ337IQNAjs.f.call(void 0, );let r=await fetch(_chunkSZLSKIYUjs.e+a,{method:"POST",headers:n,body:JSON.stringify(e)});return r.ok?{status:"ok",redirectURL:(await r.json()).url}:{...Qr(r.status,await ba(r)),status:"error"}}function Gt(){if(typeof localStorage>"u")return;let e=localStorage.getItem("bitsnap-ref");if(e!=null)return e}function Vr(e){let t=Gt();return t==null||(e.metadata==null&&(e.metadata={}),e.metadata.ref=t),e}exports.a = ge; exports.b = De; exports.c = He; exports.d = qe; exports.e = Me; exports.f = Vn; exports.g = Pt; exports.h = vt; exports.i = tt; exports.j = rt; exports.k = qa; exports.l = _e; exports.m = Al; exports.n = kf; exports.o = xf; exports.p = Cf; exports.q = Nf; exports.r = ut; exports.s = Bl; exports.t = ca; exports.u = Gr; exports.v = Of; exports.w = Gt; exports.x = Vr; exports.y = Im; exports.z = Tm; exports.A = Em; exports.B = F; exports.C = Wo; exports.D = Fr; exports.E = Am; exports.F = jr; exports.G = Vs; exports.H = hl; exports.I = Wr; exports.J = of; exports.K = pt; exports.L = af; exports.M = sf; exports.N = wl; exports.O = lf; exports.P = df; exports.Q = Sl; exports.R = uf; exports.S = cf; exports.T = pf; exports.U = mf; exports.V = ff; exports.W = gf; exports.X = yf; exports.Y = ua; exports.Z = Yr;
|
|
5
|
+
//# sourceMappingURL=chunk-FVZ4W7QG.js.map
|