@monei-js/components 1.7.10 → 2.1.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.
Files changed (56) hide show
  1. package/README.md +100 -9
  2. package/dist/chunk.js +13 -0
  3. package/dist/index.cjs +1643 -0
  4. package/dist/index.d.cts +528 -0
  5. package/dist/index.d.ts +526 -14
  6. package/dist/index.js +1616 -7
  7. package/dist/monei.umd.production.min.js +64 -0
  8. package/dist/monei.umd.production.min.js.map +1 -0
  9. package/package.json +42 -65
  10. package/src/bridge/types.ts +106 -0
  11. package/dist/api.d.ts +0 -13
  12. package/dist/bizum/container.d.ts +0 -4
  13. package/dist/bizum/index.d.ts +0 -5
  14. package/dist/bizum/modal.d.ts +0 -3
  15. package/dist/bizum/types.d.ts +0 -30
  16. package/dist/cardInput/index.d.ts +0 -8
  17. package/dist/cardInput/types.d.ts +0 -51
  18. package/dist/click2pay/container.d.ts +0 -4
  19. package/dist/click2pay/index.d.ts +0 -5
  20. package/dist/click2pay/modal.d.ts +0 -3
  21. package/dist/click2pay/types.d.ts +0 -23
  22. package/dist/cofidis/container.d.ts +0 -4
  23. package/dist/cofidis/index.d.ts +0 -6
  24. package/dist/cofidis/modal.d.ts +0 -3
  25. package/dist/cofidis/types.d.ts +0 -45
  26. package/dist/cofidis/widget.d.ts +0 -3
  27. package/dist/cofidisLoan/container.d.ts +0 -4
  28. package/dist/cofidisLoan/index.d.ts +0 -7
  29. package/dist/cofidisLoan/modal.d.ts +0 -4
  30. package/dist/cofidisLoan/types.d.ts +0 -45
  31. package/dist/cofidisLoan/widget.d.ts +0 -4
  32. package/dist/components.cjs.development.js +0 -18997
  33. package/dist/components.cjs.development.js.map +0 -1
  34. package/dist/components.cjs.production.min.js +0 -2
  35. package/dist/components.cjs.production.min.js.map +0 -1
  36. package/dist/components.esm.js +0 -18979
  37. package/dist/components.esm.js.map +0 -1
  38. package/dist/config.d.ts +0 -28
  39. package/dist/container.d.ts +0 -1
  40. package/dist/enums.d.ts +0 -4
  41. package/dist/googlePay/index.d.ts +0 -4
  42. package/dist/googlePay/types.d.ts +0 -21
  43. package/dist/paymentModal/container.d.ts +0 -4
  44. package/dist/paymentModal/index.d.ts +0 -6
  45. package/dist/paymentModal/types.d.ts +0 -28
  46. package/dist/paymentRequest/index.d.ts +0 -4
  47. package/dist/paymentRequest/types.d.ts +0 -22
  48. package/dist/paypal/index.d.ts +0 -4
  49. package/dist/paypal/types.d.ts +0 -27
  50. package/dist/types.d.ts +0 -194
  51. package/dist/utils.d.ts +0 -11
  52. package/types/belter.d.ts +0 -1
  53. package/types/component.d.ts +0 -196
  54. package/types/css.d.ts +0 -9
  55. package/types/global.d.ts +0 -3
  56. package/types/post-robot.d.ts +0 -1
