UNPKG

@payoneer/op-risk-lib

Version:

JS client-side library for risk management

10 lines 24.1 kB
/*! Copyright (c) 2022 Payoneer Germany GmbH. All rights reserved. [op-risk-lib-1.5.0] */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RiskLib=e():t.RiskLib=e()}(self,(()=>{return t={80:t=>{var e=Object.freeze({INVALID_ORIGIN:"Risk-provider iframe url origin is invalid",INVALID_IFRAME_URL:"Risk-provider iframe url is invalid",INVALID_CONFIG:"Given risk-provider config is invalid"});t.exports=e},201:t=>{var e=Object.freeze({ERROR:"EXTERNAL_ERROR_MESSAGE",DATA:"RISK_PROVIDER_RESULTS"});t.exports=e},740:(t,e,r)=>{function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */i=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new P(n||[]);return o(a,"_invoke",{value:_(t,r,u)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var y="suspendedStart",v="suspendedYield",h="executing",g="completed",m={};function b(){}function E(){}function w(){}var O={};l(O,u,(function(){return this}));var S=Object.getPrototypeOf,A=S&&S(S(T([])));A&&A!==r&&n.call(A,u)&&(O=A);var R=w.prototype=b.prototype=Object.create(O);function N(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(o,i,a,u){var s=d(t[o],t,i);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==c(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function _(e,r,n){var o=y;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=L(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var s=d(e,r,n);if("normal"===s.type){if(o=n.done?g:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function L(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(c(e)+" is not iterable")}return E.prototype=w,o(R,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:E,configurable:!0}),E.displayName=l(w,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===E||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,f,"GeneratorFunction")),t.prototype=Object.create(R),t},e.awrap=function(t){return{__await:t}},N(I.prototype),l(I.prototype,s,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new I(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},N(R),l(R,f,"Generator"),l(R,u,(function(){return this})),l(R,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function a(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,c,"next",t)}function c(t){a(i,n,o,u,c,"throw",t)}u(void 0)}))}}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}var s=r(671),f=r(777),l=r(220),p=r(321),d=r(80),y=r(812).addVersionInfo,v=r(497),h=v.isArrayOfObjects,g=v.containsKey,m=v.containsNonEmptyString,b=v.isNonEmptyArray,E=v.getParamByName,w=r(147).TN,O=r(147).i8,S="https:",A="checkout.payoneer.com";function R(t){var e;return m(t,"providerCode")&&m(t,"providerType")&&N(null==t||null===(e=t.links)||void 0===e?void 0:e.iframe)}function N(t){try{var e=new URL(t);return e.protocol===S&&(e.hostname===A||/^[a-z0-9\-_]*(resources)[a-z0-9\-_]*\.(live|stage|sandbox|integration|[a-z0-9\-_]+\.integration)\.oscato\.com$/g.test(e.hostname))}catch(t){return!1}}function I(t){var e=[];return b(t)?(t.filter(N).forEach((function(t){var r=new URL(t);e.includes(r.origin)||e.push(r.origin)})),e):e}function _(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!R(t))return"";var r=t.links.iframe;r.endsWith("/")||(r+="/");var n="?providerType="+t.providerType+"&providerCode="+t.providerCode+"&targetOrigin="+e;return g(t,"parameters")&&h(t.parameters)&&t.parameters.forEach((function(t){m(t,"name")&&g(t,"value")&&(n+="&"+t.name+"="+t.value)})),r+n}function L(t){var e=[],r=[];return b(t)&&t.forEach((function(t){R(t)?e.push(t):r.push(t)})),[e,r]}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.INVALID_CONFIG,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f.storeProviderError;b(t)&&"function"==typeof r&&t.forEach((function(t){m(t,"providerType")&&m(t,"providerCode")&&r(t.providerType,t.providerCode,"string"==typeof e?e:d.INVALID_CONFIG)}))}function x(t,e){var r;N(e)&&s(e,{success:(r=u(i().mark((function e(){var r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,riskProviderHandler.run();case 2:r=e.sent,f.storeProviderResults(t.providerType,null==t?void 0:t.providerCode,r);case 4:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)}),error:function(){var r="Failed to load script ".concat(e);f.storeProviderError(t.providerType,null==t?void 0:t.providerCode,r)}})}function P(){return(P=u(i().mark((function t(e){var r,o,a,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(T(),r=L(e),o=n(r,2),a=o[0],j(o[1]),0!==a.length){t.next=5;break}return t.abrupt("return");case 5:u=a.map((function(t){return t.links.iframe})),c=I(u),f.init(c),a.forEach((function(t){var e=E(t.parameters,"handlerLoadingType");if(e&&"javascript"==(null==e?void 0:e.value)){var r=E(t.parameters,"handlerSrc");r&&r.value&&x(t,r.value)}else{var n=_(t,window.location.origin);if(!n)return;var o=p.generateIframeId(t.providerType,t.providerCode);l.initIFrame(o,n,t.providerCode)}}));case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function T(){l.destroy(),f.clear()}"object"===("undefined"==typeof window?"undefined":c(window))&&(window.OP_RISK_LIB_VERSION=O,y(w,O)),t.exports={init:function(t){return P.apply(this,arguments)},destroy:T,getRiskData:f.getRiskData,getProviderUrl:_,isValidHandlerURL:N,getDistinctOrigins:I,getSeparatedConfigs:L,isValidProviderConfig:R,generateInternalErrors:j,configureExternalStorage:f.configureExternalStorage,dataUtil:f,iframeUtil:l,PACKAGE_NAME:w,PACKAGE_VERSION:O}},321:t=>{var e=Object.freeze({generateIframeId:function(t,e){return"IFRAME__"+t+"__"+e}});t.exports=e},777:(t,e,r)=>{function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=r(497),a=i.containsNonEmptyString,u=i.containsKey,c=i.isNonEmptyString,s=i.isNonEmptyObject,f=i.isNonEmptyArray,l=r(201),p=r(321),d={},y=[],v="__",h=2e3,g="RISK_LIBRARY",m=Object.seal({INTERNAL:"riskPluginInternalError",EXTERNAL:"riskPluginExternalError"}),b=Object.seal({dataKeys:[],setData:function(t,e){d[t]=e},getData:function(t){return d[t]},removeData:function(t){delete d[t]}});function E(){return y.map((function(t){return t.origin}))}function w(t,e){return[g,t,e].join(v)}function O(t){var e="",r="";if(c(t)){var o=n(t.split(v),3);o[0],e=o[1],r=o[2]}return[e,r]}function S(t,e,r){if(c(t)&&c(e)){var n=null;document&&(n=document.getElementById(t)),n&&n.setAttribute(e,r)}}function A(t,e,r){if(c(t)&&c(e)){var n=p.generateIframeId(t,e);S(n,"responded",!0),Object.values(l).includes(r)&&S(n,"response-type",r)}}function R(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:m.INTERNAL;if(c(t)&&c(e)&&c(r)){L(n)||(n=m.INTERNAL),r.length>h&&(r=r.slice(0,h));var o=w(t,e);b.dataKeys.includes(o)||b.dataKeys.push(o);var i={};i[n]=r,b.setData(o,i),A(t,e,l.ERROR)}}function N(t,e,r){if(c(t)&&c(e)&&s(r)){var n=w(t,e);b.dataKeys.includes(n)||b.dataKeys.push(n),b.setData(n,r),A(t,e,l.DATA)}}function I(t){if(!s(t))return[];var e=[];for(var r in t)if(c(r)){var n=t[r];null!=n&&("string"!=typeof n&&(n=JSON.stringify(n)),(n=n.trim())&&e.push({name:r,value:n}))}return e}function _(t){if(!c(t)||!b.dataKeys.includes(t))return null;var e=n(O(t),2),r=e[0],o=e[1];if(!r||!o)return null;var i=I(b.getData(t));return f(i)?{providerType:r,providerCode:o,parameters:i}:null}function L(t){return t===m.INTERNAL||t===m.EXTERNAL}function j(t){return a(t,"messageType")&&"RISK_HANDLER_ERROR"===t.messageType&&u(t,"data")&&a(t.data,"providerType")&&a(t.data,"providerCode")&&u(t.data,"providerError")&&c(t.data.providerError)}function x(t){return a(t,"messageType")&&"RISK_HANDLER"===t.messageType&&u(t,"data")&&a(t.data,"providerType")&&a(t.data,"providerCode")&&u(t.data,"providerResults")&&s(t.data.providerResults)}function P(t){if(c(t)&&!E().includes(t)){var e=function(e){if(e.origin===t){var r=e.data||null;x(r)?N(r.data.providerType,r.data.providerCode,r.data.providerResults):j(r)&&R(r.data.providerType,r.data.providerCode,r.data.providerError,m.EXTERNAL)}};y.push({origin:t,listener:e}),window.addEventListener("message",e)}}function T(){0!==y.length&&(y.forEach((function(t){window.removeEventListener("message",t.listener)})),y=[])}var k=Object.freeze({init:function(t){f(t)&&t.forEach((function(t){P(t)}))},clear:function(){b.dataKeys.forEach((function(t){b.removeData(t)})),b.dataKeys=[],T(),d={}},configureExternalStorage:function(t,e,r){"function"==typeof t&&(b.setData=t),"function"==typeof e&&(b.getData=e),"function"==typeof r&&(b.removeData=r)},SEPARATOR:v,ErrorType:m,LIB_PREFIX:g,StorageManager:b,ERROR_MESSAGE_LIMIT:h,getInMemoryStorage:function(){return JSON.parse(JSON.stringify(d))},getRiskMessageListeners:function(){return JSON.parse(JSON.stringify(y))},parseKey:O,getRiskData:function(){var t=[];return b.dataKeys.forEach((function(e){var r=_(e);r&&t.push(r)})),t},generateKey:w,getParameters:I,getKnownOrigins:E,isValidErrorType:L,setAttributeValue:S,getProviderResults:_,isValidRiskMessage:x,storeProviderError:R,addMessageListener:P,setResponseIndicator:A,storeProviderResults:N,removeMessageListeners:T,isValidRiskErrorMessage:j,configureDefaultStorage:function(){b.setData=function(t,e){d[t]=e},b.getData=function(t){return d[t]},b.removeData=function(t){delete d[t]}}});t.exports=k},497:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t){return!(!t||"object"!==e(t)||t instanceof Array)}function n(t){return!(!t||"string"!=typeof t||!t.trim())}function o(t){return!!(t&&t instanceof Array&&t.length)}function i(t){return!(!r(t)||!Object.keys(t).length)}function a(t,e){return i(t)&&t.hasOwnProperty(e)}t.exports={isJsonObject:r,isNonEmptyArray:o,isNonEmptyObject:i,isArrayOfObjects:function(t){return o(t)&&r(t[0])},isNonEmptyString:n,containsKey:a,containsNonEmptyString:function(t,e){return a(t,e)&&n(t[e])},getParamByName:function(t,e){return t.find((function(t){return t.name===e}))}}},220:(t,e,r)=>{var n=r(497).isNonEmptyString,o=new Object;function i(t){o.hasOwnProperty(t)&&o[t]&&(o[t].remove(),delete o[t])}var a=Object.freeze({iframeHolder:o,getIFrame:function(t){return o.hasOwnProperty(t)?o[t]:null},initIFrame:function(t,e){var r=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!n(t)||!n(e))return null;var i=document.createElement("iframe");return i.setAttribute("id",t),i.setAttribute("src",e),i.setAttribute("responded",!1),n(r)&&i.setAttribute("name",r),i.style.position="fixed",i.style.display="none",i.style.zIndex="-1000",i.style.left="110vw",i.style.top="110vh",i.style.height="0px",i.style.width="0px",i.style.opacity="0",o[t]=i,i}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:""),i=document.querySelector("body");r&&i&&i.appendChild(r)},removeIFrame:i,destroy:function(){for(var t in o)i(t)}});t.exports=a},671:function(t,e){var r,n,o;n=[],void 0===(o="function"==typeof(r=function(){var t=function(){},e={},r={},n={};function o(t,e){t=t.push?t:[t];var o,i,a,u=[],c=t.length,s=c;for(o=function(t,r){r.length&&u.push(t),--s||e(u)};c--;)i=t[c],(a=r[i])?o(i,a):(n[i]=n[i]||[]).push(o)}function i(t,e){if(t){var o=n[t];if(r[t]=e,o)for(;o.length;)o[0](t,e),o.splice(0,1)}}function a(e,r){e.call&&(e={success:e}),r.length?(e.error||t)(r):(e.success||t)(e)}function u(e,r,n,o){var i,a,c,s=document,f=n.async,l=(n.numRetries||0)+1,p=n.before||t,d=e.replace(/[\?|#].*$/,""),y=e.replace(/^(css|img|module|nomodule)!/,"");if(o=o||0,/(^css!|\.css$)/.test(d))(c=s.createElement("link")).rel="stylesheet",c.href=y,(i="hideFocus"in c)&&c.relList&&(i=0,c.rel="preload",c.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d))(c=s.createElement("img")).src=y;else if((c=s.createElement("script")).src=y,c.async=void 0===f||f,a="noModule"in c,/^module!/.test(d)){if(!a)return r(e,"l");c.type="module"}else if(/^nomodule!/.test(d)&&a)return r(e,"l");c.onload=c.onerror=c.onbeforeload=function(t){var a=t.type[0];if(i)try{c.sheet.cssText.length||(a="e")}catch(t){18!=t.code&&(a="e")}if("e"==a){if((o+=1)<l)return u(e,r,n,o)}else if("preload"==c.rel&&"style"==c.as)return c.rel="stylesheet";r(e,a,t.defaultPrevented)},!1!==p(e,c)&&s.head.appendChild(c)}function c(t,e,r){var n,o,i=(t=t.push?t:[t]).length,a=i,c=[];for(n=function(t,r,n){if("e"==r&&c.push(t),"b"==r){if(!n)return;c.push(t)}--i||e(c)},o=0;o<a;o++)u(t[o],n,r)}function s(t,r,n){var o,u;if(r&&r.trim&&(o=r),u=(o?n:r)||{},o){if(o in e)throw"LoadJS";e[o]=!0}function s(e,r){c(t,(function(t){a(u,t),e&&a({success:e,error:r},t),i(o,t)}),u)}if(u.returnPromise)return new Promise(s);s()}return s.ready=function(t,e){return o(t,(function(t){a(e,t)})),s},s.done=function(t){i(t,[])},s.reset=function(){e={},r={},n={}},s.isDefined=function(t){return t in e},s})?r.apply(e,n):r)||(t.exports=o)},812:(t,e)=>{"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t) /*! * escape-html * Copyright(c) 2012-2013 TJ Holowaychuk * Copyright(c) 2015 Andreas Lubbe * Copyright(c) 2015 Tiancheng "Timothy" Gu * MIT Licensed */}Object.defineProperty(e,"__esModule",{value:!0});var n=/["'&<>]/,o=function(t){var e,r=""+t,o=n.exec(r);if(!o)return r;var i="",a=0,u=0;for(a=o.index;a<r.length;a++){switch(r.charCodeAt(a)){case 34:e="&quot;";break;case 38:e="&amp;";break;case 39:e="&#39;";break;case 60:e="&lt;";break;case 62:e="&gt;";break;default:continue}u!==a&&(i+=r.substring(u,a)),u=a+1,i+=e}return u!==a?i+r.substring(u,a):i};function i(t){return"string"==typeof t}function a(t){return i(t)&&t.length>0}function u(t){return!(!t||"object"!==r(t)||t instanceof Array)}function c(t){return u(t)&&Object.keys(t).length>0}function s(t){return t instanceof Array}function f(t){return!(!s(t)||0!==t.length&&t.find((function(t){return!c(t)})))}var l=Object.freeze({isString:i,isNonEmptyString:a,isObject:u,isNonEmptyObject:c,isArray:s,isArrayOfObject:f,isValidStorageObject:function(t){return!!(c(t)&&Object.hasOwnProperty.call(t,"name")&&Object.hasOwnProperty.call(t,"version")&&Object.hasOwnProperty.call(t,"parameters")&&a(t.name)&&a(t.version)&&f(t.parameters))}}),p="__op_app_version_lib_storage__",d=["string","number","boolean"];function y(t){var e=[];if(l.isNonEmptyObject(t))for(var n in t){var i=t[n];d.includes(r(i))&&"string"==typeof n&&("string"==typeof i&&(i=o(i)),e.push({key:o(n),value:i}))}return e}function v(){return"undefined"==typeof window?(console.log("ERROR: You are outside of a browser environment"),null):(window[p]||(window[p]=(t=[],Object.freeze({storeData:function(e,r,n){if(l.isNonEmptyString(e)&&l.isNonEmptyString(r)){var i={name:o(e.toLowerCase()),version:o(r.toLowerCase()),parameters:y(n)},a=t.findIndex((function(t){return t.name===e&&t.version===r}));-1===a?t.push(i):t[a]=i}},getData:function(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return(e=r&&n?t.find((function(t){return t.name===r&&t.version===n})):r?t.find((function(t){return t.name===r})):t)&&(e=JSON.parse(JSON.stringify(e))),e}}))),window[p]);var t}var h=Object.freeze({storeData:function(t,e,r){var n=v();null!==n&&n.storeData(t,e,r)},getData:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=v();return null!==r?r.getData(t,e):{}}}),g="op-app-version-lib",m="0.2.1";function b(t){if(!l.isValidStorageObject(t))return"";var e=t.parameters.map((function(t){return"".concat(t.key,"=").concat(t.value)})).join(";");return"".concat(t.name,";version=").concat(t.version).concat(e?";".concat(e):"")}function E(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};h.storeData(t,e,r)}function w(){return h.getData().map(b).filter((function(t){return t})).join(", ")}function O(){return h.getData()}"object"===("undefined"==typeof window?"undefined":r(window))&&(window.OP_APP_VERSION_LIB_VERSION=m);var S={PACKAGE_NAME:g,PACKAGE_VERSION:m,addVersionInfo:E,toString:w,toJSON:O};e.PACKAGE_NAME=g,e.PACKAGE_VERSION=m,e.__parseHeaderString=b,e.addVersionInfo=E,e.default=S,e.toJSON=O,e.toString=w},147:t=>{"use strict";t.exports=JSON.parse('{"TN":"op-risk-lib","i8":"1.5.0"}')}},e={},function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(740);var t,e})); //# sourceMappingURL=op-risk-lib.js.map