UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

1 lines 756 kB
"use strict";var e,t,n,r,o,a,i,s,l,c,u,d,p,h,y,m={},f=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function O(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function w(t,n,r){var o,a,i,s={};for(i in n)"key"==i?o=n[i]:"ref"==i?a=n[i]:s[i]=n[i];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===s[i]&&(s[i]=t.defaultProps[i]);return _(t,s,o,a,null)}function _(e,r,o,a,i){var s={type:e,props:r,key:o,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++n:i,__i:-1,__u:0};return null==i&&null!=t.vnode&&t.vnode(s),s}function P(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function S(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],a=[],i=v({},n);i.__v=n.__v+1,t.vnode&&t.vnode(i),F(e.__P,i,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,null==r?C(n):r,!!(32&n.__u),a),i.__v=n.__v,i.__.__k[i.__i]=i,L(o,i,a),n.__e=n.__=null,i.__e!=r&&j(i)}}function j(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),j(e)}function E(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!N.__r++||o!=t.debounceRendering)&&((o=t.debounceRendering)||a)(N)}function N(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(i),e=r.shift(),t=r.length,S(e)}finally{r.length=N.__r=0}}function D(e,t,n,r,o,a,i,s,l,c,u){var d,p,h,y,b,v,O,w=r&&r.__k||f,k=t.length;for(l=function(e,t,n,r,o){var a,i,s,l,c,u=n.length,d=u,p=0;for(e.__k=new Array(o),a=0;a<o;a++)null!=(i=t[a])&&"boolean"!=typeof i&&"function"!=typeof i?("string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?i=e.__k[a]=_(null,i,null,null,null):g(i)?i=e.__k[a]=_(P,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?i=e.__k[a]=_(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,l=a+p,i.__=e,i.__b=e.__b+1,s=null,-1!=(c=i.__i=T(i,n,l,d))&&(d--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(o>u?p--:o<u&&p++),"function"!=typeof i.type&&(i.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,i.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)null!=(s=n[a])&&!(2&s.__u)&&(s.__e==r&&(r=C(s)),K(s,s));return r}(n,t,w,l,k),d=0;d<k;d++)null!=(h=n.__k[d])&&(p=-1!=h.__i&&w[h.__i]||m,h.__i=d,v=F(e,h,p,o,a,i,s,l,c,u),y=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&U(p.ref,null,h),u.push(h.ref,h.__c||y,h)),null==b&&null!=y&&(b=y),(O=!!(4&h.__u))||p.__k===h.__k?(l=A(h,l,e,O),O&&p.__e&&(p.__e=null)):"function"==typeof h.type&&void 0!==v?l=v:y&&(l=y.nextSibling),h.__u&=-7);return n.__e=b,l}function A(e,t,n,r){var o,a;if("function"==typeof e.type){for(o=e.__k,a=0;o&&a<o.length;a++)o[a]&&(o[a].__=e,t=A(o[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=C(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function R(e,t){return t=t||[],null==e||"boolean"==typeof e||(g(e)?e.some(function(e){R(e,t)}):t.push(e)),t}function T(e,t,n,r){var o,a,i,s=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==s||u&&s==c.key&&l==c.type)return n;if(r>(u?1:0))for(o=n-1,a=n+1;o>=0||a<t.length;)if(null!=(c=t[i=o>=0?o--:a++])&&!(2&c.__u)&&s==c.key&&l==c.type)return i;return-1}function I(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function x(e,t,n,r,o){var a,i;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||I(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||I(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])a=t!=(t=t.replace(u,"$1")),i=t.toLowerCase(),t=i in e||"onFocusOut"==t||"onFocusIn"==t?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n[c]=r[c]:(n[c]=d,e.addEventListener(t,a?h:p,a)):e.removeEventListener(t,a?h:p,a);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function M(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n[l])n[l]=d++;else if(n[l]<r[c])return;return r(t.event?t.event(n):n)}}}function F(e,n,r,o,a,i,s,l,c,u){var d,p,h,y,m,b,w,_,C,S,j,E,N,A,R,T=n.type;if(void 0!==n.constructor)return null;128&r.__u&&(c=!!(32&r.__u),i=[l=n.__e=r.__e]),(d=t.__b)&&d(n);e:if("function"==typeof T)try{if(_=n.props,C=T.prototype&&T.prototype.render,S=(d=T.contextType)&&o[d.__c],j=d?S?S.props.value:d.__:o,r.__c?w=(p=n.__c=r.__c).__=p.__E:(C?n.__c=p=new T(_,j):(n.__c=p=new k(_,j),p.constructor=T,p.render=q),S&&S.sub(p),p.state||(p.state={}),p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),C&&null==p.__s&&(p.__s=p.state),C&&null!=T.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,T.getDerivedStateFromProps(_,p.__s))),y=p.props,m=p.state,p.__v=n,h)C&&null==T.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),C&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(C&&null==T.getDerivedStateFromProps&&_!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(_,j),n.__v==r.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(_,p.__s,j)){n.__v!=r.__v&&(p.props=_,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),f.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(_,p.__s,j),C&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,m,b)})}if(p.context=j,p.props=_,p.__P=e,p.__e=!1,E=t.__r,N=0,C)p.state=p.__s,p.__d=!1,E&&E(n),d=p.render(p.props,p.state,p.context),f.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,E&&E(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++N<25);p.state=p.__s,null!=p.getChildContext&&(o=v(v({},o),p.getChildContext())),C&&!h&&null!=p.getSnapshotBeforeUpdate&&(b=p.getSnapshotBeforeUpdate(y,m)),A=null!=d&&d.type===P&&null==d.key?V(d.props.children):d,l=D(e,g(A)?A:[A],n,r,o,a,i,s,l,c,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),w&&(p.__E=p.__=null)}catch(e){if(n.__v=null,c||null!=i)if(e.then){for(n.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,n.__e=l}else{for(R=i.length;R--;)O(i[R]);B(n)}else n.__e=r.__e,n.__k=r.__k,e.then||B(n);t.__e(e,n,r)}else null==i&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=$(r.__e,n,r,o,a,i,s,c,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:l}function B(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(B))}function L(e,n,r){for(var o=0;o<r.length;o++)U(r[o],r[++o],r[++o]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function V(e){return"object"!=typeof e||null==e||e.__b>0?e:g(e)?e.map(V):v({},e)}function $(n,r,o,a,i,s,l,c,u){var d,p,h,y,f,b,v,w=o.props||m,_=r.props,P=r.type;if("svg"==P?i="http://www.w3.org/2000/svg":"math"==P?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=s)for(d=0;d<s.length;d++)if((f=s[d])&&"setAttribute"in f==!!P&&(P?f.localName==P:3==f.nodeType)){n=f,s[d]=null;break}if(null==n){if(null==P)return document.createTextNode(_);n=document.createElementNS(i,P,_.is&&_),c&&(t.__m&&t.__m(r,s),c=!1),s=null}if(null==P)w===_||c&&n.data==_||(n.data=_);else{if(s=s&&e.call(n.childNodes),!c&&null!=s)for(w={},d=0;d<n.attributes.length;d++)w[(f=n.attributes[d]).name]=f.value;for(d in w)f=w[d],"dangerouslySetInnerHTML"==d?h=f:"children"==d||d in _||"value"==d&&"defaultValue"in _||"checked"==d&&"defaultChecked"in _||x(n,d,null,f,i);for(d in _)f=_[d],"children"==d?y=f:"dangerouslySetInnerHTML"==d?p=f:"value"==d?b=f:"checked"==d?v=f:c&&"function"!=typeof f||w[d]===f||x(n,d,f,w[d],i);if(p)c||h&&(p.__html==h.__html||p.__html==n.innerHTML)||(n.innerHTML=p.__html),r.__k=[];else if(h&&(n.innerHTML=""),D("template"==r.type?n.content:n,g(y)?y:[y],r,o,a,"foreignObject"==P?"http://www.w3.org/1999/xhtml":i,s,l,s?s[0]:o.__k&&C(o,0),c,u),null!=s)for(d=s.length;d--;)O(s[d]);c||(d="value","progress"==P&&null==b?n.removeAttribute("value"):null!=b&&(b!==n[d]||"progress"==P&&!b||"option"==P&&b!=w[d])&&x(n,d,b,w[d],i),d="checked",null!=v&&v!=n[d]&&x(n,d,v,w[d],i))}return n}function U(e,n,r){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==n||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function K(e,n,r){var o,a;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||U(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){t.__e(e,n)}o.base=o.__P=null}if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&K(o[a],n,r||"function"!=typeof e.type);r||O(e.__e),e.__c=e.__=e.__e=void 0}function q(e,t,n){return this.constructor(e,n)}function H(n,r,o){var a,i,s;r==document&&(r=document.documentElement),t.__&&t.__(n,r),a=!1?null:r.__k,i=[],s=[],F(r,n=r.__k=w(P,null,[n]),a||m,m,r.namespaceURI,a?null:r.firstChild?e.call(r.childNodes):null,i,a?a.__e:r.firstChild,false,s),L(i,n,s)}function z(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,E(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+y++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}e=f.slice,t={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&null!=a.getDerivedStateFromError&&(o.setState(a.getDerivedStateFromError(e)),i=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(t){e=t}throw e}},n=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),E(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E(this))},k.prototype.render=P,r=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},N.__r=0,s=Math.random().toString(8),l="__d"+s,c="__a"+s,u=/(PointerCapture)$|Capture$/i,d=0,p=M(!1),h=M(!0),y=0;var W,G,Y,Q,Z=0,J=[],X=t,ee=X.__b,te=X.__r,ne=X.diffed,re=X.__c,oe=X.unmount,ae=X.__;function ie(e,t){X.__h&&X.__h(G,e,Z||t),Z=0;var n=G.__H||(G.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function se(e){return Z=1,le(we,e)}function le(e,t,n){var r=ie(W++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):we(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=G,!G.__f)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var i=r.__c.props!==e;return o.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),a&&a.call(this,e,t,n)||i};G.__f=!0;var a=G.shouldComponentUpdate,i=G.componentWillUpdate;G.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,o(e,t,n),a=r}i&&i.call(this,e,t,n)},G.shouldComponentUpdate=o}return r.__N||r.__}function ce(e,t){var n=ie(W++,3);!X.__s&&Oe(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function ue(e,t){var n=ie(W++,4);!X.__s&&Oe(n.__H,t)&&(n.__=e,n.u=t,G.__h.push(n))}function de(e){return Z=5,pe(function(){return{current:e}},[])}function pe(e,t){var n=ie(W++,7);return Oe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function he(e,t){return Z=8,pe(function(){return e},t)}function ye(e){var t=G.context[e.__c],n=ie(W++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(G)),t.props.value):e.__}function me(){for(var e;e=J.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ge),t.__h.some(ve),t.__h=[]}catch(n){t.__h=[],X.__e(n,e.__v)}}}X.__b=function(e){G=null,ee&&ee(e)},X.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ae&&ae(e,t)},X.__r=function(e){te&&te(e),W=0;var t=(G=e.__c).__H;t&&(Y===G?(t.__h=[],G.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ge),t.__h.some(ve),t.__h=[],W=0)),Y=G},X.diffed=function(e){ne&&ne(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==J.push(t)&&Q===X.requestAnimationFrame||((Q=X.requestAnimationFrame)||be)(me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Y=G=null},X.__c=function(e,t){t.some(function(e){try{e.__h.some(ge),e.__h=e.__h.filter(function(e){return!e.__||ve(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],X.__e(n,e.__v)}}),re&&re(e,t)},X.unmount=function(e){oe&&oe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ge(e)}catch(e){t=e}}),n.__H=void 0,t&&X.__e(t,n.__v))};var fe="function"==typeof requestAnimationFrame;function be(e){var t,n=function(){clearTimeout(r),fe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);fe&&(t=requestAnimationFrame(n))}function ge(e){var t=G,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),G=t}function ve(e){var t=G;e.__c=e.__(),G=t}function Oe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function we(e,t){return"function"==typeof t?t(e):t}const _e="encryptedCardNumber",Pe="encryptedExpiryDate",ke="encryptedExpiryMonth",Ce="encryptedExpiryYear",Se="encryptedSecurityCode",je="encryptedPassword",Ee="encryptedSecurityCode3digits",Ne="encryptedSecurityCode4digits",De="giftcard",Ae=["amex","mc","visa"],Re=[De],Te=[_e,Pe,ke,Ce,Se,je],Ie=["bcmc"],xe="required",Me="optional",Fe="hidden",Be=xe,Le=Me,Ve=Fe,$e=xe,Ue=Me,Ke=Fe,qe="data-cse",He="data-info",ze="data-uid",We=["accel","pulse","star","nyce"],Ge={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},Ye={[_e]:"cardNumber",[Pe]:"expiryDate",[Se]:"securityCode",[ke]:"expiryMonth",[Ce]:"expiryYear",[je]:"password",[Ee]:"securityCodeThreeDigits",[Ne]:"securityCodeFourDigits"},Qe="-ariaError",Ze="-ariaContext",Je="focusField",Xe="notValidating:blurScenario",et="field.error.required",tt="field.error.invalid",nt="invalid.format.expects",rt="creditCard.holderName.invalid",ot="creditCard.taxNumber.invalid",at="boleto.socialSecurityNumber.invalid";var it=function(e){return e.CC_NUM="cc.num",e.CC_DAT="cc.dat",e.CC_MTH="cc.mth",e.CC_YR="cc.yr",e.CC_CVC="cc.cvc",e.KCP_PWD="kcp.pwd",e}({}),st=function(e){return e.ERROR_MSG_INCOMPLETE_FIELD="err.gen.9100",e.ERROR_MSG_INVALID_FIELD="err.gen.9101",e.ERROR_MSG_LUHN_CHECK_FAILED="cc.num.902",e.ERROR_MSG_EMPTY_PAN="cc.num.900",e.ERROR_MSG_UNSUPPORTED_CARD_ENTERED="cc.num.903",e.ERROR_MSG_INCORRECTLY_FILLED_PAN="cc.num.901",e.ERROR_MSG_CARD_TOO_OLD="cc.dat.912",e.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE="cc.dat.913",e.ERROR_MSG_CARD_EXPIRES_TOO_SOON="cc.dat.914",e.ERROR_MSG_EMPTY_DATE="cc.dat.910",e.ERROR_MSG_INCORRECTLY_FILLED__DATE="cc.dat.911",e.ERROR_MSG_EMPTY_YEAR="cc.yr.917",e.ERROR_MSG_INCORRECTLY_FILLED_YEAR="cc.yr.918",e.ERROR_MSG_EMPTY_MONTH="cc.mth.915",e.ERROR_MSG_EMPTY_CVC="cc.cvc.920",e.ERROR_MSG_INCORRECTLY_FILLED_CVC="cc.cvc.921",e.ERROR_MSG_EMPTY_KCP_PWD="kcp.pwd.940",e.ERROR_MSG_INCORRECTLY_FILLED_KCP_PWD="kcp.pwd.941",e}({});const lt={[_e]:"cc.num.900",[Pe]:"cc.dat.910",[ke]:"cc.mth.915",[Ce]:"cc.yr.917",[Se]:"cc.cvc.920",[je]:"kcp.pwd.940"},ct=(e,t)=>(t===Pe?(e[ke]=!1,e[Ce]=!1):e[t]=!1,e),ut=(e,t)=>(n,r)=>{let o=!0!==t.valid[r]?((e,t)=>1!==t||e!==ke&&e!==Ce?e:Pe)(r,e):null;return o=((e,t,n)=>{const{isFieldOfType:r,fieldIsValid:o}=n.reduce((n,r)=>{var o;return n.isFieldOfType||(n.isFieldOfType=e===r,n.fieldIsValid=!(null===(o=t.errors)||void 0===o?void 0:o[r])),n},{isFieldOfType:!1,fieldIsValid:!1}),a=e===Se?"cvcPolicy":"expiryDatePolicy",i="cvcPolicy"===a?Le:Ue,s="cvcPolicy"===a?Ve:Ke;return(t[a]===i||t[a]===s)&&o&&r?null:e})(o,t,[Se,Pe,ke,Ce]),o&&!n.includes(o)&&n.push(o),n};function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class pt{constructor(e){dt(this,"callbacks",void 0),dt(this,"config",void 0),dt(this,"props",void 0),dt(this,"state",void 0),dt(this,"validateForm",void 0),dt(this,"handleBrandFromBinLookup",void 0),dt(this,"callbacksHandler",void 0),dt(this,"configHandler",void 0),dt(this,"createCardSecuredFields",void 0),dt(this,"createNonCardSecuredFields",void 0),dt(this,"createSecuredFields",void 0),dt(this,"destroySecuredFields",void 0),dt(this,"handleIOSTouchEvents",void 0),dt(this,"destroyTouchendListener",void 0),dt(this,"destroyTouchstartListener",void 0),dt(this,"handleBinValue",void 0),dt(this,"handleEncryption",void 0),dt(this,"handleFocus",void 0),dt(this,"handleIframeConfigFeedback",void 0),dt(this,"handleValidation",void 0),dt(this,"handleSFShiftTab",void 0),dt(this,"handleShiftTab",void 0),dt(this,"isConfigured",void 0),dt(this,"postMessageToAllIframes",void 0),dt(this,"processAutoComplete",void 0),dt(this,"processBrand",void 0),dt(this,"sendBrandToCardSF",void 0),dt(this,"sendExpiryDatePolicyToSF",void 0),dt(this,"setFocusOnFrame",void 0),dt(this,"setupSecuredField",void 0),dt(this,"touchendListener",void 0),dt(this,"touchstartListener",void 0),dt(this,"hasGenuineTouchEvents",void 0),dt(this,"encryptedAttrName",void 0),dt(this,"hasRedundantCVCField",void 0),dt(this,"isSingleBrandedCard",void 0),dt(this,"securityCode",void 0),this.props=e,this.state={},this.config={},this.callbacks={}}}function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yt=Object.prototype.toString;function mt(e){return"object"==typeof e&&null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function ft(e){return null!=e}function bt(e){return!1!==e&&ft(e)}function gt(e){return!!e&&"object"==typeof e}function vt(e){return!bt(e)||(!(!("number"==typeof(t=e)||gt(t)&&"[object Number]"===yt.call(t))||0!==e&&!Number.isNaN(e))||(!(!mt(e)&&!function(e){return"string"==typeof e||gt(e)&&"[object String]"===yt.call(e)}(e)||0!==e.length)||!(!gt(e)||0!==Object.keys(e).length)));var t}function Ot(...e){const t=mt(e[0])?e[0]:e;return{from:e=>t.map(t=>t in e?{[t]:e[t]}:{}).reduce((e,t)=>function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ht(e,t,n[t])})}return e}({},e,t),{})}}function wt(...e){const t=mt(e[0])?e[0]:e;return{from:e=>{const n=Object.keys(e).filter(e=>!t.includes(e));return Ot(...n).from(e)}}}let _t="undefined"!=typeof window&&window.console&&window.console.error&&window.console.error.bind(window.console);"undefined"!=typeof window&&window.console&&window.console.info&&window.console.info.bind(window.console);let Pt="undefined"!=typeof window&&window.console&&window.console.log&&window.console.log.bind(window.console),kt="undefined"!=typeof window&&window.console&&window.console.warn&&window.console.warn.bind(window.console);function Ct(e){var t,n;this.config.cardGroupTypes=mt(n=e.cardGroupTypes)&&n.length?n:Ae;const r=e.loadingContext;if(!r)return void kt("WARNING Config :: no loadingContext has been specified!");var o;this.config.loadingContext="/"===(o=r).charAt(o.length-1)?r:`${r}/`,this.config.isCreditCardType=!1===Re.includes(e.type),this.config.iframeUIConfig=null!==(t=e.iframeUIConfig)&&void 0!==t?t:{},this.config.autoFocus=!(!1===e.autoFocus||"false"===e.autoFocus),this.config.showWarnings=!0===e.showWarnings||"true"===e.showWarnings,this.config.trimTrailingSeparator=!(!1===e.trimTrailingSeparator||"false"===e.trimTrailingSeparator),this.config.keypadFix=!(!1===e.keypadFix||"false"===e.keypadFix),this.config.legacyInputMode=e.legacyInputMode||null,this.config.minimumExpiryDate=e.minimumExpiryDate||null,this.config.sfLogAtStart=!0===window._b$dl;const a=this.config.isCreditCardType?"card":e.type,i=btoa(window.location.origin),s=`${a}${!this.config.loadingContext.includes("live")&&e.forceCompat?"Compat":""}`;this.config.iframeSrc=`${this.config.loadingContext}securedfields/${e.clientKey}/6.2.0/securedFields.html?type=${s}&d=${i}`}const St=()=>{};function jt(e={}){this.callbacks.onLoad=e.onLoad?e.onLoad:St,this.callbacks.onConfigSuccess=e.onConfigSuccess?e.onConfigSuccess:St,this.callbacks.onFieldValid=e.onFieldValid?e.onFieldValid:St,this.callbacks.onAllValid=e.onAllValid?e.onAllValid:St,this.callbacks.onBrand=e.onBrand?e.onBrand:St,this.callbacks.onError=e.onError?e.onError:St,this.callbacks.onFocus=e.onFocus?e.onFocus:St,this.callbacks.onBinValue=e.onBinValue?e.onBinValue:St,this.callbacks.onAutoComplete=e.onAutoComplete?e.onAutoComplete:St,this.callbacks.onAdditionalSFConfig=e.onAdditionalSFConfig?e.onAdditionalSFConfig:St,this.callbacks.onAdditionalSFRemoved=e.onAdditionalSFRemoved?e.onAdditionalSFRemoved:St,this.callbacks.onTouchstartIOS=e.onTouchstartIOS?e.onTouchstartIOS:St,this.callbacks.onKeyPressed=e.onKeyPressed?e.onKeyPressed:St}const Et=({fieldType:e,encryptedFieldName:t,uuid:n,isValid:r,txVariant:o,rootNode:a})=>({fieldType:e,encryptedFieldName:t,uid:n,valid:r,type:o,rootNode:a});function Nt(e={},t){return Object.prototype.hasOwnProperty.call(e,t)}const Dt=(e,t,n,r,o)=>{if(!Nt(e,"error"))return null;const a=t,i={rootNode:r,fieldType:e.fieldType,error:null,type:null},s=""!==e.error;return s||a.hasError?(i.error=s?e.error:"",i.type=n,a.hasError=s,a.errorType=i.error,o(i),i):null};function At(e){let t;const n=e.fieldType;if("card"===this.state.type&&Nt(e,"cvcPolicy")&&ft(e.cvcPolicy)&&Nt(this.state.securedFields,Se)&&(this.state.securedFields[Se].cvcPolicy=e.cvcPolicy),Dt(e,this.state.securedFields[n],this.state.type,this.props.rootNode,this.callbacks.onError),this.state.securedFields[n].isEncrypted){t=(({fieldType:e,txVariant:t,rootNode:n})=>{const r=e===Pe,o=[],a=["encryptedExpiryMonth","encryptedExpiryYear"];let i,s,l,c;const u=r?2:1;for(i=0;i<u;i+=1){l=r?a[i]:e,s=`${t}-encrypted-${l}`,c=r?l:e;const u=Et({fieldType:e,encryptedFieldName:c,uuid:s,isValid:!1,txVariant:t,rootNode:n});o.push(u)}return o})({fieldType:n,txVariant:this.state.type,rootNode:this.props.rootNode}),n===_e&&(t[0].endDigits="");for(let e=0,n=t.length;e<n;e+=1)this.callbacks.onFieldValid(t[e]);this.state.securedFields[n].isEncrypted=!1}this.validateForm(),Nt(e,"brand")&&this.processBrand(e)}const Rt=(e,t,n)=>{if(t){const r=JSON.stringify(e);t.postMessage(r,n)}};function Tt(e,t){var n;return(null===(n=e.securedFields[t])||void 0===n?void 0:n.iframeContentWindow)||null}function It(e){const t=e.fieldType;let n,r;this.config.autoFocus&&("year"!==e.type&&t!==Ce||this.setFocusOnFrame(Se),t===ke&&this.setFocusOnFrame(Ce));const o=e[t];this.state.securedFields[t].isEncrypted=!0,Dt({error:"",fieldType:e.fieldType},this.state.securedFields[t],this.state.type,this.props.rootNode,this.callbacks.onError);const a=(({fieldType:e,txVariant:t,rootNode:n,encryptedObjArr:r})=>{let o,a,i,s,l;const c=[];for(o=0;o<r.length;o+=1){i=r[o],s=i.encryptedFieldName,a=`${t}-encrypted-${s}`,l=i.blob;const u=Et({fieldType:e,encryptedFieldName:s,uuid:a,isValid:!0,txVariant:t,rootNode:n});u.blob=l,c.push(u)}return c})({fieldType:t,txVariant:this.state.type,rootNode:this.props.rootNode,encryptedObjArr:o});if(t===ke&&Nt(this.state.securedFields,Ce)){const t={txVariant:this.state.type,code:e.code,blob:o[0].blob,fieldType:Ce,numKey:this.state.securedFields[Ce].numKey};Rt(t,Tt(this.state,Ce),this.config.loadingContext)}for(t===_e&&bt(e.endDigits)&&(a[0].endDigits=e.endDigits),t===_e&&bt(e.issuerBin)&&(a[0].issuerBin=+e.issuerBin),t===Pe&&bt(e.expiryDate)&&(a[1].expiryDate=e.expiryDate),n=0,r=a.length;n<r;n+=1)this.callbacks.onFieldValid(a[n]);this.validateForm()}const xt=(e,t)=>{let n=[];return e&&"function"==typeof e.querySelectorAll&&(n=[].slice.call(e.querySelectorAll(t))),n},Mt=(e,t)=>{if(e)return e.querySelector(t)},Ft=(e,t)=>{if(e)return e.getAttribute(t)};const Bt={__NO_BRAND:"noBrand",cards:[]};Bt.cards.push({cardType:"mc",permittedLengths:[16],pattern:/^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,securityCode:"CVC"}),Bt.cards.push({cardType:"visadankort",permittedLengths:[16],pattern:/^(4571)[0-9]{0,12}$/}),Bt.cards.push({cardType:"visa",permittedLengths:[13,16,19],pattern:/^4[0-9]{0,18}$/,securityCode:"CVV"}),Bt.cards.push({cardType:"amex",permittedLengths:[15],pattern:/^3[47][0-9]{0,13}$/,securityCode:"CID"}),Bt.cards.push({cardType:"diners",permittedLengths:[14,15,16,17,18,19],pattern:/^(36)[0-9]{0,12}$/}),Bt.cards.push({cardType:"maestrouk",permittedLengths:[16,18,19],pattern:/^(6759)[0-9]{0,15}$/}),Bt.cards.push({cardType:"solo",permittedLengths:[16,18,19],pattern:/^(6767)[0-9]{0,15}$/}),Bt.cards.push({cardType:"laser",permittedLengths:[16,17,18,19],pattern:/^(6304|6706|6709|6771)[0-9]{0,15}$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"discover",permittedLengths:[16,17,18,19],pattern:/^(6011[0-9]{0,12}|(644|645|646|647|648|649)[0-9]{0,13}|65[0-9]{0,14})$/}),Bt.cards.push({cardType:"jcb",permittedLengths:[16,19],pattern:/^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,securityCode:"CAV"}),Bt.cards.push({cardType:"bcmc",permittedLengths:[16,17,18,19],pattern:/^((6703)[0-9]{0,15}|(479658|606005)[0-9]{0,13})$/,cvcPolicy:"hidden"}),Bt.cards.push({cardType:"bijcard",permittedLengths:[16],pattern:/^(5100081)[0-9]{0,9}$/}),Bt.cards.push({cardType:"dankort",permittedLengths:[16],pattern:/^(5|50|501|5019[0-9]{0,12}|4|45|457|4571[0-9]{0,12}|3|35|357|3571[0-9]{0,12})$/}),Bt.cards.push({cardType:"hipercard",permittedLengths:[16],pattern:/^(606282)[0-9]{0,10}$/}),Bt.cards.push({cardType:"cup",permittedLengths:[14,15,16,17,18,19],pattern:/^(62|81)[0-9]{0,17}$/}),Bt.cards.push({cardType:"maestro",permittedLengths:[16,17,18,19],pattern:/^(5[0|6-8][0-9]{0,17}|6[0-9]{0,18})$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"elo",permittedLengths:[16],pattern:/^((((506699)|(506770)|(506771)|(506772)|(506773)|(506774)|(506775)|(506776)|(506777)|(506778)|(401178)|(438935)|(451416)|(457631)|(457632)|(504175)|(627780)|(636368)|(636297))[0-9]{0,10})|((50676)|(50675)|(50674)|(50673)|(50672)|(50671)|(50670))[0-9]{0,11})$/}),Bt.cards.push({cardType:"uatp",permittedLengths:[15],pattern:/^1[0-9]{0,14}$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"cartebancaire",permittedLengths:[16],pattern:/^[4-6][0-9]{0,15}$/}),Bt.cards.push({cardType:"visaalphabankbonus",permittedLengths:[16],pattern:/^(450903)[0-9]{0,10}$/}),Bt.cards.push({cardType:"mcalphabankbonus",permittedLengths:[16],pattern:/^(510099)[0-9]{0,10}$/}),Bt.cards.push({cardType:"hiper",permittedLengths:[16],pattern:/^(637095|637568|637599|637609|637612)[0-9]{0,10}$/}),Bt.cards.push({cardType:"oasis",permittedLengths:[16],pattern:/^(982616)[0-9]{0,10}$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"karenmillen",permittedLengths:[16],pattern:/^(98261465)[0-9]{0,8}$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"warehouse",permittedLengths:[16],pattern:/^(982633)[0-9]{0,10}$/,cvcPolicy:"optional"}),Bt.cards.push({cardType:"mir",permittedLengths:[16,17,18,19],pattern:/^(220)[0-9]{0,16}$/}),Bt.cards.push({cardType:"codensa",permittedLengths:[16],pattern:/^(590712)[0-9]{0,10}$/}),Bt.cards.push({cardType:"naranja",permittedLengths:[16,17,18,19],pattern:/^(37|40|5[28])([279])\d*$/}),Bt.cards.push({cardType:"cabal",permittedLengths:[16,17,18,19],pattern:/^(58|6[03])([03469])\d*$/}),Bt.cards.push({cardType:"shopping",permittedLengths:[16,17,18,19],pattern:/^(27|58|60)([39])\d*$/}),Bt.cards.push({cardType:"argencard",permittedLengths:[16,17,18,19],pattern:/^(50)(1)\d*$/}),Bt.cards.push({cardType:"troy",permittedLengths:[16],pattern:/^(97)(9)\d*$/}),Bt.cards.push({cardType:"forbrugsforeningen",permittedLengths:[16],pattern:/^(60)(0)\d*$/}),Bt.cards.push({cardType:"vpay",permittedLengths:[13,14,15,16,17,18,19],pattern:/^(40[1,8]|413|43[4,5]|44[1,2,3,4,6,7]|45[5,8]|46[0,1,3,6]|47[1,9]|48[2,3,7])[0-9]{0,16}$/}),Bt.cards.push({cardType:"rupay",permittedLengths:[16],pattern:/^(100003|508(2|[5-9])|60(69|[7-8])|652(1[5-9]|[2-5][0-9]|8[5-9])|65300[3-4]|8172([0-1]|[3-5]|7|9)|817(3[3-8]|40[6-9]|410)|35380([0-2]|[5-6]|9))[0-9]{0,12}$/}),Bt.cards.push({cardType:"ticket",expiryDatePolicy:"hidden"});var Lt=e=>Bt.cards.filter(t=>t.cardType===e)[0],Vt=e=>{if(!e)throw new Error("Error: isGenericCardType: type param has not been specified");return"card"===e||"scheme"===e};Bt.__NO_BRAND,Bt.cards;const $t=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.addEventListener)&&(e.addEventListener(t,n,r),!0),Ut=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.removeEventListener)&&(e.removeEventListener(t,n,r),!0);function Kt(e,t){const n=typeof e;return e&&t&&"object"===n&&n===typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>Kt(e[n],t[n])):e===t}function qt(...e){const t=e,n=t.shift();return function(...e){return n.apply(this,t.concat(e))}}function Ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class zt{constructor(){Ht(this,"sfConfig",void 0),Ht(this,"componentType",void 0),Ht(this,"loadingContext",void 0),Ht(this,"holderEl",void 0),Ht(this,"iframeRef",void 0),Ht(this,"loadToConfigTimeout",void 0),Ht(this,"_isValid",void 0),Ht(this,"_iframeContentWindow",void 0),Ht(this,"_numKey",void 0),Ht(this,"_isEncrypted",void 0),Ht(this,"_hasError",void 0),Ht(this,"_errorType",void 0),Ht(this,"_cvcPolicy",void 0),Ht(this,"_expiryDatePolicy",void 0),Ht(this,"_iframeOnLoadListener",void 0),Ht(this,"_postMessageListener",void 0),Ht(this,"submitAnalytics",void 0),Ht(this,"onIframeLoadedCallback",void 0),Ht(this,"onConfigCallback",void 0),Ht(this,"onEncryptionCallback",void 0),Ht(this,"onValidationCallback",void 0),Ht(this,"onFocusCallback",void 0),Ht(this,"onBinValueCallback",void 0),Ht(this,"onTouchstartCallback",void 0),Ht(this,"onShiftTabCallback",void 0),Ht(this,"onAutoCompleteCallback",void 0),Ht(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}function Wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gt=(e,t,n)=>{const r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Wt(e,t,n[t])})}return e}({},e),o=Qt(n);return r.error=((e,t)=>Object.values(st).reduce((n,r)=>(r.includes(t)&&(n[r]=e.get(r)),n),{}))(t,o),r},Yt=(e,t)=>{let n=e;for(const[r,o]of Object.entries(t))if(o===e){n=r;break}return null==n?void 0:n.toLowerCase().replace(/[_.\s]/g,"-")},Qt=e=>{let t;switch(e){case _e:t=it.CC_NUM;break;case Pe:t=it.CC_DAT;break;case ke:t=it.CC_MTH;break;case Ce:t=it.CC_YR;break;case Se:t=it.CC_CVC;break;case je:t=it.KCP_PWD}return t},Zt=({i18n:e,fieldTypeMappingFn:t,SRPanelRef:n},{errors:r,isValidating:o,layout:a,countrySpecificLabels:i})=>{const s=(({errors:e,i18n:t,layout:n,countrySpecificLabels:r,fieldTypeMappingFn:o})=>{const a=Object.entries(e).reduce((a,[i,s])=>{if(s){const s=e[i],l="errorI18n"in s&&"rootNode"in s,c="object"==typeof s.errorMessage;let u,d;if(u=l?s.error:c?s.errorMessage.translationKey:s.errorMessage,l&&"errorI18n"in s)d=s.errorI18n+"";else{const e=o?o(i,t,r):"";if(c){const n=s.errorMessage.translationKey,r=s.errorMessage.translationObject.values.format;d=`${t.get(n,{values:{label:e,format:r}})}`}else d=t.get(s.errorMessage,{values:{label:e}})+""}a.push({field:i,errorMessage:d,errorCode:u}),n&&a.sort((e,t)=>n.indexOf(e.field)-n.indexOf(t.field))}return a},[]);return a})({errors:r,i18n:e,fieldTypeMappingFn:t,countrySpecificLabels:i,layout:a});if(s.length){if(o){const e=s.map(e=>e.errorMessage);n.setMessages(e);const t=s.map(e=>e.field);return{currentErrorsSortedByLayout:s,action:Je,fieldToFocus:t[0]}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:Xe}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:"none"}},Jt=(e,t)=>{if(!e)return null;return Object.entries(e).reduce((e,[n,r])=>{if(r){e[`${t}${n}`]=r}return e},{})};function Xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var en=(e,t,n,r)=>{const o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Xt(e,t,n[t])})}return e}({},e),a={};switch(n){case"ach":case De:break;default:if(r===Se)a[Ee]=t.get("creditCard.securityCode.contextualText.3digits"),a[Ne]=t.get("creditCard.securityCode.contextualText.4digits");else{const e=`creditCard.${Ye[r]}.contextualText`,n=t.get(e);n!==e&&(a[r]=n)}}return Object.keys(a).length&&(o.contextualTexts=a),o};function tn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function rn(e,t,n,r){const o=["giftcard"].includes(e)?e:"creditCard";let a=n.get(`${o}.${t}.aria.iframeTitle`);"none"===a&&(a="");const i=n.get(`${o}.${Ye[t]}.label`),s=n.locale;let l=Gt({iframeTitle:a,label:i},n,t);return r&&(l=en(l,n,e,t)),nn(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){tn(e,t,n[t])})}return e}({},s&&{lang:s}),{[t]:l})}function on(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function an(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sn=function(e){return e.info="info",e.error="error",e.log="log",e}({});class ln{constructor(e){an(this,"timestamp",void 0),an(this,"id",void 0),an(this,"component",void 0),this.component=e,this.id=on(),this.timestamp=String(Date.now())}}function cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var un=function(e){return e.network="Network",e.implementation="Implementation",e.internal="Internal",e.apiError="ApiError",e.sdkError="SdkError",e.thirdParty="ThirdParty",e.generic="Generic",e.redirect="Redirect",e.threeDS2="ThreeDS2",e}({}),dn=function(e){return e.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND="500",e.REDIRECT="600",e.SECURED_FIELDS_KEY_NOT_FOUND="608",e.SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED="609",e.SECURED_FIELDS_ENCRYPTION_ERROR="610",e.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA="700",e.THREEDS2_ACTION_IS_MISSING_TOKEN="701",e.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL="702",e.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS="703",e.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED="704",e.THREEDS2_TIMEOUT="710",e.THREEDS2_TOKEN_IS_MISSING_ACSURL="800",e.THREEDS2_NO_TRANSSTATUS="801",e.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED="802",e.THREEDS2_NO_COMPONENT_FOR_ACTION="803",e.THREEDS2_NO_ACTION_FOR_CHALLENGE="804",e.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP="805",e}({});class pn extends ln{getEventCategory(){return sn.error}constructor(e){super(e.component),cn(this,"errorType",void 0),cn(this,"code",void 0),cn(this,"message",void 0),this.errorType=e.errorType,this.code=e.code,e.message&&(this.message=e.message)}}function hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){hn(e,t,n[t])})}return e}function mn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}class fn extends zt{init(e,t,n,r){const o=rn(this.sfConfig.txVariant,this.sfConfig.fieldType,e,r);this.sfConfig.iframeUIConfig.ariaConfig=o,this.sfConfig.iframeUIConfig.placeholders=function(e,t,n){var r,o,a,i;return e===De?{[t]:null!==(r=n[Ye[t]])&&void 0!==r?r:""}:t===Se?{[Ee]:null!==(o=n.securityCodeThreeDigits)&&void 0!==o?o:"",[Ne]:null!==(a=n.securityCodeFourDigits)&&void 0!==a?a:""}:{[t]:null!==(i=n[Ye[t]])&&void 0!==i?i:""}}(this.sfConfig.txVariant,this.sfConfig.fieldType,n);const a=function({src:e,title:t="iframe element",policy:n="origin"}){const r=document.createElement("iframe");r.setAttribute("src",e),r.classList.add("js-iframe"),r.setAttribute("role","presentation"),""!==t&&t.trim().length>0&&r.setAttribute("title",t),r.setAttribute("allowtransparency","true"),r.setAttribute("referrerpolicy",n);const o=document.createTextNode("<p>Your browser does not support iframes.</p>");return r.appendChild(o),r}({src:t,title:o[this.sfConfig.fieldType].iframeTitle,policy:"origin"});this.holderEl.appendChild(a);const i=Mt(this.holderEl,".js-iframe");if(i){if(!i.contentWindow){var s;console.error("ERROR: Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined. Are you sure the element into which the Card component is being mounted already exists in the DOM *before* the Card component is mounted?");const e=new pn({component:this.componentType,code:dn.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:un.implementation,message:`Trying to initialise an iframe for ${this.sfConfig.fieldType}, but the iframe.contentWindow is undefined`});null===(s=this.submitAnalytics)||void 0===s||s.call(this,e)}this.iframeContentWindow=i.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,$t(i,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=i,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,$t(window,"message",this.postMessageListener,!1);const e=mn(yn({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),Rt(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(e){if(!((e,t,n)=>{const r=e.origin,o=t.indexOf("/checkoutshopper/");let a=o>-1?t.substring(0,o):t;const i=a.length-1;return"/"===a.charAt(i)&&(a=a.substring(0,i)),r===a||(n&&kt("WARNING postMessageValidation: postMessage listener for iframe::origin mismatch!\n Received message with origin:",r,"but the only allowed origin for messages to CSF is",a,"### event.data=",e.data),!1)})(e,this.loadingContext,this.sfConfig.showWarnings))return;let t;try{t=JSON.parse(e.data)}catch(t){return(e=>e.data&&e.data.type&&"string"==typeof e.data.type&&e.data.type.includes("webpack"))(e)?void(this.sfConfig.showWarnings&&Pt("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):(e=>e.data&&"string"==typeof e.data&&e.data.includes("cvox"))(e)?void(this.sfConfig.showWarnings&&Pt("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&Pt("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",e.data))}if(Nt(t,"action")&&Nt(t,"numKey"))if(this.numKey===t.numKey)switch(t.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(t);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",t.fieldType),this.onConfigCallback(t);break;case"focus":this.onFocusCallback(t);break;case"binValue":this.onBinValueCallback(t);break;case"touch":this.onTouchstartCallback(t);break;case"shifttab":this.onShiftTabCallback(t);break;case"autoComplete":this.onAutoCompleteCallback(t);break;case"enterKeyPressed":this.onKeyPressedCallback(t);break;case"encryptionError":{var n;const e=new pn({component:this.componentType,code:t.code,errorType:un.internal,message:`${t.error}. Field= ${this.sfConfig.fieldType}`});null===(n=this.submitAnalytics)||void 0===n||n.call(this,e);break}default:this.isValid=!1,this.onValidationCallback(t)}else this.sfConfig.showWarnings&&kt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&kt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){Ut(window,"message",this.postMessageListener,!1),Ut(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,(e=>{for(;e.firstChild;)e.removeChild(e.firstChild)})(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===Pe||this.sfConfig.fieldType===ke||this.sfConfig.fieldType===Ce)switch(this.expiryDatePolicy){case Ke:return!0;case Ue:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===Se)switch(this.cvcPolicy){case Ve:return!0;case Le:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyPressed(e){return this.onKeyPressedCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===Se)switch(this.cvcPolicy){case Ve:return!0;case Le:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===Pe||this.sfConfig.fieldType===ke||this.sfConfig.fieldType===Ce)switch(this.expiryDatePolicy){case Ke:return!0;case Ue:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===Se&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==Pe&&this.sfConfig.fieldType!==ke&&this.sfConfig.fieldType!==Ce||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,t){super(),hn(this,"sfConfig",void 0);const n=wt(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=mn(yn({},n),{iframeUIConfig:yn({},n.iframeUIConfig)});const{iframeSrc:r,placeholders:o,showContextualElement:a}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.submitAnalytics=e.submitAnalytics,this.componentType=e.componentType,this.isValid=!1,this.iframeContentWindow=null,this.numKey=function(){if(!window.crypto)return 4294967296*Math.random()|0;const e=new Uint32Array(1);return window.crypto.getRandomValues(e),e[0]}(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(t,r,o,a)}}function bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const gn="NETWORK_ERROR",vn="IMPLEMENTATION_ERROR",On="API_ERROR",wn="ERROR",_n="SDK_ERROR";class Pn extends Error{constructor(e,t,n){super(t),bn(this,"cause",void 0),bn(this,"options",void 0),this.name=Pn.errorTypes[e],this.options=n||{},this.cause=this.options.cause}}bn(Pn,"errorTypes",{NETWORK_ERROR:gn,CANCEL:"CANCEL",IMPLEMENTATION_ERROR:vn,API_ERROR:On,ERROR:wn,SCRIPT_ERROR:"SCRIPT_ERROR",SDK_ERROR:_n});const kn=(e,t)=>{const n="card"===e?"nocard":e||"nocard",r={type:n,extension:"svg"};return t.getImage(r)(n)},Cn=e=>{let t=e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return Sn(e)&&(t=t.substring(10)),t};function Sn(e){return Te.includes(e)}function jn(e,t){if(null==e)return{};var n,r,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function En(){this.encryptedAttrName=qe;const e=xt(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const t=Ft(e,this.encryptedAttrName),n=Sn(t);return n||console.warn(`WARNING: '${t}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),n}),t=Be,n=$e;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(e,t,n),e.length):(this.createNonCardSecuredFields(e),e.length)}async function Nn(e){for(let t=0;t<e.length;t++){const n=e[t];await this.setupSecuredField(n).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function Dn(e,t,n){let r=this.state.type;if("card"===r&&1===this.config.cardGroupTypes.length&&(r=this.config.cardGroupTypes[0],this.state.type=r),this.isSingleBrandedCard="card"!==r,this.isSingleBrandedCard){const e=Lt(r);ft(e)?(t=e.cvcPolicy||Be,n=e.expiryDatePolicy||$e,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let r=0;r<e.length;r++){const o=e[r];window._b$dl&&console.log("\nAbout to set up securedField:",o),await this.setupSecuredField(o,t,n).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",o)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:r,cvcPolicy:t,expiryDatePolicy:n,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function An(e,t,n){return new Promise((r,o)=>{const a=Ft(e,this.encryptedAttrName);a===Ce&&(this.state.hasSeparateDateFields=!0);const i={fieldType:a,extraFieldData:Ft(e,He),uid:Ft(e,ze),cvcPolicy:t,holderEl:e,expiryDatePolicy:n,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders,submitAnalytics:this.props.onSubmitAnalytics,componentType:this.props.componentType},s=new fn(i,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new Pn("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(s.loadToConfigTimeout=setTimeout(()=>{o({type:i.fieldType,failReason:"sf took too long to config"})},6e3),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(s.loadToConfigTimeout),s.loadToConfigTimeout=null,r(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.