@@ -0,0 +1,64 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.monei={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};let r=2592e5,i=`thumbmark`,a=`https://api.thumbmarkjs.com`,o={exclude:[],include:[],stabilize:[`private`,`iframe`],logging:!0,timeout:5e3,cache_api_call:!0,cache_lifetime_in_ms:0,performance:!1,experimental:!1,property_name_factory:e=>`${i}_${e}`};({...o});let s={private:[{exclude:[`canvas`],browsers:[`firefox`,`safari>=17`,`brave`]},{exclude:[`audio`],browsers:[`samsungbrowser`,`safari`]},{exclude:[`fonts`],browsers:[`firefox`]},{exclude:[`audio.sampleHash`,`hardware.deviceMemory`,`header.acceptLanguage.q`,`system.hardwareConcurrency`,`plugins`],browsers:[`brave`]},{exclude:[`tls.extensions`],browsers:[`firefox`,`chrome`,`safari`]},{exclude:[`header.acceptLanguage`],browsers:[`edge`,`chrome`]}],iframe:[{exclude:[`system.applePayVersion`,`system.cookieEnabled`],browsers:[`safari`]},{exclude:[`permissions`]}],vpn:[{exclude:[`ip`]}],always:[{exclude:[`speech`],browsers:[`brave`,`firefox`]}]},c=typeof window<`u`?window.OfflineAudioContext||window.webkitOfflineAudioContext:null;function l(e){let t=0;for(let n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function u(e,t,n){let r=[];for(let t=0;t<e[0].data.length;t++){let n=[];for(let r=0;r<e.length;r++)n.push(e[r].data[t]);r.push(d(n))}let i=new Uint8ClampedArray(r);return new ImageData(i,t,n)}function d(e){if(e.length===0)return 0;let t={};for(let n of e)t[n]=(t[n]||0)+1;let n=e[0];for(let e in t)t[e]>t[n]&&(n=parseInt(e,10));return n}function f(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),(e^=e>>>16)>>>0}let p=new Uint32Array([597399067,2869860233,951274213,2716044179]);function m(e,t){return e<<t|e>>>32-t}function h(e,t=0){if(t=t?0|t:0,typeof e==`string`&&(e=function(e){if(typeof TextEncoder<`u`)return new TextEncoder().encode(e).buffer;let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return new Uint8Array(t).buffer}(e)),!(e instanceof ArrayBuffer))throw TypeError(`Expected key to be ArrayBuffer or string`);let n=new Uint32Array([t,t,t,t]);(function(e,t){let n=e.byteLength/16|0,r=new Uint32Array(e,0,4*n);for(let e=0;e<n;e++){let n=r.subarray(4*e,4*(e+1));n[0]=Math.imul(n[0],p[0]),n[0]=m(n[0],15),n[0]=Math.imul(n[0],p[1]),t[0]^=n[0],t[0]=m(t[0],19),t[0]+=t[1],t[0]=Math.imul(t[0],5)+1444728091,n[1]=Math.imul(n[1],p[1]),n[1]=m(n[1],16),n[1]=Math.imul(n[1],p[2]),t[1]^=n[1],t[1]=m(t[1],17),t[1]+=t[2],t[1]=Math.imul(t[1],5)+197830471,n[2]=Math.imul(n[2],p[2]),n[2]=m(n[2],17),n[2]=Math.imul(n[2],p[3]),t[2]^=n[2],t[2]=m(t[2],15),t[2]+=t[3],t[2]=Math.imul(t[2],5)+2530024501,n[3]=Math.imul(n[3],p[3]),n[3]=m(n[3],18),n[3]=Math.imul(n[3],p[0]),t[3]^=n[3],t[3]=m(t[3],13),t[3]+=t[0],t[3]=Math.imul(t[3],5)+850148119}})(e,n),function(e,t){let n=e.byteLength/16|0,r=e.byteLength%16,i=new Uint32Array(4),a=new Uint8Array(e,16*n,r);switch(r){case 15:i[3]^=a[14]<<16;case 14:i[3]^=a[13]<<8;case 13:i[3]^=a[12],i[3]=Math.imul(i[3],p[3]),i[3]=m(i[3],18),i[3]=Math.imul(i[3],p[0]),t[3]^=i[3];case 12:i[2]^=a[11]<<24;case 11:i[2]^=a[10]<<16;case 10:i[2]^=a[9]<<8;case 9:i[2]^=a[8],i[2]=Math.imul(i[2],p[2]),i[2]=m(i[2],17),i[2]=Math.imul(i[2],p[3]),t[2]^=i[2];case 8:i[1]^=a[7]<<24;case 7:i[1]^=a[6]<<16;case 6:i[1]^=a[5]<<8;case 5:i[1]^=a[4],i[1]=Math.imul(i[1],p[1]),i[1]=m(i[1],16),i[1]=Math.imul(i[1],p[2]),t[1]^=i[1];case 4:i[0]^=a[3]<<24;case 3:i[0]^=a[2]<<16;case 2:i[0]^=a[1]<<8;case 1:i[0]^=a[0],i[0]=Math.imul(i[0],p[0]),i[0]=m(i[0],15),i[0]=Math.imul(i[0],p[1]),t[0]^=i[0]}}(e,n),function(e,t){t[0]^=e.byteLength,t[1]^=e.byteLength,t[2]^=e.byteLength,t[3]^=e.byteLength,t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0,t[0]=f(t[0]),t[1]=f(t[1]),t[2]=f(t[2]),t[3]=f(t[3]),t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0}(e,n);let r=new Uint8Array(n.buffer);return Array.from(r).map((e=>e.toString(16).padStart(2,`0`))).join(``)}async function g(e){for(;!document.body;)await _(50);let t=document.createElement(`iframe`);t.setAttribute(`frameBorder`,`0`);let n=t.style;n.setProperty(`position`,`fixed`),n.setProperty(`display`,`block`,`important`),n.setProperty(`visibility`,`visible`),n.setProperty(`border`,`0`),n.setProperty(`opacity`,`0`),t.src=`about:blank`,document.body.appendChild(t);let r=t.contentDocument||t.contentWindow?.document;if(!r)throw Error(`Iframe document is not accessible`);e({iframe:r}),setTimeout((()=>{document.body.removeChild(t)}),0)}function _(e,t){return new Promise((n=>setTimeout(n,e,t)))}let ee=`Arial.Arial Black.Arial Narrow.Arial Rounded MT.Arimo.Archivo.Barlow.Bebas Neue.Bitter.Bookman.Calibri.Cabin.Candara.Century.Century Gothic.Comic Sans MS.Constantia.Courier.Courier New.Crimson Text.DM Mono.DM Sans.DM Serif Display.DM Serif Text.Dosis.Droid Sans.Exo.Fira Code.Fira Sans.Franklin Gothic Medium.Garamond.Geneva.Georgia.Gill Sans.Helvetica.Impact.Inconsolata.Indie Flower.Inter.Josefin Sans.Karla.Lato.Lexend.Lucida Bright.Lucida Console.Lucida Sans Unicode.Manrope.Merriweather.Merriweather Sans.Montserrat.Myriad.Noto Sans.Nunito.Nunito Sans.Open Sans.Optima.Orbitron.Oswald.Pacifico.Palatino.Perpetua.PT Sans.PT Serif.Poppins.Prompt.Public Sans.Quicksand.Rajdhani.Recursive.Roboto.Roboto Condensed.Rockwell.Rubik.Segoe Print.Segoe Script.Segoe UI.Sora.Source Sans Pro.Space Mono.Tahoma.Taviraj.Times.Times New Roman.Titillium Web.Trebuchet MS.Ubuntu.Varela Round.Verdana.Work Sans`.split(`.`),v=[`monospace`,`sans-serif`,`serif`];function y(e,t){return e.font=`72px ${t}`,e.measureText(`WwMmLli0Oo`).width}function te(){let e=document.createElement(`canvas`),t=e.getContext(`webgl`)??e.getContext(`experimental-webgl`);if(t&&`getParameter`in t)try{let e=(t.getParameter(t.VENDOR)||``).toString(),n=(t.getParameter(t.RENDERER)||``).toString(),r={vendor:e,renderer:n,version:(t.getParameter(t.VERSION)||``).toString(),shadingLanguageVersion:(t.getParameter(t.SHADING_LANGUAGE_VERSION)||``).toString()};if(!n.length||!e.length){let e=t.getExtension(`WEBGL_debug_renderer_info`);if(e){let n=(t.getParameter(e.UNMASKED_VENDOR_WEBGL)||``).toString(),i=(t.getParameter(e.UNMASKED_RENDERER_WEBGL)||``).toString();n&&(r.vendorUnmasked=n),i&&(r.rendererUnmasked=i)}}return r}catch{}return`undefined`}function ne(){let e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]-=e[0],t[3]}let b=(e,t,n,r)=>{let i=(n-t)/r,a=0;for(let n=0;n<r;n++)a+=e(t+(n+.5)*i);return a*i};function re(e,t){let n={};return t.forEach((t=>{let r=function(e){if(e.length===0)return null;let t={};e.forEach((e=>{let n=String(e);t[n]=(t[n]||0)+1}));let n=e[0],r=1;return Object.keys(t).forEach((e=>{t[e]>r&&(n=e,r=t[e])})),n}(e.map((e=>t in e?e[t]:void 0)).filter((e=>e!==void 0)));r&&(n[t]=r)})),n}let ie=`accelerometer.accessibility.accessibility-events.ambient-light-sensor.background-fetch.background-sync.bluetooth.camera.clipboard-read.clipboard-write.device-info.display-capture.gyroscope.geolocation.local-fonts.magnetometer.microphone.midi.nfc.notifications.payment-handler.persistent-storage.push.speaker.storage-access.top-level-storage-access.window-management.query`.split(`.`);function ae(){if(typeof navigator>`u`)return{name:`unknown`,version:`unknown`};let e=[{name:`Brave`,detect:()=>!!navigator.brave}];for(let t of e)if(t.detect()){let e=oe(navigator.userAgent);return{name:t.name,version:e.version}}return oe(navigator.userAgent)}function oe(e){let t=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>OPR|OPX)\/(?<version>\d+(?:\.\d+)+)/,/Opera[\s\/](?<version>\d+(?:\.\d+)+)/,/Opera Mini\/(?<version>\d+(?:\.\d+)+)/,/Opera Mobi\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Vivaldi)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>CriOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>FxiOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Chrome|Chromium)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\/(?<version>\d+(?:\.\d+)+)/,/Version\/(?<version1>[\d.]+).*Safari\/[\d.]+|(?<name>Safari)\/(?<version2>[\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)+)/,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)+)/],n={edg:`Edge`,edga:`Edge`,edgios:`Edge`,opr:`Opera`,opx:`Opera`,crios:`Chrome`,fxios:`Firefox`,samsung:`SamsungBrowser`,vivaldi:`Vivaldi`};for(let r of t){let t=e.match(r);if(t){let e=t.groups?.name,i=t.groups?.version||t.groups?.version1||t.groups?.version2;if(e||!t.groups?.version1&&!t.groups?.version2||(e=`Safari`),!e&&r.source.includes(`Opera Mini`)&&(e=`Opera Mini`),!e&&r.source.includes(`Opera Mobi`)&&(e=`Opera Mobi`),!e&&r.source.includes(`Opera`)&&(e=`Opera`),!e&&t[1]&&(e=t[1]),!i&&t[2]&&(i=t[2]),e)return{name:n[e.toLowerCase()]||e,version:i||`unknown`}}}return{name:`unknown`,version:`unknown`}}function se(){if(typeof navigator>`u`||!navigator.userAgent)return!1;let e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function ce(){let e=[],t={"prefers-contrast":[`high`,`more`,`low`,`less`,`forced`,`no-preference`],"any-hover":[`hover`,`none`],"any-pointer":[`none`,`coarse`,`fine`],pointer:[`none`,`coarse`,`fine`],hover:[`hover`,`none`],update:[`fast`,`slow`],"inverted-colors":[`inverted`,`none`],"prefers-reduced-motion":[`reduce`,`no-preference`],"prefers-reduced-transparency":[`reduce`,`no-preference`],scripting:[`none`,`initial-only`,`enabled`],"forced-colors":[`active`,`none`]};return Object.keys(t).forEach((n=>{t[n].forEach((t=>{matchMedia(`(${n}: ${t})`).matches&&e.push(`${n}: ${t}`)}))})),e}function le(){if(window.location.protocol===`https:`&&typeof window.ApplePaySession==`function`)try{let e=window.ApplePaySession.supportsVersion;for(let t=15;t>0;t--)if(e(t))return t}catch{return 0}return 0}let ue=ae().name===`SamsungBrowser`?3:1,x,S=null;function C(e){let t=[];return function e(n){if(n&&n.toJSON&&typeof n.toJSON==`function`&&(n=n.toJSON()),n===void 0)return;if(typeof n==`number`)return isFinite(n)?``+n:`null`;if(typeof n!=`object`)return JSON.stringify(n);let r,i;if(Array.isArray(n)){for(i=`[`,r=0;r<n.length;r++)r&&(i+=`,`),i+=e(n[r])||`null`;return i+`]`}if(n===null)return`null`;if(t.indexOf(n)!==-1)throw TypeError(`Converting circular structure to JSON`);let a=t.push(n)-1,o=Object.keys(n).sort();for(i=``,r=0;r<o.length;r++){let t=o[r],a=e(n[t]);a&&(i&&(i+=`,`),i+=JSON.stringify(t)+`:`+a)}return t.splice(a,1),`{`+i+`}`}(e)||``}let de=[`𝔄`,`𝔅`,`ℭ`,`𝔇`,`𝔈`,`𝔉`,`𝔸`,`𝔹`,`ℂ`,`𝔻`,`𝔼`,`𝔽`],fe=[`β`,`ψ`,`λ`,`ε`,`ζ`,`α`,`ξ`,`μ`,`ρ`,`φ`,`κ`,`τ`,`η`,`σ`,`ι`,`ω`,`γ`,`ν`,`χ`,`δ`,`θ`,`π`,`υ`,`ο`];function w(e,t){return`<math><mrow>${t}</mrow></math>`}function pe(){let e=`<mo>∏</mo>`;return de.forEach(((t,n)=>{let r=2*n,i=fe.slice(r,r+2);i.length===2&&(e+=`<mmultiscripts><mi>${t}</mi><none/><mi>${i[1]}</mi><mprescripts></mprescripts><mi>${i[0]}</mi><none/></mmultiscripts>`)})),w(0,`<munderover><mmultiscripts>${e}</mmultiscripts></munderover>`)}function me(){let e=[];return de.forEach(((t,n)=>{let r=2*n,i=fe.slice(r,r+2);i.length===2&&e.push(w(0,`<mmultiscripts><mi>${t}</mi><none/><mi>${i[1]}</mi><mprescripts></mprescripts><mi>${i[0]}</mi><none/></mmultiscripts>`))})),e}let he={audio:async function(){return c?async function(){return new Promise(((e,t)=>{try{let t=new c(1,5e3,44100),n=t.createBufferSource(),r=t.createOscillator();r.frequency.value=1e3;let i=t.createDynamicsCompressor(),a;i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.2,r.connect(i),i.connect(t.destination),r.start(),t.oncomplete=r=>{a=r.renderedBuffer.getChannelData(0),e({sampleHash:l(a),maxChannels:t.destination.maxChannelCount,channelCountMode:n.channelCountMode})},t.startRendering()}catch(e){console.error(`Error creating audio fingerprint:`,e),t(e)}}))}():null},canvas:async function(){return new Promise((e=>{let t=Array.from({length:3},(()=>function(){let e=document.createElement(`canvas`),t=e.getContext(`2d`);if(!t)return null;e.width=280,e.height=20;let n=t.createLinearGradient(0,0,e.width,e.height);n.addColorStop(0,`red`),n.addColorStop(1/6,`orange`),n.addColorStop(2/6,`yellow`),n.addColorStop(.5,`green`),n.addColorStop(4/6,`blue`),n.addColorStop(5/6,`indigo`),n.addColorStop(1,`violet`),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);let r=`Random Text WMwmil10Oo`;return t.font=`23.123px Arial`,t.fillStyle=`black`,t.fillText(r,-5,15),t.fillStyle=`rgba(0, 0, 255, 0.5)`,t.fillText(r,-3.3,17.7),t.beginPath(),t.moveTo(0,0),t.lineTo(2*e.width/7,e.height),t.strokeStyle=`white`,t.lineWidth=2,t.stroke(),t.getImageData(0,0,e.width,e.height)}())).filter((e=>e!==null));t.length===0?e(null):e({commonPixelsHash:h(u(t,280,20).data.toString()).toString()})}))},fonts:async function(e){return new Promise((e=>{try{g((async({iframe:t})=>{let n=t.createElement(`canvas`).getContext(`2d`);if(!n)return void e(null);let r=v.map((e=>y(n,e))),i={};ee.forEach((e=>{let t=y(n,e);r.includes(t)||(i[e]=t)})),e(i)}))}catch{e(null)}}))},hardware:function(){return new Promise(((e,t)=>{let n=navigator.deviceMemory===void 0?0:navigator.deviceMemory,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:te(),architecture:ne(),deviceMemory:n.toString()||`undefined`,jsHeapSizeLimit:r.jsHeapSizeLimit||0})}))},locales:function(){return new Promise((e=>{e({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))},math:function(){return new Promise((e=>{e({acos:Math.acos(.5),asin:b(Math.asin,-1,1,97),cos:b(Math.cos,0,Math.PI,97),largeCos:Math.cos(0x56bc75e2d63100000),largeSin:Math.sin(0x56bc75e2d63100000),largeTan:Math.tan(0x56bc75e2d63100000),sin:b(Math.sin,-Math.PI,Math.PI,97),tan:b(Math.tan,0,2*Math.PI,97)})}))},permissions:async function(e){let t=e?.permissions_to_check||ie;return re(await Promise.all(Array.from({length:3},(()=>async function(e){let t={};for(let n of e)try{t[n]=(await navigator.permissions.query({name:n})).state.toString()}catch{}return t}(t)))),t)},plugins:async function(){let e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){let n=navigator.plugins[t];e.push([n.name,n.filename,n.description].join(`|`))}return new Promise((t=>{t({plugins:e})}))},screen:function(){return new Promise((e=>{if(typeof matchMedia>`u`||typeof screen>`u`)return void e(null);let t={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:ce()};se()&&navigator.maxTouchPoints>0&&(t.resolution=function(){let e=window.screen.width,t=window.screen.height;return`${Math.max(e,t).toString()}x${Math.min(e,t).toString()}`}()),e(t)}))},system:function(){return new Promise((e=>{let t=ae();e({platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:t.name,version:t.version},mobile:se(),applePayVersion:le(),cookieEnabled:window.navigator.cookieEnabled})}))},webgl:async function(){typeof document<`u`&&(x=document.createElement(`canvas`),x.width=200,x.height=100,S=x.getContext(`webgl`));try{if(!S)throw Error(`WebGL not supported`);return{commonPixelsHash:h(u(Array.from({length:ue},(()=>function(){try{if(!S)throw Error(`WebGL not supported`);let e=S.createShader(S.VERTEX_SHADER),t=S.createShader(S.FRAGMENT_SHADER);if(!e||!t)throw Error(`Failed to create shaders`);if(S.shaderSource(e,`
2
+ attribute vec2 position;
3
+ void main() {
4
+ gl_Position = vec4(position, 0.0, 1.0);
5
+ }
6
+ `),S.shaderSource(t,`
7
+ precision mediump float;
8
+ void main() {
9
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
10
+ }
11
+ `),S.compileShader(e),!S.getShaderParameter(e,S.COMPILE_STATUS))throw Error(`Vertex shader compilation failed: `+S.getShaderInfoLog(e));if(S.compileShader(t),!S.getShaderParameter(t,S.COMPILE_STATUS))throw Error(`Fragment shader compilation failed: `+S.getShaderInfoLog(t));let n=S.createProgram();if(!n)throw Error(`Failed to create shader program`);if(S.attachShader(n,e),S.attachShader(n,t),S.linkProgram(n),!S.getProgramParameter(n,S.LINK_STATUS))throw Error(`Shader program linking failed: `+S.getProgramInfoLog(n));S.useProgram(n);let r=new Float32Array(548),i=2*Math.PI/137;for(let e=0;e<137;e++){let t=e*i;r[4*e]=0,r[4*e+1]=0,r[4*e+2]=Math.cos(t)*(x.width/2),r[4*e+3]=Math.sin(t)*(x.height/2)}let a=S.createBuffer();S.bindBuffer(S.ARRAY_BUFFER,a),S.bufferData(S.ARRAY_BUFFER,r,S.STATIC_DRAW);let o=S.getAttribLocation(n,`position`);S.enableVertexAttribArray(o),S.vertexAttribPointer(o,2,S.FLOAT,!1,0,0),S.viewport(0,0,x.width,x.height),S.clearColor(0,0,0,1),S.clear(S.COLOR_BUFFER_BIT),S.drawArrays(S.LINES,0,274);let s=new Uint8ClampedArray(x.width*x.height*4);return S.readPixels(0,0,x.width,x.height,S.RGBA,S.UNSIGNED_BYTE,s),new ImageData(s,x.width,x.height)}catch{return new ImageData(1,1)}finally{S&&(S.bindBuffer(S.ARRAY_BUFFER,null),S.useProgram(null),S.viewport(0,0,S.drawingBufferWidth,S.drawingBufferHeight),S.clearColor(0,0,0,0))}}())),x.width,x.height).data.toString()).toString()}}catch{return{webgl:`unsupported`}}},webrtc:async function(e){return new Promise((t=>{try{let n=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!n)return void t({supported:!1,error:`WebRTC not supported`});let r=new n({iceCandidatePoolSize:1,iceServers:[]});r.createDataChannel(``),(async()=>{try{let n=await r.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});await r.setLocalDescription(n);let i=n.sdp||``,a=[...new Set((i.match(/extmap:\d+ [^\n\r]+/g)||[]).map((e=>e.replace(/extmap:\d+ /,``))))].sort(),o=e=>{let t=i.match(RegExp(`m=${e} [^\\s]+ [^\\s]+ ([^\\n\\r]+)`));return t?t[1].split(` `):[]},s=(e,t)=>t.map((t=>{let n=RegExp(`(rtpmap|fmtp|rtcp-fb):${t} (.+)`,`g`),r=[...i.matchAll(n)];if(!r.length)return null;let a={};return r.forEach((t=>{let[n,r,i]=t,o=i.split(`/`);r===`rtpmap`?(a.mimeType=`${e}/${o[0]}`,a.clockRate=+o[1],e===`audio`&&(a.channels=+o[2]||1)):r===`rtcp-fb`?(a.feedbackSupport=a.feedbackSupport||[],a.feedbackSupport.push(i)):r===`fmtp`&&(a.sdpFmtpLine=i)})),a})).filter(Boolean),c=s(`audio`,o(`audio`)),l=s(`video`,o(`video`)),u={audio:{count:c.length,hash:h(C(c))},video:{count:l.length,hash:h(C(l))},extensionsHash:h(C(a))},d=e?.timeout||5e3,f=Math.floor(.9*d),p=await new Promise((e=>{let t=setTimeout((()=>{r.removeEventListener(`icecandidate`,n),r.close(),e({supported:!0,...u,timeout:!0})}),f),n=i=>{let a=i.candidate;a&&a.candidate&&(clearTimeout(t),r.removeEventListener(`icecandidate`,n),r.close(),e({supported:!0,...u,candidateType:a.type||``}))};r.addEventListener(`icecandidate`,n)}));t({details:p,hash:h(C(p))})}catch(e){r.close(),t({supported:!0,error:`WebRTC offer failed: ${e.message}`})}})()}catch(e){t({supported:!1,error:`WebRTC error: ${e.message}`})}}))},speech:async function(){return new Promise((e=>{try{if(typeof window>`u`||!window.speechSynthesis||typeof window.speechSynthesis.getVoices!=`function`)return void e({supported:!1,error:`Speech Synthesis API not supported`});let t=!1,n=null,r=r=>{if(!t){t=!0,n&&clearTimeout(n);try{let t=r.map((e=>{let t=e=>e.replace(/\\/g,`\\\\`).replace(/,/g,`\\,`);return[t(e.voiceURI||``),t(e.name||``),t(e.lang||``),e.localService?`1`:`0`,e.default?`1`:`0`].join(`,`)}));t.sort();let n={voiceCount:r.length,voicesHash:h(C(t))};e({details:n,hash:h(C(n))})}catch(t){e({supported:!0,error:`Voice processing failed: ${t.message}`})}}},i=window.speechSynthesis.getVoices();if(i.length>0)return void r(i);n=setTimeout((()=>{r(window.speechSynthesis.getVoices())}),800);let a=()=>{window.speechSynthesis.removeEventListener(`voiceschanged`,a),r(window.speechSynthesis.getVoices())};window.speechSynthesis.addEventListener(`voiceschanged`,a)}catch(t){e({supported:!1,error:`Speech Synthesis error: ${t.message}`})}}))}},ge={mathml:async function(){return new Promise((e=>{try{g((async({iframe:t})=>{try{if(!function(e){try{let t=e.createElement(`math`);t.innerHTML=`<mrow><mi>x</mi></mrow>`,t.style.position=`absolute`,t.style.visibility=`hidden`,e.body.appendChild(t);let n=t.getBoundingClientRect();return e.body.removeChild(t),n.width>0&&n.height>0}catch{return!1}}(t))return void e({supported:!1,error:`MathML not supported`});let n=[w(`integral`,`<msubsup><mo>∫</mo><mi>a</mi><mi>b</mi></msubsup><mfrac><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mrow><mi>g</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mfrac><mi>dx</mi>`),w(`fraction`,`<mfrac><mrow><mi>π</mi><mo>×</mo><msup><mi>r</mi><mn>2</mn></msup></mrow><mrow><mn>2</mn><mi>σ</mi></mrow></mfrac>`),w(`matrix`,`<mo>[</mo><mtable><mtr><mtd><mi>α</mi></mtd><mtd><mi>β</mi></mtd></mtr><mtr><mtd><mi>γ</mi></mtd><mtd><mi>δ</mi></mtd></mtr></mtable><mo>]</mo>`),pe(),...me()],r=[],i=``;n.forEach(((e,n)=>{let a=function(e,t){try{let n=t.createElement(`math`);n.innerHTML=e.replace(/<\/?math>/g,``),n.style.whiteSpace=`nowrap`,n.style.position=`absolute`,n.style.visibility=`hidden`,n.style.top=`-9999px`,t.body.appendChild(n);let r=n.getBoundingClientRect(),i=(t.defaultView||window).getComputedStyle(n),a={dimensions:{width:r.width,height:r.height},fontInfo:{fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontStyle:i.fontStyle,lineHeight:i.lineHeight,fontVariant:i.fontVariant||`normal`,fontStretch:i.fontStretch||`normal`,fontSizeAdjust:i.fontSizeAdjust||`none`,textRendering:i.textRendering||`auto`,fontFeatureSettings:i.fontFeatureSettings||`normal`,fontVariantNumeric:i.fontVariantNumeric||`normal`,fontKerning:i.fontKerning||`auto`}};return t.body.removeChild(n),a}catch(e){return{error:e.message}}}(e,t);r.push({width:a.dimensions.width,height:a.dimensions.height}),n===0&&a.fontInfo&&(i=h(C(a.fontInfo)))}));let a={fontStyleHash:i,dimensions:r};e({details:a,hash:h(C(a))})}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}}))}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}}))}},_e={},ve={timeout:`true`};function ye(e,t){let n=ae();if(n.name===`unknown`&&t){let e=t.system?.browser;e!=null&&e.name&&(n={name:String(e.name),version:String(e.version||`unknown`)})}let r=n.name.toLowerCase(),i=parseInt(n.version.split(`.`)[0]||`0`,10),a=[...e?.exclude||[]],o=[...new Set([...e?.stabilize||[],`always`])];for(let e of o){let t=s[e];if(t)for(let e of t)`browsers`in e&&!e.browsers?.some((e=>{let t=e.match(/(.+?)(>=)(\d+)/);return t?r===t[1]&&i>=+t[3]:r===e}))||a.push(...e.exclude)}return a}function be(e,t){let n=ye(t,e),r=t?.include||[];return function e(t,i=``){let a={};for(let[o,s]of Object.entries(t)){let t=i?`${i}.${o}`:o;if(typeof s!=`object`||Array.isArray(s)||s===null){let e=n.some((e=>t.startsWith(e))),i=r.some((e=>t.startsWith(e)));e&&!i||(a[o]=s)}else{let n=e(s,t);Object.keys(n).length>0&&(a[o]=n)}}return a}(e)}let xe=`visitor_id`;function Se(e){return e.storage_property_name?e.storage_property_name:e.property_name_factory(xe)}let Ce=`${i}_${xe}`;function we(e,t){try{localStorage.setItem(Se(t),e)}catch{}}let Te=`cache`;function T(e){try{let t=localStorage.getItem(e.property_name_factory(Te));return JSON.parse(t)||{}}catch{}return{}}function Ee(e){return e.cache_lifetime_in_ms>r?Date.now()+r:Date.now()+e.cache_lifetime_in_ms}var E=class extends Error{constructor(e){super(`HTTP error! status: ${e}`),this.status=e}};let D=null,O=null;async function De(e,t,n,r){let i=await fetch(e,{method:`POST`,headers:{"x-api-key":n.api_key,Authorization:`custom-authorized`,"Content-Type":`application/json`},body:JSON.stringify(t)});if(!i.ok)throw new E(i.status);let a=await i.json();return a.visitorId&&a.visitorId!==r&&we(a.visitorId,n),O=a,function(e,t){!e.cache_api_call||!e.cache_lifetime_in_ms||(function(e,t){let n={...T(e),...t};try{localStorage.setItem(e.property_name_factory(Te),JSON.stringify(n))}catch{}})(e,{apiResponseExpiry:Ee(e),apiResponse:t})}(n,a),a}let Oe=(e,t)=>{if(e.cache_api_call){if(O)return Promise.resolve(O);let t=function(e){let t=T(e);if(t&&t.apiResponse&&t.apiResponseExpiry&&Date.now()<=t.apiResponseExpiry)return t.apiResponse}(e);if(t)return Promise.resolve(t);if(D)return D}let n=`${e.api_endpoint||a}/thumbmark`,r=function(e){try{let t=Se(e),n=localStorage.getItem(t);return n||t===Ce||(n=localStorage.getItem(Ce),n&&we(n,e)),n}catch{return null}}(e),i={components:t,options:e,clientHash:h(C(t)),version:`1.7.6`};if(r&&(i.visitorId=r),e.metadata){let t=typeof e.metadata==`function`?e.metadata():e.metadata;t&&((typeof t==`string`?t.length:JSON.stringify(t).length)>1e3?console.error(`ThumbmarkJS: Metadata exceeds 1000 characters. Skipping metadata.`):i.metadata=t)}let o=e.timeout||5e3,s=async function(e,t,n,r){for(let i=0;i<3;i++){i>0&&await new Promise((e=>setTimeout(e,200*i)));try{return await De(e,t,n,r)}catch(e){if(e instanceof E||i===2)throw e}}throw Error(`Unreachable`)}(n,i,e,r).finally((()=>{D=null})),c=new Promise((t=>{setTimeout((()=>{t(T(e)?.apiResponse||{info:{timed_out:!0},...r&&{visitorId:r}})}),o)}));return D=Promise.race([s,c]),D};async function ke(e,t={}){var n;if(typeof document>`u`||typeof window>`u`)return{thumbmark:``,components:{},info:{},version:`1.7.6`,error:[{type:`fatal`,message:`Browser environment required`}]};try{let r={...o,...e},i=[],s=r.logging&&!sessionStorage.getItem(`_tmjs_l`)&&Math.random()<1e-4,{elapsed:c,resolvedComponents:l,errors:u}=await Ae({...he,..._e,...t},r);i.push(...u);let d={},f={};if(s||r.experimental){let{elapsed:e,resolvedComponents:t,errors:n}=await Ae(ge,r);d=t,f=e,i.push(...n)}let p=r.api_key?Oe(r,l):null,m=null;if(p)try{m=await p}catch(e){if(e instanceof E&&e.status===403)return{error:[{type:`api_unauthorized`,message:`Invalid API key or quota exceeded`}],components:{},info:{},version:`1.7.6`,thumbmark:``};i.push({type:e instanceof E?`api_error`:`network_error`,message:e instanceof Error?e.message:String(e)})}(n=m?.info)!=null&&n.timed_out&&i.push({type:`api_timeout`,message:`API request timed out`});let g={...c,...f},_=r.performance?{elapsed:g}:{},ee=be(m?.components||{},r),v={...l,...ee},y=m?.info||{uniqueness:{score:`api only`}},te=m?.thumbmark??h(C(v));return s&&async function(e,t,n,r={},i=[]){let o=`${a}/log`,s={thumbmark:e,components:t,experimental:r,version:`1.7.6`,options:n,path:(window==null?void 0:window.location)?.pathname,...i.length>0&&{errors:i}};sessionStorage.setItem(`_tmjs_l`,`1`);try{await fetch(o,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)})}catch{}}(te,v,r,d,i).catch((()=>{})),{...m?.visitorId&&{visitorId:m.visitorId},thumbmark:te,components:v,info:y,version:`1.7.6`,..._,...i.length>0&&{error:i},...Object.keys(d).length>0&&r.experimental&&{experimental:d},...m?.requestId&&{requestId:m.requestId},...m?.metadata&&{metadata:m.metadata}}}catch(e){return{thumbmark:``,components:{},info:{},version:`1.7.6`,error:[{type:`fatal`,message:e instanceof Error?e.message:String(e)}]}}}async function Ae(e,t){let n={...o,...t},r=ye(n).filter((e=>!e.includes(`.`))),i=Object.entries(e).filter((([e])=>!(n?.exclude)?.includes(e))).filter((([e])=>!r.includes(e))).filter((([e])=>(n?.include)?.some((e=>e.includes(`.`)))?(n?.include)?.some((t=>t.startsWith(e))):n?.include?.length===0||(n?.include)?.includes(e))),a=i.map((([e])=>e)),s=await function(e,t,n){return Promise.all(e.map((e=>{let r=performance.now();return Promise.race([e.then((e=>({value:e,elapsed:performance.now()-r}))).catch((e=>({value:n,elapsed:performance.now()-r,error:e instanceof Error?e.message:String(e)}))),(i=t,a=n,new Promise((e=>{setTimeout((()=>e(a)),i)}))).then((e=>({value:e,elapsed:performance.now()-r,error:`timeout`})))]);var i,a})))}(i.map((([e,n])=>n(t))),n?.timeout||5e3,ve),c={},l={},u=[];return s.forEach(((e,t)=>{let n=a[t];c[n]=e.elapsed??0,e.error===`timeout`?u.push({type:`component_timeout`,message:`Component '${n}' timed out`,component:n}):e.error&&u.push({type:`component_error`,message:e.error,component:n}),e.value!=null&&(l[n]=e.value)})),{elapsed:c,resolvedComponents:be(l,n),errors:u}}var je=class{constructor(e){this.options={...o,...e},this.customComponents={}}async get(e){return ke({...this.options,...e},this.customComponents)}getVersion(){return`1.7.6`}includeComponent(e,t){this.customComponents[e]=t}};let k=(e,t)=>{if(e==null)return t;if(typeof e==`number`)return e;let n=parseInt(e);return isNaN(n)?t:n},Me=(e,t)=>e==null?t:typeof e==`number`?`${e}px`:e||t;var Ne=n({fixLocalstorage:()=>Ie,getClientEnv:()=>M,getClientFingerprint:()=>P,isMethodSupported:()=>Ue,loadScript:()=>Pe,parsePx:()=>k,stringify:()=>Fe,toCssPx:()=>Me,transformStyle:()=>A,validateComponentProps:()=>F,withError:()=>He});let A=e=>Object.keys(e).reduce((t,n)=>(typeof e[n]==`string`?t[n]=e[n]:t[n]=`${e[n]}px`,t),{}),Pe=(e,t,n,r)=>new Promise((i,a)=>{let o=Array.from(document.scripts).find(t=>t.src===e);if(o)if(r)o.remove();else{i(o);return}let s=document.createElement(`script`);s.src=e,s.onload=()=>i(s),s.onerror=e=>a(e),t&&s.setAttribute(`nonce`,t),n&&Object.keys(n).forEach(e=>{n[e]&&(s.dataset[e]=n[e])}),document.head.appendChild(s)}),Fe=e=>Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e[n])}`),t),[]).join(`&`),Ie=()=>{let e;try{({localStorage:e}=window)}catch{let t=(()=>{let e=new Map;return{getItem(t){return e.get(t)},setItem:function(t,n){e.set(t,n)},clear:function(){e=new Map},removeItem:function(t){e.delete(t)}}})();Object.defineProperty(window,`localStorage`,{value:t}),e=t}return e},Le=()=>{let e,t=Ie();try{e=t.getItem(`i18nextLng`)}catch{}return e?e.split(`-`)[0]:``},j=e=>{try{return String(e()??``)}catch{return``}},M=()=>{let e=[window.screen.colorDepth,window.screen.height,window.screen.width,new Date().getTimezoneOffset(),Le(),j(()=>Intl.DateTimeFormat().resolvedOptions().timeZone),j(()=>window.devicePixelRatio),j(()=>navigator.hardwareConcurrency),j(()=>navigator.deviceMemory),j(()=>navigator.maxTouchPoints),j(()=>navigator.platform),j(()=>navigator.languages?.join(`,`))].join(`|`);return window.btoa(e)},Re=`_monei_fp`,ze=e=>{if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>(e%16).toString(16)).join(``)}return Array.from({length:e},()=>Math.floor(Math.random()*16).toString(16)).join(``)},N=null,Be=async()=>{if(N)return{seed:N};try{let e=Ie();if(N=e.getItem(Re),!N){N=ze(32);try{e.setItem(Re,N)}catch{}}}catch{N=ze(32)}return{seed:N}},Ve=new je({logging:!1});Ve.includeComponent(`persistent_seed`,Be);let P=async()=>{let[,e]=await He(Ve.get());return e?.thumbmark??``},He=async e=>{try{return[void 0,await e]}catch(e){return[e,void 0]}},Ue=(e,t)=>e.paymentMethods&&e.paymentMethods.includes(t),F=({props:e})=>{if(!e.paymentId&&!(e.accountId&&e.amount&&e.currency))throw Error(`You need to provide paymentId or accountId amount and currency`)},We={}.env?.STAGE||`prod`,I={}.env?.DOMAIN||`http://localhost:3001`,L={}.env?.VERSION||`v1`,Ge={domain:I,version:L,stage:We,isProduction:We===`prod`,paymentPageUrl:`${I}/${L}/payment-page/`,cardInputUrl:`${I}/${L}/inner-card-input/`,paymentModalUrl:`${I}/${L}/inner-payment-modal/`,paypalUrl:`${I}/${L}/inner-paypal/`,bizumUrl:`${I}/${L}/inner-bizum/`,bizumButtonUrl:`${I}/${L}/inner-bizum-button/`,paymentRequestUrl:`${I}/${L}/inner-payment-request/`},Ke={local:{domain:`http://card-input.localhost:1355`,paymentPageUrl:`http://payment-page.localhost:1355/`,cardInputUrl:`http://card-input.localhost:1355/`,paymentModalUrl:`http://payment-modal.localhost:1355/`,paypalUrl:`http://paypal.localhost:1355/`,bizumUrl:`http://bizum.localhost:1355/`,bizumButtonUrl:`http://bizum-button.localhost:1355/`,paymentRequestUrl:`http://payment-request.localhost:1355/`,apiUrl:`https://api.monei-dev.com/v1`,secureDomain:`https://secure.monei-dev.com`,rootDomain:`monei-dev.com`},"local-prod":{domain:`http://card-input.localhost:1355`,paymentPageUrl:`http://payment-page.localhost:1355/`,cardInputUrl:`http://card-input.localhost:1355/`,paymentModalUrl:`http://payment-modal.localhost:1355/`,paypalUrl:`http://paypal.localhost:1355/`,bizumUrl:`http://bizum.localhost:1355/`,bizumButtonUrl:`http://bizum-button.localhost:1355/`,paymentRequestUrl:`http://payment-request.localhost:1355/`,apiUrl:`https://api.monei.com/v1`,secureDomain:`https://secure.monei.com`,rootDomain:`monei.com`},tunnel:{domain:`https://card-input.monei-dev-tunnel.com`,paymentPageUrl:`https://payment-page.monei-dev-tunnel.com/`,cardInputUrl:`https://card-input.monei-dev-tunnel.com/`,paymentModalUrl:`https://payment-modal.monei-dev-tunnel.com/`,paypalUrl:`https://paypal.monei-dev-tunnel.com/`,bizumUrl:`https://bizum.monei-dev-tunnel.com/`,bizumButtonUrl:`https://bizum-button.monei-dev-tunnel.com/`,paymentRequestUrl:`https://payment-request.monei-dev-tunnel.com/`,apiUrl:`https://api.monei.com/v1`,secureDomain:`https://secure.monei.com`,rootDomain:`monei.com`},dev:{apiUrl:`https://api.monei-dev.com/v1`,secureDomain:`https://secure.monei-dev.com`,rootDomain:`monei-dev.com`},prod:{apiUrl:`https://api.monei.com/v1`,secureDomain:`https://secure.monei.com`,rootDomain:`monei.com`}},R={...Ge,...Ke[We]};var qe=n({confirmPayment:()=>Xe,createApplePaySession:()=>$e,createPayment:()=>Ze,createToken:()=>Je,getPayment:()=>Ye,getPaymentMethods:()=>V,sendPaymentReceipt:()=>Qe,validateBizumPhone:()=>et});let z=async(e,{method:t=`GET`,headers:n,body:r}={})=>{t===`POST`&&(n={"Content-Type":`application/json`,...n});let i=await fetch(`${R.apiUrl}${e}`,{method:t,headers:n,body:r?JSON.stringify(r):void 0}),[,a]=await He(i.json());if(!i.ok)throw a||Error(i.statusText);return a},B={},V=async({accountId:e,paymentId:t})=>{let n;if(t)n={paymentId:t};else if(e)n={accountId:e};else throw Error(`You need to provide paymentId or accountId`);let r=Fe(n);if(r in B)return B[r];let i=z(`/payment-methods?${r}`);return B[r]=i,i.catch(()=>delete B[r]),i},Je=async({paymentMethod:e,paymentId:t,sessionId:n,amount:r,currency:i,accountId:a,transactionType:o})=>{let s;if(t)s={paymentId:t,paymentMethod:e};else if(a)s={accountId:a,paymentMethod:e,sessionId:n,amount:r,currency:i,transactionType:o};else throw Error(`You need to provide paymentId or accountId`);let c=await z(`/tokens`,{method:`POST`,headers:{"X-Client-Env":M(),"X-Client-Fingerprint":await P()},body:s});return c.paymentToken&&!c.token&&(c.token=c.paymentToken),c},Ye=async e=>z(`/payments/${e}/client-get`),Xe=async({paymentId:e,...t})=>z(`/payments/${e}/client-confirm`,{method:`POST`,headers:{"X-Client-Env":M(),"X-Client-Fingerprint":await P()},body:t}),Ze=async({signature:e,...t})=>z(`/client-payments`,{method:`POST`,headers:{"X-Client-Env":M(),"X-Client-Fingerprint":await P(),"Client-Signature":e},body:t}),Qe=async({paymentId:e,customerEmail:t,signature:n,language:r})=>z(`/payments/${e}/client-receipt`,{method:`POST`,body:{customerEmail:t,signature:n,language:r}}),$e=async e=>z(`/apple-pay/sessions`,{method:`POST`,body:e}),et=async e=>z(`/bizum/validate-phone`,{method:`POST`,body:e});var tt=class{constructor(){this.listeners=new Map,this.destroyed=!1}on(e,t){if(this.destroyed)return{cancel:()=>{}};let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),{cancel:()=>{n.delete(t)}}}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}trigger(e,...t){if(this.destroyed)return;let n=this.listeners.get(e);if(n)for(let e of n)try{e(...t)}catch(e){console.error(e)}}off(e,t){let n=this.listeners.get(e);n&&n.delete(t)}destroy(){this.destroyed=!0,this.listeners.clear()}};function nt(e){return({React:t})=>t.forwardRef(function(n,r){let i=t.useRef(null),a=t.useRef(null),o=t.useRef(!1),s=t.useRef({});return t.useLayoutEffect(()=>{let t=i.current;if(!t)return;let s=!1,c=new e({...n});return a.current=c,c.render(t).then(()=>{s||(rt(r,c),o.current=!0)}).catch(e=>{s||console.error(e)}),()=>{s=!0,c.destroy(),a.current=null,o.current=!1,rt(r,null)}},[]),t.useEffect(()=>{!o.current||!a.current||it(s.current,n)||(s.current={...n},a.current.updateProps({...n}).catch(at))}),t.createElement(`div`,{ref:i})})}function rt(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function it(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function at(){}function ot(e){return()=>({template:`<div></div>`,inheritAttrs:!1,mounted(){let t=this.$el;this.__bridgeInstance=new e({...this.$attrs}),this.__bridgeInstance.render(t).catch(console.error)},watch:{$attrs:{handler(){this.__bridgeInstance&&this.__bridgeInstance.updateProps({...this.$attrs}).catch(()=>{})},deep:!0}},unmounted(){this.__bridgeInstance&&=(this.__bridgeInstance.destroy(),null)}})}function st(e){return({Component:t,NgModule:n,ElementRef:r,NgZone:i,Inject:a})=>{class o{constructor(e,t){this.props={},this.__bridgeInstance=null,this._prevProps={},this.elementRef=e,this.zone=t}getProps(){let e={...this.props},{zone:t}=this;for(let[n,r]of Object.entries(e))typeof r==`function`&&(e[n]=function(...e){return t.run(()=>r.apply(this,e))});return e}ngOnInit(){let t=this.elementRef.nativeElement;this.__bridgeInstance=new e(this.getProps()),this.__bridgeInstance.render(t).catch(console.error)}ngDoCheck(){this.__bridgeInstance&&!ct(this._prevProps,this.props)&&(this._prevProps={...this.props},this.__bridgeInstance.updateProps(this.getProps()).catch(()=>{}))}ngOnDestroy(){this.__bridgeInstance&&=(this.__bridgeInstance.destroy(),null)}}o.parameters=[[new a(r)],[new a(i)]],o.annotations=[new t({selector:e.prototype.__options?.tag||`bridge-component`,template:`<div></div>`,inputs:[`props`]})];class s{}return s.annotations=[new n({declarations:[o],exports:[o]})],s}}function ct(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}let lt={react:nt,vue3:ot,angular:st};function ut(e,t,n){let r=lt[e];if(!r)throw Error(`Unknown driver: ${e}. Available: ${Object.keys(lt).join(`, `)}`);return r(t)(n)}var H=class extends Error{code;constructor(e,t){super(t),this.name=`PenpalError`,this.code=e}},dt=e=>({name:e.name,message:e.message,stack:e.stack,penpalCode:e instanceof H?e.code:void 0}),ft=({name:e,message:t,stack:n,penpalCode:r})=>{let i=r?new H(r,t):Error(t);return i.name=e,i.stack=n,i},pt=class{value;transferables;constructor(e,t){this.value=e,this.transferables=t?.transferables}},U=`penpal`,W=e=>typeof e==`object`&&!!e,mt=e=>typeof e==`function`,ht=e=>W(e)&&e.namespace===U,G=e=>e.type===`SYN`,gt=e=>e.type===`ACK1`,_t=e=>e.type===`ACK2`,vt=e=>e.type===`CALL`,yt=e=>e.type===`REPLY`,bt=e=>e.type===`DESTROY`,xt=(e,t=[])=>{let n=[];for(let r of Object.keys(e)){let i=e[r];mt(i)?n.push([...t,r]):W(i)&&n.push(...xt(i,[...t,r]))}return n},St=(e,t)=>{let n=e.reduce((e,t)=>W(e)?e[t]:void 0,t);return mt(n)?n:void 0},K=e=>e.join(`.`),Ct=(e,t,n)=>({namespace:U,channel:e,type:`REPLY`,callId:t,isError:!0,...n instanceof Error?{value:dt(n),isSerializedErrorInstance:!0}:{value:n}}),wt=(e,t,n,r)=>{let i=!1,a=async a=>{if(i||!vt(a))return;r?.(`Received ${K(a.methodPath)}() call`,a);let{methodPath:o,args:s,id:c}=a,l,u;try{let e=St(o,t);if(!e)throw new H(`METHOD_NOT_FOUND`,`Method \`${K(o)}\` is not found.`);let r=await e(...s);r instanceof pt&&(u=r.transferables,r=await r.value),l={namespace:U,channel:n,type:`REPLY`,callId:c,value:r}}catch(e){l=Ct(n,c,e)}if(!i)try{r?.(`Sending ${K(o)}() reply`,l),e.sendMessage(l,u)}catch(t){throw t.name===`DataCloneError`&&(l=Ct(n,c,t),r?.(`Sending ${K(o)}() reply`,l),e.sendMessage(l)),t}};return e.addMessageHandler(a),()=>{i=!0,e.removeMessageHandler(a)}},Tt=crypto.randomUUID?.bind(crypto)??(()=>[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)),Et=class{transferables;timeout;constructor(e){this.transferables=e?.transferables,this.timeout=e?.timeout}},Dt=new Set([`apply`,`call`,`bind`]),Ot=(e,t,n=[])=>new Proxy(n.length?()=>{}:Object.create(null),{get(r,i){if(i!==`then`)return n.length&&Dt.has(i)?Reflect.get(r,i):Ot(e,t,[...n,i])},apply(t,r,i){return e(n,i)}}),kt=e=>new H(`CONNECTION_DESTROYED`,`Method call ${K(e)}() failed due to destroyed connection`),At=(e,t,n)=>{let r=!1,i=new Map,a=e=>{if(!yt(e))return;let{callId:t,value:r,isError:a,isSerializedErrorInstance:o}=e,s=i.get(t);s&&(i.delete(t),n?.(`Received ${K(s.methodPath)}() call`,e),a?s.reject(o?ft(r):r):s.resolve(r))};return e.addMessageHandler(a),{remoteProxy:Ot((a,o)=>{if(r)throw kt(a);let s=Tt(),c=o[o.length-1],l=c instanceof Et,{timeout:u,transferables:d}=l?c:{},f=l?o.slice(0,-1):o;return new Promise((r,o)=>{let c=u===void 0?void 0:window.setTimeout(()=>{i.delete(s),o(new H(`METHOD_CALL_TIMEOUT`,`Method call ${K(a)}() timed out after ${u}ms`))},u);i.set(s,{methodPath:a,resolve:r,reject:o,timeoutId:c});try{let r={namespace:U,channel:t,type:`CALL`,id:s,methodPath:a,args:f};n?.(`Sending ${K(a)}() call`,r),e.sendMessage(r,d)}catch(e){o(new H(`TRANSMISSION_FAILED`,e.message))}})},n),destroy:()=>{r=!0,e.removeMessageHandler(a);for(let{methodPath:e,reject:t,timeoutId:n}of i.values())clearTimeout(n),t(kt(e));i.clear()}}},jt=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},Mt=`deprecated-penpal`,Nt=e=>W(e)&&`penpal`in e,Pt=e=>e.split(`.`),Ft=e=>e.join(`.`),It=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Lt=e=>new H(`TRANSMISSION_FAILED`,`Unexpected message to translate: ${It(e)}`),Rt=e=>{if(e.penpal===`syn`)return{namespace:U,channel:void 0,type:`SYN`,participantId:Mt};if(e.penpal===`ack`)return{namespace:U,channel:void 0,type:`ACK2`};if(e.penpal===`call`)return{namespace:U,channel:void 0,type:`CALL`,id:e.id,methodPath:Pt(e.methodName),args:e.args};if(e.penpal===`reply`)return e.resolution===`fulfilled`?{namespace:U,channel:void 0,type:`REPLY`,callId:e.id,value:e.returnValue}:{namespace:U,channel:void 0,type:`REPLY`,callId:e.id,isError:!0,...e.returnValueIsError?{value:e.returnValue,isSerializedErrorInstance:!0}:{value:e.returnValue}};throw Lt(e)},zt=e=>{if(gt(e))return{penpal:`synAck`,methodNames:e.methodPaths.map(Ft)};if(vt(e))return{penpal:`call`,id:e.id,methodName:Ft(e.methodPath),args:e.args};if(yt(e))return e.isError?{penpal:`reply`,id:e.callId,resolution:`rejected`,...e.isSerializedErrorInstance?{returnValue:e.value,returnValueIsError:!0}:{returnValue:e.value}}:{penpal:`reply`,id:e.callId,resolution:`fulfilled`,returnValue:e.value};throw Lt(e)},Bt=({messenger:e,methods:t,timeout:n,channel:r,log:i})=>{let a=Tt(),o,s=[],c=!1,l=xt(t),{promise:u,resolve:d,reject:f}=jt(),p=n===void 0?void 0:setTimeout(()=>{f(new H(`CONNECTION_TIMEOUT`,`Connection timed out after ${n}ms`))},n),m=()=>{for(let e of s)e()},h=()=>{if(c)return;s.push(wt(e,t,r,i));let{remoteProxy:n,destroy:a}=At(e,r,i);s.push(a),clearTimeout(p),c=!0,d({remoteProxy:n,destroy:m})},g=()=>{let t={namespace:U,type:`SYN`,channel:r,participantId:a};i?.(`Sending handshake SYN`,t);try{e.sendMessage(t)}catch(e){f(new H(`TRANSMISSION_FAILED`,e.message))}},_=t=>{if(i?.(`Received handshake SYN`,t),t.participantId===o&&o!==Mt||(o=t.participantId,g(),!(a>o||o===Mt)))return;let n={namespace:U,channel:r,type:`ACK1`,methodPaths:l};i?.(`Sending handshake ACK1`,n);try{e.sendMessage(n)}catch(e){f(new H(`TRANSMISSION_FAILED`,e.message));return}},ee=t=>{i?.(`Received handshake ACK1`,t);let n={namespace:U,channel:r,type:`ACK2`};i?.(`Sending handshake ACK2`,n);try{e.sendMessage(n)}catch(e){f(new H(`TRANSMISSION_FAILED`,e.message));return}h()},v=e=>{i?.(`Received handshake ACK2`,e),h()},y=e=>{G(e)&&_(e),gt(e)&&ee(e),_t(e)&&v(e)};return e.addMessageHandler(y),s.push(()=>e.removeMessageHandler(y)),g(),u},Vt=e=>{let t=!1,n;return(...r)=>(t||(t=!0,n=e(...r)),n)},Ht=new WeakSet,Ut=({messenger:e,methods:t={},timeout:n,channel:r,log:i})=>{if(!e)throw new H(`INVALID_ARGUMENT`,`messenger must be defined`);if(Ht.has(e))throw new H(`INVALID_ARGUMENT`,`A messenger can only be used for a single connection`);Ht.add(e);let a=[e.destroy],o=Vt(t=>{if(t){let t={namespace:U,channel:r,type:`DESTROY`};try{e.sendMessage(t)}catch{}}for(let e of a)e();i?.(`Connection destroyed`)}),s=e=>ht(e)&&e.channel===r;return{promise:(async()=>{try{e.initialize({log:i,validateReceivedMessage:s}),e.addMessageHandler(e=>{bt(e)&&o(!1)});let{remoteProxy:c,destroy:l}=await Bt({messenger:e,methods:t,timeout:n,channel:r,log:i});return a.push(l),c}catch(e){throw o(!0),e}})(),destroy:()=>{o(!0)}}},Wt=class{#e;#t;#n;#r;#i;#a=new Set;#o;#s=!1;constructor({remoteWindow:e,allowedOrigins:t}){if(!e)throw new H(`INVALID_ARGUMENT`,`remoteWindow must be defined`);this.#e=e,this.#t=t?.length?t:[window.origin]}initialize=({log:e,validateReceivedMessage:t})=>{this.#n=e,this.#r=t,window.addEventListener(`message`,this.#d)};sendMessage=(e,t)=>{if(G(e)){let n=this.#l(e);this.#e.postMessage(e,{targetOrigin:n,transfer:t});return}if(gt(e)||this.#s){let n=this.#s?zt(e):e,r=this.#l(e);this.#e.postMessage(n,{targetOrigin:r,transfer:t});return}if(_t(e)){let{port1:n,port2:r}=new MessageChannel;this.#o=n,n.addEventListener(`message`,this.#f),n.start();let i=[r,...t||[]],a=this.#l(e);this.#e.postMessage(e,{targetOrigin:a,transfer:i});return}if(this.#o){this.#o.postMessage(e,{transfer:t});return}throw new H(`TRANSMISSION_FAILED`,`Cannot send message because the MessagePort is not connected`)};addMessageHandler=e=>{this.#a.add(e)};removeMessageHandler=e=>{this.#a.delete(e)};destroy=()=>{window.removeEventListener(`message`,this.#d),this.#u(),this.#a.clear()};#c=e=>this.#t.some(t=>t instanceof RegExp?t.test(e):t===e||t===`*`);#l=e=>{if(G(e))return`*`;if(!this.#i)throw new H(`TRANSMISSION_FAILED`,`Cannot send message because the remote origin is not established`);return this.#i===`null`&&this.#t.includes(`*`)?`*`:this.#i};#u=()=>{this.#o?.removeEventListener(`message`,this.#f),this.#o?.close(),this.#o=void 0};#d=({source:e,origin:t,ports:n,data:r})=>{if(e===this.#e){if(Nt(r)){this.#n?.(`Please upgrade the child window to the latest version of Penpal.`),this.#s=!0;try{r=Rt(r)}catch(e){this.#n?.(`Failed to translate deprecated message: ${e.message}`);return}}if(this.#r?.(r)){if(!this.#c(t)){this.#n?.(`Received a message from origin \`${t}\` which did not match allowed origins \`[${this.#t.join(`, `)}]\``);return}if(G(r)&&(this.#u(),this.#i=t),_t(r)&&!this.#s){if(this.#o=n[0],!this.#o){this.#n?.(`Ignoring ACK2 because it did not include a MessagePort`);return}this.#o.addEventListener(`message`,this.#f),this.#o.start()}for(let e of this.#a)e(r)}}};#f=({data:e})=>{if(this.#r?.(e))for(let t of this.#a)t(e)}};let q={RENDERED:`RENDERED`,RESIZE:`RESIZE`,DESTROY:`DESTROY`,BEFORE_CLOSE:`BEFORE_CLOSE`,DISPLAY:`DISPLAY`},Gt=new Set([`onClose`,`onDestroy`,`onRendered`,`onRender`,`onDisplay`,`onResize`,`onProps`]);function J(e){e&&e.remove()}function Y(e){return typeof e==`number`?`${e}px`:e}let Kt={"monei-card-input":`allow-scripts allow-forms allow-same-origin`,"monei-bizum":`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,"monei-bizum-button":`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,"monei-paypal":`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,"monei-payment-request":`allow-scripts allow-forms allow-same-origin allow-popups`,"monei-payment-modal":`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,"monei-google-pay":`allow-scripts allow-forms allow-same-origin allow-popups`};function qt(e){if(!e)throw Error(`render() requires a container element or selector`);if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw Error(`Container not found: ${e}`);return t}return e}function Jt(e){return`${e}-${Math.random().toString(36).slice(2,9)}`}function Yt(e,t){let n=[[`onClose`,q.DESTROY],[`onDestroy`,q.DESTROY],[`onRendered`,q.RENDERED],[`onResize`,q.RESIZE]];for(let[r,i]of n)t.on(i,(...t)=>{let n=e[r];typeof n==`function`&&n(...t)})}function Xt(e){let{props:t,options:n,state:r,dispatchMap:i}=e,a={},o=new Set(n.computedProps?Object.keys(n.computedProps):[]);if(n.computedProps)for(let[e,o]of Object.entries(n.computedProps)){let n=o.factory({props:t,state:r});o.type===`function`?i.set(e,n):a[e]=n}for(let[e,n]of Object.entries(t))Gt.has(e)||o.has(e)||(typeof n==`function`?i.set(e,n):a[e]=n);let s=new Set([`close`,`resize`,`show`,`hide`,`getParentDomain`,`focus`]);return{dataProps:a,functionNames:[...i.keys()].filter(e=>!s.has(e))}}function Zt(e,t){let n={dispatchMap:new Map,connection:null,remote:null,containerEl:null,frame:null,destroyed:!1,ownsContainer:!1,pendingPropsUpdate:null,pendingRemovals:new Set},r=!1,i=!1;n.dispatchMap.set(`resize`,i=>{let{autoResize:a}=t,o={};i.width!==void 0&&(!a||a.width===!0)&&(o.width=i.width),i.height!==void 0&&(!a||a.height===!0)&&(o.height=i.height),n.frame&&(o.width!==void 0&&(n.frame.style.width=Y(o.width)),o.height!==void 0&&(n.frame.style.height=Y(o.height))),r||(r=!0,e.event.trigger(q.RENDERED)),e.event.trigger(q.RESIZE,o)}),n.dispatchMap.set(`close`,()=>e.close()),n.dispatchMap.set(`show`,()=>{n.frame&&(n.frame.style.display=``)}),n.dispatchMap.set(`hide`,()=>{n.frame&&(n.frame.style.display=`none`)}),n.dispatchMap.set(`getParentDomain`,()=>window.location.origin),n.dispatchMap.set(`focus`,()=>{n.frame&&n.frame.focus()}),e.render=async a=>{if(n.destroyed)throw Error(`Component is destroyed`);if(n.frame)throw Error(`Component already rendered`);let o=qt(a),s=Jt(t.tag),c=o.ownerDocument,l=c.createElement(`iframe`);l.src=t.url,l.setAttribute(`title`,t.tag.replace(/-/g,`_`)),l.setAttribute(`allowpaymentrequest`,`true`),l.setAttribute(`allow`,`payment`),l.style.border=`none`;let u=Kt[t.tag]??`allow-scripts allow-forms allow-same-origin`;l.setAttribute(`sandbox`,u),i||=(Yt(e.props,e.event),!0);let d=[],f={on(t,n){let r=e.event.on(t,n);return d.push(r),r},once(t,n){let r=e.event.once(t,n);return d.push(r),r},trigger(t,...n){e.event.trigger(t,...n)},off(t,n){e.event.off(t,n)},destroy(){e.event.destroy()}},p,m,h={},g=[];try{t.prerenderTemplate&&(p=t.prerenderTemplate({uid:s,frame:l,placeholder:void 0,doc:c,props:e.props,event:f,dimensions:t.dimensions??{width:`100%`,height:`auto`},state:e.state,container:o})),t.containerTemplate&&(m=t.containerTemplate({uid:s,frame:l,placeholder:p,doc:c,props:e.props,event:f,dimensions:t.dimensions??{width:`100%`,height:`auto`},state:e.state,container:o})),{dataProps:h,functionNames:g}=Xt({props:e.props,options:t,state:e.state,dispatchMap:n.dispatchMap})}catch(e){for(let e of d)e.cancel();let t=new Set([`close`,`resize`,`show`,`hide`,`getParentDomain`,`focus`]);for(let e of n.dispatchMap.keys())t.has(e)||n.dispatchMap.delete(e);throw e}n.frame=l;let _=()=>{l.contentWindow&&l.contentWindow.postMessage({type:`__monei_bridge_init__`,props:h,functionNames:g},new URL(t.url).origin)};try{if(m?(o.appendChild(m),n.containerEl=m,n.ownsContainer=!0):(o.appendChild(l),n.containerEl=o),e.event.trigger(q.DISPLAY),l.addEventListener(`load`,_),l.contentWindow&&_(),!l.contentWindow)throw Error(`iframe contentWindow is not available — frame may not be in the DOM`);let i=Ut({messenger:new Wt({remoteWindow:l.contentWindow,allowedOrigins:[new URL(t.url).origin]}),methods:{callParent:(e,t)=>{let r=n.dispatchMap.get(e);if(!r)throw Error(`Unknown parent method: ${e}`);return r(...t)}}});n.connection=i;let a;try{a=await i.promise}catch(e){if(n.destroyed)return;throw e}if(n.destroyed||(n.remote=a,e.state.__callChild=a.callChild,await a.updateProps(h,g),n.destroyed))return;if(n.pendingPropsUpdate){let e=n.pendingPropsUpdate;n.pendingPropsUpdate=null;let t=new Set(e.functionNames??[]),r=new Map;for(let i of Object.keys(e.dataProps))n.dispatchMap.has(i)&&!t.has(i)&&(r.set(i,n.dispatchMap.get(i)),n.pendingRemovals.add(i));if(await n.remote.updateProps(e.dataProps,e.functionNames),n.destroyed)return;for(let[e,t]of r)n.pendingRemovals.delete(e),n.dispatchMap.get(e)===t&&n.dispatchMap.delete(e)}r||(r=!0,e.event.trigger(q.RENDERED)),l.removeEventListener(`load`,_)}catch(t){l.removeEventListener(`load`,_);for(let e of d)e.cancel();delete e.state.__callChild,n.connection&&=(n.connection.destroy(),null),n.remote=null,n.frame=null,n.ownsContainer&&n.containerEl?n.containerEl.remove():l.parentNode&&l.remove(),n.containerEl=null,n.ownsContainer=!1,n.pendingPropsUpdate=null,n.pendingRemovals.clear();let i=new Set([`close`,`resize`,`show`,`hide`,`getParentDomain`,`focus`]);for(let e of n.dispatchMap.keys())i.has(e)||n.dispatchMap.delete(e);throw r=!1,t}},e.updateProps=async r=>{if(n.destroyed)throw Error(`Component is destroyed`);let i=en(r,t.aliases);if(Object.assign(e.props,i),!n.frame)return;let a={},o=[],s=new Set(t.computedProps?Object.keys(t.computedProps):[]),c=new Map;for(let[e,t]of Object.entries(i))if(!(Gt.has(e)||s.has(e)))if(typeof t==`function`){let r=n.pendingPropsUpdate!=null&&e in n.pendingPropsUpdate.dataProps,i=n.pendingRemovals.has(e);(!n.dispatchMap.has(e)||r||i)&&o.push(e),n.dispatchMap.set(e,t)}else n.dispatchMap.has(e)&&n.remote&&(c.set(e,n.dispatchMap.get(e)),n.pendingRemovals.add(e)),a[e]=t;let l=o.length>0?o:void 0;if(n.remote){await n.remote.updateProps(a,l);for(let[e,t]of c)n.pendingRemovals.delete(e),n.dispatchMap.get(e)===t&&n.dispatchMap.delete(e)}else{if(n.pendingPropsUpdate||={dataProps:{},functionNames:void 0},Object.assign(n.pendingPropsUpdate.dataProps,a),n.pendingPropsUpdate.functionNames){let e=Object.keys(a);if(e.length>0){let t=new Set(e);n.pendingPropsUpdate.functionNames=n.pendingPropsUpdate.functionNames.filter(e=>!t.has(e)),n.pendingPropsUpdate.functionNames.length===0&&(n.pendingPropsUpdate.functionNames=void 0)}}if(l){for(let e of l)delete n.pendingPropsUpdate.dataProps[e];n.pendingPropsUpdate.functionNames=[...n.pendingPropsUpdate.functionNames??[],...l]}}},e.destroy=async()=>{n.destroyed||(n.destroyed=!0,e.event.trigger(q.DESTROY),n.connection&&=(n.connection.destroy(),null),n.remote=null,n.frame&&=(n.frame.remove(),null),n.ownsContainer&&n.containerEl&&n.containerEl.remove(),e.event.destroy(),n.dispatchMap.clear())},e.close=async()=>{await e.destroy()},e.__renderState=n}let Qt={react:`@monei-js/react-components`,vue3:`@monei-js/vue-components`,angular:`@monei-js/angular-components`};function $t(e){let t=Qt[e],n=t?`Use ${t} instead.`:``;console.warn(`[MONEI] .driver('${e}') is deprecated. ${n}`.trim())}function en(e,t){if(!t)return e;let n=new Map;for(let[e,r]of Object.entries(t))n.set(r,e);let r={};for(let[t,i]of Object.entries(e)){let e=n.get(t)??t;r[e]=i}return r}function X(e){class t{constructor(t){this.state={},this.event=new tt;let n=en(t,e.aliases);e.defaultProps?this.props={...e.defaultProps({event:this.event}),...n}:this.props={...n},e.validate&&e.validate({props:this.props}),Zt(this,e),e.submit&&(this.submit=e.submit(this))}async render(e){throw Error(`render() not attached`)}async updateProps(e){throw Error(`updateProps() not attached — call render() first`)}async close(){throw Error(`close() not attached`)}async destroy(){throw Error(`destroy() not attached`)}driver(e,n){return $t(e),ut(e,t,n)}}function n(e){return this instanceof n?new t(e):new n(e)}return n.prototype=t.prototype,n.driver=function(e,t){return $t(e),ut(e,n,t)},t.prototype.__options=e,n}let Z=function(e){return e.VISIBLE=`is-visible`,e.INVISIBLE=`is-invisible`,e}({});function tn(e={}){let{background:t=`#fff`,overflow:n,borderRadius:r,fadeOnRender:i=!0,allowTransparency:a=!1,modal:o=!1}=e;return function({uid:e,frame:s,placeholder:c,doc:l,props:u,event:d,dimensions:{width:f,height:p}}){if(!s)return;a&&(s.setAttribute(`allowtransparency`,`true`),s.style.background=`transparent`);let m=l.createElement(`div`);m.setAttribute(`id`,e);let h=l.createElement(`style`);if(u?.cspNonce&&h.setAttribute(`nonce`,u.cspNonce),o){let t=l.createElement(`div`);t.classList.add(`backdrop`),h.appendChild(l.createTextNode(`
12
+ #${e} {
13
+ position: fixed;
14
+ inset: 0;
15
+ z-index: 99999;
16
+ }
17
+ #${e} > .backdrop {
18
+ position: fixed;
19
+ inset: 0;
20
+ background-color: rgba(40, 40, 40, 0.7);
21
+ opacity: 0;
22
+ transition: opacity 0.35s ease-in-out;
23
+ will-change: opacity;
24
+ }
25
+ #${e} > .backdrop.${Z.VISIBLE} {
26
+ opacity: 1;
27
+ }
28
+ #${e} > iframe {
29
+ display: block;
30
+ position: absolute;
31
+ width: 100%;
32
+ height: 100%;
33
+ top: 0;
34
+ left: 0;
35
+ transition: opacity .2s ease-in-out;
36
+ }
37
+ #${e} > iframe.${Z.INVISIBLE} {
38
+ opacity: 0;
39
+ }
40
+ #${e} > iframe.${Z.VISIBLE} {
41
+ opacity: 1;
42
+ }
43
+ `)),m.appendChild(t),m.appendChild(s),c&&m.appendChild(c),m.appendChild(h),d.on(q.DISPLAY,()=>{t.offsetHeight,requestAnimationFrame(()=>t.classList.add(Z.VISIBLE))}),d.on(q.BEFORE_CLOSE,()=>{t.classList.remove(Z.VISIBLE)}),s.classList.add(Z.INVISIBLE),i&&c&&c.classList.add(Z.VISIBLE),d.on(q.RENDERED,()=>{i?(c&&(c.classList.remove(Z.VISIBLE),c.classList.add(Z.INVISIBLE)),s.classList.remove(Z.INVISIBLE),s.classList.add(Z.VISIBLE),setTimeout(()=>J(c),1)):(c&&J(c),s.style.transition=`none`,s.classList.remove(Z.INVISIBLE),s.classList.add(Z.VISIBLE))})}else{let o=u?.style||u?.innerStyle,g=p===`0`?`0`:Y(o?.base?.height||o?.height||(p===`auto`?45:p)),_=[`display: block`,`position: relative`,`width: ${f}`,`height: ${a?p:g}`,`background: ${t}`];n&&_.push(`overflow: ${n}`),r&&_.push(`border-radius: ${r}`),h.appendChild(l.createTextNode(`
44
+ #${e} {
45
+ ${_.join(`;
46
+ `)};
47
+ }
48
+ #${e} > iframe {
49
+ display: block;
50
+ position: absolute;
51
+ width: 100%;
52
+ height: 100%;
53
+ top: 0;
54
+ left: 0;
55
+ transition: opacity .2s ease-in-out;
56
+ }
57
+ #${e} > iframe.${Z.INVISIBLE} {
58
+ opacity: 0;
59
+ }
60
+ #${e} > iframe.${Z.VISIBLE} {
61
+ opacity: 1;
62
+ }
63
+ `)),m.appendChild(s),c&&m.appendChild(c),m.appendChild(h),d.on(q.RESIZE,({width:e,height:t})=>{typeof e==`number`&&(m.style.width=Y(e)),typeof t==`number`&&(m.style.height=Y(t))}),c&&(s.classList.add(Z.INVISIBLE),i&&c.classList.add(Z.VISIBLE),d.on(q.RENDERED,()=>{i?(c.classList.remove(Z.VISIBLE),c.classList.add(Z.INVISIBLE),s.classList.remove(Z.INVISIBLE),s.classList.add(Z.VISIBLE),setTimeout(()=>J(c),1)):(J(c),s.style.transition=`none`,s.classList.remove(Z.INVISIBLE),s.classList.add(Z.VISIBLE))}))}return m}}let Q=tn({overflow:`hidden`,borderRadius:`var(--monei-radius, 4px)`}),nn=tn({modal:!0}),rn=e=>{if(e.state?.__createToken)return e.state.__createToken;throw Error(`Index is not registered`)},an=async(e,t)=>{console.warn(`[MONEI] Standalone createToken() is deprecated. Use cardInput.submit() instead.`);let{data:n}=await rn(e)(t);return n},on=X({tag:`monei-card-input`,url:R.cardInputUrl,dimensions:{width:`100%`,height:`auto`},autoResize:{width:!1,height:!0},aliases:{sessionId:`orderId`,style:`innerStyle`},computedProps:{__getConfig:{factory:({props:e})=>V.bind(null,e),type:`function`}},validate:F,submit:e=>async t=>{let n=e.state?.__createToken;if(!n)throw Error(`CardInput is not rendered or connection is pending — call render() first`);let{data:r}=await n(t);return r},containerTemplate:e=>(e.state.__createToken=async(t={})=>{let n=e.state.__callChild;if(!n)throw Error(`CardInput instance is not registered`);return{data:await n(`createToken`,[t])}},Q(e)),prerenderTemplate:({doc:e,props:t})=>{let n=e.createElement(`html`),r=e.createElement(`body`);r.style.margin=`0`,r.style.background=`#fff`;let i=e.createElement(`div`);i.style.height=`45px`,i.style.boxSizing=`border-box`;let a=t.style||t.innerStyle;return a?.base&&Object.assign(i.style,A(a.base)),a?.loading&&Object.assign(i.style,A(a.loading)),r.appendChild(i),n.appendChild(r),n}}),sn=X({tag:`monei-payment-modal`,url:R.paymentModalUrl,dimensions:{width:`100%`,height:`100%`},autoResize:{width:!1,height:!1},aliases:{style:`innerStyle`},containerTemplate:tn({background:`transparent`,fadeOnRender:!1,allowTransparency:!0})}),cn=e=>{let t=document.createElement(`div`),n=document.body.style.overflow;Object.assign(document.body.style,{overflow:`hidden`}),Object.assign(t.style,{position:`fixed`,overflow:`hidden`,display:`block`,top:`0`,bottom:`0`,left:`0`,right:`0`,width:`100%`,height:`100%`,zIndex:`99999`}),document.body.appendChild(t);let r=null,i=()=>{r?.destroy(),r=null,Object.assign(document.body.style,{overflow:n}),t.parentNode&&t.parentNode.removeChild(t)};return new Promise((n,a)=>{r=new sn({...e,isOpen:!0,onResult:e=>{n(e),i()},onError:e=>{a(e),i()}}),r.render(t).catch(e=>{i(),a(e)})})},$=`monei-paypal`,ln=async(e,t,n)=>{t.__scriptId=(await Pe(n,e.cspNonce,{namespace:$,cspNonce:e.cspNonce},!0)).dataset.uidAuto;let r={layout:`horizontal`,tagline:!1,height:45},i=k(e.style?.borderRadius??e.borderRadius);i&&(r.borderRadius=i);let a={...r,...e.style};a.height=k(a.height,45),e.onLoad?.(!0);let o;await window[$].Buttons({createOrder:async()=>{try{let t=await Je({paymentId:e.paymentId,accountId:e.accountId,sessionId:e.sessionId,amount:e.amount,currency:e.currency,transactionType:e.transactionType,paymentMethod:{paypal:{}}});return{token:o}=t,t.paypal?.orderId}catch(t){e.onError?.(t);return}},onApprove:function(t){t.orderID?e.onSubmit({token:o}):e.onError?.(t)},onClick:function(t,n){let r=!0;if(e.onBeforeOpen&&(r=e.onBeforeOpen()),!r)return n.reject()},style:a}).render(t.__container)},un=X({tag:$,url:R.paypalUrl,dimensions:{width:`100%`,height:`0`},autoResize:{width:!1,height:!1},aliases:{style:`innerStyle`},computedProps:{__getConfig:{factory:({props:e})=>V.bind(null,e),type:`function`},__onLoadPayPal:{factory:({props:e,state:t})=>ln.bind(null,e,t),type:`function`}},containerTemplate:e=>{if(e.state.__container=e.container,!e.props.accountId&&!e.props.paymentId)throw Error(`You need to provide paymentId or accountId`);let t=Q(e);return e.event.on(q.DESTROY,()=>{window[$]?.Buttons?.instances?.forEach(e=>{e.close()});let t=e.state.__scriptId;if(t){let e=document.querySelector(`script[data-uid-auto="${t}"]`);e&&e.remove()}}),t}}),dn=X({tag:`monei-bizum`,url:R.bizumUrl,autoResize:{width:!1,height:!1},containerTemplate:e=>{if(e.frame){if(e.props.isHidden){let t=e.doc.createElement(`div`);return t.setAttribute(`id`,e.uid),t.style.display=`none`,t.appendChild(e.frame),e.placeholder&&t.appendChild(e.placeholder),t}return nn(e)}},defaultProps:({event:e})=>({onBeforeClose:()=>{e.trigger(q.BEFORE_CLOSE)}})}),fn=X({tag:`monei-bizum-button`,url:R.bizumButtonUrl,dimensions:{width:`100%`,height:`auto`},autoResize:{width:!1,height:!0},aliases:{style:`innerStyle`},computedProps:{__getConfig:{factory:({props:e})=>V.bind(null,e),type:`function`},__onClick:{factory:({props:e,state:t})=>{let n=document.createElement(`div`);return({amount:r,currency:i})=>{if(t.isOpen)return;let a=!0;if(e.onBeforeOpen&&(a=e.onBeforeOpen()),!a)return;t.isOpen=!0,n.parentNode||document.body.appendChild(n);let o=new dn({amount:r,currency:i,...e,onClose:()=>{t.isOpen=!1,window.onpopstate=null,document.body.style.overflow=``},isOpen:!0});return window.history.pushState(null,``,window.location.href),window.onpopstate=()=>o.updateProps({isOpen:!1}),Object.assign(document.body.style,{overflow:`hidden`}),o.render(n)}},type:`function`}},validate:F,containerTemplate:Q}),pn=X({tag:`monei-google-pay`,url:R.paymentRequestUrl,dimensions:{width:`100%`,height:`0`},autoResize:{width:!1,height:!0},aliases:{style:`innerStyle`},computedProps:{__getConfig:{factory:({props:e})=>V.bind(null,e),type:`function`}},validate:F,containerTemplate:Q}),mn=X({tag:`monei-payment-request`,url:R.paymentRequestUrl,dimensions:{width:`100%`,height:`auto`},autoResize:{width:!1,height:!0},aliases:{style:`innerStyle`},computedProps:{__getConfig:{factory:({props:e})=>V.bind(null,e),type:`function`}},validate:F,containerTemplate:Q}),hn=function(e){return e.CONFIRM=`CONFIRM`,e.FRICTIONLESS_CHALLENGE=`FRICTIONLESS_CHALLENGE`,e.BIZUM_CHALLENGE=`BIZUM_CHALLENGE`,e.CHALLENGE=`CHALLENGE`,e.COMPLETE=`COMPLETE`,e}({}),gn=function(e){return e.Visa=`visa`,e.Mastercard=`mastercard`,e.Amex=`amex`,e.Discover=`discover`,e.Diners=`diners`,e.JCB=`jcb`,e.Maestro=`maestro`,e.UnionPay=`unionpay`,e.Elo=`elo`,e.Hipercard=`hipercard`,e}({}),_n=function(e){return e.AUTH=`AUTH`,e.SALE=`SALE`,e.PAYOUT=`PAYOUT`,e.VERIF=`VERIF`,e}({}),vn=qe,yn=Ne;e.Bizum=fn,e.BizumModal=dn,e.CardBrand=gn,e.CardInput=on,e.GooglePay=pn,e.NextActionType=hn,e.PayPal=un,e.PaymentModal=sn,e.PaymentRequest=mn,e.TransactionType=_n,e.api=vn,e.config=R,e.confirmPayment=cn,e.createToken=an,e.utils=yn});
64
+ //# sourceMappingURL=monei.umd.production.min.js.map