@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
1 lines • 718 kB
JavaScript
"use strict";var e,t,n,r,o,a,i,s,l,c,u,d,p={},h=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=Array.isArray;function f(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function g(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 O(t,s,o,a,null)}function O(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 v(e){return e.children}function _(e,t){this.props=e,this.context=t}function w(e,t){if(null==t)return e.__?w(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?w(e):null}function P(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return P(e)}}function k(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!S.__r++||o!=t.debounceRendering)&&((o=t.debounceRendering)||a)(S)}function S(){for(var e,n,o,a,s,l,c,u=1;r.length;)r.length>u&&r.sort(i),e=r.shift(),u=r.length,e.__d&&(o=void 0,a=void 0,s=(a=(n=e).__v).__e,l=[],c=[],n.__P&&((o=f({},a)).__v=a.__v+1,t.vnode&&t.vnode(o),T(n.__P,o,a,n.__n,n.__P.namespaceURI,32&a.__u?[s]:null,l,null==s?w(a):s,!!(32&a.__u),c),o.__v=a.__v,o.__.__k[o.__i]=o,x(l,o,c),a.__e=a.__=null,o.__e!=s&&P(o)));S.__r=0}function C(e,t,n,r,o,a,i,s,l,c,u){var d,y,f,b,g,_,P,k=r&&r.__k||h,S=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]=O(null,i,null,null,null):m(i)?i=e.__k[a]=O(v,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?i=e.__k[a]=O(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=N(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=w(s)),L(s,s));return r}(n,t,k,l,S),d=0;d<S;d++)null!=(f=n.__k[d])&&(y=-1==f.__i?p:k[f.__i]||p,f.__i=d,_=T(e,f,y,o,a,i,s,l,c,u),b=f.__e,f.ref&&y.ref!=f.ref&&(y.ref&&B(y.ref,null,f),u.push(f.ref,f.__c||b,f)),null==g&&null!=b&&(g=b),(P=!!(4&f.__u))||y.__k===f.__k?l=j(f,l,e,P):"function"==typeof f.type&&void 0!==_?l=_:b&&(l=b.nextSibling),f.__u&=-7);return n.__e=g,l}function j(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=j(o[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=w(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function E(e,t){return t=t||[],null==e||"boolean"==typeof e||(m(e)?e.some(function(e){E(e,t)}):t.push(e)),t}function N(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 D(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||y.test(t)?n:n+"px"}function R(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||D(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])a=t!=(t=t.replace(s,"$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.u=r.u:(n.u=l,e.addEventListener(t,a?u:c,a)):e.removeEventListener(t,a?u:c,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 A(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n.t)n.t=l++;else if(n.t<r.u)return;return r(t.event?t.event(n):n)}}}function T(e,n,r,o,a,i,s,l,c,u){var d,p,h,y,g,O,w,P,k,S,j,E,N,D,R,A,T,x=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 x)try{if(P=n.props,k="prototype"in x&&x.prototype.render,S=(d=x.contextType)&&o[d.__c],j=d?S?S.props.value:d.__:o,r.__c?w=(p=n.__c=r.__c).__=p.__E:(k?n.__c=p=new x(P,j):(n.__c=p=new _(P,j),p.constructor=x,p.render=V),S&&S.sub(p),p.state||(p.state={}),p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),k&&null==p.__s&&(p.__s=p.state),k&&null!=x.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=f({},p.__s)),f(p.__s,x.getDerivedStateFromProps(P,p.__s))),y=p.props,g=p.state,p.__v=n,h)k&&null==x.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),k&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(k&&null==x.getDerivedStateFromProps&&P!==y&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(P,j),n.__v==r.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(P,p.__s,j)){for(n.__v!=r.__v&&(p.props=P,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),E=0;E<p._sb.length;E++)p.__h.push(p._sb[E]);p._sb=[],p.__h.length&&s.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(P,p.__s,j),k&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(y,g,O)})}if(p.context=j,p.props=P,p.__P=e,p.__e=!1,N=t.__r,D=0,k){for(p.state=p.__s,p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),R=0;R<p._sb.length;R++)p.__h.push(p._sb[R]);p._sb=[]}else do{p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++D<25);p.state=p.__s,null!=p.getChildContext&&(o=f(f({},o),p.getChildContext())),k&&!h&&null!=p.getSnapshotBeforeUpdate&&(O=p.getSnapshotBeforeUpdate(y,g)),A=d,null!=d&&d.type===v&&null==d.key&&(A=M(d.props.children)),l=C(e,m(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(T=i.length;T--;)b(i[T]);I(n)}else n.__e=r.__e,n.__k=r.__k,e.then||I(n);t.__e(e,n,r)}else null==i&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=F(r.__e,n,r,o,a,i,s,c,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:l}function I(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(I)}function x(e,n,r){for(var o=0;o<r.length;o++)B(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 M(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:m(e)?e.map(M):f({},e)}function F(n,r,o,a,i,s,l,c,u){var d,h,y,f,g,O,v,_=o.props||p,P=r.props,k=r.type;if("svg"==k?i="http://www.w3.org/2000/svg":"math"==k?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((g=s[d])&&"setAttribute"in g==!!k&&(k?g.localName==k:3==g.nodeType)){n=g,s[d]=null;break}if(null==n){if(null==k)return document.createTextNode(P);n=document.createElementNS(i,k,P.is&&P),c&&(t.__m&&t.__m(r,s),c=!1),s=null}if(null==k)_===P||c&&n.data==P||(n.data=P);else{if(s=s&&e.call(n.childNodes),!c&&null!=s)for(_={},d=0;d<n.attributes.length;d++)_[(g=n.attributes[d]).name]=g.value;for(d in _)if(g=_[d],"children"==d);else if("dangerouslySetInnerHTML"==d)y=g;else if(!(d in P)){if("value"==d&&"defaultValue"in P||"checked"==d&&"defaultChecked"in P)continue;R(n,d,null,g,i)}for(d in P)g=P[d],"children"==d?f=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?O=g:"checked"==d?v=g:c&&"function"!=typeof g||_[d]===g||R(n,d,g,_[d],i);if(h)c||y&&(h.__html==y.__html||h.__html==n.innerHTML)||(n.innerHTML=h.__html),r.__k=[];else if(y&&(n.innerHTML=""),C("template"==r.type?n.content:n,m(f)?f:[f],r,o,a,"foreignObject"==k?"http://www.w3.org/1999/xhtml":i,s,l,s?s[0]:o.__k&&w(o,0),c,u),null!=s)for(d=s.length;d--;)b(s[d]);c||(d="value","progress"==k&&null==O?n.removeAttribute("value"):null!=O&&(O!==n[d]||"progress"==k&&!O||"option"==k&&O!=_[d])&&R(n,d,O,_[d],i),d="checked",null!=v&&v!=n[d]&&R(n,d,v,_[d],i))}return n}function B(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 L(e,n,r){var o,a;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||B(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]&&L(o[a],n,r||"function"!=typeof e.type);r||b(e.__e),e.__c=e.__=e.__e=void 0}function V(e,t,n){return this.constructor(e,n)}function $(n,r,o){var a,i,s;r==document&&(r=document.documentElement),t.__&&t.__(n,r),a=!1?null:r.__k,i=[],s=[],T(r,n=r.__k=g(v,null,[n]),a||p,p,r.namespaceURI,a?null:r.firstChild?e.call(r.childNodes):null,i,a?a.__e:r.firstChild,false,s),x(i,n,s)}function K(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,k(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"+d++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}e=h.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,_.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(f({},n),this.props)),e&&f(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),k(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),k(this))},_.prototype.render=v,r=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},S.__r=0,s=/(PointerCapture)$|Capture$/i,l=0,c=A(!1),u=A(!0),d=0;var U,H,q,z,W=0,G=[],Y=t,Z=Y.__b,Q=Y.__r,J=Y.diffed,X=Y.__c,ee=Y.unmount,te=Y.__;function ne(e,t){Y.__h&&Y.__h(H,e,W||t),W=0;var n=H.__H||(H.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function re(e){return W=1,oe(be,e)}function oe(e,t,n){var r=ne(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):be(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=H,!H.__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.forEach(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};H.__f=!0;var a=H.shouldComponentUpdate,i=H.componentWillUpdate;H.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)},H.shouldComponentUpdate=o}return r.__N||r.__}function ae(e,t){var n=ne(U++,3);!Y.__s&&fe(n.__H,t)&&(n.__=e,n.u=t,H.__H.__h.push(n))}function ie(e,t){var n=ne(U++,4);!Y.__s&&fe(n.__H,t)&&(n.__=e,n.u=t,H.__h.push(n))}function se(e){return W=5,le(function(){return{current:e}},[])}function le(e,t){var n=ne(U++,7);return fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ce(e,t){return W=8,le(function(){return e},t)}function ue(e){var t=H.context[e.__c],n=ne(U++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(H)),t.props.value):e.__}function de(){for(var e;e=G.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ye),e.__H.__h.forEach(me),e.__H.__h=[]}catch(t){e.__H.__h=[],Y.__e(t,e.__v)}}Y.__b=function(e){H=null,Z&&Z(e)},Y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),te&&te(e,t)},Y.__r=function(e){Q&&Q(e),U=0;var t=(H=e.__c).__H;t&&(q===H?(t.__h=[],H.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ye),t.__h.forEach(me),t.__h=[],U=0)),q=H},Y.diffed=function(e){J&&J(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==G.push(t)&&z===Y.requestAnimationFrame||((z=Y.requestAnimationFrame)||he)(de)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),q=H=null},Y.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ye),e.__h=e.__h.filter(function(e){return!e.__||me(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Y.__e(n,e.__v)}}),X&&X(e,t)},Y.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ye(e)}catch(e){t=e}}),n.__H=void 0,t&&Y.__e(t,n.__v))};var pe="function"==typeof requestAnimationFrame;function he(e){var t,n=function(){clearTimeout(r),pe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);pe&&(t=requestAnimationFrame(n))}function ye(e){var t=H,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),H=t}function me(e){var t=H;e.__c=e.__(),H=t}function fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function be(e,t){return"function"==typeof t?t(e):t}const ge="encryptedCardNumber",Oe="encryptedExpiryDate",ve="encryptedExpiryMonth",_e="encryptedExpiryYear",we="encryptedSecurityCode",Pe="encryptedPassword",ke="encryptedSecurityCode3digits",Se="encryptedSecurityCode4digits",Ce="giftcard",je=["amex","mc","visa"],Ee=[Ce],Ne=[ge,Oe,ve,_e,we,Pe],De=["bcmc"],Re="required",Ae="optional",Te="hidden",Ie=Re,xe=Ae,Me=Te,Fe=Re,Be=Ae,Le=Te,Ve="data-cse",$e="data-info",Ke="data-uid",Ue=["accel","pulse","star","nyce"],He={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"},qe={[ge]:"cardNumber",[Oe]:"expiryDate",[we]:"securityCode",[ve]:"expiryMonth",[_e]:"expiryYear",[Pe]:"password",[ke]:"securityCodeThreeDigits",[Se]:"securityCodeFourDigits"},ze="-ariaError",We="-ariaContext",Ge="focusField",Ye="notValidating:blurScenario",Ze="field.error.required",Qe="field.error.invalid",Je="invalid.format.expects",Xe="creditCard.holderName.invalid",et="creditCard.taxNumber.invalid",tt="boleto.socialSecurityNumber.invalid";var nt=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}({}),rt=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 ot={[ge]:"cc.num.900",[Oe]:"cc.dat.910",[ve]:"cc.mth.915",[_e]:"cc.yr.917",[we]:"cc.cvc.920",[Pe]:"kcp.pwd.940"},at=(e,t)=>(t===Oe?(e[ve]=!1,e[_e]=!1):e[t]=!1,e),it=(e,t)=>(n,r)=>{let o=!0!==t.valid[r]?((e,t)=>1!==t||e!==ve&&e!==_e?e:Oe)(r,e):null;return o=((e,t,n)=>{const{isFieldOfType:r,fieldIsValid:o}=n.reduce((n,r)=>(n.isFieldOfType||(n.isFieldOfType=e===r,n.fieldIsValid=!t.errors[r]),n),{isFieldOfType:!1,fieldIsValid:!1}),a=e===we?"cvcPolicy":"expiryDatePolicy",i="cvcPolicy"===a?xe:Be,s="cvcPolicy"===a?Me:Le;return(t[a]===i||t[a]===s)&&o&&r?null:e})(o,t,[we,Oe,ve,_e]),o&&!n.includes(o)&&n.push(o),n};function st(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class lt{constructor(e){st(this,"callbacks",void 0),st(this,"config",void 0),st(this,"props",void 0),st(this,"state",void 0),st(this,"validateForm",void 0),st(this,"handleBrandFromBinLookup",void 0),st(this,"callbacksHandler",void 0),st(this,"configHandler",void 0),st(this,"createCardSecuredFields",void 0),st(this,"createNonCardSecuredFields",void 0),st(this,"createSecuredFields",void 0),st(this,"destroySecuredFields",void 0),st(this,"handleIOSTouchEvents",void 0),st(this,"destroyTouchendListener",void 0),st(this,"destroyTouchstartListener",void 0),st(this,"handleBinValue",void 0),st(this,"handleEncryption",void 0),st(this,"handleFocus",void 0),st(this,"handleIframeConfigFeedback",void 0),st(this,"handleValidation",void 0),st(this,"handleSFShiftTab",void 0),st(this,"handleShiftTab",void 0),st(this,"isConfigured",void 0),st(this,"postMessageToAllIframes",void 0),st(this,"processAutoComplete",void 0),st(this,"processBrand",void 0),st(this,"sendBrandToCardSF",void 0),st(this,"sendExpiryDatePolicyToSF",void 0),st(this,"setFocusOnFrame",void 0),st(this,"setupSecuredField",void 0),st(this,"touchendListener",void 0),st(this,"touchstartListener",void 0),st(this,"hasGenuineTouchEvents",void 0),st(this,"encryptedAttrName",void 0),st(this,"hasRedundantCVCField",void 0),st(this,"isSingleBrandedCard",void 0),st(this,"securityCode",void 0),this.props=e,this.state={},this.config={},this.callbacks={}}}function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ut=Object.prototype.toString;function dt(e){return"object"==typeof e&&null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function pt(e){return null!=e}function ht(e){return!1!==e&&pt(e)}function yt(e){return!!e&&"object"==typeof e}function mt(e){return!ht(e)||(!(!("number"==typeof(t=e)||yt(t)&&"[object Number]"===ut.call(t))||0!==e&&!Number.isNaN(e))||(!(!dt(e)&&!function(e){return"string"==typeof e||yt(e)&&"[object String]"===ut.call(e)}(e)||0!==e.length)||!(!yt(e)||0!==Object.keys(e).length)));var t}function ft(...e){const t=dt(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){ct(e,t,n[t])})}return e}({},e,t),{})}}function bt(...e){const t=dt(e[0])?e[0]:e;return{from:e=>{const n=Object.keys(e).filter(e=>!t.includes(e));return ft(...n).from(e)}}}let gt="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 Ot="undefined"!=typeof window&&window.console&&window.console.log&&window.console.log.bind(window.console),vt="undefined"!=typeof window&&window.console&&window.console.warn&&window.console.warn.bind(window.console);function _t(e){var t,n;this.config.cardGroupTypes=dt(n=e.cardGroupTypes)&&n.length?n:je;const r=e.loadingContext;if(!r)return void vt("WARNING Config :: no loadingContext has been specified!");var o;this.config.loadingContext="/"===(o=r).charAt(o.length-1)?r:`${r}/`,this.config.isCreditCardType=!1===Ee.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.1.0/securedFields.html?type=${s}&d=${i}`}const wt=()=>{};function Pt(e={}){this.callbacks.onLoad=e.onLoad?e.onLoad:wt,this.callbacks.onConfigSuccess=e.onConfigSuccess?e.onConfigSuccess:wt,this.callbacks.onFieldValid=e.onFieldValid?e.onFieldValid:wt,this.callbacks.onAllValid=e.onAllValid?e.onAllValid:wt,this.callbacks.onBrand=e.onBrand?e.onBrand:wt,this.callbacks.onError=e.onError?e.onError:wt,this.callbacks.onFocus=e.onFocus?e.onFocus:wt,this.callbacks.onBinValue=e.onBinValue?e.onBinValue:wt,this.callbacks.onAutoComplete=e.onAutoComplete?e.onAutoComplete:wt,this.callbacks.onAdditionalSFConfig=e.onAdditionalSFConfig?e.onAdditionalSFConfig:wt,this.callbacks.onAdditionalSFRemoved=e.onAdditionalSFRemoved?e.onAdditionalSFRemoved:wt,this.callbacks.onTouchstartIOS=e.onTouchstartIOS?e.onTouchstartIOS:wt,this.callbacks.onKeyPressed=e.onKeyPressed?e.onKeyPressed:wt}const kt=({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 St(e={},t){return Object.prototype.hasOwnProperty.call(e,t)}const Ct=(e,t,n,r,o)=>{if(!St(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 jt(e){let t;const n=e.fieldType;if("card"===this.state.type&&St(e,"cvcPolicy")&&pt(e.cvcPolicy)&&St(this.state.securedFields,we)&&(this.state.securedFields[we].cvcPolicy=e.cvcPolicy),Ct(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===Oe,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=kt({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===ge&&(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(),St(e,"brand")&&this.processBrand(e)}const Et=(e,t,n)=>{if(t){const r=JSON.stringify(e);t.postMessage(r,n)}};function Nt(e,t){var n;return(null===(n=e.securedFields[t])||void 0===n?void 0:n.iframeContentWindow)||null}function Dt(e){const t=e.fieldType;let n,r;this.config.autoFocus&&("year"!==e.type&&t!==_e||this.setFocusOnFrame(we),t===ve&&this.setFocusOnFrame(_e));const o=e[t];this.state.securedFields[t].isEncrypted=!0,Ct({error:"",fieldType:t},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=kt({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===ve&&St(this.state.securedFields,_e)){const t={txVariant:this.state.type,code:e.code,blob:o[0].blob,fieldType:_e,numKey:this.state.securedFields[_e].numKey};Et(t,Nt(this.state,_e),this.config.loadingContext)}for(t===ge&&ht(e.endDigits)&&(a[0].endDigits=e.endDigits),t===ge&&ht(e.issuerBin)&&(a[0].issuerBin=+e.issuerBin),t===Oe&&ht(e.expiryDate)&&(a[1].expiryDate=e.expiryDate),n=0,r=a.length;n<r;n+=1)this.callbacks.onFieldValid(a[n]);this.validateForm()}const Rt=(e,t)=>{let n=[];return e&&"function"==typeof e.querySelectorAll&&(n=[].slice.call(e.querySelectorAll(t))),n},At=(e,t)=>{if(e)return e.querySelector(t)},Tt=(e,t)=>{if(e)return e.getAttribute(t)};const It={__NO_BRAND:"noBrand",cards:[]};It.cards.push({cardType:"mc",startingRules:[51,52,53,54,55,22,23,24,25,26,27],permittedLengths:[16],pattern:/^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,securityCode:"CVC"}),It.cards.push({cardType:"visadankort",startingRules:[4571],permittedLengths:[16],pattern:/^(4571)[0-9]{0,12}$/}),It.cards.push({cardType:"visa",startingRules:[4],permittedLengths:[13,16,19],pattern:/^4[0-9]{0,18}$/,securityCode:"CVV"}),It.cards.push({cardType:"amex",startingRules:[34,37],permittedLengths:[15],pattern:/^3[47][0-9]{0,13}$/,securityCode:"CID"}),It.cards.push({cardType:"diners",startingRules:[36],permittedLengths:[14,15,16,17,18,19],pattern:/^(36)[0-9]{0,12}$/}),It.cards.push({cardType:"maestrouk",startingRules:[6759],permittedLengths:[16,18,19],pattern:/^(6759)[0-9]{0,15}$/}),It.cards.push({cardType:"solo",startingRules:[6767],permittedLengths:[16,18,19],pattern:/^(6767)[0-9]{0,15}$/}),It.cards.push({cardType:"laser",startingRules:[6304,6706,677117,677120],permittedLengths:[16,17,18,19],pattern:/^(6304|6706|6709|6771)[0-9]{0,15}$/,cvcPolicy:"optional"}),It.cards.push({cardType:"discover",startingRules:[6011,644,645,646,647,648,649,65],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})$/}),It.cards.push({cardType:"jcb",startingRules:[3528,3529,353,354,355,356,357,358],permittedLengths:[16,19],pattern:/^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,securityCode:"CAV"}),It.cards.push({cardType:"bcmc",startingRules:[6703,479658,606005],permittedLengths:[16,17,18,19],pattern:/^((6703)[0-9]{0,15}|(479658|606005)[0-9]{0,13})$/,cvcPolicy:"hidden"}),It.cards.push({cardType:"bijcard",startingRules:[5100081],permittedLengths:[16],pattern:/^(5100081)[0-9]{0,9}$/}),It.cards.push({cardType:"dankort",startingRules:[5019],permittedLengths:[16],pattern:/^(5019)[0-9]{0,12}$/}),It.cards.push({cardType:"hipercard",startingRules:[606282],permittedLengths:[16],pattern:/^(606282)[0-9]{0,10}$/}),It.cards.push({cardType:"cup",startingRules:[62,81],permittedLengths:[14,15,16,17,18,19],pattern:/^(62|81)[0-9]{0,17}$/}),It.cards.push({cardType:"maestro",startingRules:[50,56,57,58,6],permittedLengths:[16,17,18,19],pattern:/^(5[0|6-8][0-9]{0,17}|6[0-9]{0,18})$/,cvcPolicy:"optional"}),It.cards.push({cardType:"elo",startingRules:[506699,50670,50671,50672,50673,50674,50675,50676,506770,506771,506772,506773,506774,506775,506776,506777,506778,401178,438935,451416,457631,457632,504175,627780,636297,636368],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})$/}),It.cards.push({cardType:"uatp",startingRules:[1],permittedLengths:[15],pattern:/^1[0-9]{0,14}$/,cvcPolicy:"optional"}),It.cards.push({cardType:"cartebancaire",startingRules:[4,5,6],permittedLengths:[16],pattern:/^[4-6][0-9]{0,15}$/}),It.cards.push({cardType:"visaalphabankbonus",startingRules:[450903],permittedLengths:[16],pattern:/^(450903)[0-9]{0,10}$/}),It.cards.push({cardType:"mcalphabankbonus",startingRules:[510099],permittedLengths:[16],pattern:/^(510099)[0-9]{0,10}$/}),It.cards.push({cardType:"hiper",startingRules:[637095,637568,637599,637609,637612],permittedLengths:[16],pattern:/^(637095|637568|637599|637609|637612)[0-9]{0,10}$/}),It.cards.push({cardType:"oasis",startingRules:[982616],permittedLengths:[16],pattern:/^(982616)[0-9]{0,10}$/,cvcPolicy:"optional"}),It.cards.push({cardType:"karenmillen",startingRules:[98261465],permittedLengths:[16],pattern:/^(98261465)[0-9]{0,8}$/,cvcPolicy:"optional"}),It.cards.push({cardType:"warehouse",startingRules:[982633],permittedLengths:[16],pattern:/^(982633)[0-9]{0,10}$/,cvcPolicy:"optional"}),It.cards.push({cardType:"mir",startingRules:[220],permittedLengths:[16,17,18,19],pattern:/^(220)[0-9]{0,16}$/}),It.cards.push({cardType:"codensa",startingRules:[590712],permittedLengths:[16],pattern:/^(590712)[0-9]{0,10}$/}),It.cards.push({cardType:"naranja",startingRules:[377798,377799,402917,402918,527571,527572,589562],permittedLengths:[16,17,18,19],pattern:/^(37|40|5[28])([279])\d*$/}),It.cards.push({cardType:"cabal",startingRules:[589657,600691,603522,6042,6043,636908],permittedLengths:[16,17,18,19],pattern:/^(58|6[03])([03469])\d*$/}),It.cards.push({cardType:"shopping",startingRules:[2799,589407,603488],permittedLengths:[16,17,18,19],pattern:/^(27|58|60)([39])\d*$/}),It.cards.push({cardType:"argencard",startingRules:[501],permittedLengths:[16,17,18,19],pattern:/^(50)(1)\d*$/}),It.cards.push({cardType:"troy",startingRules:[9792],permittedLengths:[16],pattern:/^(97)(9)\d*$/}),It.cards.push({cardType:"forbrugsforeningen",startingRules:[600722],permittedLengths:[16],pattern:/^(60)(0)\d*$/}),It.cards.push({cardType:"vpay",startingRules:[401,408,413,434,435,437,439,441,442,443,444,446,447,455,458,460,461,463,466,471,479,482,483,487],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}$/}),It.cards.push({cardType:"rupay",startingRules:[508528],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}$/}),It.cards.push({cardType:"ticket",expiryDatePolicy:"hidden"});var xt=e=>It.cards.filter(t=>t.cardType===e)[0],Mt=e=>{if(!e)throw new Error("Error: isGenericCardType: type param has not been specified");return"card"===e||"scheme"===e};It.__NO_BRAND,It.cards;const Ft=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.addEventListener)&&(e.addEventListener(t,n,r),!0),Bt=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.removeEventListener)&&(e.removeEventListener(t,n,r),!0);function Lt(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=>Lt(e[n],t[n])):e===t}function Vt(...e){const t=e,n=t.shift();return function(...e){return n.apply(this,t.concat(e))}}function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Kt{constructor(){$t(this,"sfConfig",void 0),$t(this,"componentType",void 0),$t(this,"loadingContext",void 0),$t(this,"holderEl",void 0),$t(this,"iframeRef",void 0),$t(this,"loadToConfigTimeout",void 0),$t(this,"_isValid",void 0),$t(this,"_iframeContentWindow",void 0),$t(this,"_numKey",void 0),$t(this,"_isEncrypted",void 0),$t(this,"_hasError",void 0),$t(this,"_errorType",void 0),$t(this,"_cvcPolicy",void 0),$t(this,"_expiryDatePolicy",void 0),$t(this,"_iframeOnLoadListener",void 0),$t(this,"_postMessageListener",void 0),$t(this,"submitAnalytics",void 0),$t(this,"onIframeLoadedCallback",void 0),$t(this,"onConfigCallback",void 0),$t(this,"onEncryptionCallback",void 0),$t(this,"onValidationCallback",void 0),$t(this,"onFocusCallback",void 0),$t(this,"onBinValueCallback",void 0),$t(this,"onTouchstartCallback",void 0),$t(this,"onShiftTabCallback",void 0),$t(this,"onAutoCompleteCallback",void 0),$t(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ht=(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){Ut(e,t,n[t])})}return e}({},e),o=zt(n);return r.error=((e,t)=>Object.values(rt).reduce((n,r)=>(r.includes(t)&&(n[r]=e.get(r)),n),{}))(t,o),r},qt=(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,"-")},zt=e=>{let t;switch(e){case ge:t=nt.CC_NUM;break;case Oe:t=nt.CC_DAT;break;case ve:t=nt.CC_MTH;break;case _e:t=nt.CC_YR;break;case we:t=nt.CC_CVC;break;case Pe:t=nt.KCP_PWD}return t},Wt=({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:Ge,fieldToFocus:t[0]}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:Ye}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:"none"}},Gt=(e,t)=>{if(!e)return null;return Object.entries(e).reduce((e,[n,r])=>{if(r){e[`${t}${n}`]=r}return e},{})};function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Zt=(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){Yt(e,t,n[t])})}return e}({},e),a={};switch(n){case"ach":case Ce:break;default:if(r===we)a[ke]=t.get("creditCard.securityCode.contextualText.3digits"),a[Se]=t.get("creditCard.securityCode.contextualText.4digits");else{const e=`creditCard.${qe[r]}.contextualText`,n=t.get(e);n!==e&&(a[r]=n)}}return Object.keys(a).length&&(o.contextualTexts=a),o};function Qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(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 Xt(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}.${qe[t]}.label`),s=n.locale;let l=Ht({iframeTitle:a,label:i},n,t);return r&&(l=Zt(l,n,e,t)),Jt(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){Qt(e,t,n[t])})}return e}({},s&&{lang:s}),{[t]:l})}function en(){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 tn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nn=function(e){return e.info="info",e.error="error",e.log="log",e}({});class rn{constructor(e){tn(this,"timestamp",void 0),tn(this,"id",void 0),tn(this,"component",void 0),this.component=e,this.id=en(),this.timestamp=String(Date.now())}}function on(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var an=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}({}),sn=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 ln extends rn{getEventCategory(){return nn.error}constructor(e){super(e.component),on(this,"errorType",void 0),on(this,"code",void 0),on(this,"message",void 0),this.errorType=e.errorType,this.code=e.code,e.message&&(this.message=e.message)}}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}function un(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){cn(e,t,n[t])})}return e}function dn(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 pn extends Kt{init(e,t,n,r){const o=Xt(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===Ce?{[t]:null!==(r=n[qe[t]])&&void 0!==r?r:""}:t===we?{[ke]:null!==(o=n.securityCodeThreeDigits)&&void 0!==o?o:"",[Se]:null!==(a=n.securityCodeFourDigits)&&void 0!==a?a:""}:{[t]:null!==(i=n[qe[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=At(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 ln({component:this.componentType,code:sn.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND,errorType:an.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,Ft(i,"load",this.iframeOnLoadListener,!1)}return this.iframeRef=i,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,Ft(window,"message",this.postMessageListener,!1);const e=dn(un({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),Et(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&&vt("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.indexOf("webpack")>-1)(e)?void(this.sfConfig.showWarnings&&Ot("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):(e=>e.data&&"string"==typeof e.data&&e.data.indexOf("cvox")>-1)(e)?void(this.sfConfig.showWarnings&&Ot("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&Ot("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",e.data))}if(St(t,"action")&&St(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 ln({component:this.componentType,code:t.code,errorType:an.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&&vt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&vt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){Bt(window,"message",this.postMessageListener,!1),Bt(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,(e=>{for(;e.firstChild;)e.removeChild(e.firstChild)})(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===Oe||this.sfConfig.fieldType===ve||this.sfConfig.fieldType===_e)switch(this.expiryDatePolicy){case Le:return!0;case Be:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===we)switch(this.cvcPolicy){case Me:return!0;case xe: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===we)switch(this.cvcPolicy){case Me:return!0;case xe:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===Oe||this.sfConfig.fieldType===ve||this.sfConfig.fieldType===_e)switch(this.expiryDatePolicy){case Le:return!0;case Be: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===we&&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!==Oe&&this.sfConfig.fieldType!==ve&&this.sfConfig.fieldType!==_e||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();const n=bt(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=dn(un({},n),{iframeUIConfig:un({},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 hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn="NETWORK_ERROR",mn="IMPLEMENTATION_ERROR",fn="API_ERROR",bn="ERROR",gn="SDK_ERROR";class On extends Error{constructor(e,t,n){super(t),hn(this,"cause",void 0),hn(this,"options",void 0),this.name=On.errorTypes[e],this.options=n||{},this.cause=this.options.cause}}hn(On,"errorTypes",{NETWORK_ERROR:yn,CANCEL:"CANCEL",IMPLEMENTATION_ERROR:mn,API_ERROR:fn,ERROR:bn,SCRIPT_ERROR:"SCRIPT_ERROR",SDK_ERROR:gn});const vn=(e,t)=>{const n="card"===e?"nocard":e||"nocard",r={type:n,extension:"svg"};return t.getImage(r)(n)},_n=e=>{let t=e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return wn(e)&&(t=t.substring(10)),t};function wn(e){return Ne.includes(e)}function Pn(e,t){if(null==e)return{};var n,r,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(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 kn(){this.encryptedAttrName=Ve;const e=Rt(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const t=Tt(e,this.encryptedAttrName),n=wn(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=Ie,n=Fe;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(e,t,n),e.length):(this.createNonCardSecuredFields(e),e.length)}async function Sn(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 Cn(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=xt(r);pt(e)?(t=e.cvcPolicy||Ie,n=e.expiryDatePolicy||Fe,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 jn(e,t,n){return new Promise((r,o)=>{const a=Tt(e,this.encryptedAttrName);a===_e&&(this.state.hasSeparateDateFields=!0);const i={fieldType:a,extraFieldData:Tt(e,$e),uid:Tt(e,Ke),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,implementatio