@comgate/checkout-dev
Version:
Comgate pre-built checkout library
3 lines • 93 kB
JavaScript
(function(M,ie){typeof exports=="object"&&typeof module<"u"?ie(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],ie):(M=typeof globalThis<"u"?globalThis:M||self,ie(M.comgateCheckout={},M.axios))})(this,function(M,ie){"use strict";function p(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(h){s(h)}}function u(d){try{c(r.throw(d))}catch(h){s(h)}}function c(d){d.done?o(d.value):i(d.value).then(a,u)}c((r=r.apply(n,e||[])).next())})}function W(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}function Ae(n,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t}typeof SuppressedError=="function"&&SuppressedError;var _e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zt(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ht="Expected a function",Xe=0/0,Kt="[object Symbol]",Zt=/^\s+|\s+$/g,Jt=/^[-+]0x[0-9a-f]+$/i,Yt=/^0b[01]+$/i,Xt=/^0o[0-7]+$/i,Qt=parseInt,en=typeof _e=="object"&&_e&&_e.Object===Object&&_e,tn=typeof self=="object"&&self&&self.Object===Object&&self,nn=en||tn||Function("return this")(),rn=Object.prototype,on=rn.toString,sn=Math.max,an=Math.min,Te=function(){return nn.Date.now()};function ln(n,e,t){var r,i,o,s,a,u,c=0,d=!1,h=!1,g=!0;if(typeof n!="function")throw new TypeError(Ht);e=Qe(e)||0,Me(t)&&(d=!!t.leading,h="maxWait"in t,o=h?sn(Qe(t.maxWait)||0,e):o,g="trailing"in t?!!t.trailing:g);function P(w){var F=r,we=i;return r=i=void 0,c=w,s=n.apply(we,F),s}function y(w){return c=w,a=setTimeout(k,e),d?P(w):s}function be(w){var F=w-u,we=w-c,Ft=e-F;return h?an(Ft,o-we):Ft}function C(w){var F=w-u,we=w-c;return u===void 0||F>=e||F<0||h&&we>=o}function k(){var w=Te();if(C(w))return ye(w);a=setTimeout(k,be(w))}function ye(w){return a=void 0,g&&r?P(w):(r=i=void 0,s)}function br(){a!==void 0&&clearTimeout(a),c=0,r=u=i=a=void 0}function yr(){return a===void 0?s:ye(Te())}function Ye(){var w=Te(),F=C(w);if(r=arguments,i=this,u=w,F){if(a===void 0)return y(u);if(h)return a=setTimeout(k,e),P(u)}return a===void 0&&(a=setTimeout(k,e)),s}return Ye.cancel=br,Ye.flush=yr,Ye}function Me(n){var e=typeof n;return!!n&&(e=="object"||e=="function")}function un(n){return!!n&&typeof n=="object"}function cn(n){return typeof n=="symbol"||un(n)&&on.call(n)==Kt}function Qe(n){if(typeof n=="number")return n;if(cn(n))return Xe;if(Me(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Me(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=n.replace(Zt,"");var t=Yt.test(n);return t||Xt.test(n)?Qt(n.slice(2),t?2:8):Jt.test(n)?Xe:+n}var dn=ln;const et=zt(dn);var hn=Object.defineProperty,fn=(n,e,t)=>e in n?hn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,X=(n,e,t)=>(fn(n,typeof e!="symbol"?e+"":e,t),t),De=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},v=(n,e,t)=>(De(n,e,"read from private field"),t?t.call(n):e.get(n)),b=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},S=(n,e,t,r)=>(De(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),vn=(n,e,t,r)=>({set _(i){S(n,e,i,t)},get _(){return v(n,e,r)}}),_=(n,e,t)=>(De(n,e,"access private method"),t);let f=class extends Error{constructor(n,e=null,t=null){super(n),X(this,"context"),this.name="CgError",this.context=e??null,this.cause=t??null}toString(){let n=`[${this.name}] ${this.message}`;return this.context&&(n+=` Context: ${JSON.stringify(this.context)}`),this.cause&&(n+=` Cause: [${this.cause.toString()}]`),n}};function pn(n){return new Promise(e=>{const t=setTimeout(()=>{e(t)},n)})}function tt(n,e,t=!1,r=null){const i=o=>t&&Math.floor(o)>=e?Math.floor(o):o;return typeof n=="number"&&n>=e?i(n):i(r?r<e?e:r:e)}function nt(n,e,t=!1,r=null){const i=o=>t&&Math.ceil(o)<=e?Math.ceil(o):o;return typeof n=="number"&&n<e?i(n):i(r?r>e?e:r:e)}function oe(n,e,t,r=!1,i=!1,o="lower"){let s=t;return o==="lower"?s=e:Number.isFinite(o)&&(s=o),tt(nt(n,t,r,s),e,i,s)}function mn(){let n=!1;try{n=window.navigator.javaEnabled()}catch{}return{language:window.navigator.language,colorDepth:window.screen.colorDepth,screenHeight:window.screen.height,screenWidth:window.screen.width,timezone:new Date().getTimezoneOffset(),javaEnabled:n,javascriptEnabled:!0}}function gn(n=!1){const e={isSecureContext:window.isSecureContext},t=["vendor","connection","hardwareConcurrency","cookieEnabled","appCodeName","appName","appVersion","platform","product","userAgent","language","onLine","userAgentData","globalPrivacyControl","maxTouchPoints","productSub","userActivation","webdriver","doNotTrack"],r=navigator;for(const i of t)i in r&&![null,void 0].includes(r[i])&&(typeof r[i]=="object"?Object.keys(r[i]).length>0&&(e[i]=r[i]):e[i]=r[i]);return n?" Navigator: "+JSON.stringify(e):e}function rt(){return crypto&&"randomUUID"in crypto?crypto.randomUUID():it(16)}function it(n,e="-"){return(Array.isArray(n)?n:[n]).map(t=>{let r="";do r+=Math.floor(Math.random()*Date.now()).toString(32);while(r.length<t);return r.slice(0,t)}).join(e)}function bn(n,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){let t="";const r=e.length;let i=0;for(;i<n;)t+=e.charAt(Math.floor(Math.random()*r)),i+=1;return t}async function yn(n){return new Promise((e,t)=>{try{if(typeof n.foundValidator=="function"&&n.foundValidator()){n.id,e(!0);return}if(document.getElementById(n.id))n.foundValidator?typeof n.foundValidator!="function"?(console.warn("FoundValidator is not a function"),e(!1)):n.foundValidator()===!0?(n.id,e(!0)):(n.id,t("Script injected to the DOM but not loaded.")):(n.id,e(!1));else{let r=null;if(n.elementType==="script")r=document.createElement("script"),r.src=n.link,r.async=n.async??!1,r.defer=n.defer??!1;else if(n.elementType==="link")r=document.createElement("link"),r.href=n.link,r.rel=n.rel,r.as=n.as;else throw new CgError("Invalid elementType: "+n.elementType);r.id=n.id,r.addEventListener("load",()=>{typeof n.foundValidator=="function"&&n.foundValidator()===!0?(n.id,e(!0)):e(!1)}),n.elementType!=="link"&&r.addEventListener("error",i=>{n.id,t(i)}),document.head.append(r)}}catch(r){n.id,t(r)}})}const V=Object.freeze(Object.defineProperty({__proto__:null,appendScript:yn,bothBarrier:oe,delayedPromise:pn,getBrowserInfo:mn,getNavigatorDump:gn,getPseudoRandom:it,getPseudoRandomString:rt,getRandom:bn,lowerBarrier:tt,upperBarrier:nt},Symbol.toStringTag,{value:"Module"}));let Pe="https://payments.comgate.cz";const wn=ie.create({baseURL:Pe});function _n(n,e=200,t={},r={}){return new Promise((i,o)=>{Re({url:n,method:"GET",params:t},e,i,o,at(r),!1,!1,0,0)})}function ot(n,e=200,t={},r={},i={}){return new Promise((o,s)=>{Re({url:n,params:t,data:r,method:"POST"},e,o,s,at(i),!1,!1,0,0)})}function st(n){return typeof n=="string"&&/^https:\/\/[a-zA-Z0-9_.-]+/.test(n)}function Pn(n){let e=!0,t=n;t&&typeof t=="string"&&(t=t.toLowerCase().trim(),t.endsWith("/")&&(t=t.slice(0,-1)),t.startsWith("http://")&&(!window.Cypress||location.hostname!=="localhost")&&(t=t.replace("http://","https://"),console.warn(`Checkout SDK: Changing HTTP of base domain to HTTPS: '${t}'`)),st(t)&&(Pe=t,e=!1)),e&&console.warn(`Checkout SDK: Invalid base domain: '${t}'. Using default domain: '${Pe}'`)}function at(n){const{maxRetries:e,repeatDelay:t,responseValidator:r}=n;return{checkSuccessParam:n.checkSuccessParam!==!1,strictMaxRetries:n.strictMaxRetries!==!1,repeatDelay:oe(t,0,5e3,!0,!0,500),maxRetries:oe(e,0,10,!0,!0,1),responseValidator:r&&typeof r=="function"?r:null}}function Re(n,e=200,t,r,i,o=!1,s=!1,a=0,u=0){if(!n.url)throw new f("Missing URL");n.url=lt(n.url),n.headers||(n.headers={}),n.headers["X-Requested-With"]="XMLHttpRequest",n.headers["X-Cg-Origin"]=window.location.origin,wn(n).then(c=>{var d;if(Array.isArray(e)&&(e.length!==2||e[0]>e[1])&&console.warn("Invalid successCode array "+JSON.stringify(e)+" the first number must be lower or equal than the second one"),(Array.isArray(e)?c.status>=e[0]&&c.status<=e[1]:c.status===e)&&(i.checkSuccessParam&&((d=c.data)==null?void 0:d.success)===!0||!i.checkSuccessParam)){if(delete c.data.success,i.responseValidator){if(i.responseValidator(c.data,c.status,c.headers,c.config)===!0){t(c.data);return}return Promise.reject({msg:"Invalid response by custom validator.",valid:!1,response:c})}t(c.data);return}return Promise.reject({msg:"Invalid response by basic validation.",valid:!1,response:c})}).catch(c=>{var d,h;const g=(c==null?void 0:c.code)??((d=c==null?void 0:c.response)==null?void 0:d.code)??((h=c==null?void 0:c.error)==null?void 0:h.code)??"Not specified",P=g==="ETIMEDOUT",y=g==="ERR_NETWORK";let be,C;(c==null?void 0:c.valid)===!1?(be=(c==null?void 0:c.msg)||"Invalid response validation",C=c==null?void 0:c.response):(be=(c==null?void 0:c.toString())??"Unknown error",typeof c=="object"&&"response"in c&&typeof c.response=="object"?C=c.response:C=c);let k=a;if(P&&!o||y&&!s?k+=1:k=0,!i.strictMaxRetries&&k<=2||i.maxRetries>u){let ye=u+1;(P||y)&&k<1&&!i.strictMaxRetries&&(ye=u),setTimeout(()=>{Re(n,e,t,r,i,P,y,k,ye)},i.repeatDelay);return}r({url:n.url,message:be,status:(C==null?void 0:C.status)??null,expectedStatus:e,requiredSuccessResponseParam:i.checkSuccessParam,data:(C==null?void 0:C.data)??null,headers:(C==null?void 0:C.headers)??null,retries:u,maxRetries:i.maxRetries,errorCode:g,networkErrorCountInner:k})})}function lt(n){let e=n;return e.startsWith("/")&&(e=Pe+e),e}const I=Object.freeze(Object.defineProperty({__proto__:null,changeBaseDomain:Pn,expandUrl:lt,get:_n,isDomainValid:st,post:ot},Symbol.toStringTag,{value:"Module"}));var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ut={},x=Ee&&Ee.__classPrivateFieldGet||function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},je=Ee&&Ee.__classPrivateFieldSet||function(n,e,t,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t},D,q;Object.defineProperty(ut,"__esModule",{value:!0});class En{constructor(){D.set(this,!1),q.set(this,new Set)}get acquired(){return x(this,D,"f")}acquireAsync({timeout:e}={}){if(!x(this,D,"f"))return je(this,D,!0,"f"),Promise.resolve();if(e==null)return new Promise(i=>{x(this,q,"f").add(i)});let t,r;return Promise.race([new Promise(i=>{t=()=>{clearTimeout(r),i()},x(this,q,"f").add(t)}),new Promise((i,o)=>{r=setTimeout(()=>{x(this,q,"f").delete(t),o(new Error("Timed out waiting for lock"))},e)})])}tryAcquire(){return x(this,D,"f")?!1:(je(this,D,!0,"f"),!0)}release(){if(!x(this,D,"f"))throw new Error("Cannot release an unacquired lock");if(x(this,q,"f").size>0){const[e]=x(this,q,"f");x(this,q,"f").delete(e),e()}else je(this,D,!1,"f")}}var Sn=ut.default=En;D=new WeakMap,q=new WeakMap;function Q(n,e){try{return ct(Se(n,(e==null?void 0:e.ignore)??[],oe(e==null?void 0:e.maxDeep,1,15,!0,!0,5),(e==null?void 0:e.stringify)===!0,0),(e==null?void 0:e.stringify)===!0,oe(e==null?void 0:e.maxStringLength,0,3e4,!0,!0,2e4),e==null?void 0:e.linePrefixSpace)}catch(t){return"Error: "+((t==null?void 0:t.toString())??t.message)}}function ct(n,e=!1,t=15e3,r=void 0){return e?e&&typeof n!="string"?JSON.stringify(n,null,r).slice(0,t):String(n).slice(0,t):n}function Se(n,e,t,r,i){if(n instanceof Date)return r?n.toISOString():n;if(Array.isArray(n))return n.map(o=>Se(o,e,t,r));if(typeof n=="object"&&n!==null){if(t<=0)return"==deeper==";if("data"in n&&"status"in n&&"statusText"in n&&"headers"in n&&"config"in n)return dt(n);if(n instanceof Error){const{name:a,message:u,stack:c,cause:d,context:h}=n,g={name:a,message:u,stack:c,cause:d};return"context"in n&&(g.context=h),Se(g,e,3,r)}const o=["client","session","token","password","parentElement","parentNode","children","childNodes","innerHTML","outerHTML","innerText","ownerDocument","offsetParent","ownerElement","googlepayClient","window","self","document","top","parent","state","frames","navigator","doctype","documentElement","body","head","defaultView","scripts","scrollingElement","firstElementChild","lastElementChild","activeElement","styleSheets","adoptedStyleSheets","firstChild","lastChild","srcElement"],s={};for(const a in n){if(e.includes(a)){s[a]="==ignore==";continue}if(o.includes(a)){s[a]="==skip==";continue}s[a]=Se(n[a],e,t-1,r)}return s}return typeof n=="function"?"func":n}function dt(n){var e,t,r,i,o,s,a;try{return{request:{base:(e=n.config)==null?void 0:e.baseURL,url:(t=n.config)==null?void 0:t.url,data:(r=n.config)==null?void 0:r.data,params:(i=n.config)==null?void 0:i.params,method:(o=n.config)==null?void 0:o.method,timeout:(s=n.config)==null?void 0:s.timeout,headers:(a=n.config)==null?void 0:a.headers},response:{status:n.status,data:n.data,headers:n.headers}}}catch(u){return"Axios parse error: "+(u==null?void 0:u.message)}}const se=Object.freeze(Object.defineProperty({__proto__:null,clearedDeepCopy:Q,convertAxios:dt,cutOutput:ct},Symbol.toStringTag,{value:"Module"}));class ht{constructor(){X(this,"_steps",[]),X(this,"_start",new Date),X(this,"_lastStep",new Date),X(this,"_done",!1),this._lastStep=this._start,this._steps.push({message:"start",time:this._start.toISOString(),durationStart:0})}step(e,t){const r=new Date,i={message:e,time:r.toISOString(),durationStart:r.getTime()-this._start.getTime()},o=this._steps.length;(o>=2||o===1&&e!=="done")&&(this._steps[0].durationStep=0,i.durationStep=r.getTime()-this._lastStep.getTime()),t&&(i.context=t),this._steps.push(i),this._lastStep=r}done(){this.step("done"),this._done=!0}getData(){return this._steps}toString(){return"Performance: "+JSON.stringify(this.getData())+` Final: ${this._done?"Y":"N"}`}}var G,Le,R,ae,Ne,B,O,z,ee,Ue,ft,H,te;let j=(G=class{constructor(n){if(b(this,z),b(this,Ue),b(this,H),b(this,Le,new Sn),b(this,R,{}),b(this,ae,!1),b(this,Ne,0),b(this,B,0),b(this,O,[]),this.addTransports(n).using<=0)throw new Error("No transports defined.")}getTransports(){return v(this,O)}addTransports(n){const e=Array.isArray(n)?n:[n];let t=0;for(const r of e)v(this,O).some(i=>i.getId()===r.getId())||(v(this,O).push(r),t++);return S(this,B,v(this,O).length),{added:t,using:v(this,B)}}removeTransports(n){const e=v(this,B),t=v(this,O).filter(i=>n.getId()!==i.getId()),r=t.length;return r>0?(S(this,O,t),S(this,B,r),{removed:e-r,using:r}):{removed:0,using:e}}async info(n,e){return _(this,H,te).call(this,{message:n,level:G.LEVELS.INFO,..._(this,z,ee).call(this,e)})}async warn(n,e){return _(this,H,te).call(this,{message:n,level:G.LEVELS.WARN,..._(this,z,ee).call(this,e)})}async error(n,e){return _(this,H,te).call(this,{message:n,level:G.LEVELS.ERROR,..._(this,z,ee).call(this,e)})}async debug(n,e){return _(this,H,te).call(this,{message:n,level:G.LEVELS.DEBUG,..._(this,z,ee).call(this,e)})}async log(n,e){return _(this,H,te).call(this,{message:n,level:(e==null?void 0:e.level)||G.LEVELS.INFO,..._(this,z,ee).call(this,e)})}start(){return new ht}with(n,e){return typeof e=="object"?!1:e==null?this.removeWith(n):(v(this,R)[n]=e,S(this,ae,Object.keys(v(this,R)).length>0),!0)}removeWith(n){return n in v(this,R)?(delete v(this,R)[n],S(this,ae,Object.keys(v(this,R)).length>0),!0):!1}withPayment(n){return this.with("payment",n)}withInstance(n){return this.with("instance",n)}async withPerformance(n,e,t){try{const r=new ht;let i=null;const o=async()=>{r.done();const s=t||{level:"INFO"};s.level=s.level||"INFO",s.context=s.context||{},s.context.performance=r.getData();const a=await this.log(n,s);return i&&i(a),a};if(await e({step:r.step.bind(r),getData:r.getData.bind(r)},o),e.length===2)return new Promise(s=>{i=s});if(e.length===1)return await o()}catch{}return!1}},Le=new WeakMap,R=new WeakMap,ae=new WeakMap,Ne=new WeakMap,B=new WeakMap,O=new WeakMap,z=new WeakSet,ee=function(n){const{code:e,context:t,onlyLocal:r,dispatchNow:i,ignoreLimitCheck:o,date:s}=n??{},a={onlyLocal:r??!1,dispatchNow:i??!1,ignoreLimitCheck:o??!1};return e&&(a.code=Number(e)),t&&(a.context=Q(t)),s&&(a.date=new Date(s)),v(this,ae)&&(a.details=Q(v(this,R),{maxDeep:1})),a},Ue=new WeakSet,ft=async function(){try{await v(this,Le).acquireAsync();try{return++vn(this,Ne)._}catch{return}finally{v(this,Le).release()}}catch{return}},H=new WeakSet,te=async function(n){try{if(!n.message||!n.level)return!1;typeof n.level=="string"&&(n.level=n.level.toUpperCase());let e=!1,t=!1;for(let i=0;i<v(this,B);i++){const o=v(this,O)[i];if(o.canHandleLevel(n.level)&&(e=!0,!o.isLocal())){t=!0;break}}if(!e)return!1;if(t||(n.onlyLocal=!0),n.level==="ERR"&&(n.level="ERROR"),!n.onlyLocal){const i=await _(this,Ue,ft).call(this),o=n.date||new Date;n.order=i,n.date=o;const s=n.details;n.details={...Q(s),order:i}}let r=0;for(let i=0;i<v(this,B);i++){const o=v(this,O)[i];o.canHandleLevel(n.level)&&(!n.onlyLocal||n.onlyLocal&&o.isLocal())&&(o.handle(n,v(this,R).payment),r++)}return r>0}catch(e){return console.error("Logger error",e),!1}},X(G,"LEVELS",{DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}),G);var Ve,K,le;const Ln=class Wt{constructor(e,t){if(b(this,Ve,rt()),b(this,K,{}),b(this,le,{}),this.constructor===Wt)throw new Error("Instance of Abstract Class cannot be created");S(this,le,e),S(this,K,t)}getId(){return v(this,Ve)}setConfig(e,t){const r={};return r[e]=t,this.applyConfig(r)===1}getConfig(e){if(e in v(this,K))return v(this,K)[e]}handle(e,t){throw new Error("TransportBase abstract method 'handle' has no implementation")}getType(){throw new Error("TransportBase abstract method 'handle' has no implementation")}isLocal(){throw new Error("TransportBase abstract method 'isLocal' has no implementation")}canIgnoreLimit(){return!1}canDispatchNow(){return!1}canHandleLevel(e){return v(this,K)[e.toLowerCase()]===!0}applyConfig(e){if(!e||typeof e!="object")return 0;let t=0;for(const r in e){const i=v(this,le)[r],o=Array.isArray(i);r in v(this,le)&&(!o&&typeof e[r]===i||o&&i.includes(e[r]))&&(v(this,K)[r]=e[r],t++)}return t}hole(e){(e==null?void 0:e.catch)==="function"&&e.catch(t=>{console.warn(`Failed to send logs to Comgate server.
Detail:`,t)})}};Ve=new WeakMap,K=new WeakMap,le=new WeakMap;let qe=Ln;class vt extends qe{constructor(e){super({debug:"boolean",info:"boolean",warn:"boolean",error:"boolean",prefix:"string"},{debug:!0,info:!0,warn:!0,error:!0,prefix:""}),super.applyConfig(e)}handle(e,t){var r,i,o;try{let s=e.level;e.onlyLocal&&(s="LOCAL "+s),e.level===j.LEVELS.DEBUG&&(s=` ${s} `);const a=`%c${this.getConfig("prefix")}${s}`;let u="";e.order&&(u+=` (${e.order})`),e.code&&(u+=` <${e.code}>`),(t||(r=e.details)!=null&&r.payment)&&(u+=` [${t||((i=e.details)==null?void 0:i.payment)}]`),(o=e.details)!=null&&o.instance&&(u+=` {${e.details.instance}}`),u+=":";const c=[u.trim(),e.message];switch(e.context&&(c.push(`
Context:`),c.push(e.context)),e.level){case j.LEVELS.DEBUG:console.log(a,"color:#fff;background:#444;font-weight: bold",...c);break;case j.LEVELS.INFO:console.log(a,"color:#0099e5;font-weight: bold",...c);break;case j.LEVELS.WARN:console.log(a,"color:#FFA500;font-weight: bold",...c);break;case j.LEVELS.ERROR:console.log(a,"color:#ff221e;font-weight: bold",...c);break;default:return console.log("Invalid level.",e),!1}return!0}catch{}return!1}isLocal(){return!0}canIgnoreLimit(){return!0}getType(){return"ConsoleTransport"}}const Cn=typeof btoa=="function",Ge=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder;const pt=typeof TextEncoder=="function"?new TextEncoder:void 0,In="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ue=Array.prototype.slice.call(In);(n=>{let e={};return n.forEach((t,r)=>e[t]=r),e})(ue);const A=String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);const kn=n=>n.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),xn=n=>{let e,t,r,i,o="";const s=n.length%3;for(let a=0;a<n.length;){if((t=n.charCodeAt(a++))>255||(r=n.charCodeAt(a++))>255||(i=n.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|i,o+=ue[e>>18&63]+ue[e>>12&63]+ue[e>>6&63]+ue[e&63]}return s?o.slice(0,s-3)+"===".substring(s):o},mt=Cn?n=>btoa(n):Ge?n=>Buffer.from(n,"binary").toString("base64"):xn,On=Ge?n=>Buffer.from(n).toString("base64"):n=>{let e=[];for(let t=0,r=n.length;t<r;t+=4096)e.push(A.apply(null,n.subarray(t,t+4096)));return mt(e.join(""))},An=n=>{if(n.length<2){var e=n.charCodeAt(0);return e<128?n:e<2048?A(192|e>>>6)+A(128|e&63):A(224|e>>>12&15)+A(128|e>>>6&63)+A(128|e&63)}else{var e=65536+(n.charCodeAt(0)-55296)*1024+(n.charCodeAt(1)-56320);return A(240|e>>>18&7)+A(128|e>>>12&63)+A(128|e>>>6&63)+A(128|e&63)}},Tn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Mn=n=>n.replace(Tn,An),gt=Ge?n=>Buffer.from(n,"utf8").toString("base64"):pt?n=>On(pt.encode(n)):n=>mt(Mn(n)),Be=(n,e=!1)=>e?kn(gt(n)):gt(n);var N,Z,J,Y,ce,Ce,$e,Ie,Fe,We,bt,ze,yt;class wt extends qe{constructor(e){super({debug:"boolean",info:"boolean",warn:"boolean",error:"boolean",debounce:"number",maxWait:"number",maxStack:"number"},{debug:!1,info:!0,warn:!0,error:!0,debounce:2e3,maxWait:1e4,maxStack:20}),b(this,Ce),b(this,Ie),b(this,We),b(this,ze),b(this,N,[]),b(this,Z,void 0),b(this,J,void 0),b(this,Y,{aborted:!1,time:new Date().getTime(),count:0}),b(this,ce,!1),S(this,N,[]),super.applyConfig(e),_(this,Ce,$e).call(this)}getQueueSize(){return v(this,N).length}handle(e,t){if((e.ignoreLimitCheck||[j.LEVELS.WARN,j.LEVELS.ERROR].includes(e.level))&&S(this,ce,!0),!_(this,ze,yt).call(this))return!1;t&&S(this,J,t);const r={message:e.message,level:e.level,code:e.code,order:e.order,date:e.date??new Date};if(e.context&&(r.context=Q(e.context)),e.details&&(r.details=Q(e.details)),v(this,N).push(r),e.dispatchNow||v(this,N).length>=this.getConfig("maxStack"))this.hole(this.dispatchNow());else if(v(this,Z))v(this,Z).call(this);else return!1;return!0}dispatchNow(){var e;return(e=v(this,Z))==null||e.cancel(),_(this,Ie,Fe).call(this)}applyConfig(e){const t=super.applyConfig(e);if(!e||t<=0)return 0;const r=Object.keys(e);return r.some(i=>["debounce","maxWait"].includes(i))&&_(this,Ce,$e).call(this),r.includes("maxStack")&&v(this,N).length>this.getConfig("maxStack")&&this.hole(this.dispatchNow()),t}isLocal(){return!1}canIgnoreLimit(){return!0}canDispatchNow(){return!0}getType(){return"ServerTransport"}}N=new WeakMap,Z=new WeakMap,J=new WeakMap,Y=new WeakMap,ce=new WeakMap,Ce=new WeakSet,$e=function(){var n;(n=v(this,Z))==null||n.flush(),S(this,Z,et(()=>this.hole(_(this,Ie,Fe).call(this)),this.getConfig("debounce"),{maxWait:this.getConfig("maxWait")}))},Ie=new WeakSet,Fe=async function(){const n=v(this,N);if(S(this,N,[]),n.length<=0)return Promise.resolve({invalid:!1,count:0,loggerEnabled:this.getConfig("enabled"),stackSize:n.length,server:null,error:null});const e=v(this,ce);S(this,ce,!1);const t=_(this,We,bt).call(this,n);return ot("/checkout/journal",204,{ignoreLimitCheck:e?1:0,...v(this,J)&&{id:v(this,J)}},t,{strictMaxRetries:!0,maxRetries:1,repeatDelay:500,checkSuccessParam:!1}).then(()=>Promise.resolve({invalid:!1,count:n.length})).catch(r=>Promise.resolve({invalid:!0,count:n.length,stackSize:this.getConfig("maxStack"),error:r}))},We=new WeakSet,bt=function(n){const e={...v(this,J)&&{transId:v(this,J)},encoded:!0,logs:[]};return e.logs=n.map(t=>{const{level:r,date:i,code:o,order:s,message:a,context:u,details:c}=t;return{level:r,dt:i.toISOString(),...o&&{code:o},...s&&{order:s},message:Be(a),...u&&{context:Be(JSON.stringify(u))},...c&&{details:Be(JSON.stringify(c))}}}),e},ze=new WeakSet,yt=function(){const{aborted:n,time:e,count:t}=v(this,Y);if(n)return!1;const r=window.Cypress?45:5,i=new Date().getTime();return t>r&&i-e<1500?(v(this,Y).aborted=!0,!1):(i-e<1500?++v(this,Y).count:(v(this,Y).count=0,v(this,Y).time=new Date().getTime()),!0)};function _t(n){return new j(n)}const He=_t([new vt,new wt]),ne=Object.freeze(Object.defineProperty({__proto__:null,BaseTransport:qe,ConsoleTransport:vt,Logger:j,LoggerInstance:He,ServerTransport:wt,createLogger:_t,default:He},Symbol.toStringTag,{value:"Module"}));class ${static validateUrl(e){return/^http(|s):\/\/.*/i.test(e)}static redirectGet(e,t="self"){if(!e||typeof e!="string"||!$.validateUrl(e))throw new f("Cannot GET redirect to invalid URL address.",{...arguments});const r=$.getRedirectWindow(t);try{r.location.href=e}catch{window.location.href=e}}static redirectPost(e,t,r,i="self"){if(!e||typeof e!="string"||!$.validateUrl(e))throw new f("Cannot POST redirect to invalid URL address.",{...arguments});const o=document.createElement("form");o.action=e,o.method="POST",o.enctype="multipart/form-data",o.target=$.getFormEscapeTarget(i),document.body.append(o);for(const s in t){const a=document.createElement("input");a.type="hidden",a.name=s,a.name=s,a.value=t[s],o.append(a)}r&&(o.enctype=r,o.encoding=r),o.submit()}static redirectFormPost(e,t="self"){if(!e||typeof e!="string")throw new f("Cannot redirect to invalid form.",{formDef:e,redirectMode:t});const r=document.createElement("div");r.innerHTML=e;const i=r.firstChild;if(i&&i instanceof HTMLFormElement)i.target=$.getFormEscapeTarget(t),document.body.append(i),i.submit();else throw new f("Cannot get form from virtual DIV.",{formDef:e,redirectMode:t})}static getFormEscapeTarget(e="self"){switch(e){case"parent":return"_parent";case"top":return"_top";case"self":default:return"_self"}}static getRedirectWindow(e="self"){return e==="top"&&window.top?window.top:e==="parent"&&window.parent?window.parent:e==="self"&&window.self?window.self:(He.warn("Unknown redirect mode. Redirecting to self window.",{context:{redirectMode:e}}),window)}}const wr="",Dn="1.1.7";function Rn(n,e=null){return I.get("/checkout/data/load",200,Object.assign({transId:e,checkoutId:n},{dev:null}))}function jn(n,e){return I.get("/checkout/data/payment",200,{transId:e,checkoutId:n})}function Nn(n){return I.get("/checkout/methods",200,n,{checkSuccessParam:!1,responseValidator:(e,t)=>t===200&&"methods"in e})}const ke=["cs","de","en","es","fr","hr","hu","it","no","pl","ro","si","sl","sk","sv"],Un=["CZK","EUR","PLN","HUF","USD","GBP","RON","NOK","SEK"],Pt=["ALL",...["AT","BE","CY","CZ","DE","EE","EL","ES","FI","FR","GB","HR","HU","IE","IT","LT","LU","LV","MT","NL","NO","PL","PT","RO","SL","SK","SE","US"]],Et=["CSOB","COMGATE"],Vn=["self","parent","top"],St=["applepay","googlepay","card"],qn=["PAID","AUTHORIZED","PENDING","CANCELLED"],Gn=["PAID","AUTHORIZED","CANCELLED"],Lt=["PAID","AUTHORIZED"],L=[!0,!1],Ct={style:["black","white","white-outline"],type:["plain","add-money","book","buy","check-out","continue","contribute","donate","order","pay","reload","rent","set-up","subscribe","support","tip","top-up"],disabled:L,locale:["en-US","ar-AB","ca-ES","zh-CN","zh-HK","zh-TW","hr-HR","cs-CZ","da-DK","de-DE","nl-NL","en-AU","en-GB","fi-FI","fr-CA","fr-FR","de-DE","el-GR","he-IL","hi-IN","hu-HU","id-ID","it-IT","ja-JP","ko-KR","ms-MY","nb-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","es-MX","es-ES","sv-SE","th-TH","tr-TR","uk-UA","vi-VN"],provider:Et,testEnvironment:L},It={style:["black","white"],type:["book","buy","checkout","donate","order","pay","plain","subscribe"],disabled:L,locale:["ar","bg","ca","zh","hr","cs","da","nl","en","et","fi","fr","de","el","id","it","ja","ko","ms","no","pl","pt","ru","sr","sk","sl","es","sv","th","tr","uk"],provider:Et,testEnvironment:L},kt={locale:ke,layout:["list","groups"],icons:L,expanded:L,expandable:L,disabled:L,currency:Un,country:Pt,preauth:L,embedded:L,initRecurring:L,verification:L,dynamicExpiration:L},xe={cs:{a:"cs-CZ",g:"cs"},de:{a:"de-DE",g:"de"},en:{a:"en-GB",g:"en"},es:{a:"es-ES",g:"es"},fr:{a:"fr-FR",g:"fr"},hr:{a:"hr-HR",g:"hr"},hu:{a:"hu-HU",g:"en"},it:{a:"it-IT",g:"it"},no:{a:"nb-NO",g:"no"},pl:{a:"pl-PL",g:"pl"},ro:{a:"ro-RO",g:"en"},si:{a:"en-GB",g:"sl"},sl:{a:"en-GB",g:"sl"},sk:{a:"sk-SK",g:"sk"},sv:{a:"sv-SE",g:"sv"},bg:{a:"en-GB",g:"bg"},da:{a:"da-DK",g:"da"},el:{a:"el-GR",g:"el"},et:{a:"en-GB",g:"et"},lt:{a:"en-GB",g:"en"},lv:{a:"en-GB",g:"en"},nl:{a:"nl-NL",g:"nl"},pt:{a:"pt-PT",g:"pt"}},Bn=/^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/i,xt=/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,$n=/^[1-9][0-9]*(m|h|d)$/i,Fn=/^(APPLEPAY|GOOGLEPAY|CARD|LATER|BANK|PART|LOAN|[A-Z0-9]+_([A-Z]{2})_[A-Z0-9]+)/i,Wn=typeof btoa=="function",Ke=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder;const Ot=typeof TextEncoder=="function"?new TextEncoder:void 0,zn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",de=Array.prototype.slice.call(zn);(n=>{let e={};return n.forEach((t,r)=>e[t]=r),e})(de);const T=String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);const Hn=n=>n.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),At=Wn?n=>btoa(n):Ke?n=>Buffer.from(n,"binary").toString("base64"):n=>{let e,t,r,i,o="";const s=n.length%3;for(let a=0;a<n.length;){if((t=n.charCodeAt(a++))>255||(r=n.charCodeAt(a++))>255||(i=n.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=t<<16|r<<8|i,o+=de[e>>18&63]+de[e>>12&63]+de[e>>6&63]+de[e&63]}return s?o.slice(0,s-3)+"===".substring(s):o},Kn=Ke?n=>Buffer.from(n).toString("base64"):n=>{let t=[];for(let r=0,i=n.length;r<i;r+=4096)t.push(T.apply(null,n.subarray(r,r+4096)));return At(t.join(""))},Zn=n=>{if(n.length<2){var e=n.charCodeAt(0);return e<128?n:e<2048?T(192|e>>>6)+T(128|e&63):T(224|e>>>12&15)+T(128|e>>>6&63)+T(128|e&63)}else{var e=65536+(n.charCodeAt(0)-55296)*1024+(n.charCodeAt(1)-56320);return T(240|e>>>18&7)+T(128|e>>>12&63)+T(128|e>>>6&63)+T(128|e&63)}},Jn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Yn=n=>n.replace(Jn,Zn),Tt=Ke?n=>Buffer.from(n,"utf8").toString("base64"):Ot?n=>Kn(Ot.encode(n)):n=>At(Yn(n)),Oe=(n,e=!1)=>e?Hn(Tt(n)):Tt(n);var re;class Xn extends ne.BaseTransport{constructor(e){if(super({debug:"boolean",info:"boolean",warn:"boolean",error:"boolean"},{debug:!0,info:!0,warn:!0,error:!0}),re.set(this,void 0),typeof e!="function")throw new TypeError("ExternalLogger: loggingFunction must be a function");Ae(this,re,e,"f")}handle(e,t){var r;try{if(W(this,re,"f")&&typeof W(this,re,"f")=="function")return W(this,re,"f").call(this,e.message,e.level.toLowerCase(),(r=e.code)!==null&&r!==void 0?r:null,{source:"checkout",context:e.context,details:e.details},e.onlyLocal,e.ignoreLimitCheck,e.dispatchNow),!0}catch(i){console.error("Logger: log error",i)}return!1}getType(){return"ExternalTransport"}isLocal(){return!1}canIgnoreLimit(){return!0}canDispatchNow(){return!0}}re=new WeakMap;function Mt(n){ne.default.withPayment(n)}function Qn(){ne.default.withInstance(V.getPseudoRandomString())}function er(n){const e=ne.default,t=e.getTransports();for(const r of t)(n==="remote"&&r.isLocal()||n==="local"&&!r.isLocal())&&e.removeTransports(r)}function tr(n){const e=ne.default,t=e.getTransports(),r=new Xn(n);e.addTransports(r);for(const i of t)r.getId()!==i.getId()&&e.removeTransports(i)}const m=ne.default;function Dt(n){return p(this,void 0,void 0,function*(){return I.post("/checkout/provider/payment-prepare",200,{transId:n.transactionId},{transId:n.transactionId,checkoutId:n.checkoutId,service:`${n.provider}_${n.service}`.toUpperCase(),iframe:window.self!==window.top,isInEshop:n.isInEshop},{strictMaxRetries:!0,maxRetries:2}).then(e=>{var t;return e!=null&&e.vsymbol&&(e!=null&&e.subpayment)&&Number.isInteger(e==null?void 0:e.subpayment)&&typeof(e==null?void 0:e.vsymbol)=="string"?{vsymbol:(t=e.vsymbol)===null||t===void 0?void 0:t.toString(),subpayment:e.subpayment}:Promise.reject(new f("Neplatná data odpovědi",e))}).catch(e=>(fe(n,"Error during of establishing the payer's payment","payment-prepare",e),null))})}function Rt(n){I.post("/checkout/provider/payment-init",200,{transId:n.transactionId},{transId:n.transactionId,checkoutId:n.checkoutId,payload:n.token,paymentDetails:n.cardDetails,service:`${n.provider}_${n.service}`.toUpperCase(),platbaPlatcePk:n.platbaPlatcePk},{strictMaxRetries:!0}).then(e=>{var t,r;Ze((t=e==null?void 0:e.status)!==null&&t!==void 0?t:"PENDING",(r=e==null?void 0:e.statusPP)!==null&&r!==void 0?r:"PENDING",n)||(e!=null&&e.browserInit&&ir(e.browserInit),nr(n))}).catch(e=>{fe(n,"Unexpected error during payment initialization.","payment-init",e)})}function nr(n){I.post("/checkout/provider/payment-process",200,{transId:n.transactionId},{transId:n.transactionId,checkoutId:n.checkoutId,browserInfo:JSON.stringify(V.getBrowserInfo()),browserInfoEncoded:!1,platbaPlatcePk:n.platbaPlatcePk,payload:n.token,service:`${n.provider}_${n.service}`.toUpperCase()},{maxRetries:2,repeatDelay:750}).then(e=>{var t,r;Ze((t=e==null?void 0:e.status)!==null&&t!==void 0?t:"UNKNOWN",(r=e==null?void 0:e.statusPP)!==null&&r!==void 0?r:"UNKNOWN",n)||Nt(e,n)||setTimeout(()=>{jt(n)},2e3)}).catch(e=>{fe(n,"Unexpected error during payment process.","payment-process",e)})}function jt(n){I.post("/checkout/provider/payment-status",200,{transId:n.transactionId},{transId:n.transactionId,checkoutId:n.checkoutId,platbaPlatcePk:n.platbaPlatcePk,service:`${n.provider}_${n.service}`.toUpperCase()},{maxRetries:3,repeatDelay:750}).then(e=>{var t,r;Ze((t=e==null?void 0:e.status)!==null&&t!==void 0?t:"UNKNOWN",(r=e==null?void 0:e.statusPP)!==null&&r!==void 0?r:"UNKNOWN",n)||Nt(e,n)||rr(e,n)}).catch(e=>{fe(n,"Unexpected error during payment status.","payment-status",e)})}function rr(n,e){if(e.canContinue()){if(n.retry){const t=V.lowerBarrier(n.retry,2e3,!0);setTimeout(()=>{e.canContinue()&&jt(e)},t);return}fe(e,`Invalid payment status '${n==null?void 0:n.statusPP}', with no status retry instructions.`,"payment-status-resolver",n)}}function Ze(n,e,t){if(Lt.includes(n)||Lt.includes(e))return he(t,!0),t.onPaid({service:t.service,transactionId:t.transactionId,price:t.price,currency:t.currency,status:n==="AUTHORIZED"||e==="AUTHORIZED"?"AUTHORIZED":"PAID"}),!0;if(n==="CANCELLED"||e==="CANCELLED"){t.stopProcessing(),he(t,!1);const r={scope:"payment-status",detail:{status:n,statusPP:e},params:se.clearedDeepCopy(t),service:t.service};return n==="CANCELLED"?(r.message="Payment has been cancelled.",t.onCancelled(r)):(t.showButton(),r.message="Sub payment has been cancelled.",t.onPending(r)),!0}return!1}function Nt(n,e){var t;return"3dschallenge"in n&&((t=n["3dschallenge"])!==null&&t!==void 0?t:!1)===!0&&(n!=null&&n.form)?(he(e,!0),$.redirectFormPost(n==null?void 0:n.form,e.redirectMode),!0):"browserChallenge"in n&&(n!=null&&n.browserChallenge)?(he(e,!0),$.redirectGet(n.browserChallenge,e.redirectMode),!0):!1}function he(n,e){try{if(n!=null&&n.session)window!=null&&window.ApplePaySession&&n.service==="applepay"&&"completePayment"in n.session&&(e?n.session.completePayment(window.ApplePaySession.STATUS_SUCCESS):n.session.completePayment(window.ApplePaySession.STATUS_FAILURE));else throw new f("Session is not defined.")}catch(t){m.error(`Error during closeUI with status '${e?"TRUE":"FALSE"}'.`,{code:666,source:"close-ui",context:{error:t,payload:n,status:e}})}}function ir(n){try{const e=document.querySelector("#cg-browser-init");e&&e.remove();const t=document.createElement("iframe");return t.src=n,t.id="cg-browser-init",t.style.position="fixed",t.style.top="-1000px",t.style.left="-1000px",t.style.width="1px",t.style.height="1px",document.body.append(t),!0}catch(e){return m.error("Error in createInlineIframe",{context:e}),!1}}function fe(n,e,t,r){try{n.stopProcessing(),he(n,!1),n.showButton(),n==null||n.onError({message:e,scope:t,detail:se.clearedDeepCopy(n),params:se.clearedDeepCopy(r),service:n.service})}catch(i){m.error("Error during emitError",{code:666,context:{source:"emit-error",message:e,scope:t,error:i,payload:n,detail:r}}),n==null||n.onError({message:"Unknown error during emitError.",scope:"emit-error",error:i,service:n.service})}}function Ut(n={},e="globalStoreEvent"){function t(r,i){return{get(o,s){return s==="_isProxy"?!0:(["object","array"].includes(Object.prototype.toString.call(o[s]).slice(8,-1).toLowerCase())&&!o[s]._isProxy&&(o[s]=new Proxy(o[s],t())),o[s])},set(o,s,a){return o[s]===a||(o[s]=a),!0},deleteProperty(o,s){return delete o[s],!0},has(o,s){return s in o}}}return new Proxy(n,t())}function or(){try{Object.keys(l).forEach(n=>{delete l[n]})}catch(n){m.error("Error while flushing global store",{context:{error:n}})}}const l=Ut(),Je=n=>`[ComgateCheckout DEBUG ${n}]:`,E={warn:(...n)=>{l.debug&&console.warn(Je("WARN"),...n)},info:(...n)=>{l.debug&&console.info("%c"+Je("INFO"),"color: #0389ff;font-weight:bold",...n)},error:(...n)=>{l.debug&&console.error(Je("ERR"),...n)},useDebugNotice:()=>l.debug===!0?"":" Use debug for more details."};function sr(n){return["warn","info","error"].reduce((e,t)=>(e[t]=(...r)=>{t in E&&E[t](n,...r)},e),{useDebugNotice:E.useDebugNotice})}function ar(n){if(!n||!Array.isArray(n)){E.warn("Prefetch is not valid array.");return}n.includes("googlepay")&&V.appendScript({id:"cg-prefetch-gpay",elementType:"link",rel:"prefetch",as:"script",link:"https://pay.google.com/gp/p/js/pay.js"}),n.includes("card")&&V.appendScript({id:"cg-prefetch-card",elementType:"link",rel:"prefetch",as:"document",link:"https://sec.comgate.cz/securedField.multi.html"})}function Vt(n,e=", "){return Array.isArray(n)&&n.length>0?n.join(e):""}function qt(n,e,t=", "){return e&&typeof e=="object"&&n in e?Vt(e[n],t):""}const lr={cs:{c_number:"Číslo karty",c_expiry:"Datum expirace",c_error:"Chybná hodnota",c_pay:"Zaplatit",c_payc:"Zaplatit %price% %currency%",CZK:"Kč",no_methods:"Žádné dostupné metody",group_none:"Neznámá skupina"},en:{c_number:"Card number",c_expiry:"Expiration date",c_error:"Invalid value",c_pay:"Pay",c_payc:"Pay %currency% %price%",GBP:"£",no_methods:"No available methods",group_none:"Unknown group"},de:{},fr:{},hr:{},hu:{HUF:"ft"},no:{NOK:"kr"},pl:{PLN:"zł"},ro:{RON:"lei"},si:{},sk:{},sv:{},it:{},es:{},bg:{},da:{},el:{},et:{},lt:{},lv:{},nl:{},pt:{},general:{c_secret:"CVV/CVC",CZK:"CZK",EUR:"€",PLN:"PLN",USD:"$",GBP:"GBP",RON:"RON",NOK:"NOK",SEK:"SEK",HUF:"HUF"}};function ur(n){return new cr(n??lr)}class cr{constructor(e,t={},r="cs"){Object.defineProperty(this,"_mainDictionary",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_customDictionary",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_lang",{enumerable:!0,configurable:!0,writable:!0,value:"cs"}),Object.defineProperty(this,"setLang",{enumerable:!0,configurable:!0,writable:!0,value:i=>this.isLangAvailable(i)?(this._lang=i,!0):!1}),Object.defineProperty(this,"getLang",{enumerable:!0,configurable:!0,writable:!0,value:i=>i&&this.isLangAvailable(i)?i:this._lang&&this.isLangAvailable(this._lang)?this._lang:Object.keys(this._mainDictionary)[0]||Object.keys(this._customDictionary)[0]}),Object.defineProperty(this,"t",{enumerable:!0,configurable:!0,writable:!0,value:(i,o,s)=>{const a=this.getLang(s),u=this._customDictionary[a],c=this._mainDictionary[a];if(u){if(i in u)return this.expandParams(u[i],o);const d=this._customDictionary.general;if(d&&i in d)return this.expandParams(d[i],o)}if(c){if(i in c)return this.expandParams(c[i],o);const d=this._mainDictionary.general;if(d&&i in d)return this.expandParams(d[i],o)}return this.expandParams(i,o)}}),Object.defineProperty(this,"expandParams",{enumerable:!0,configurable:!0,writable:!0,value:(i,o)=>{let s=i;return o&&typeof o=="object"&&Object.keys(o).forEach(a=>{let u=o[a];u==null&&(u=""),s=s.replaceAll(`%${a}%`,u==null?void 0:u.toString())}),s}}),Object.defineProperty(this,"updateDictionary",{enumerable:!0,configurable:!0,writable:!0,value:(i,o)=>i==="main"?(this._mainDictionary=Object.assign({},o),!0):i==="custom"?(this._customDictionary=Object.assign({},o),!0):!1}),this._mainDictionary=Object.assign({},e),this._customDictionary=Object.assign({},t),this._lang=r}isLangAvailable(e){return(e&&e in this._customDictionary||e&&e in this._mainDictionary)===!0}}class ve{constructor(e,t,r,i=!1){if(Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:V.getPseudoRandomString()}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serviceUpper",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serviceName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_checkoutRef",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_debugPrinter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serviceElements",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_mountPoints",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_translator",{enumerable:!0,configurable:!0,writable:!0,value:ur()}),Object.defineProperty(this,"_isMounted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_available",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_mappers",{enumerable:!0,configurable:!0,writable:!0,value:{locale:this.expandLocale}}),Object.defineProperty(this,"_updateValidators",{enumerable:!0,configurable:!0,writable:!0,value:{locale:this.validateLocale}}),Object.defineProperty(this,"_defaultValues",{enumerable:!0,configurable:!0,writable:!0,value:{locale:void 0,disabled:!1,testEnvironment:!1}}),Object.defineProperty(this,"_resizeDebounce",{enumerable:!0,configurable:!0,writable:!0,value:et(()=>{this.onResizeComponent()},15)}),Object.defineProperty(this,"getId",{enumerable:!0,configurable:!0,writable:!0,value:()=>this._id}),Object.defineProperty(this,"getServiceName",{enumerable:!0,configurable:!0,writable:!0,value:()=>this._service}),Object.defineProperty(this,"isValueValid",{enumerable:!0,configurable:!0,writable:!0,value:(o,s)=>{try{if(o in this._updateValidators){const a=this._updateValidators[o];if(Array.isArray(a))return a.includes(s);if(typeof a=="function")return a(s);m.error(`Invalid service '${this._service}' validator type '${o}'.`,{context:{key:o,value:s,type:typeof a}})}else m.error(`Service '${this._service}' validator not found.`,{context:{key:o,value:s}})}catch(a){m.error("Service isValueValid error",{context:{error:a,key:o,value:s}})}return!1}}),Object.defineProperty(this,"updateLocale",{enumerable:!0,configurable:!0,writable:!0,value:o=>this.updateValue("locale",o)}),Object.defineProperty(this,"updateValue",{enumerable:!0,configurable:!0,writable:!0,value:(o,s)=>{const a=this.expandValue(o,s),u=this._config[o];if(u===a)return{result:!0,reloaded:!1,isMounted:this._isMounted,detail:"Value is same as previous"};if(!this._available||!(o in this._available))return{result:!1,reason:`Invalid key '${o}' for value update.`,reloaded:!1,isMounted:this._isMounted};if(this.isValueValid(o,a))this._config[o]=a,o==="locale"&&this._translator.setLang(a);else return{result:!1,reason:`Invalid value '${a}' for key '${o}'. Allowed: [${qt(o,this._available)}].`,reloaded:!1,isMounted:this._isMounted};const c=this.onValueUpdated(o,a,u);return c&&this._isMounted&&this.renderComponents.call(this),{result:!0,reloaded:c&&this._isMounted,isMounted:this._isMounted}}}),Object.defineProperty(this,"disableInteraction",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.updateValue("disabled",!0).result}),Object.defineProperty(this,"enableInteraction",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.updateValue("disabled",!1).result}),Object.defineProperty(this,"getAllowedCurrencies",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var o;try{return(o=l["_"+this._service])===null||o===void 0?void 0:o.curr}catch(s){return m.error(`Error while getting allowed currencies for service '${this._serviceUpper}'.`,{context:s}),[]}}}),Object.defineProperty(this,"isCurrencyAllowed",{enumerable:!0,configurable:!0,writable:!0,value:o=>{try{return this.getAllowedCurrencies().includes(o)}catch(s){return m.error(`Error while checking currency '${o}' for service '${this._serviceUpper}'.`,{context:s}),!1}}}),Object.defineProperty(this,"isMounted",{enumerable:!0,configurable:!0,writable:!0,value:()=>this._isMounted}),Object.defineProperty(this,"validateMountPoints",{enumerable:!0,configurable:!0,writable:!0,value:o=>{const s=Array.isArray(o)?o:[o],a=[];return s.forEach(u=>{const c=document.querySelectorAll(u);if(!c||c.length<=0){a.push(`Service ${this._serviceUpper} mount point '${u}' not found.`);return}if(c.length===1){c[0]instanceof HTMLElement?this._mountPoints.push(c[0]):a.push(`Service ${this._serviceUpper} mount point '${u}' is not an HTMLElement type.`);return}if(c.length>1){a.push(`Service ${this._serviceUpper} mount point '${u}' has ${c.length} occurrences.`);return}a.push(`Service ${this._serviceUpper} mount point '${u}' unknown error.`)}),a.length>0?a:!0}}),Object.defineProperty(this,"mount",{enumerable:!0,configurable:!0,writable:!0,value:o=>p(this,void 0,void 0,function*(){if(this._isMounted)return{result:!1,reason:`The service ${this._serviceUpper} has already been mounted. Unmount it first.`};const s=yield this.canMakePayment();if((s==null?void 0:s.result)!==!0)return s;const a=this.validateMountPoints(o);if(a!==!0)return{result:!1,reason:`Invalid service ${this._serviceUpper} mount point.`,detail:a};this._config.enableResizeListener&&window.addEventListener("resize",this._resizeDebounce.bind(this));const u=yield this.renderComponents.call(this);return u!=null&&u.result?(this._isMounted=!0,{result:!0}):u})}),Object.defineProperty(this,"unmount",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(this._isMounted){this._config.enableResizeListener&&window.removeEventListener("resize",this._resizeDebounce.bind(this));const o=this.getMountPointElements();return o.innerHTML="",this._mountPoints=[],this._serviceElements={},this._isMounted=!1,!0}return this._debugPrinter.warn("Service not mounted."),!1}}),Object.defineProperty(this,"showLoader",{enumerable:!0,configurable:!0,writable:!0,value:(o=!0)=>{if(this.handleLoader(!0),o){if(this._checkoutRef)this._checkoutRef.handleLoader(!0,this._id);else if(this._service!=="list")throw new f("Checkout reference is not defined in "+this._serviceName+".")}this._isRunning=!0}}),Object.defineProperty(this,"hideLoader",{enumerable:!0,configurable:!0,writable:!0,value:(o=!0)=>{if(this.handleLoader(!1),o){if(this._checkoutRef)this._checkoutRef.handleLoader(!1,this._id);else if(this._service!=="list")throw new f("Checkout reference is not defined in "+this._serviceName+".")}this._isRunning=!1}}),this.constructor===ve)throw new f("Instance of Abstract Class cannot be created");this.validateLocale=this.validateLocale.bind(this),this._service=t,this._serviceUpper=t==null?void 0:t.toUpperCase(),this._serviceName=r,this._checkoutRef=e??null,this._serviceElements={},this._mountPoints=[],this._config=Ut({},this._serviceUpper+"-"+this._id),this._config.enableResizeListener=i,this._debugPrinter=sr(`(${this._serviceName})`)}init(e,t,r,i,o,s){return p(this,void 0,void 0,function*(){this._defaultValues=Object.assign(Object.assign({},this._defaultValues),o),this._updateValidators=Object.assign(Object.assign(Object.assign({},this._updateValidators),t),r),this._mappers=Object.assign(Object.assign({},this._mappers),i),this._available=t;const a=this.expandValue("locale",l.locale);this.isValueValid("locale",a)?this._defaultValues.locale=a:this._defaultValues.locale=this.expandLocale("cs");for(const u in this._available){let c=!1;const d="style"in e&&e.style&&typeof(e==null?void 0:e.style)=="object"&&u in e.style;if(u in e||d){const h=d?e.style[u]:e[u],g=this.expandValue(u,h);if(this.isValueValid(u,g)){this._config[u]=g;continue}else c=!0,this._debugPrinter.warn(`Invalid value '${g.toString()}' of config key '${u}'. Allowed: [${qt(u,this._available)}].`)}if(u in this._defaultValues)c&&this._debugPrinter.warn(`Using default value '${this._defaultValues[u]}' for key '${u}'.`),this._config[u]=this._defaultValues[u];else if(u in s)throw m.error(`Service '${this._service}' default value '${u}' is not defined.`,{context:{key:u,defaultValues:this._defaultValues}}),new f(`Invalid service configuration. Value for '${u}' is not defined.`)}return this._config.locale&&this._translator.setLang(this._config.locale),Promise.resolve(this)})}expandValue(e,t){try{if(e in this._mappers&&typeof this._mappers[e]=="function"){const r=this._mappers[e](t);return r||t}}catch(r){m.error("Service expandValue error",{context:{error:r,key:e,value:t}})}return t}canMakePayment(){return p(this,void 0,void 0,function*(){throw new Error("Abstract method 'canMakePayment' has no implementation")})}getSupportedLocales(){throw new Error("Abstract method 'getSupportedLocales' has no implementation")}expandLocale(e){throw new Error("Abstract method 'getSupportedLocales' has no implementation")}onValueUpdated(e,t,r){let i=this._isMounted;switch(e){case"disabled":i=!1,this.handleDisabled(this.getElements(),t);break}return i}handleDisabled(e,t){throw new Error("Abstract method 'handleDi