@trustpayments/3ds-sdk-js 1.2.731 → 1.2.732

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.tp-3ds-challenge-iframe{border:0;outline:0;overflow:hidden}@media (max-width:440px){.tp-3ds-challenge-iframe{width:100%}}.tp-3ds-method-url-iframe{border:0;width:0;height:0}.tp-3ds-overlay{background-color:#ffffffe6;position:fixed;top:0;left:0}.tp-3ds-processing-screen{position:relative}.tp-3ds-processing-screen-wrapper{z-index:50;background-color:#ffffffe6;width:100%;height:100%;position:fixed;top:0;left:0}.tp-3ds-processing-screen-wrapper-attach-to-element{position:absolute}.tp-3ds-processing-screen-loader{box-sizing:border-box;will-change:animation;border:4px solid #e61c5b;border-color:#e61c5b #0000;border-radius:32px;width:40px;height:40px;animation:1.2s cubic-bezier(.5,0,.5,1) .15s infinite tp-3ds-spin;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%)rotate(0)}.tp-3ds-processing-screen-loader-with-logo{margin-top:30px}.tp-3ds-processing-screen-logo{-webkit-user-select:none;user-select:none;position:absolute;top:50%;left:50%}.tp-3ds-processing-screen-wrapper-visa .tp-3ds-processing-screen-logo{margin:-100px 0 0 -56px}.tp-3ds-processing-screen-wrapper-mastercard .tp-3ds-processing-screen-logo{margin:-123px 0 0 -79px}.tp-3ds-processing-screen-wrapper-amex .tp-3ds-processing-screen-logo{margin:-124px 0 0 -60px}@keyframes tp-3ds-spin{0%{transform:translate(-50%)rotate(0)}to{transform:translate(-50%)rotate(360deg)}}.tp-3ds-popup-view{content:"";z-index:999999;min-width:100vw;height:100vh}.tp-3ds-popup-view-overlay{box-sizing:border-box;background-color:#fff;flex-direction:column;padding:20px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:0 6px 22px -3px #000}.tp-3ds-popup-view-wrapper{height:100%}.tp-3ds-popup-view-header{justify-content:flex-end;display:flex}.tp-3ds-popup-view-header-button{background-color:#0000;border:0;font-size:12px;font-weight:600;position:relative;top:-10px;left:10px}.tp-3ds-popup-view-header-button:hover{cursor:pointer;text-decoration:underline}@media (max-width:440px){.tp-3ds-popup-view-overlay{width:100%;padding:5px}}.tp-3ds-inline-view iframe{width:100%;height:100%;min-height:200px;overflow:hidden}.tp-3ds-inline-view{height:100%}.tp-3ds-inline-view-wrapper{height:calc(100% - 18px)}.tp-3ds-inline-view-header{justify-content:flex-end;display:flex}.tp-3ds-inline-view-header-button{background-color:#0000;border:0;margin:10px;padding:0;font-size:12px;font-weight:600;position:relative}.tp-3ds-inline-view-header-button:hover{cursor:pointer;text-decoration:underline}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}function n(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function r(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function i(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function a(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function s(e){return this instanceof s?(this.v=e,this):new s(e)}function c(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,f)}}function c(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||l(e,t)})},t&&(i[e]=t(i[e])))}function l(e,t){try{u(r[e](t))}catch(e){p(a[0][3],e)}}function u(e){e.value instanceof s?Promise.resolve(e.value.v).then(d,f):p(a[0][2],e)}function d(e){l(`next`,e)}function f(e){l(`throw`,e)}function p(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function l(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof i==`function`?i(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),a(r,i,n.done,n.value)})}}function a(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function u(e){return typeof e==`function`}function d(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var f=d(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}function n(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function r(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function i(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function a(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function o(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function s(e){return this instanceof s?(this.v=e,this):new s(e)}function c(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,f)}}function c(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||l(e,t)})},t&&(i[e]=t(i[e])))}function l(e,t){try{u(r[e](t))}catch(e){p(a[0][3],e)}}function u(e){e.value instanceof s?Promise.resolve(e.value.v).then(d,f):p(a[0][2],e)}function d(e){l(`next`,e)}function f(e){l(`throw`,e)}function p(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function l(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof i==`function`?i(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),a(r,i,n.done,n.value)})}}function a(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function u(e){return typeof e==`function`}function d(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var f=d(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
3
3
  `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(`
4
- `):``,this.name=`UnsubscriptionError`,this.errors=t}});function p(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var m=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=i(c),d=l.next();!d.done;d=l.next())d.value.remove(this)}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else c.remove(this);var p=this.initialTeardown;if(u(p))try{p()}catch(e){s=e instanceof f?e.errors:[e]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var h=i(m),g=h.next();!g.done;g=h.next()){var _=g.value;try{ee(_)}catch(e){s??=[],e instanceof f?s=o(o([],a(s)),a(e.errors)):s.push(e)}}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(s)throw new f(s)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)ee(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&p(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),h=m.EMPTY;function g(e){return e instanceof m||e&&`closed`in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function ee(e){u(e)?e():e.unsubscribe()}var _={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},v={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=v.delegate;return i?.setTimeout?i.setTimeout.apply(i,o([e,t],a(n))):setTimeout.apply(void 0,o([e,t],a(n)))},clearTimeout:function(e){return(v.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function te(e){v.setTimeout(function(){var t=_.onUnhandledError;if(t)t(e);else throw e})}function ne(){}var re=(function(){return y(`C`,void 0,void 0)})();function ie(e){return y(`E`,void 0,e)}function ae(e){return y(`N`,e,void 0)}function y(e,t,n){return{kind:e,value:t,error:n}}var b=null;function x(e){if(_.useDeprecatedSynchronousErrorHandling){var t=!b;if(t&&(b={errorThrown:!1,error:null}),e(),t){var n=b,r=n.errorThrown,i=n.error;if(b=null,r)throw i}}else e()}function oe(e){_.useDeprecatedSynchronousErrorHandling&&b&&(b.errorThrown=!0,b.error=e)}var S=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,g(t)&&t.add(n)):n.destination=ue,n}return n.create=function(e,t,n){return new w(e,t,n)},n.prototype.next=function(e){this.isStopped?E(ae(e),this):this._next(e)},n.prototype.error=function(e){this.isStopped?E(ie(e),this):(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped?E(re,this):(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(m),se=Function.prototype.bind;function C(e,t){return se.call(e,t)}var ce=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){T(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){T(e)}else T(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){T(e)}},e}(),w=function(e){t(n,e);function n(t,n,r){var i=e.call(this)||this,a;if(u(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&_.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&C(t.next,o),error:t.error&&C(t.error,o),complete:t.complete&&C(t.complete,o)}):a=t}return i.destination=new ce(a),i}return n}(S);function T(e){_.useDeprecatedSynchronousErrorHandling?oe(e):te(e)}function le(e){throw e}function E(e,t){var n=_.onStoppedNotification;n&&v.setTimeout(function(){return n(e,t)})}var ue={closed:!0,next:ne,error:le,complete:ne},D=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function O(e){return e}function de(e){return e.length===0?O:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var k=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=me(e)?e:new w(e,t,n);return x(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=fe(t),new t(function(t,r){var i=new w({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[D]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return de(e)(this)},e.prototype.toPromise=function(e){var t=this;return e=fe(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function fe(e){return e??_.Promise??Promise}function pe(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}function me(e){return e&&e instanceof S||pe(e)&&g(e)}function he(e){return u(e?.lift)}function A(e){return function(t){if(he(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function j(e,t,n,r,i){return new ge(e,t,n,r,i)}var ge=function(e){t(n,e);function n(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},n}(S),_e=d(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),M=function(e){t(n,e);function n(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n.prototype.lift=function(e){var t=new ve(this,this);return t.operator=e,t},n.prototype._throwIfClosed=function(){if(this.closed)throw new _e},n.prototype.next=function(e){var t=this;x(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var a=i(t.currentObservers),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}})},n.prototype.error=function(e){var t=this;x(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},n.prototype.complete=function(){var e=this;x(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},n.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?h:(this.currentObservers=null,a.push(e),new m(function(){t.currentObservers=null,p(a,e)}))},n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},n.prototype.asObservable=function(){var e=new k;return e.source=this,e},n.create=function(e,t){return new ve(e,t)},n}(k),ve=function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},n.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},n.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},n.prototype._subscribe=function(e){return this.source?.subscribe(e)??h},n}(M),ye=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},n}(M),be={now:function(){return(be.delegate||Date).now()},delegate:void 0},xe=function(e){t(n,e);function n(t,n){return e.call(this)||this}return n.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},n}(m),N={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=N.delegate;return i?.setInterval?i.setInterval.apply(i,o([e,t],a(n))):setInterval.apply(void 0,o([e,t],a(n)))},clearInterval:function(e){return(N.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},Se=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),N.setInterval(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&N.clearInterval(t)},n.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},n.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n}(xe),Ce=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=be.now,e}(),we=new(function(e){t(n,e);function n(t,n){n===void 0&&(n=Ce.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return n.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},n}(Ce))(Se),Te=we,Ee=new k(function(e){return e.complete()});function De(e){return e&&u(e.schedule)}function Oe(e){return e[e.length-1]}function ke(e){return De(Oe(e))?e.pop():void 0}function Ae(e,t){return typeof Oe(e)==`number`?e.pop():t}var P=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function je(e){return u(e?.then)}function Me(e){return u(e[D])}function Ne(e){return Symbol.asyncIterator&&u(e?.[Symbol.asyncIterator])}function Pe(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Fe(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var Ie=Fe();function Le(e){return u(e?.[Ie])}function Re(e){return c(this,arguments,function(){var t,n,i,a;return r(this,function(r){switch(r.label){case 0:t=e.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,s(t.read())];case 3:return n=r.sent(),i=n.value,a=n.done,a?[4,s(void 0)]:[3,5];case 4:return[2,r.sent()];case 5:return[4,s(i)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ze(e){return u(e?.getReader)}function F(e){if(e instanceof k)return e;if(e!=null){if(Me(e))return Be(e);if(P(e))return Ve(e);if(je(e))return He(e);if(Ne(e))return We(e);if(Le(e))return Ue(e);if(ze(e))return Ge(e)}throw Pe(e)}function Be(e){return new k(function(t){var n=e[D]();if(u(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function Ve(e){return new k(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function He(e){return new k(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,te)})}function Ue(e){return new k(function(t){var n,r;try{for(var a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}t.complete()})}function We(e){return new k(function(t){Ke(e,t).catch(function(e){return t.error(e)})})}function Ge(e){return We(Re(e))}function Ke(e,t){var i,a,o,s;return n(this,void 0,void 0,function(){var n,c;return r(this,function(r){switch(r.label){case 0:r.trys.push([0,5,6,11]),i=l(e),r.label=1;case 1:return[4,i.next()];case 2:if(a=r.sent(),a.done)return[3,4];if(n=a.value,t.next(n),t.closed)return[2];r.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=r.sent(),o={error:c},[3,11];case 6:return r.trys.push([6,,9,10]),a&&!a.done&&(s=i.return)?[4,s.call(i)]:[3,8];case 7:r.sent(),r.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function I(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function qe(e,t){return t===void 0&&(t=0),A(function(n,r){n.subscribe(j(r,function(n){return I(r,e,function(){return r.next(n)},t)},function(){return I(r,e,function(){return r.complete()},t)},function(n){return I(r,e,function(){return r.error(n)},t)}))})}function Je(e,t){return t===void 0&&(t=0),A(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Ye(e,t){return F(e).pipe(Je(t),qe(t))}function Xe(e,t){return F(e).pipe(Je(t),qe(t))}function Ze(e,t){return new k(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Qe(e,t){return new k(function(n){var r;return I(n,t,function(){r=e[Ie](),I(n,t,function(){var e,t,i;try{e=r.next(),t=e.value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return u(r?.return)&&r.return()}})}function $e(e,t){if(!e)throw Error(`Iterable cannot be null`);return new k(function(n){I(n,t,function(){var r=e[Symbol.asyncIterator]();I(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function et(e,t){return $e(Re(e),t)}function tt(e,t){if(e!=null){if(Me(e))return Ye(e,t);if(P(e))return Ze(e,t);if(je(e))return Xe(e,t);if(Ne(e))return $e(e,t);if(Le(e))return Qe(e,t);if(ze(e))return et(e,t)}throw Pe(e)}function nt(e,t){return t?tt(e,t):F(e)}function L(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nt(e,ke(e))}function R(e,t){var n=u(e)?e:function(){return e},r=function(e){return e.error(n())};return new k(t?function(e){return t.schedule(r,0,e)}:r)}var rt=d(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}});function it(e){return e instanceof Date&&!isNaN(e)}var at=d(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function ot(e,t){var n=it(e)?{first:e}:typeof e==`number`?{each:e}:e,r=n.first,i=n.each,a=n.with,o=a===void 0?st:a,s=n.scheduler,c=s===void 0?t??we:s,l=n.meta,u=l===void 0?null:l;if(r==null&&i==null)throw TypeError(`No timeout provided.`);return A(function(e,t){var n,a,s=null,l=0,d=function(e){a=I(t,c,function(){try{n.unsubscribe(),F(o({meta:u,lastValue:s,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe(j(t,function(e){a?.unsubscribe(),l++,t.next(s=e),i>0&&d(i)},void 0,void 0,function(){a?.closed||a?.unsubscribe(),s=null})),!l&&d(r==null?i:typeof r==`number`?r:+r-c.now())})}function st(e){throw new at(e)}function z(e,t){return A(function(n,r){var i=0;n.subscribe(j(r,function(n){r.next(e.call(t,n,i++))}))})}var ct=Array.isArray;function lt(e,t){return ct(t)?e.apply(void 0,o([],a(t))):e(t)}function ut(e){return z(function(t){return lt(e,t)})}function dt(e,t,n,r,i,a,o,s){var c=[],l=0,u=0,d=!1,f=function(){d&&!c.length&&!l&&t.complete()},p=function(e){return l<r?m(e):c.push(e)},m=function(e){a&&t.next(e),l++;var s=!1;F(n(e,u++)).subscribe(j(t,function(e){i?.(e),a?p(e):t.next(e)},function(){s=!0},void 0,function(){if(s)try{l--;for(var e=function(){var e=c.shift();o?I(t,o,function(){return m(e)}):m(e)};c.length&&l<r;)e();f()}catch(e){t.error(e)}}))};return e.subscribe(j(t,p,function(){d=!0,f()})),function(){s?.()}}function B(e,t,n){return n===void 0&&(n=1/0),u(t)?B(function(n,r){return z(function(e,i){return t(n,e,r,i)})(F(e(n,r)))},n):(typeof t==`number`&&(n=t),A(function(t,r){return dt(t,r,e,n)}))}function ft(e){return e===void 0&&(e=1/0),B(O,e)}function pt(e){return new k(function(t){F(e()).subscribe(t)})}var mt=[`addListener`,`removeListener`],ht=[`addEventListener`,`removeEventListener`],gt=[`on`,`off`];function V(e,t,n,r){if(u(n)&&(r=n,n=void 0),r)return V(e,t,n).pipe(ut(r));var i=a(bt(e)?ht.map(function(r){return function(i){return e[r](t,i,n)}}):vt(e)?mt.map(_t(e,t)):yt(e)?gt.map(_t(e,t)):[],2),o=i[0],s=i[1];if(!o&&P(e))return B(function(e){return V(e,t,n)})(F(e));if(!o)throw TypeError(`Invalid event target`);return new k(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function _t(e,t){return function(n){return function(r){return e[n](t,r)}}}function vt(e){return u(e.addListener)&&u(e.removeListener)}function yt(e){return u(e.on)&&u(e.off)}function bt(e){return u(e.addEventListener)&&u(e.removeEventListener)}function xt(e,t,n){e===void 0&&(e=0),n===void 0&&(n=Te);var r=-1;return t!=null&&(De(t)?n=t:r=t),new k(function(t){var i=it(e)?+e-n.now():e;i<0&&(i=0);var a=0;return n.schedule(function(){t.closed||(t.next(a++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function St(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ke(e),r=Ae(e,1/0),i=e;return i.length?i.length===1?F(i[0]):ft(r)(nt(i,n)):Ee}function Ct(e,t){return A(function(n,r){var i=0;n.subscribe(j(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function wt(e){return A(function(t,n){var r=null,i=!1,a;r=t.subscribe(j(n,void 0,void 0,function(o){a=F(e(o,wt(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function Tt(e){return A(function(t,n){var r=!1;t.subscribe(j(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Et(e){return e<=0?function(){return Ee}:A(function(t,n){var r=0;t.subscribe(j(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function Dt(e){return e===void 0&&(e=Ot),A(function(t,n){var r=!1;t.subscribe(j(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function Ot(){return new rt}function kt(e){return A(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function H(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?Ct(function(t,n){return e(t,n,r)}):O,Et(1),n?Tt(t):Dt(function(){return new rt}))}}function At(e){e===void 0&&(e=1/0);var t=e&&typeof e==`object`?e:{count:e},n=t.count,r=n===void 0?1/0:n,i=t.delay,a=t.resetOnSuccess,o=a!==void 0&&a;return r<=0?O:A(function(e,t){var n=0,a,s=function(){var c=!1;a=e.subscribe(j(t,function(e){o&&(n=0),t.next(e)},void 0,function(e){if(n++<r){var o=function(){a?(a.unsubscribe(),a=null,s()):c=!0};if(i!=null){var l=typeof i==`number`?xt(i):F(i(e,n)),u=j(t,function(){u.unsubscribe(),o()},function(){t.complete()});l.subscribe(u)}else o()}else t.error(e)})),c&&(a.unsubscribe(),a=null,s())};s()})}function U(e,t){return A(function(n,r){var i=null,a=0,o=!1,s=function(){return o&&!i&&r.complete()};n.subscribe(j(r,function(n){i?.unsubscribe();var o=0,c=a++;F(e(n,c)).subscribe(i=j(r,function(e){return r.next(t?t(n,e,c,o++):e)},function(){i=null,s()}))},function(){o=!0,s()}))})}function W(e,t,n){var r=u(e)||t||n?{next:e,error:t,complete:n}:e;return r?A(function(e,t){var n;(n=r.subscribe)==null||n.call(r);var i=!0;e.subscribe(j(t,function(e){var n;(n=r.next)==null||n.call(r,e),t.next(e)},function(){var e;i=!1,(e=r.complete)==null||e.call(r),t.complete()},function(e){var n;i=!1,(n=r.error)==null||n.call(r,e),t.error(e)},function(){var e,t;i&&((e=r.unsubscribe)==null||e.call(r)),(t=r.finalize)==null||t.call(r)}))}):O}var G=function(e){return e.ERROR=`ERROR`,e.ALL=`ALL`,e}({}),jt=class{loggerService;configService;browserData;challengeService;methodURLService;sessionIdService;processingScreenService;logs$;constructor(e,t,n,r,i,a,o){this.loggerService=e,this.configService=t,this.browserData=n,this.challengeService=r,this.methodURLService=i,this.sessionIdService=a,this.processingScreenService=o,this.logs$=this.loggerService.logs$}init$(e){try{return this.loggerService.init(e.loggingLevel||G.ERROR),this.configService.setConfig(e),this.sessionIdService.createId(),this.configService.getConfig$().pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`Initialization failed\n\n${JSON.stringify(e)}`))}}run3DSMethod$(e,t,n){try{return this.methodURLService.run$(e,t,n).pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`3DS Method failed\n\n${JSON.stringify(e)}`))}}doChallenge$(e,t,n,r,i,a){try{return this.challengeService.run$(e,t,n,r,i,a).pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`3DS Challenge failed\n\n${JSON.stringify(e)}`))}}getBrowserData$(e,t){try{return this.browserData.getData$(e,t)}catch(e){throw this.loggerService.error(e),Error(`getBrowserData() failed.\n\n${JSON.stringify(e)}`)}}addProcessingScreenDuration=e=>new Promise(t=>{setTimeout(()=>{t(`duration`)},e+2e3||2e3)});async showProcessingScreen(e,t=0){try{this.processingScreenService.show(e),await this.addProcessingScreenDuration(t)}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Show Processing Screen failed\n\n${JSON.stringify(e)}`))}}hideProcessingScreen(){try{this.processingScreenService.hide()}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Hide Processing Screen failed\n\n${JSON.stringify(e)}`))}}cancelChallenge$(){try{return this.challengeService.cancelChallenge$()}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Cancel process has failed\n\n${JSON.stringify(e)}`))}}},K=function(e){return e.ERROR=`error`,e.WARNING=`warning`,e.DEBUG=`debug`,e}({}),Mt=class{logsSubject$=new M;loggingLevel=G.ERROR;logs$=this.logsSubject$.asObservable();init(e){this.loggingLevel=e,this.logsSubject$.subscribe(e=>this.logToConsole(e))}getErrorMessage(e){return e instanceof Error?`3dsJS dev error\n\n${e.message}`:`3dsJS dev error\n\n${e}`}error(e){let t=typeof e==`string`?e:e.stack;this.logMessage(K.ERROR,`${t}`)}warning(e){this.logMessage(K.WARNING,`3dsJS dev warning\n\n${e}`)}debug(e){this.logMessage(K.DEBUG,`3dsJS dev debug\n\n${e}`)}logMessage(e,t){this.logsSubject$.next({type:e,message:t,time:new Date})}logToConsole(e){if(!(this.loggingLevel===G.ERROR&&e.type!==K.ERROR))switch(e.type){case K.ERROR:console.error(e.message);break;case K.WARNING:console.warn(e.message);break;case K.DEBUG:console.debug(e.message);break}}},q=class e extends Error{constructor(t){super(t),this.name=`ValidationError`,Object.setPrototypeOf(this,e.prototype)}},J=function(e){return e.OVERLAY=`OVERLAY`,e.ATTACH_TO_ELEMENT=`ATTACH_TO_ELEMENT`,e}({}),Y=function(e){return e.POPUP=`POPUP`,e.INLINE=`INLINE`,e}({}),Nt=class{domMethodsService;translationsWhitelist=[`cancel`];constructor(e){this.domMethodsService=e}config$=new ye({challengeDisplayMode:Y.POPUP,loggingLevel:G.ERROR,translations:{cancel:`X`},processingScreenMode:J.OVERLAY,threeDSMethodTimeout:1e4});getConfig$(){return this.config$.asObservable()}setConfig(e){let t={...this.config$.value,...e};this.validateConfig(t),this.config$.next(t)}validateConfig(e){this.validateAgainstUnknownProperties(e),this.validateChallengeDisplayMode(e),this.validateLoggingLevel(e),this.validateTranslations(e),this.validateProcessingScreen(e),this.validateThreeDSMethodTimeout(e)}validateAgainstUnknownProperties(e){let t=[`challengeDisplayMode`,`challengeDisplayInlineTargetElementId`,`loggingLevel`,`translations`,`processingScreenMode`,`processingScreenWrapperElementId`,`threeDSMethodTimeout`],n=Object.keys(e).filter(e=>!t.includes(e));if(n.length>0)throw new q(`config contains unknown properties: ${n.join(`, `)}`)}validateChallengeDisplayMode(e){if(!Object.values(Y).includes(e.challengeDisplayMode))throw new q(`config.challengeDisplayMode must be either ${Y.POPUP} or ${Y.INLINE}`);if(e.challengeDisplayMode===Y.INLINE&&!this.domMethodsService.getElement(`#${e.challengeDisplayInlineTargetElementId}`))throw new q(`config.challengeDisplayInlineTargetElementId must exist when using display mode ${Y.INLINE}`)}validateLoggingLevel(e){if(!Object.values(G).includes(e.loggingLevel))throw new q(`config.loggingLevel must be: ${G.ERROR} or ${G.ALL}`)}validateTranslations(e){if(e.translations){let t=Object.keys(e.translations).filter(e=>!this.translationsWhitelist.includes(e));if(t.length>0)throw new q(`config.translations contains unknown keys: ${t.join(`,`)}. Whitelisted keys are: ${this.translationsWhitelist.join(`,`)}`)}else throw new q(`config.translations must be an object`)}validateProcessingScreen(e){if(!Object.values(J).includes(e.processingScreenMode))throw new q(`config.processingScreenMode must be either ${J.OVERLAY} or ${J.ATTACH_TO_ELEMENT}`);if(e.processingScreenMode===J.ATTACH_TO_ELEMENT&&!this.domMethodsService.getElement(`#${e.processingScreenWrapperElementId}`))throw new q(`config.processingScreenWrapperElementId must exist when using processing screen mode ${J.ATTACH_TO_ELEMENT}`)}validateThreeDSMethodTimeout(e){if(!(typeof e.threeDSMethodTimeout==`number`&&e.threeDSMethodTimeout>0&&e.threeDSMethodTimeout<=1e4))throw new q(`config.threeDSMethodTimeout must be a number in range from 1 to 10000 milliseconds`)}},Pt=class{sessionId=null;createId(){this.sessionId=crypto.randomUUID()}getId(){return this.sessionId}},X=function(e){return e.METHOD_URL_RESPONSE=`TP_METHOD_URL_RESPONSE`,e.CHALLENGE_RESPONSE=`TP_CHALLENGE_RESPONSE`,e.BROWSER_DATA_RESPONSE=`TP_BROWSER_DATA_RESPONSE`,e}({}),Ft=class{window;domMethodsService;interFrameCommunicatorService;base64TranscoderService;loggerService;acceptableColorDepthValues=[1,4,8,15,16,24,32,48];fallbackColorDepthValue=24;browserDataIframeSelector=`tp-3ds-browser-data-iframe`;browserDataTimeout=1e4;fallbackAcceptHeaderValue=`*/*`;constructor(e,t,n,r,i){this.window=e,this.domMethodsService=t,this.interFrameCommunicatorService=n,this.base64TranscoderService=r,this.loggerService=i}getData$(e,t){let n=this.getBrowserGeneralDataObject(t);return t&&!t.isRequiredBrowserIP&&!t.isRequiredBrowserAcceptHeader?L(n):this.getAcceptHeaderAndIPAddress$(e).pipe(z(e=>{let r={...n};return t?(t.isRequiredBrowserAcceptHeader&&(r.browserAcceptHeader=e.browserAcceptHeader),t.isRequiredBrowserIP&&(r.browserIP=e.browserIP)):(r.browserAcceptHeader=e.browserAcceptHeader,r.browserIP=e.browserIP),r}))}getBrowserGeneralDataObject(e){let t=e=>{if(!e)return``;let t=e.split(/[;,]/)[0].trim();t=t.replace(/_/g,`-`);let n=t.split(`-`);return n.length===1?n[0]:n.slice(0,2).join(`-`)},n={};return e?(e.isRequiredBrowserJavaEnabled&&(n.browserJavaEnabled=this.window.navigator.javaEnabled()),e.isRequiredBrowserJavascriptEnabled&&(n.browserJavascriptEnabled=!0),e.isRequiredBrowserLanguage&&(n.browserLanguage=t(this.window.navigator.language||this.window.navigator.userLanguage)),e.isRequiredBrowserScreenWidth&&(n.browserScreenWidth=this.window.screen.width),e.isRequiredBrowserScreenHeight&&(n.browserScreenHeight=this.getScreenHeight()),e.isRequiredBrowserColorDepth&&(n.browserColorDepth=this.getColorDepth(this.window.screen)),e.isRequiredBrowserUserAgent&&(n.browserUserAgent=this.window.navigator.userAgent),e.isRequiredBrowserTZ&&(n.browserTZ=new Date().getTimezoneOffset())):n={browserJavaEnabled:this.window.navigator.javaEnabled(),browserJavascriptEnabled:!0,browserLanguage:t(this.window.navigator.language),browserScreenWidth:this.window.screen.width,browserScreenHeight:this.getScreenHeight(),browserColorDepth:this.getColorDepth(this.window.screen),browserUserAgent:this.window.navigator.userAgent,browserTZ:new Date().getTimezoneOffset()},n}getScreenHeight(){let e=[this.window.screen.height,this.window.screen.availHeight,this.window.innerHeight,this.window.outerHeight],t=!1,n=999999,r=n;for(let i of e)if(i!==void 0&&typeof i==`number`&&i>0&&i<=n){r=i;break}else t=!0;return t&&this.loggerService.error(`Error in calculating screen height. Chosen value is ${r}. Options were ${JSON.stringify(e)}`),r}getColorDepth(e){return this.acceptableColorDepthValues.includes(e.colorDepth)?e.colorDepth:this.fallbackColorDepthValue}getAcceptHeaderAndIPAddress$(e){let t=typeof e==`string`?e:e[0];return pt(()=>L(this.createIframeForAcceptHeaderAndIPAddress(t))).pipe(U(()=>this.interFrameCommunicatorService.receive$(X.BROWSER_DATA_RESPONSE).pipe(Et(1))),W(e=>this.loggerService.debug(`Received raw browser data from iframe: ${e}`)),z(e=>this.base64TranscoderService.decode(e)),z(e=>({browserAcceptHeader:e.acceptHeader,browserIP:e.userIP})),W(e=>this.loggerService.debug(`Collected browser data: ${JSON.stringify(e)}`)),kt(()=>this.destroyView()),ot(this.browserDataTimeout),At(2),wt(e=>(this.loggerService.error(`Cannot retrieve user IP and accept header. Using fallback values instead.`),this.loggerService.error(e),L({browserAcceptHeader:this.fallbackAcceptHeaderValue,browserIP:``}))))}createIframeForAcceptHeaderAndIPAddress(e){let t=this.domMethodsService.createElement(`iframe`,{src:e,id:this.browserDataIframeSelector,width:`0px`,height:`0px`});this.domMethodsService.addToElement(t,this.domMethodsService.getElement(`body`)),this.loggerService.debug(`Created browser data iframe, url: ${e}`),t.addEventListener(`load`,()=>this.loggerService.debug(`Browser data iframe load completed, waiting for data`))}destroyView(){this.domMethodsService.removeElement(this.domMethodsService.getElement(`#${this.browserDataIframeSelector}`)),this.loggerService.debug(`Destroyed browser data iframe`)}},Z=class e{static get V2(){return new e(`2.0.0`)}static versionNumberPattern=/^\d+\.\d+\.\d+$/;major;minor;patch;constructor(t){if(!t||!t.match(e.versionNumberPattern))throw Error(`Invalid 3DS version: ${t}`);let[n,r,i]=t.split(`.`);this.major=Number(n),this.minor=Number(r),this.patch=Number(i)}isEqual(e){return this.toString()===e.toString()}isHigherThan(e){return this.major===e.major?this.minor===e.minor?this.patch>e.patch:this.minor>e.minor:this.major>e.major}isHigherOrEqual(e){return this.isEqual(e)||this.isHigherThan(e)}isLowerThan(e){return!this.isHigherOrEqual(e)}isLowerOrEqual(e){return!this.isHigherThan(e)}toString(){return`${this.major}.${this.minor}.${this.patch}`}},It=class{configService;challengeV1Service;challengeV2Service;challengeCommonService;constructor(e,t,n,r){this.configService=e,this.challengeV1Service=t,this.challengeV2Service=n,this.challengeCommonService=r}run$(e,t,n,r,i,a){return this.configService.getConfig$().pipe(U(o=>e.isLowerThan(Z.V2)?this.challengeV1Service.run$(o,t,n,i,a,r):this.challengeV2Service.run$(o,t,n,r)))}cancelChallenge$(){return this.configService.getConfig$().pipe(W(e=>this.challengeCommonService.cancelChallenge(e)),U(e=>this.challengeCommonService.handleCancelEvent$(e)))}},Q=function(e){return e.SUCCESS=`SUCCESS`,e.FAILURE=`FAILURE`,e.ERROR=`ERROR`,e.NOACTION=`NOACTION`,e.CANCELLED=`CANCELLED`,e.COMPLETED=`COMPLETED`,e.UNCOMPLETED=`UNCOMPLETED`,e}({}),Lt=class{domMethodsService;interFrameCommunicatorService;base64TranscoderService;iframeCreatorService;configService;methodURLIframeSelector=`tp-3ds-method-url-iframe`;methodURLIframeFormSelector=`tp-3ds-method-url-form`;constructor(e,t,n,r,i){this.domMethodsService=e,this.interFrameCommunicatorService=t,this.base64TranscoderService=n,this.iframeCreatorService=r,this.configService=i}run$(e,t,n){if(typeof e!=`string`||e.length===0)throw new q(`run3DSMethod$() requires transactionId`);if(typeof t!=`string`||t.length===0)throw new q(`run3DSMethod$() requires notificationURL`);if(typeof n!=`string`||n.length===0)throw new q(`run3DSMethod$() requires methodURL`);return this.domMethodsService.addToElement(this.createIframeForMethodURL(n,e,t),this.domMethodsService.getElement(`body`)),this.configService.getConfig$().pipe(U(t=>this.interFrameCommunicatorService.receive$(X.METHOD_URL_RESPONSE).pipe(z(e=>this.mapStatus(this.base64TranscoderService.decode(e))),ot({first:t.threeDSMethodTimeout,with:()=>L(this.getUncompletedResult(e))}),W(()=>{this.destroyView()}))))}createIframeForMethodURL(e,t,n){let r=this.base64TranscoderService.encode({threeDSServerTransID:t,threeDSMethodNotificationURL:n}),i=this.iframeCreatorService.getIframe(this.methodURLIframeSelector),a=()=>{i.contentWindow.document.body.innerHTML=this.iframeCreatorService.getIframeHTMLMarkup(this.methodURLIframeFormSelector,e,[{name:`threeDSMethodData`,value:r}]),i.removeEventListener(`load`,a),i.contentWindow.document.getElementById(this.methodURLIframeFormSelector).submit()};return i.addEventListener(`load`,a),i}mapStatus(e){return{status:e.actionCode,description:e.errorDescription,transactionId:e.threeDSServerTransID}}destroyView(){this.domMethodsService.removeElement(this.domMethodsService.getElement(`#${this.methodURLIframeSelector}`))}getUncompletedResult(e){return{status:Q.UNCOMPLETED,description:`Method URL did not complete`,transactionId:e}}},$=function(e){return e.VISA=`VISA`,e.ELECTRON=`ELECTRON`,e.DELTA=`DELTA`,e.VPAY=`VPAY`,e.PURCHASING=`PURCHASING`,e.MASTER_CARD=`MASTERCARD`,e.MASTER_CARD_DEBIT=`MASTERCARDDEBIT`,e.MAESTRO=`MAESTRO`,e.AMEX=`AMEX`,e.UNKNOWN=`UNKNOWN`,e}({}),Rt=`
4
+ `):``,this.name=`UnsubscriptionError`,this.errors=t}});function p(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var m=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=i(c),d=l.next();!d.done;d=l.next())d.value.remove(this)}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else c.remove(this);var p=this.initialTeardown;if(u(p))try{p()}catch(e){s=e instanceof f?e.errors:[e]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var h=i(m),g=h.next();!g.done;g=h.next()){var _=g.value;try{ee(_)}catch(e){s??=[],e instanceof f?s=o(o([],a(s)),a(e.errors)):s.push(e)}}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(s)throw new f(s)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)ee(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&p(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),h=m.EMPTY;function g(e){return e instanceof m||e&&`closed`in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function ee(e){u(e)?e():e.unsubscribe()}var _={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},v={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=v.delegate;return i?.setTimeout?i.setTimeout.apply(i,o([e,t],a(n))):setTimeout.apply(void 0,o([e,t],a(n)))},clearTimeout:function(e){return(v.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function te(e){v.setTimeout(function(){var t=_.onUnhandledError;if(t)t(e);else throw e})}function ne(){}var re=(function(){return y(`C`,void 0,void 0)})();function ie(e){return y(`E`,void 0,e)}function ae(e){return y(`N`,e,void 0)}function y(e,t,n){return{kind:e,value:t,error:n}}var b=null;function x(e){if(_.useDeprecatedSynchronousErrorHandling){var t=!b;if(t&&(b={errorThrown:!1,error:null}),e(),t){var n=b,r=n.errorThrown,i=n.error;if(b=null,r)throw i}}else e()}function oe(e){_.useDeprecatedSynchronousErrorHandling&&b&&(b.errorThrown=!0,b.error=e)}var S=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,g(t)&&t.add(n)):n.destination=ue,n}return n.create=function(e,t,n){return new w(e,t,n)},n.prototype.next=function(e){this.isStopped?E(ae(e),this):this._next(e)},n.prototype.error=function(e){this.isStopped?E(ie(e),this):(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped?E(re,this):(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(m),se=Function.prototype.bind;function C(e,t){return se.call(e,t)}var ce=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){T(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){T(e)}else T(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){T(e)}},e}(),w=function(e){t(n,e);function n(t,n,r){var i=e.call(this)||this,a;if(u(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&_.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&C(t.next,o),error:t.error&&C(t.error,o),complete:t.complete&&C(t.complete,o)}):a=t}return i.destination=new ce(a),i}return n}(S);function T(e){_.useDeprecatedSynchronousErrorHandling?oe(e):te(e)}function le(e){throw e}function E(e,t){var n=_.onStoppedNotification;n&&v.setTimeout(function(){return n(e,t)})}var ue={closed:!0,next:ne,error:le,complete:ne},D=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function O(e){return e}function de(e){return e.length===0?O:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var k=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=me(e)?e:new w(e,t,n);return x(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=fe(t),new t(function(t,r){var i=new w({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[D]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return de(e)(this)},e.prototype.toPromise=function(e){var t=this;return e=fe(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function fe(e){return e??_.Promise??Promise}function pe(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}function me(e){return e&&e instanceof S||pe(e)&&g(e)}function he(e){return u(e?.lift)}function A(e){return function(t){if(he(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function j(e,t,n,r,i){return new ge(e,t,n,r,i)}var ge=function(e){t(n,e);function n(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},n}(S),_e=d(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),M=function(e){t(n,e);function n(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n.prototype.lift=function(e){var t=new ve(this,this);return t.operator=e,t},n.prototype._throwIfClosed=function(){if(this.closed)throw new _e},n.prototype.next=function(e){var t=this;x(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var a=i(t.currentObservers),o=a.next();!o.done;o=a.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}})},n.prototype.error=function(e){var t=this;x(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},n.prototype.complete=function(){var e=this;x(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},n.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?h:(this.currentObservers=null,a.push(e),new m(function(){t.currentObservers=null,p(a,e)}))},n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},n.prototype.asObservable=function(){var e=new k;return e.source=this,e},n.create=function(e,t){return new ve(e,t)},n}(k),ve=function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},n.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},n.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},n.prototype._subscribe=function(e){return this.source?.subscribe(e)??h},n}(M),ye=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n._value=t,n}return Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},n}(M),be={now:function(){return(be.delegate||Date).now()},delegate:void 0},xe=function(e){t(n,e);function n(t,n){return e.call(this)||this}return n.prototype.schedule=function(e,t){return t===void 0&&(t=0),this},n}(m),N={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=N.delegate;return i?.setInterval?i.setInterval.apply(i,o([e,t],a(n))):setInterval.apply(void 0,o([e,t],a(n)))},clearInterval:function(e){return(N.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},Se=function(e){t(n,e);function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n.prototype.schedule=function(e,t){if(t===void 0&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return n===void 0&&(n=0),N.setInterval(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&N.clearInterval(t)},n.prototype.execute=function(e,t){if(this.closed)return Error(`executing a cancelled action`);this.pending=!1;var n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r},n.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,r=t.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n}(xe),Ce=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=be.now,e}(),we=new(function(e){t(n,e);function n(t,n){n===void 0&&(n=Ce.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return n.prototype.flush=function(e){var t=this.actions;if(this._active){t.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}},n}(Ce))(Se),Te=we,Ee=new k(function(e){return e.complete()});function De(e){return e&&u(e.schedule)}function Oe(e){return e[e.length-1]}function ke(e){return De(Oe(e))?e.pop():void 0}function Ae(e,t){return typeof Oe(e)==`number`?e.pop():t}var P=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function je(e){return u(e?.then)}function Me(e){return u(e[D])}function Ne(e){return Symbol.asyncIterator&&u(e?.[Symbol.asyncIterator])}function Pe(e){return TypeError(`You provided `+(typeof e==`object`&&e?`an invalid object`:`'`+e+`'`)+` where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Fe(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var Ie=Fe();function Le(e){return u(e?.[Ie])}function Re(e){return c(this,arguments,function(){var t,n,i,a;return r(this,function(r){switch(r.label){case 0:t=e.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,s(t.read())];case 3:return n=r.sent(),i=n.value,a=n.done,a?[4,s(void 0)]:[3,5];case 4:return[2,r.sent()];case 5:return[4,s(i)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ze(e){return u(e?.getReader)}function F(e){if(e instanceof k)return e;if(e!=null){if(Me(e))return Be(e);if(P(e))return Ve(e);if(je(e))return He(e);if(Ne(e))return We(e);if(Le(e))return Ue(e);if(ze(e))return Ge(e)}throw Pe(e)}function Be(e){return new k(function(t){var n=e[D]();if(u(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function Ve(e){return new k(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function He(e){return new k(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,te)})}function Ue(e){return new k(function(t){var n,r;try{for(var a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}t.complete()})}function We(e){return new k(function(t){Ke(e,t).catch(function(e){return t.error(e)})})}function Ge(e){return We(Re(e))}function Ke(e,t){var i,a,o,s;return n(this,void 0,void 0,function(){var n,c;return r(this,function(r){switch(r.label){case 0:r.trys.push([0,5,6,11]),i=l(e),r.label=1;case 1:return[4,i.next()];case 2:if(a=r.sent(),a.done)return[3,4];if(n=a.value,t.next(n),t.closed)return[2];r.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=r.sent(),o={error:c},[3,11];case 6:return r.trys.push([6,,9,10]),a&&!a.done&&(s=i.return)?[4,s.call(i)]:[3,8];case 7:r.sent(),r.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function I(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function qe(e,t){return t===void 0&&(t=0),A(function(n,r){n.subscribe(j(r,function(n){return I(r,e,function(){return r.next(n)},t)},function(){return I(r,e,function(){return r.complete()},t)},function(n){return I(r,e,function(){return r.error(n)},t)}))})}function Je(e,t){return t===void 0&&(t=0),A(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Ye(e,t){return F(e).pipe(Je(t),qe(t))}function Xe(e,t){return F(e).pipe(Je(t),qe(t))}function Ze(e,t){return new k(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Qe(e,t){return new k(function(n){var r;return I(n,t,function(){r=e[Ie](),I(n,t,function(){var e,t,i;try{e=r.next(),t=e.value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return u(r?.return)&&r.return()}})}function $e(e,t){if(!e)throw Error(`Iterable cannot be null`);return new k(function(n){I(n,t,function(){var r=e[Symbol.asyncIterator]();I(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function et(e,t){return $e(Re(e),t)}function tt(e,t){if(e!=null){if(Me(e))return Ye(e,t);if(P(e))return Ze(e,t);if(je(e))return Xe(e,t);if(Ne(e))return $e(e,t);if(Le(e))return Qe(e,t);if(ze(e))return et(e,t)}throw Pe(e)}function nt(e,t){return t?tt(e,t):F(e)}function L(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nt(e,ke(e))}function R(e,t){var n=u(e)?e:function(){return e},r=function(e){return e.error(n())};return new k(t?function(e){return t.schedule(r,0,e)}:r)}var rt=d(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}});function it(e){return e instanceof Date&&!isNaN(e)}var at=d(function(e){return function(t){t===void 0&&(t=null),e(this),this.message=`Timeout has occurred`,this.name=`TimeoutError`,this.info=t}});function ot(e,t){var n=it(e)?{first:e}:typeof e==`number`?{each:e}:e,r=n.first,i=n.each,a=n.with,o=a===void 0?st:a,s=n.scheduler,c=s===void 0?t??we:s,l=n.meta,u=l===void 0?null:l;if(r==null&&i==null)throw TypeError(`No timeout provided.`);return A(function(e,t){var n,a,s=null,l=0,d=function(e){a=I(t,c,function(){try{n.unsubscribe(),F(o({meta:u,lastValue:s,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe(j(t,function(e){a?.unsubscribe(),l++,t.next(s=e),i>0&&d(i)},void 0,void 0,function(){a?.closed||a?.unsubscribe(),s=null})),!l&&d(r==null?i:typeof r==`number`?r:+r-c.now())})}function st(e){throw new at(e)}function z(e,t){return A(function(n,r){var i=0;n.subscribe(j(r,function(n){r.next(e.call(t,n,i++))}))})}var ct=Array.isArray;function lt(e,t){return ct(t)?e.apply(void 0,o([],a(t))):e(t)}function ut(e){return z(function(t){return lt(e,t)})}function dt(e,t,n,r,i,a,o,s){var c=[],l=0,u=0,d=!1,f=function(){d&&!c.length&&!l&&t.complete()},p=function(e){return l<r?m(e):c.push(e)},m=function(e){a&&t.next(e),l++;var s=!1;F(n(e,u++)).subscribe(j(t,function(e){i?.(e),a?p(e):t.next(e)},function(){s=!0},void 0,function(){if(s)try{l--;for(var e=function(){var e=c.shift();o?I(t,o,function(){return m(e)}):m(e)};c.length&&l<r;)e();f()}catch(e){t.error(e)}}))};return e.subscribe(j(t,p,function(){d=!0,f()})),function(){s?.()}}function B(e,t,n){return n===void 0&&(n=1/0),u(t)?B(function(n,r){return z(function(e,i){return t(n,e,r,i)})(F(e(n,r)))},n):(typeof t==`number`&&(n=t),A(function(t,r){return dt(t,r,e,n)}))}function ft(e){return e===void 0&&(e=1/0),B(O,e)}function pt(e){return new k(function(t){F(e()).subscribe(t)})}var mt=[`addListener`,`removeListener`],ht=[`addEventListener`,`removeEventListener`],gt=[`on`,`off`];function V(e,t,n,r){if(u(n)&&(r=n,n=void 0),r)return V(e,t,n).pipe(ut(r));var i=a(bt(e)?ht.map(function(r){return function(i){return e[r](t,i,n)}}):vt(e)?mt.map(_t(e,t)):yt(e)?gt.map(_t(e,t)):[],2),o=i[0],s=i[1];if(!o&&P(e))return B(function(e){return V(e,t,n)})(F(e));if(!o)throw TypeError(`Invalid event target`);return new k(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function _t(e,t){return function(n){return function(r){return e[n](t,r)}}}function vt(e){return u(e.addListener)&&u(e.removeListener)}function yt(e){return u(e.on)&&u(e.off)}function bt(e){return u(e.addEventListener)&&u(e.removeEventListener)}function xt(e,t,n){e===void 0&&(e=0),n===void 0&&(n=Te);var r=-1;return t!=null&&(De(t)?n=t:r=t),new k(function(t){var i=it(e)?+e-n.now():e;i<0&&(i=0);var a=0;return n.schedule(function(){t.closed||(t.next(a++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function St(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ke(e),r=Ae(e,1/0),i=e;return i.length?i.length===1?F(i[0]):ft(r)(nt(i,n)):Ee}function Ct(e,t){return A(function(n,r){var i=0;n.subscribe(j(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function wt(e){return A(function(t,n){var r=null,i=!1,a;r=t.subscribe(j(n,void 0,void 0,function(o){a=F(e(o,wt(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function Tt(e){return A(function(t,n){var r=!1;t.subscribe(j(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Et(e){return e<=0?function(){return Ee}:A(function(t,n){var r=0;t.subscribe(j(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function Dt(e){return e===void 0&&(e=Ot),A(function(t,n){var r=!1;t.subscribe(j(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function Ot(){return new rt}function kt(e){return A(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function H(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?Ct(function(t,n){return e(t,n,r)}):O,Et(1),n?Tt(t):Dt(function(){return new rt}))}}function At(e){e===void 0&&(e=1/0);var t=e&&typeof e==`object`?e:{count:e},n=t.count,r=n===void 0?1/0:n,i=t.delay,a=t.resetOnSuccess,o=a!==void 0&&a;return r<=0?O:A(function(e,t){var n=0,a,s=function(){var c=!1;a=e.subscribe(j(t,function(e){o&&(n=0),t.next(e)},void 0,function(e){if(n++<r){var o=function(){a?(a.unsubscribe(),a=null,s()):c=!0};if(i!=null){var l=typeof i==`number`?xt(i):F(i(e,n)),u=j(t,function(){u.unsubscribe(),o()},function(){t.complete()});l.subscribe(u)}else o()}else t.error(e)})),c&&(a.unsubscribe(),a=null,s())};s()})}function U(e,t){return A(function(n,r){var i=null,a=0,o=!1,s=function(){return o&&!i&&r.complete()};n.subscribe(j(r,function(n){i?.unsubscribe();var o=0,c=a++;F(e(n,c)).subscribe(i=j(r,function(e){return r.next(t?t(n,e,c,o++):e)},function(){i=null,s()}))},function(){o=!0,s()}))})}function W(e,t,n){var r=u(e)||t||n?{next:e,error:t,complete:n}:e;return r?A(function(e,t){var n;(n=r.subscribe)==null||n.call(r);var i=!0;e.subscribe(j(t,function(e){var n;(n=r.next)==null||n.call(r,e),t.next(e)},function(){var e;i=!1,(e=r.complete)==null||e.call(r),t.complete()},function(e){var n;i=!1,(n=r.error)==null||n.call(r,e),t.error(e)},function(){var e,t;i&&((e=r.unsubscribe)==null||e.call(r)),(t=r.finalize)==null||t.call(r)}))}):O}var G=function(e){return e.ERROR=`ERROR`,e.ALL=`ALL`,e}({}),jt=class{loggerService;configService;browserData;challengeService;methodURLService;sessionIdService;processingScreenService;logs$;constructor(e,t,n,r,i,a,o){this.loggerService=e,this.configService=t,this.browserData=n,this.challengeService=r,this.methodURLService=i,this.sessionIdService=a,this.processingScreenService=o,this.logs$=this.loggerService.logs$}init$(e){try{return this.loggerService.init(e.loggingLevel||G.ERROR),this.configService.setConfig(e),this.sessionIdService.createId(),this.configService.getConfig$().pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`Initialization failed\n\n${JSON.stringify(e)}`))}}run3DSMethod$(e,t,n){try{return this.methodURLService.run$(e,t,n).pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`3DS Method failed\n\n${JSON.stringify(e)}`))}}doChallenge$(e,t,n,r,i,a){try{return this.challengeService.run$(e,t,n,r,i,a).pipe(H())}catch(e){return this.loggerService.error(e),R(this.loggerService.getErrorMessage(`3DS Challenge failed\n\n${JSON.stringify(e)}`))}}getBrowserData$(e,t){try{return this.browserData.getData$(e,t)}catch(e){throw this.loggerService.error(e),Error(`getBrowserData() failed.\n\n${JSON.stringify(e)}`)}}addProcessingScreenDuration=e=>new Promise(t=>{setTimeout(()=>{t(`duration`)},e+2e3||2e3)});async showProcessingScreen(e,t=0){try{this.processingScreenService.show(e),await this.addProcessingScreenDuration(t)}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Show Processing Screen failed\n\n${JSON.stringify(e)}`))}}hideProcessingScreen(){try{this.processingScreenService.hide()}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Hide Processing Screen failed\n\n${JSON.stringify(e)}`))}}cancelChallenge$(){try{return this.challengeService.cancelChallenge$()}catch(e){throw this.loggerService.error(e),Error(this.loggerService.getErrorMessage(`Cancel process has failed\n\n${JSON.stringify(e)}`))}}},K=function(e){return e.ERROR=`error`,e.WARNING=`warning`,e.DEBUG=`debug`,e}({}),Mt=class{logsSubject$=new M;loggingLevel=G.ERROR;logs$=this.logsSubject$.asObservable();init(e){this.loggingLevel=e,this.logsSubject$.subscribe(e=>this.logToConsole(e))}getErrorMessage(e){return e instanceof Error?`3dsJS dev error\n\n${e.message}`:`3dsJS dev error\n\n${e}`}error(e){let t=typeof e==`string`?e:e.stack;this.logMessage(K.ERROR,`${t}`)}warning(e){this.logMessage(K.WARNING,`3dsJS dev warning\n\n${e}`)}debug(e){this.logMessage(K.DEBUG,`3dsJS dev debug\n\n${e}`)}logMessage(e,t){this.logsSubject$.next({type:e,message:t,time:new Date})}logToConsole(e){if(this.loggingLevel!==G.ERROR||e.type===K.ERROR)switch(e.type){case K.ERROR:console.error(e.message);break;case K.WARNING:console.warn(e.message);break;case K.DEBUG:console.debug(e.message)}}},q=class e extends Error{constructor(t){super(t),this.name=`ValidationError`,Object.setPrototypeOf(this,e.prototype)}},J=function(e){return e.OVERLAY=`OVERLAY`,e.ATTACH_TO_ELEMENT=`ATTACH_TO_ELEMENT`,e}({}),Y=function(e){return e.POPUP=`POPUP`,e.INLINE=`INLINE`,e}({}),Nt=class{domMethodsService;translationsWhitelist=[`cancel`];constructor(e){this.domMethodsService=e}config$=new ye({challengeDisplayMode:Y.POPUP,loggingLevel:G.ERROR,translations:{cancel:`X`},processingScreenMode:J.OVERLAY,threeDSMethodTimeout:1e4});getConfig$(){return this.config$.asObservable()}setConfig(e){let t={...this.config$.value,...e};this.validateConfig(t),this.config$.next(t)}validateConfig(e){this.validateAgainstUnknownProperties(e),this.validateChallengeDisplayMode(e),this.validateLoggingLevel(e),this.validateTranslations(e),this.validateProcessingScreen(e),this.validateThreeDSMethodTimeout(e)}validateAgainstUnknownProperties(e){let t=[`challengeDisplayMode`,`challengeDisplayInlineTargetElementId`,`loggingLevel`,`translations`,`processingScreenMode`,`processingScreenWrapperElementId`,`threeDSMethodTimeout`],n=Object.keys(e).filter(e=>!t.includes(e));if(n.length>0)throw new q(`config contains unknown properties: ${n.join(`, `)}`)}validateChallengeDisplayMode(e){if(!Object.values(Y).includes(e.challengeDisplayMode))throw new q(`config.challengeDisplayMode must be either ${Y.POPUP} or ${Y.INLINE}`);if(e.challengeDisplayMode===Y.INLINE&&!this.domMethodsService.getElement(`#${e.challengeDisplayInlineTargetElementId}`))throw new q(`config.challengeDisplayInlineTargetElementId must exist when using display mode ${Y.INLINE}`)}validateLoggingLevel(e){if(!Object.values(G).includes(e.loggingLevel))throw new q(`config.loggingLevel must be: ${G.ERROR} or ${G.ALL}`)}validateTranslations(e){if(e.translations){let t=Object.keys(e.translations).filter(e=>!this.translationsWhitelist.includes(e));if(t.length>0)throw new q(`config.translations contains unknown keys: ${t.join(`,`)}. Whitelisted keys are: ${this.translationsWhitelist.join(`,`)}`)}else throw new q(`config.translations must be an object`)}validateProcessingScreen(e){if(!Object.values(J).includes(e.processingScreenMode))throw new q(`config.processingScreenMode must be either ${J.OVERLAY} or ${J.ATTACH_TO_ELEMENT}`);if(e.processingScreenMode===J.ATTACH_TO_ELEMENT&&!this.domMethodsService.getElement(`#${e.processingScreenWrapperElementId}`))throw new q(`config.processingScreenWrapperElementId must exist when using processing screen mode ${J.ATTACH_TO_ELEMENT}`)}validateThreeDSMethodTimeout(e){if(!(typeof e.threeDSMethodTimeout==`number`&&e.threeDSMethodTimeout>0&&e.threeDSMethodTimeout<=1e4))throw new q(`config.threeDSMethodTimeout must be a number in range from 1 to 10000 milliseconds`)}},Pt=class{sessionId=null;createId(){this.sessionId=crypto.randomUUID()}getId(){return this.sessionId}},X=function(e){return e.METHOD_URL_RESPONSE=`TP_METHOD_URL_RESPONSE`,e.CHALLENGE_RESPONSE=`TP_CHALLENGE_RESPONSE`,e.BROWSER_DATA_RESPONSE=`TP_BROWSER_DATA_RESPONSE`,e}({}),Ft=class{window;domMethodsService;interFrameCommunicatorService;base64TranscoderService;loggerService;acceptableColorDepthValues=[1,4,8,15,16,24,32,48];fallbackColorDepthValue=24;browserDataIframeSelector=`tp-3ds-browser-data-iframe`;browserDataTimeout=1e4;fallbackAcceptHeaderValue=`*/*`;constructor(e,t,n,r,i){this.window=e,this.domMethodsService=t,this.interFrameCommunicatorService=n,this.base64TranscoderService=r,this.loggerService=i}getData$(e,t){let n=this.getBrowserGeneralDataObject(t);return t&&!t.isRequiredBrowserIP&&!t.isRequiredBrowserAcceptHeader?L(n):this.getAcceptHeaderAndIPAddress$(e).pipe(z(e=>{let r={...n};return t?(t.isRequiredBrowserAcceptHeader&&(r.browserAcceptHeader=e.browserAcceptHeader),t.isRequiredBrowserIP&&(r.browserIP=e.browserIP)):(r.browserAcceptHeader=e.browserAcceptHeader,r.browserIP=e.browserIP),r}))}getBrowserGeneralDataObject(e){let t=e=>{if(!e)return``;let t=e.split(/[;,]/)[0].trim();t=t.replace(/_/g,`-`);let n=t.split(`-`);return n.length===1?n[0]:n.slice(0,2).join(`-`)},n={};return e?(e.isRequiredBrowserJavaEnabled&&(n.browserJavaEnabled=this.window.navigator.javaEnabled()),e.isRequiredBrowserJavascriptEnabled&&(n.browserJavascriptEnabled=!0),e.isRequiredBrowserLanguage&&(n.browserLanguage=t(this.window.navigator.language||this.window.navigator.userLanguage)),e.isRequiredBrowserScreenWidth&&(n.browserScreenWidth=this.window.screen.width),e.isRequiredBrowserScreenHeight&&(n.browserScreenHeight=this.getScreenHeight()),e.isRequiredBrowserColorDepth&&(n.browserColorDepth=this.getColorDepth(this.window.screen)),e.isRequiredBrowserUserAgent&&(n.browserUserAgent=this.window.navigator.userAgent),e.isRequiredBrowserTZ&&(n.browserTZ=new Date().getTimezoneOffset())):n={browserJavaEnabled:this.window.navigator.javaEnabled(),browserJavascriptEnabled:!0,browserLanguage:t(this.window.navigator.language),browserScreenWidth:this.window.screen.width,browserScreenHeight:this.getScreenHeight(),browserColorDepth:this.getColorDepth(this.window.screen),browserUserAgent:this.window.navigator.userAgent,browserTZ:new Date().getTimezoneOffset()},n}getScreenHeight(){let e=[this.window.screen.height,this.window.screen.availHeight,this.window.innerHeight,this.window.outerHeight],t=!1,n=999999,r=n;for(let i of e)if(i!==void 0&&typeof i==`number`&&i>0&&i<=n){r=i;break}else t=!0;return t&&this.loggerService.error(`Error in calculating screen height. Chosen value is ${r}. Options were ${JSON.stringify(e)}`),r}getColorDepth(e){return this.acceptableColorDepthValues.includes(e.colorDepth)?e.colorDepth:this.fallbackColorDepthValue}getAcceptHeaderAndIPAddress$(e){let t=typeof e==`string`?e:e[0];return pt(()=>L(this.createIframeForAcceptHeaderAndIPAddress(t))).pipe(U(()=>this.interFrameCommunicatorService.receive$(X.BROWSER_DATA_RESPONSE).pipe(Et(1))),W(e=>this.loggerService.debug(`Received raw browser data from iframe: ${e}`)),z(e=>this.base64TranscoderService.decode(e)),z(e=>({browserAcceptHeader:e.acceptHeader,browserIP:e.userIP})),W(e=>this.loggerService.debug(`Collected browser data: ${JSON.stringify(e)}`)),kt(()=>this.destroyView()),ot(this.browserDataTimeout),At(2),wt(e=>(this.loggerService.error(`Cannot retrieve user IP and accept header. Using fallback values instead.`),this.loggerService.error(e),L({browserAcceptHeader:this.fallbackAcceptHeaderValue,browserIP:``}))))}createIframeForAcceptHeaderAndIPAddress(e){let t=this.domMethodsService.createElement(`iframe`,{src:e,id:this.browserDataIframeSelector,width:`0px`,height:`0px`});this.domMethodsService.addToElement(t,this.domMethodsService.getElement(`body`)),this.loggerService.debug(`Created browser data iframe, url: ${e}`),t.addEventListener(`load`,()=>this.loggerService.debug(`Browser data iframe load completed, waiting for data`))}destroyView(){this.domMethodsService.removeElement(this.domMethodsService.getElement(`#${this.browserDataIframeSelector}`)),this.loggerService.debug(`Destroyed browser data iframe`)}},Z=class e{static get V2(){return new e(`2.0.0`)}static versionNumberPattern=/^\d+\.\d+\.\d+$/;major;minor;patch;constructor(t){if(!t||!t.match(e.versionNumberPattern))throw Error(`Invalid 3DS version: ${t}`);let[n,r,i]=t.split(`.`);this.major=Number(n),this.minor=Number(r),this.patch=Number(i)}isEqual(e){return this.toString()===e.toString()}isHigherThan(e){return this.major===e.major?this.minor===e.minor?this.patch>e.patch:this.minor>e.minor:this.major>e.major}isHigherOrEqual(e){return this.isEqual(e)||this.isHigherThan(e)}isLowerThan(e){return!this.isHigherOrEqual(e)}isLowerOrEqual(e){return!this.isHigherThan(e)}toString(){return`${this.major}.${this.minor}.${this.patch}`}},It=class{configService;challengeV1Service;challengeV2Service;challengeCommonService;constructor(e,t,n,r){this.configService=e,this.challengeV1Service=t,this.challengeV2Service=n,this.challengeCommonService=r}run$(e,t,n,r,i,a){return this.configService.getConfig$().pipe(U(o=>e.isLowerThan(Z.V2)?this.challengeV1Service.run$(o,t,n,i,a,r):this.challengeV2Service.run$(o,t,n,r)))}cancelChallenge$(){return this.configService.getConfig$().pipe(W(e=>this.challengeCommonService.cancelChallenge(e)),U(e=>this.challengeCommonService.handleCancelEvent$(e)))}},Q=function(e){return e.SUCCESS=`SUCCESS`,e.FAILURE=`FAILURE`,e.ERROR=`ERROR`,e.NOACTION=`NOACTION`,e.CANCELLED=`CANCELLED`,e.COMPLETED=`COMPLETED`,e.UNCOMPLETED=`UNCOMPLETED`,e}({}),Lt=class{domMethodsService;interFrameCommunicatorService;base64TranscoderService;iframeCreatorService;configService;methodURLIframeSelector=`tp-3ds-method-url-iframe`;methodURLIframeFormSelector=`tp-3ds-method-url-form`;constructor(e,t,n,r,i){this.domMethodsService=e,this.interFrameCommunicatorService=t,this.base64TranscoderService=n,this.iframeCreatorService=r,this.configService=i}run$(e,t,n){if(typeof e!=`string`||e.length===0)throw new q(`run3DSMethod$() requires transactionId`);if(typeof t!=`string`||t.length===0)throw new q(`run3DSMethod$() requires notificationURL`);if(typeof n!=`string`||n.length===0)throw new q(`run3DSMethod$() requires methodURL`);return this.domMethodsService.addToElement(this.createIframeForMethodURL(n,e,t),this.domMethodsService.getElement(`body`)),this.configService.getConfig$().pipe(U(t=>this.interFrameCommunicatorService.receive$(X.METHOD_URL_RESPONSE).pipe(z(e=>this.mapStatus(this.base64TranscoderService.decode(e))),ot({first:t.threeDSMethodTimeout,with:()=>L(this.getUncompletedResult(e))}),W(()=>{this.destroyView()}))))}createIframeForMethodURL(e,t,n){let r=this.base64TranscoderService.encode({threeDSServerTransID:t,threeDSMethodNotificationURL:n}),i=this.iframeCreatorService.getIframe(this.methodURLIframeSelector),a=()=>{i.contentWindow.document.body.innerHTML=this.iframeCreatorService.getIframeHTMLMarkup(this.methodURLIframeFormSelector,e,[{name:`threeDSMethodData`,value:r}]),i.removeEventListener(`load`,a),i.contentWindow.document.getElementById(this.methodURLIframeFormSelector).submit()};return i.addEventListener(`load`,a),i}mapStatus(e){return{status:e.actionCode,description:e.errorDescription,transactionId:e.threeDSServerTransID}}destroyView(){this.domMethodsService.removeElement(this.domMethodsService.getElement(`#${this.methodURLIframeSelector}`))}getUncompletedResult(e){return{status:Q.UNCOMPLETED,description:`Method URL did not complete`,transactionId:e}}},$=function(e){return e.VISA=`VISA`,e.ELECTRON=`ELECTRON`,e.DELTA=`DELTA`,e.VPAY=`VPAY`,e.PURCHASING=`PURCHASING`,e.MASTER_CARD=`MASTERCARD`,e.MASTER_CARD_DEBIT=`MASTERCARDDEBIT`,e.MAESTRO=`MAESTRO`,e.AMEX=`AMEX`,e.UNKNOWN=`UNKNOWN`,e}({}),Rt=`
5
5
  <svg xmlns="http://www.w3.org/2000/svg" width="112px" height="112px" viewBox="0 0 179.23 179.23">
6
6
  <defs>
7
7
  <style>.cls-1{fill:#fff;}.cls-2{fill:#1a1f71;}</style>
@@ -52,7 +52,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=functio
52
52
  <path d="m954.78 1677.4v-25.459h58.671c8.6812 0 12.44-4.6912 12.44-9.8363 0-4.9296-3.7471-9.9134-12.44-9.9134h-26.513c-23.046 0-35.88-14.041-35.88-35.121 0-18.802 11.753-36.934 45.999-36.934h57.089l-12.344 26.384h-49.374c-9.4382 0-12.344 4.9526-12.344 9.6821 0 4.8612 3.5904 10.222 10.801 10.222h27.773c25.69 0 36.838 14.572 36.838 33.656 0 20.516-12.422 37.32-38.236 37.32z" fill="#016fd0"/>
53
53
  </g>
54
54
  </svg>
55
- `,Vt=class{domMethodsService;loggerService;configService;document;classNames={mainContainer:`tp-3ds-processing-screen`,overlay:`tp-3ds-overlay`,screenWrapper:`tp-3ds-processing-screen-wrapper`,wrapperAttachToElement:`tp-3ds-processing-screen-wrapper-attach-to-element`,wrapperVisa:`tp-3ds-processing-screen-wrapper-visa`,wrapperMasterCard:`tp-3ds-processing-screen-wrapper-mastercard`,wrapperAmex:`tp-3ds-processing-screen-wrapper-amex`,loader:`tp-3ds-processing-screen-loader`,loaderWithLogo:`tp-3ds-processing-screen-loader-with-logo`,logo:`tp-3ds-processing-screen-logo`};processingScreenWrapperElement;loaderElement;constructor(e,t,n,r){this.domMethodsService=e,this.loggerService=t,this.configService=n,this.document=r,this.processingScreenWrapperElement=this.domMethodsService.createElement(`div`),this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[this.classNames.overlay,this.classNames.screenWrapper]),this.loaderElement=this.domMethodsService.createElement(`div`),this.domMethodsService.addClassesToElement(this.loaderElement,[this.classNames.loader])}show(e){this.configService.getConfig$().pipe(H()).subscribe(t=>{if(t.processingScreenMode===J.OVERLAY)this.connectTo(this.document.body,e,J.OVERLAY);else{let n=this.domMethodsService.getElement(`#${t.processingScreenWrapperElementId}`);this.connectTo(n,e,J.ATTACH_TO_ELEMENT)}})}hide(){this.configService.getConfig$().pipe(H()).subscribe(e=>{if(e.processingScreenMode===J.OVERLAY)this.disconnectFrom(this.document.body);else{let t=this.domMethodsService.getElement(`#${e.processingScreenWrapperElementId}`);this.disconnectFrom(t)}})}connectTo(e,t,n){try{if(e)switch(this.processingScreenWrapperElement.innerText=``,this.domMethodsService.removeClassesFromElement(this.loaderElement,[this.classNames.loaderWithLogo]),this.domMethodsService.addClassesToElement(e,[this.classNames.mainContainer]),this.domMethodsService.addToElement(this.processingScreenWrapperElement,e),this.domMethodsService.addToElement(this.loaderElement,this.processingScreenWrapperElement),n===J.ATTACH_TO_ELEMENT&&this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[this.classNames.wrapperAttachToElement]),t){case $.VISA:case $.ELECTRON:case $.DELTA:case $.VPAY:case $.PURCHASING:this.addCardLogo(Rt,this.classNames.wrapperVisa);break;case $.MASTER_CARD:case $.MASTER_CARD_DEBIT:case $.MAESTRO:this.addCardLogo(zt,this.classNames.wrapperMasterCard);break;case $.AMEX:this.addCardLogo(Bt,this.classNames.wrapperAmex);break;default:break}else throw Error(`Could not connect Processing Loader. targetElement: ${JSON.stringify(e)} not found. You must define existing targetElement.`)}catch(e){this.loggerService.error(e)}}disconnectFrom(e){let t=this.domMethodsService.getElement(`.${this.classNames.screenWrapper}`);try{if(e)this.domMethodsService.removeClassesFromElement(e,[this.classNames.overlay,this.classNames.mainContainer]),t&&this.domMethodsService.removeElement(t);else throw Error(`Could not disconnect Processing Loader. targetElement: ${JSON.stringify(e)} not found. You must define existing targetElement.`)}catch(e){this.loggerService.error(e)}}addCardLogo(e,t){let n=this.domMethodsService.createElement(`div`,{class:this.classNames.logo});n.innerHTML=e,this.domMethodsService.addToElement(n,this.processingScreenWrapperElement),this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[t]),this.domMethodsService.addClassesToElement(this.loaderElement,[this.classNames.loaderWithLogo])}},Ht=class{document;loggerService;constructor(e,t){this.document=e,this.loggerService=t}getElement(e){return this.document.querySelector(e)||null}createElement(e,t){let n=this.document.createElement(e);return t&&Object.entries(t).forEach(([e,t])=>{n.setAttribute(e,t)}),n}addToElement(e,t){try{if(!e||!t)throw Error(`Cannot find element(s): element: ${JSON.stringify(e)}, targetElement: ${JSON.stringify(t)}`);t.appendChild(e)}catch(e){throw this.loggerService.error(e),Error(e)}}removeElement(e){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);e.remove()}catch(e){throw this.loggerService.error(e),Error(e)}}addClassesToElement(e,t){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);t.forEach(t=>{e.classList.add(t)})}catch(e){throw this.loggerService.error(e),Error(e)}}removeClassesFromElement(e,t){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);t.forEach(t=>{e.classList.remove(t)})}catch(e){throw this.loggerService.error(e),Error(e)}}},Ut=class{window;constructor(e){this.window=e}encode(e){return this.window.btoa(JSON.stringify(e))}encodeString(e){return this.window.btoa(e)}decode(e){return JSON.parse(this.window.atob(e))}},Wt=class{window;constructor(e){this.window=e}receive$(e){return V(this.window,`message`).pipe(Ct(t=>t.data&&t.data.type===e),z(e=>e.data.data))}},Gt=`
55
+ `,Vt=class{domMethodsService;loggerService;configService;document;classNames={mainContainer:`tp-3ds-processing-screen`,overlay:`tp-3ds-overlay`,screenWrapper:`tp-3ds-processing-screen-wrapper`,wrapperAttachToElement:`tp-3ds-processing-screen-wrapper-attach-to-element`,wrapperVisa:`tp-3ds-processing-screen-wrapper-visa`,wrapperMasterCard:`tp-3ds-processing-screen-wrapper-mastercard`,wrapperAmex:`tp-3ds-processing-screen-wrapper-amex`,loader:`tp-3ds-processing-screen-loader`,loaderWithLogo:`tp-3ds-processing-screen-loader-with-logo`,logo:`tp-3ds-processing-screen-logo`};processingScreenWrapperElement;loaderElement;constructor(e,t,n,r){this.domMethodsService=e,this.loggerService=t,this.configService=n,this.document=r,this.processingScreenWrapperElement=this.domMethodsService.createElement(`div`),this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[this.classNames.overlay,this.classNames.screenWrapper]),this.loaderElement=this.domMethodsService.createElement(`div`),this.domMethodsService.addClassesToElement(this.loaderElement,[this.classNames.loader])}show(e){this.configService.getConfig$().pipe(H()).subscribe(t=>{if(t.processingScreenMode===J.OVERLAY)this.connectTo(this.document.body,e,J.OVERLAY);else{let n=this.domMethodsService.getElement(`#${t.processingScreenWrapperElementId}`);this.connectTo(n,e,J.ATTACH_TO_ELEMENT)}})}hide(){this.configService.getConfig$().pipe(H()).subscribe(e=>{if(e.processingScreenMode===J.OVERLAY)this.disconnectFrom(this.document.body);else{let t=this.domMethodsService.getElement(`#${e.processingScreenWrapperElementId}`);this.disconnectFrom(t)}})}connectTo(e,t,n){try{if(e)switch(this.processingScreenWrapperElement.innerText=``,this.domMethodsService.removeClassesFromElement(this.loaderElement,[this.classNames.loaderWithLogo]),this.domMethodsService.addClassesToElement(e,[this.classNames.mainContainer]),this.domMethodsService.addToElement(this.processingScreenWrapperElement,e),this.domMethodsService.addToElement(this.loaderElement,this.processingScreenWrapperElement),n===J.ATTACH_TO_ELEMENT&&this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[this.classNames.wrapperAttachToElement]),t){case $.VISA:case $.ELECTRON:case $.DELTA:case $.VPAY:case $.PURCHASING:this.addCardLogo(Rt,this.classNames.wrapperVisa);break;case $.MASTER_CARD:case $.MASTER_CARD_DEBIT:case $.MAESTRO:this.addCardLogo(zt,this.classNames.wrapperMasterCard);break;case $.AMEX:this.addCardLogo(Bt,this.classNames.wrapperAmex)}else throw Error(`Could not connect Processing Loader. targetElement: ${JSON.stringify(e)} not found. You must define existing targetElement.`)}catch(e){this.loggerService.error(e)}}disconnectFrom(e){let t=this.domMethodsService.getElement(`.${this.classNames.screenWrapper}`);try{if(e)this.domMethodsService.removeClassesFromElement(e,[this.classNames.overlay,this.classNames.mainContainer]),t&&this.domMethodsService.removeElement(t);else throw Error(`Could not disconnect Processing Loader. targetElement: ${JSON.stringify(e)} not found. You must define existing targetElement.`)}catch(e){this.loggerService.error(e)}}addCardLogo(e,t){let n=this.domMethodsService.createElement(`div`,{class:this.classNames.logo});n.innerHTML=e,this.domMethodsService.addToElement(n,this.processingScreenWrapperElement),this.domMethodsService.addClassesToElement(this.processingScreenWrapperElement,[t]),this.domMethodsService.addClassesToElement(this.loaderElement,[this.classNames.loaderWithLogo])}},Ht=class{document;loggerService;constructor(e,t){this.document=e,this.loggerService=t}getElement(e){return this.document.querySelector(e)||null}createElement(e,t){let n=this.document.createElement(e);return t&&Object.entries(t).forEach(([e,t])=>{n.setAttribute(e,t)}),n}addToElement(e,t){try{if(!e||!t)throw Error(`Cannot find element(s): element: ${JSON.stringify(e)}, targetElement: ${JSON.stringify(t)}`);t.appendChild(e)}catch(e){throw this.loggerService.error(e),Error(e)}}removeElement(e){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);e.remove()}catch(e){throw this.loggerService.error(e),Error(e)}}addClassesToElement(e,t){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);t.forEach(t=>{e.classList.add(t)})}catch(e){throw this.loggerService.error(e),Error(e)}}removeClassesFromElement(e,t){try{if(!e)throw Error(`Cannot find element: ${JSON.stringify(e)}`);t.forEach(t=>{e.classList.remove(t)})}catch(e){throw this.loggerService.error(e),Error(e)}}},Ut=class{window;constructor(e){this.window=e}encode(e){return this.window.btoa(JSON.stringify(e))}encodeString(e){return this.window.btoa(e)}decode(e){return JSON.parse(this.window.atob(e))}},Wt=class{window;constructor(e){this.window=e}receive$(e){return V(this.window,`message`).pipe(Ct(t=>t.data&&t.data.type===e),z(e=>e.data.data))}},Gt=`
56
56
  .tp-3ds-processing-screen {
57
57
  position: relative;
58
58
  height: 100%;
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ function r(e, t) {
80
80
  s = n.ops.pop(), n.trys.pop();
81
81
  continue;
82
82
  default:
83
- if ((a = n.trys, !(a = a.length > 0 && a[a.length - 1])) && (s[0] === 6 || s[0] === 2)) {
83
+ if (a = n.trys, !(a = a.length > 0 && a[a.length - 1]) && (s[0] === 6 || s[0] === 2)) {
84
84
  n = 0;
85
85
  continue;
86
86
  }
@@ -1608,16 +1608,14 @@ var G = /* @__PURE__ */ function(e) {
1608
1608
  });
1609
1609
  }
1610
1610
  logToConsole(e) {
1611
- if (!(this.loggingLevel === G.ERROR && e.type !== K.ERROR)) switch (e.type) {
1611
+ if (this.loggingLevel !== G.ERROR || e.type === K.ERROR) switch (e.type) {
1612
1612
  case K.ERROR:
1613
1613
  console.error(e.message);
1614
1614
  break;
1615
1615
  case K.WARNING:
1616
1616
  console.warn(e.message);
1617
1617
  break;
1618
- case K.DEBUG:
1619
- console.debug(e.message);
1620
- break;
1618
+ case K.DEBUG: console.debug(e.message);
1621
1619
  }
1622
1620
  }
1623
1621
  }, q = class e extends Error {
@@ -1938,10 +1936,7 @@ var G = /* @__PURE__ */ function(e) {
1938
1936
  case $.MAESTRO:
1939
1937
  this.addCardLogo(zt, this.classNames.wrapperMasterCard);
1940
1938
  break;
1941
- case $.AMEX:
1942
- this.addCardLogo(Bt, this.classNames.wrapperAmex);
1943
- break;
1944
- default: break;
1939
+ case $.AMEX: this.addCardLogo(Bt, this.classNames.wrapperAmex);
1945
1940
  }
1946
1941
  else throw Error(`Could not connect Processing Loader. targetElement: ${JSON.stringify(e)} not found. You must define existing targetElement.`);
1947
1942
  } catch (e) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Trust Payments <support@trustpayments.com>",
3
3
  "homepage": "https://docs.trustpayments.com",
4
4
  "name": "@trustpayments/3ds-sdk-js",
5
- "version": "1.2.731",
5
+ "version": "1.2.732",
6
6
  "description": "",
7
7
  "type": "module",
8
8
  "main": "./dist/index.cjs",
@@ -60,7 +60,7 @@
60
60
  "prettier": "3.9.6",
61
61
  "typescript": "6.0.3",
62
62
  "typescript-eslint": "8.65.0",
63
- "vite": "8.1.5",
63
+ "vite": "8.2.0",
64
64
  "vite-plugin-css-injected-by-js": "5.0.2",
65
65
  "vite-plugin-dts": "4.5.4",
66
66
  "vitest": "4.1.10"
@@ -88,5 +88,5 @@
88
88
  "safari 16-17",
89
89
  "Android 13-14"
90
90
  ],
91
- "gitHead": "580025aa469d221881e1ed891023e93421d147da"
91
+ "gitHead": "fc1196009189431fccd26d5d2a2372958434eb8c"
92
92
  }