@payrails/web-sdk 2.8.1 → 2.8.2

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
- !function(){"use strict";function e(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}function t(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function i(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}let n;exports.ElementType=void 0,function(e){e.CARD_NUMBER="CARD_NUMBER",e.CARDHOLDER_NAME="CARDHOLDER_NAME",e.CVV="CVV",e.EXPIRATION_MONTH="EXPIRATION_MONTH",e.EXPIRATION_YEAR="EXPIRATION_YEAR"}(exports.ElementType||(exports.ElementType={})),"function"==typeof SuppressedError&&SuppressedError;const o=new Uint8Array(16);function s(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(o)}const r=[];for(let e=0;e<256;++e)r.push((e+256).toString(16).slice(1));var a,l={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function d(e,t,i){if(l.randomUUID&&!t&&!e)return l.randomUUID();const n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]}(n)}!function(e){e.GET="GET",e.POST="POST"}(a||(a={}));const c=({url:t,method:i=a.GET,token:n,body:o})=>e(void 0,void 0,void 0,(function*(){const e={method:i,headers:Object.assign(Object.assign(Object.assign({},h()),I(n)),u())};i===a.POST&&(e.body=JSON.stringify(o||{}));const s=yield fetch(t,e),r=yield s.json();if([401,403].includes(s.status))throw new E(t,i);if(!s.ok)throw new _(t,i,r);return{ok:s.ok,req:Object.assign({url:t},e),res:r}}));class E extends Error{constructor(e,t){super(`[${t}] ${e} unauthorized`)}}class _ extends Error{constructor(e,t,i){super(`[${t}] ${e} unsuccessful`),this.res=i}}const I=e=>({authorization:`Bearer ${e}`}),h=()=>({"x-idempotency-key":d()}),u=()=>({"x-client-version":"2.8.1","x-client-type":"web-sdk"});class p{constructor(e,t,i){this.sdkConfig=e,this.execution=t,this.returnLinks=i}pay(t){return e(this,void 0,void 0,(function*(){const e=(yield this.authorize(t)).res.links.execution;return yield this.pollForAuthorizationResult(e)}))}authorize(t){return e(this,void 0,void 0,(function*(){if(!this.execution.authorizeLink||!this.sdkConfig.amount)throw new Error("SDK was not initialized with workflow execution");const{success:e="https://payrails.io/success",error:i="https://payrails.io/error",cancel:n="https://payrails.io/cancel"}=this.returnLinks||{};return c({url:this.execution.authorizeLink,method:a.POST,token:this.sdkConfig.token,body:{amount:this.sdkConfig.amount,paymentComposition:t,returnInfo:{success:e,cancel:n,error:i}}})}))}confirm(t,i={}){return e(this,void 0,void 0,(function*(){const e=yield c({url:t,method:a.POST,token:this.sdkConfig.token,body:{data:i}}),n=yield this.pollForAuthorizationResult(e.res.links.execution);if(n.finalState)return n;const o=n.response.status.slice().sort(((e,t)=>new Date(t.time).getTime()-new Date(e.time).getTime()))[0].time,{res:s}=yield this.getExecution(e.res.links.execution,void 0,o);return{finalState:s.status.find((({code:e,time:t})=>["authorizeSuccessful","authorizeFailed"].includes(e)&&new Date(t)>new Date(o))),response:s}}))}pollForAuthorizationResult(t,i=0){return e(this,void 0,void 0,(function*(){const e=(yield this.getExecution(t)).res,n=e.status,o=["authorizePending","authorizeSuccessful","authorizeFailed"],s=n.find((({code:e})=>"authorizeRequested"===e));if(!s&&i<10)return yield new Promise((e=>setTimeout(e,300))),this.pollForAuthorizationResult(t,i+1);if(!s)throw new Error("Authorization was not requested");const r=n.find((({code:e,time:t})=>"confirmRequested"===e&&new Date(t)>new Date(s.time))),a=r?r.time:s.time;let l=n.find((({code:e,time:t})=>o.includes(e)&&new Date(t)>new Date(a)));if(!l){const{res:e}=yield this.getExecution(t,void 0,a);return l=e.status.find((({code:e,time:t})=>o.includes(e)&&new Date(t)>new Date(a))),{finalState:l,response:e}}return{finalState:l,response:e}}))}getExecution(t,i,n){return e(this,void 0,void 0,(function*(){const e=new URLSearchParams;i&&i.length>0&&e.append("waitWhile[status]",`[${i.map((e=>`"${e}"`)).join(",")}]`),n&&e.append("waitWhile[lastStatusTime]",n);const o=`${t}${e.toString()?"?":""}${e.toString()}`;return c({url:o,token:this.sdkConfig.token})}))}createApplePaySession(t){return e(this,void 0,void 0,(function*(){return c({url:t.requestUrl,method:a.POST,token:this.sdkConfig.token,body:{integrationType:"api",paymentMethodCode:"applePay",amount:this.sdkConfig.amount,meta:{sessionURL:t.sessionUrl,clientDomain:t.clientDomain||window.location.host}}})}))}}var f,N,T;!function(e){e.CARD="card",e.GOOGLE_PAY="googlePay",e.PAYPAL="payPal",e.APPLE_PAY="applePay"}(f||(f={})),function(e){e.ENABLED="enabled",e.CREATED="created"}(N||(N={}));class O{constructor(e){this.executionResponse=e}get lookup(){return this.executionResponse.initialResults.find((({body:{name:e}})=>"lookup"===e))}get holderReference(){return this.executionResponse.holderReference}get savedCreditCards(){return this.getStoredInstrumentForPaymentMethod(f.CARD)}get savedPaypalAccounts(){return this.getStoredInstrumentForPaymentMethod(f.PAYPAL)}get savedGooglePayAccounts(){return this.getStoredInstrumentForPaymentMethod(f.GOOGLE_PAY)}get savedApplePayAccounts(){return this.getStoredInstrumentForPaymentMethod(f.APPLE_PAY)}get paypalConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===f.PAYPAL));if(!e)throw new Error("trying to initialize paypal without config");return e.config||{}}get googlePayConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===f.GOOGLE_PAY));if(!e)throw new Error("trying to initialize google pay without config");return e?[e.config]:[]}isPaymentMethodAvailable(e){return this.availablePaymentMethods.some((({paymentMethodCode:t})=>t===e))}get applePayConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===f.APPLE_PAY));if(!e)throw new Error("apple pay config not found");return e.config.parameters}get url(){return this.response.links.self}get response(){return this.executionResponse}get meta(){return this.executionResponse.meta}get availablePaymentMethods(){var e;return(null===(e=this.lookup)||void 0===e?void 0:e.body.data.paymentCompositionOptions)||[]}get authorizeLink(){var e;return null===(e=this.lookup)||void 0===e?void 0:e.body.links.authorize.href}get createSessionLink(){var e;return null===(e=this.response.links.startPaymentSession)||void 0===e?void 0:e.href}get storedPaymentInstruments(){return this.availablePaymentMethods.flatMap((e=>e.paymentInstruments||[]))}getStoredInstrumentForPaymentMethod(e){var t;return(null===(t=this.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e)))||void 0===t?void 0:t.paymentInstruments)||[]}}class L{constructor(e,{id:t="",className:i=""}={}){this.subElements=[];const n=document.createElement(e);t&&(this.id=t,n.setAttribute("id",t)),i&&n.setAttribute("class",i),this.element=n}get parentElement(){return this.element.parentElement}get selector(){if(!this.id)throw new Error("Element id is not set");return`#${this.id}`}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);t.appendChild(this.element),this.subElements.forEach((e=>{if(!this.id)throw new Error("Sub elements can not be rendered, please set id for the element");e.mount(this.selector)}))}unmount(){var e;this.subElements.forEach((e=>e.unmount())),null===(e=this.parentElement)||void 0===e||e.removeChild(this.element)}}class v extends L{get bin(){var e;return this.selectedInstrument?this.selectedInstrument.data.bin?this.selectedInstrument.data.bin:"":(null===(e=this.cardForm)||void 0===e?void 0:e.bin)||""}constructor(e,t,i,n){var o;super("button",{id:"payrails-card-payment-button"}),this.sdkConfig=e,this.execution=t,this.options=i,this.returnLinks=n,this.selectedInstrument=null,this.element.innerText=(null===(o=null==i?void 0:i.translations)||void 0===o?void 0:o.label)||"Pay",this.element.addEventListener("click",this.onPay.bind(this)),this.element.addEventListener("mouseenter",(()=>{var e;this.element.classList.contains("disabled")||(this.element.classList.add("hover"),this.setStyles((null===(e=this.options.styles)||void 0===e?void 0:e.hover)||{}))})),this.element.addEventListener("mouseleave",(()=>{var e;this.element.classList.contains("disabled")||(this.element.classList.remove("hover"),this.removeStyles((null===(e=this.options.styles)||void 0===e?void 0:e.hover)||{}))})),this.paymentExecutor=new p(this.sdkConfig,this.execution,this.returnLinks)}setDisabled(e){var t,i,n,o,s;this.element.classList.contains("disabled")!==e&&(null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onStateChanged)||void 0===i||i.call(t,e?"disabled":"enabled")),this.element.disabled=e,e?(this.element.classList.add("disabled"),(null===(n=this.options.styles)||void 0===n?void 0:n.disabled)&&this.setStyles(this.options.styles.disabled)):(this.element.classList.remove("disabled"),this.removeStyles((null===(o=this.options.styles)||void 0===o?void 0:o.disabled)||{}),(null===(s=this.options.styles)||void 0===s?void 0:s.base)&&this.setStyles(this.options.styles.base))}setSavedCreditCard(e){console.warn("setSavedCreditCard is deprecated, please use setSavedInstrument"),this.setSavedInstrument(e)}setSavedInstrument(e){this.selectedInstrument=e,this.setDisabled(!1)}setStyles(e){var t;const i=Object.assign(Object.assign({},null===(t=this.options.styles)||void 0===t?void 0:t.base),e);Object.keys(i).forEach((e=>{this.element.style[e]=i[e]}))}removeStyles(e){var t;const i=Object.keys((null===(t=this.options.styles)||void 0===t?void 0:t.base)||{});Object.keys(e).forEach((e=>{var t,n;i.includes(e)?this.element.style[e]=null===(n=null===(t=this.options.styles)||void 0===t?void 0:t.base)||void 0===n?void 0:n[e]:this.element.style[e]=""}))}setLabel(e){this.element.innerText=e}setCardForm(e){this.cardForm=e}triggerLoading(e){var t,i,n,o;const s=this.element.offsetWidth;this.element.style.minWidth=`${s}px`,e?(this.element.innerHTML='<div class="dot-flashing"></div>',this.element.classList.add("loading"),(null===(t=this.options.styles)||void 0===t?void 0:t.loading)&&this.setStyles(this.options.styles.loading)):(this.element.innerText=(null===(n=null===(i=this.options)||void 0===i?void 0:i.translations)||void 0===n?void 0:n.label)||"Pay",this.element.classList.remove("loading"),this.removeStyles((null===(o=this.options.styles)||void 0===o?void 0:o.loading)||{}))}onAuthorizationFailed(e){var t,i;this.setDisabled(!1),this.triggerLoading(!1),(null===(t=this.options.events)||void 0===t?void 0:t.onAuthorizeFailed)&&(null===(i=this.options.events)||void 0===i||i.onAuthorizeFailed(e))}onPay(){var t,i,n,o,s,r,a,l,d,c;return e(this,void 0,void 0,(function*(){if(this.setDisabled(!0),this.triggerLoading(!0),null===(t=this.options.events)||void 0===t?void 0:t.onPaymentButtonClicked)try{if(!1===(yield null===(i=this.options.events)||void 0===i?void 0:i.onPaymentButtonClicked({bin:this.bin||""})))return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.VALIDATION_FAILED,message:"Callback passed to onPaymentButtonClicked resolved to false"})}catch(e){return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.VALIDATION_FAILED,message:"Callback passed to onPaymentButtonClicked threw an error"})}try{const e=[{paymentMethodCode:f.CARD,integrationType:"api",amount:this.sdkConfig.amount,storeInstrument:!1}];if(null===(n=this.selectedInstrument)||void 0===n?void 0:n.id)e[0].paymentInstrumentId=null===(o=this.selectedInstrument)||void 0===o?void 0:o.id,e[0].paymentMethodCode=null===(s=this.selectedInstrument)||void 0===s?void 0:s.paymentMethod;else{const{tokenizedCardData:t,storeInstrument:i,enrollInstrumentToNetworkOffers:n}=yield this.collectCardFormValues();e[0].paymentInstrumentData={vaultToken:null==t?void 0:t.instrumentId,card:{numberToken:null==t?void 0:t.card_number,securityCodeToken:null==t?void 0:t.security_code}},e[0].storeInstrument=i,e[0].enrollInstrumentToNetworkOffers=n}const t=yield this.paymentExecutor.pay(e);this.handleAuthorizationResult(t)}catch(e){e instanceof E||[401,403].includes(null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.code)?(null===(l=null===(a=this.options.events)||void 0===a?void 0:a.onPaymentSessionExpired)||void 0===l||l.call(a),this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:"API token is not valid or expired."})):e.toString().includes("Invalid token")?(null===(c=null===(d=this.options.events)||void 0===d?void 0:d.onPaymentSessionExpired)||void 0===c||c.call(d),this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:"Vault token is not valid or expired."})):this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.UNKNOWN_ERROR,message:e.toString(),rawError:e})}}))}handleAuthorizationResult(e){var t,i,n;switch(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code){case"authorizeSuccessful":this.triggerLoading(!1),(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)&&this.options.events.onAuthorizeSuccess();break;case"authorizePending":"3ds"===(null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.actionRequired)&&this.handle3ds(e);break;default:this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed."})}}handle3ds(t){var i,n,o,s;try{null===(n=null===(i=this.options.events)||void 0===i?void 0:i.onThreeDSecureChallenge)||void 0===n||n.call(i)}catch(e){}const r=null===(o=null==t?void 0:t.response)||void 0===o?void 0:o.links["3ds"];if(r){const t=[[250,400],[390,400],[500,600],[600,400]],i=screen.width,n=t.reduce(((e,t)=>i>t[0]?t:e),[250,400]),o=document.createElement("iframe");o.setAttribute("id","payrails-3ds-frame"),o.setAttribute("src",r),o.setAttribute("width",n[0].toString()),o.setAttribute("height",n[1].toString());const a=document.createElement("div");a.setAttribute("id","payrails-3ds-challenge"),a.appendChild(o);const l=document.createElement("div");l.addEventListener("click",(()=>e(this,void 0,void 0,(function*(){l.remove()})))),l.setAttribute("id","payrails-3ds-popup-background"),l.appendChild(a);const d=t=>e(this,void 0,void 0,(function*(){var e,i,n;if(t.data&&'{"type":"3DS-challenge-completed"}'===t.data){window.removeEventListener("message",d),l.remove();if(!(yield this.paymentExecutor.getExecution(this.execution.url)).res.status.find((({code:e})=>"authorizeSuccessful"===e))&&(null===(e=this.options.events)||void 0===e?void 0:e.onAuthorizeFailed))return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed after 3DS challenge."});if(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)return void(null===(n=this.options.events)||void 0===n||n.onAuthorizeSuccess())}}));null===(s=document.querySelector("body"))||void 0===s||s.appendChild(l),window.addEventListener("message",d),a.style.width=`${n[0]+4}px`,a.style.height=`${n[1]+4}px`}}collectCardFormValues(){return e(this,void 0,void 0,(function*(){if(!this.cardForm)throw new Error("Trying to collect values from non-existent card form");return yield this.cardForm.collectValues()}))}}exports.AuthorizationFailureReasons=void 0,(T=exports.AuthorizationFailureReasons||(exports.AuthorizationFailureReasons={})).VALIDATION_FAILED="VALIDATION_FAILED",T.AUTHORIZATION_ERROR="AUTHORIZATION_ERROR",T.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",T.UNKNOWN_ERROR="UNKNOWN_ERROR";var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var R={},y={},D={};Object.defineProperty(D,"__esModule",{value:!0}),D.isntString=void 0,D.isntString=function(e){return"string"!=typeof e};var S={},g={};Object.defineProperty(g,"__esModule",{value:!0}),g.subscribers=g.childWindows=g.prefix=void 0,g.prefix="/*framebus*/",g.childWindows=[],g.subscribers={};var C={},b={},w={},M={};Object.defineProperty(M,"__esModule",{value:!0}),M.subscriptionArgsInvalid=void 0;var P=D;M.subscriptionArgsInvalid=function(e,t,i){return!!P.isntString(e)||("function"!=typeof t||P.isntString(i))};var V={},U={};Object.defineProperty(U,"__esModule",{value:!0}),U.hasOpener=void 0,U.hasOpener=function(e){return e.top===e&&(null!=e.opener&&(e.opener!==e&&!0!==e.opener.closed))},Object.defineProperty(V,"__esModule",{value:!0}),V.broadcast=void 0;var k,Y=U;function F(){if(k)return w;k=1,Object.defineProperty(w,"__esModule",{value:!0}),w.Framebus=void 0;var e=D,t=M,i=V,n=j(),o=g,s=function(){function s(e){void 0===e&&(e="*"),this.origin=e}return s.target=function(e){return void 0===e&&(e="*"),new s(e)},s.prototype.include=function(e){return null!=e&&(null!=e.Window&&(e.constructor===e.Window&&(o.childWindows.push(e),!0)))},s.prototype.target=function(e){return s.target(e)},s.prototype.emit=function(t,o,s){var r=this.origin;if(e.isntString(t))return!1;if(e.isntString(r))return!1;"function"==typeof o&&(s=o,o=void 0);var a=n.packagePayload(t,r,o,s);return!!a&&(i.broadcast(window.top||window.self,a,r),!0)},s.prototype.on=function(e,i){var n=this.origin;return!t.subscriptionArgsInvalid(e,i,n)&&(o.subscribers[n]=o.subscribers[n]||{},o.subscribers[n][e]=o.subscribers[n][e]||[],o.subscribers[n][e].push(i),!0)},s.prototype.off=function(e,i){var n=this.origin;if(t.subscriptionArgsInvalid(e,i,n))return!1;var s=o.subscribers[n]&&o.subscribers[n][e];if(!s)return!1;for(var r=0;r<s.length;r++)if(s[r]===i)return s.splice(r,1),!0;return!1},s}();return w.Framebus=s,w}V.broadcast=function e(t,i,n){var o,s=0;try{for(t.postMessage(i,n),Y.hasOpener(t)&&e(t.opener.top,i,n);o=t.frames[s];)e(o,i,n),s++}catch(e){}};var x,B,G=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))};function j(){if(B)return C;B=1,Object.defineProperty(C,"__esModule",{value:!0}),C.packagePayload=void 0;var e=function(){if(x)return b;x=1;var e=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(b,"__esModule",{value:!0}),b.subscribeReplier=void 0;var t=F(),i=e(G);return b.subscribeReplier=function(e,n){var o=i.default();return t.Framebus.target(n).on(o,(function i(s,r){e(s,r),t.Framebus.target(n).off(o,i)})),o},b}(),t=g;return C.packagePayload=function(i,n,o,s){var r,a={event:i,origin:n};"function"==typeof s&&(a.reply=e.subscribeReplier(s,n)),a.eventData=o;try{r=t.prefix+JSON.stringify(a)}catch(e){throw new Error("Could not stringify event: "+e.message)}return r},C}Object.defineProperty(S,"__esModule",{value:!0}),S.unpackPayload=void 0;var X=g,K=j();S.unpackPayload=function(e){var t;if(e.data.slice(0,X.prefix.length)!==X.prefix)return!1;try{t=JSON.parse(e.data.slice(X.prefix.length))}catch(e){return!1}if(t.reply){var i=e.origin,n=e.source,o=t.reply;t.reply=function(e){if(n){var t=K.packagePayload(o,i,e);t&&n.postMessage(t,i)}}}return t};var W={};Object.defineProperty(W,"__esModule",{value:!0}),W.dispatch=void 0;var $=g;W.dispatch=function(e,t,i,n,o){if($.subscribers[e]&&$.subscribers[e][t]){var s=[];i&&s.push(i),n&&s.push(n);for(var r=0;r<$.subscribers[e][t].length;r++)$.subscribers[e][t][r].apply(o,s)}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.broadcastToChildWindows=void 0;var z=V,q=g;H.broadcastToChildWindows=function(e,t,i){for(var n=q.childWindows.length-1;n>=0;n--){var o=q.childWindows[n];o.closed?q.childWindows.splice(n,1):i!==o&&z.broadcast(o.top,e,t)}},Object.defineProperty(y,"__esModule",{value:!0}),y.onmessage=void 0;var J=D,Z=S,Q=W,ee=H;y.onmessage=function(e){if(!J.isntString(e.data)){var t=Z.unpackPayload(e);if(t){var i=t.eventData,n=t.reply;Q.dispatch("*",t.event,i,n,e),Q.dispatch(e.origin,t.event,i,n,e),ee.broadcastToChildWindows(e.data,t.origin,e.source)}}},Object.defineProperty(R,"__esModule",{value:!0}),R.detach=R.attach=void 0;var te=y,ie=!1;R.attach=function(){ie||"undefined"==typeof window||(ie=!0,window.addEventListener("message",te.onmessage,!1))},R.detach=function(){ie=!1,window.removeEventListener("message",te.onmessage,!1)};var ne=R,oe=new(F().Framebus);ne.attach();var se=m(oe);const re={INITIALIZE_CLIENT:"%s1 - Initializing skyflow client.",CLIENT_INITIALIZED:"%s1 - Initialized skyflow client successfully.",CREATE_COLLECT_CONTAINER:"%s1 - Creating Collect container.",COLLECT_CONTAINER_CREATED:"%s1 - Created Collect container successfully.",CREATE_REVEAL_CONTAINER:"%s1 - Creating Reveal container.",REVEAL_CONTAINER_CREATED:"%s1 - Created Reveal container successfully.",VALIDATE_RECORDS:"%s1 - Validating insert records.",VALIDATE_DETOKENIZE_INPUT:"%s1 - Validating detokenize input.",VALIDATE_GET_INPUT:"%s1 - Validating get input.",VALIDATE_DELETE_INPUT:"%s1 - Validating delete input.",VALIDATE_COLLECT_RECORDS:"%s1 - Validating collect element input.",VALIDATE_REVEAL_RECORDS:"%s1 - Validating reveal element input.",VALIDATE_RENDER_RECORDS:"%s1 - Validating file render element input.",CREATED_ELEMENT:"%s1 - Created %s2 element.",ELEMENT_MOUNTED:"%s1 - %s2 Element mounted.",ELEMENT_REVEALED:"%s1 - %s2 Element revealed.",FILE_RENDERED:"%s1 - %s2 File rendered.",COLLECT_SUBMIT_SUCCESS:"%s1 - Data has been collected successfully.",REVEAL_SUBMIT_SUCCESS:"%s1 - Data has been revealed successfully.",RENDER_SUBMIT_SUCCESS:"%s1 - File download URL has been fetched successfully.",INSERT_DATA_SUCCESS:"%s1 - Data has been inserted successfully.",DETOKENIZE_SUCCESS:"%s1 - Data has been revealed successfully.",GET_SUCCESS:"%s1 - Data has been revealed successfully.",DELETE_SUCCESS:"%s1 - Data has been deleted successfully.",BEARER_TOKEN_LISTENER:"%s1 - Get bearer token listener added.",CAPTURED_BEARER_TOKEN_EVENT:"%s1 - Captured bearer token event.",BEARER_TOKEN_RESOLVED:"%s1 - GetBearerToken promise resolved successfully.",REUSE_BEARER_TOKEN:"%s1 - Reusing the bearer token.",PUREJS_CONTROLLER_INITIALIZED:"%s1 - SkyflowController initialized.",PUREJS_LISTENER_READY:"%s1 - Purejs listener ready.",EMIT_PURE_JS_CONTROLLER:"%s1 - Emitted Skyflow controller event.",INSERT_TRIGGERED:"%s1 - Insert method triggered.",DETOKENIZE_TRIGGERED:"%s1 - Detokenize method triggered.",GET_TRIGGERED:"%s1 - Get method triggered.",GET_BY_ID_TRIGGERED:"%s1 - Get method triggered.",DELETE_TRIGGERED:"%s1 - Delete method triggered.",EMIT_PURE_JS_REQUEST:"%s1 - Emitted %s2 request.",CAPTURE_PURE_JS_REQUEST:"%s1 - Captured %s2 event.",LISTEN_PURE_JS_REQUEST:"%s1 - Listening to %s2 event.",CAPTURE_PUREJS_FRAME:"%s1 - Captured SkyflowController frame ready event.",FETCH_RECORDS_RESOLVED:"%s1 - Detokenize request is resolved.",INSERT_RECORDS_RESOLVED:"%s1 - Insert request is resolved.",GET_RESOLVED:"%s1 - Get request is resolved.",GET_BY_SKYFLOWID_RESOLVED:"%s1 - GetById request is resolved.",DELETE_RESOLVED:"%s1 - Delete request is resolved",EMIT_EVENT:"%s1 - %s2 event emitted",CAPTURE_EVENT:"%s1 - Captured event %s2",LISTEN_COLLECT_FRAME_READY:"%s1 - Listening to collect FRAME_READY event",EMIT_COLLECT_ELEMENT_FRAME_READY:"%s1 - Emitting collect element %s2 FRAME_READY event",ENTERED_COLLECT_FRAME_READY_CB:"%s1 - In IFrameForm constructor, Entered FRAME_READY callback",EXECUTE_COLLECT_ELEMENT_FRAME_READY_CB:"%s1 - In IFrameForm, executing collect element, %s2 FRAME_READY callback",CLIENT_METADATA_NOT_SET:"%s1 - Client metadata not set",EXECUTE_COLLECT_ELEMENT_INIT:"%s1 - calling Collect element init",INSIDE__COLLECT_ELEMENT_INIT:"%s1 - Inside Collect element init for %s2",CREATING_COLLECT_ELEMENT_FORM:"%s1 - Start, creating iframe form for %s2",COLLECT_FRAME_READY_CB:"%s1 - In FrameElements, executing collect element FRAME_READY cb for %s2, sending metadata",INSIDE_FRAME_ELEMENTS_CONSTRUCOTR:"%s1 - Inside FrameElements constructor",SETUP_IN_START:"%s1 - Inside FrameElements start(), calling setup",SETUP_IN_CONSTRUCTOR:"%s1 - Inside FrameElements constructor, calling setup",COLLECT_ELEMET_START:"%s1 - %s2, Collect Element start",COLLECT_CONTROLLER_START:"%s1 - %s2, Collect Controller start",REVEAL_ELEMENT_START:"%s1 - %s2, Reveal Element start",EMIT_COLLECT_FRAME_CONTROLLER_EVENT:"%s1 - Emit collect FrameController FRAME_READY event",EXECUTE_COLLECT_CONTROLLER_READY_CB:"%s1 - Executing collect FrameController FRAME_READY callback, set client metadata",IFRAMEFORM_CONSTRUCTOR_FRAME_READY_LISTNER:"%s1 - In IFrameForm constructor, Adding listner for FRAME_READY event",IFRAMEFORM_CONSTRUCTOR_TOKENIZATION_LISTNER:"%s1 - In IFrameForm constructor, Adding listner for TOKENIZATION_REQUEST event",CURRENT_ENV:"%s1 - Client Env is %s2",CURRENT_LOG_LEVEL:"%s1 - Client LogLevel is %s2",VALIDATE_GET_BY_ID_INPUT:"%s1 - Validating getByID input."},ae={CLIENT_CONNECTION:"Interface: collect container - client connection not established. client info has not reached iframes",INVALID_BEARER_TOKEN:"Interface: init - Invalid token is generated from getBearerToken callback",BEARER_TOKEN_REJECTED:"Interface: init - GetBearerToken promise got rejected.",VAULTID_IS_REQUIRED:"Interface: init - Invalid client credentials. vaultID is required.",EMPTY_VAULTID_IN_INIT:"Interface: init - Invalid client credentials. vaultID cannot be empty.",VAULTURL_IS_REQUIRED:"Interface: init - Invalid client credentials. vaultURL is required.",EMPTY_VAULTURL_IN_INIT:"Interface: init - Invalid client credentials. vaultURL cannot be empty.",INVALID_VAULTURL_IN_INIT:"Interface: init - Invalid client credentials. Expecting https://XYZ for vaultURL",GET_BEARER_TOKEN_IS_REQUIRED:"Interface: init - Invalid client credentials. getBearerToken is required.",EMPTY_CONTAINER_TYPE:"Interface: client {containerType} container - Invalid container type. Container object cannot be empty.",INVALID_CONTAINER_TYPE:"Interface: client {containerType} container - Invalid container type. Invalid container object.",INVALID_COLLECT_VALUE:"Invalid value",INVALID_COLLECT_VALUE_WITH_LABEL:"Invalid %s1",REQUIRED_COLLECT_VALUE:"%s1 is required",DEFAULT_REQUIRED_COLLECT_VALUE:"Field is required",RECORDS_KEY_NOT_FOUND:"Interface: client insert - records object is required.",INVALID_RECORDS_IN_INSERT:"Interface: client insert - Invalid records. records object should be an array.",EMPTY_RECORDS_IN_INSERT:"Interface: client insert - records array cannot be empty.",MISSING_TABLE_IN_INSERT:'Interface: client insert - "table" key is required in records array at index %s1',EMPTY_TABLE_IN_INSERT:"Interface: client insert - table cannot be empty in records array at index %s1",INVALID_TABLE_IN_INSERT:"Interface: client insert - table of type string is required at index %s1 in records array.",EMPTY_FIELDS_IN_INSERT:"Interface: client insert - fields cannot be empty in records array at index %s1",MISSING_FIELDS_IN_INSERT:'Interface: client insert - "fields" key is required in records array at index %s1',INVALID_FIELDS_IN_INSERT:"Interface: client insert - fields of type object is required at index %s1 in records array.",INVALID_TOKENS_IN_INSERT:"Interface: client insert - Invalid tokens in options. tokens of type boolean is required.",RECORDS_KEY_NOT_FOUND_DELETE:"Interface: client delete - records object is required.",INVALID_RECORDS_IN_DELETE:"Interface: client delete - Invalid records. records object should be an array.",EMPTY_RECORDS_IN_DELETE:"Interface: client delete - records array cannot be empty.",MISSING_TABLE_IN_DELETE:'Interface: client delete - "table" key is required in records array at index %s1',EMPTY_TABLE_IN_DELETE:"Interface: client delete - table cannot be empty in records array at index %s1",INVALID_TABLE_IN_DELETE:"Interface: client delete - table of type string is required at index %s1 in records array.",MISSING_ID_IN_DELETE:'Interface: client delete - "id" key is required in records array at index %s1',EMPTY_ID_IN_DELETE:"Interface: client delete - id cannot be empty in records array at index %s1",INVALID_ID_IN_DELETE:"Interface: client delete - id of type string is required at index %s1 in records array.",DELETE_RECORDS_REJECTED:"Interface: client delete - delete request is rejected.",INVALID_TOKENS_IN_COLLECT:"Interface: collect container - Invalid tokens. tokens of type boolean is required.",RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS:'Interface: collect container - "records" key not found in additionalFields',INVALID_RECORDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - records should be an array inside additionalFields",EMPTY_RECORDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - records object cannot be empty in additionalFields",MISSING_TABLE_IN_ADDITIONAL_FIELDS:'Interface: collect container - "table" key not found in additionalFields records at index %s1',INVALID_TABLE_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid table name in additionalFields records at index %s1",INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid skyflow id in additionalFields records at index %s1",MISSING_FIELDS_IN_ADDITIONAL_FIELDS:'Interface: collect container - "fields" key not found in additionalFields records at index %s1',INVALID_FIELDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid fields in additionalFields records at index %s1",RECORDS_KEY_NOT_FOUND_DETOKENIZE:"Interface: client detokenize - records object is required.",EMPTY_RECORDS_DETOKENIZE:"Interface: client detokenize - records array cannot be empty.",INVALID_RECORDS_IN_DETOKENIZE:"Interface: client detokenize - Invalid records. records object should be an array.",MISSING_TOKEN_IN_DETOKENIZE:'Interface: client detokenize - "token" key is required in records array at index %s1 ',INVALID_TOKEN_IN_DETOKENIZE:"Interface: client detokenize - Invalid token. token of type string is required at index %s1 in records array.",RECORDS_KEY_NOT_FOUND_GET:"Interface: client get - records object is required.",INVALID_RECORDS_IN_GET:"Interface: client get - Invalid records. records object should be an array.",EMPTY_RECORDS_GET:"Interface: client get - records array cannot be empty.",MISSING_IDS_IN_GET:'Interface: client get - "ids" key is required in records array at index %s1',INVALID_IDS_IN_GET:"Interface: client get - Invalid ids. ids object should be an array.",INVALID_COLUMN_VALUES_IN_GET:"Interface: client get - Invalid column values. column values object should be an array.",EMPTY_IDS_IN_GET:"Interface: client get - ids array cannot be empty at index %s1",INVALID_SKYFLOWID_TYPE_IN_GET:"Interface: client get - Invalid skyflowId in ids array at index %s1",MISSING_TABLE_IN_GET:'Interface: client get - "table" key is required in records array at index %s1',INVALID_TABLE_IN_GET:"Interface: client get - table of type string is required at index %s1 in records array.",MISSING_REDACTION_IN_GET:'Interface: client get - "redaction" key is required in records array at index %s1',INVALID_REDACTION_TYPE_IN_GET:"Interface: client get - Invalid redaction type in records array at index %s1",INVALID_TOKENS_IN_GET:"Interface: client get - Invalid tokens in options. tokens of type boolean is required.",TOKENS_GET_COLUMN_NOT_SUPPORTED:"Interface: client get - column_name or column_values cannot be used with tokens in options.",REDACTION_WITH_TOKENS_NOT_SUPPORTED:"Interface: client get - redaction cannot be used when tokens are true in options.",INVALID_REDACTION_TYPE_IN_DETOKENIZE:"Interface: client get - Invalid redaction type in records array at index %s1",EMPTY_RECORDS_REVEAL:"Interface: reveal container - cannot invoke reveal method before creating reveal elements",MISSING_TOKEN_KEY_REVEAL:"Interface: RevealElement - token key is required ",MISSING_SKYFLOWID_KEY_REVEAL:"Interface: FileRenderElement - skyflowID key is required ",MISSING_TABLE_KEY_REVEAL:"Interface: FileRenderElement - table key is required ",MISSING_COLUMN_KEY_REVEAL:"Interface: FileRenderElement - column key is required ",INVALID_SKYFLOW_ID_REVEAL:"Interface: FileRenderElement - skyflowID is invalid. skyflowID of type string is required",INVALID_TABLE_REVEAL:"Interface: FileRenderElement - table is invalid. table of type string is required",INVALID_COLUMN_NAME_REVEAL:"Interface: FileRenderElement - column name is invalid. column of type string is required",EMPTY_SKYFLOW_ID_REVEAL:"Interface: FileRenderElement - skyflowID is empty.",EMPTY_TABLE_REVEAL:"Interface: FileRenderElement - table is empty.",EMPTY_COLUMN_NAME_REVEAL:"Interface: FIleRenderElement - column is empty.",INVALID_TOKEN_ID_REVEAL:"Interface: RevealElement - token is invalid. token of type string is required",INVALID_LABEL_REVEAL:"Interface: RevealElement - label is invalid.",INVALID_ALT_TEXT_REVEAL:"Interface: RevealElement - Invalid altText.",INVALID_ALT_TEXT_RENDER:"Interface: RevealElement - Invalid altText.",INVALID_FORMAT_REVEAL:"Interface: RevealElement - Invalid format type.",EMPTY_FORMAT_REVEAL:"Interface: RevealElement - Empty format value provided.",INVALID_FORMAT_VALUE_REVEAL:"Interface: RevealElement - Invalid format value provided.",INVALID_REDACTION_TYPE_REVEAL:"Interface: RevealElement - Invalid Redaction type.",ELEMENTS_NOT_MOUNTED_REVEAL:"Interface: reveal container - Cannot invoke reveal before mounting the elements",ELEMENT_NOT_MOUNTED_RENDER:"Interface: render container - Cannot invoke renderFile before mounting the elements",EMPTY_TABLE_IN_ADDITIONAL_FIELDS:"Interface: collect container - table cannot be empty in additionalFields at index %s1",EMPTY_FIELDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - fields cannot be empty in additionalFields at index %s1",EMPTY_TOKEN_IN_DETOKENIZE:"Interface: client detokenize - token cannot be empty in records array at index %s1",EMPTY_SKYFLOWID_IN_GET:"Interface: client get - id cannot be empty in records array at index %s1",EMPTY_TABLE_IN_GET:"Interface: client get - table cannot be empty in records array at index %s1",EMPTY_REDACTION_TYPE_IN_GET:"Interface: client get - redaction cannot be empty in records array at index %s1",EMPTY_TOKEN_ID_REVEAL:"Interface: RevealElement - token cannot be empty",FETCH_RECORDS_REJECTED:"Interface: client detokenize - detokenize request is rejected.",INSERT_RECORDS_REJECTED:"Interface: client insert - insert request is rejected.",GET_REJECTED:"Interface: client get - get request is rejected.",FAILED_REVEAL:"Interface: reveal container - Failed to reveal data",FAILED_RENDER:"Interface: reveal container - Failed to render file",SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED:"Interface: FileRenderElement: skyflowID and token can not be specified together.",MISSING_TABLE_IN_COLLECT:'Interface: collect element - "table" key is required.',EMPTY_TABLE_IN_COLLECT:"Interface: collect element - table cannot be empty.",EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:"Interface: collect element - id cannot be empty.",INVALID_TABLE_IN_COLLECT:"Interface: collect element - Invalid table. table of type string is required",INVALID_SKYFLOWID_IN_COLLECT:"Interface: collect element - Invalid id. id of type string is required",MISSING_COLUMN_IN_COLLECT:'Interface: collect element - "column" key is required.',MISSING_SKYFLOWID_IN_COLLECT:'Interface: collect element - "skyflowID" key is required in file type element',EMPTY_COLUMN_IN_COLLECT:"Interface: collect element - column cannot be empty.",INVALID_COLUMN_IN_COLLECT:"Interface: collect element - Invalid column. column of type string is required",UNIQUE_ELEMENT_NAME:"The element name has to unique: %s1",ELEMENTS_NOT_MOUNTED:"Interface: collect container - Elements should be mounted before invoking collect",DUPLICATE_ELEMENT:"Interface: collect container - Duplicate column %s1 found in %s2.",DUPLICATE_ELEMENT_ADDITIONAL_FIELDS:"Interface: collect container - Duplicate column %s1 found in %s2 in additional fields",MISSING_ELEMENT_TYPE:'Interface:container element with type {TYPE} - Invalid element type. "type" key is required.',EMPTY_ELEMENT_TYPE:"Interface:container element with type {TYPE} - Invalid element type. type cannot be empty.",INVALID_ELEMENT_TYPE:"Interface:container element with type {TYPE} - invalid element type. type not found",INVALID_ELEMENT_SELECTOR:"Interface: container element with type {TYPE} - Div cannot be found.",CANNOT_CHANGE_ELEMENT:"Element can't be changed.",INVALID_IFRAME:"Error occured while creating an iframe",INVALID_FIELD:"Invalid Field.",FRAME_NOT_FOUND:"Interface: collect element - %s1 frame not found:",COMPLETE_AND_VALID_INPUTS:"Interface: collect container - Provide complete and valid inputs for %s1",REQUIRED_PARAMS_NOT_PROVIDED:"Interface: collect element - Required params are not provided.",INVALID_EVENT_TYPE:"Interface: collect element - Provide a valid event type.",INVALID_EVENT_LISTENER:'Interface: "on" on CollectElement - Provide valid event listener.',MISSING_HANDLER_IN_EVENT_LISTENER:'Interface: "on" on CollectElement - Second argument is missing. handler cannot be empty.',INVALID_HANDLER_IN_EVENT_LISTENER:'Interface: "on" on CollectElement - Invalid handler. handler should be of type function.',UNKNOWN_ERROR:"Unknown Error.",NETWORK_ERROR:"A network error occurred. This could be a CORS issue or a dropped internet connection. It is not possible for us to know. Please reach out to skyflow if you see this error",CONNECTION_ERROR:"Error while initializing the connection.",ERROR_OCCURED:"Error occurred.",INVALID_VALIDATIONS_TYPE:"Interface: collect element - Invalid validations type.",MISSING_VALIDATION_RULE_TYPE:"Interface: collect element - Type is missing in validationRule at index %s1 in validations array",INVALID_VALIDATION_RULE_TYPE:"Interface: collect element - Invalid ValidationRuleType at index %s1 in validations array",MISSING_VALIDATION_RULE_PARAMS:"Interface: collect element - params are missing in validationRule at index %s1 in validations array",INVALID_VALIDATION_RULE_PARAMS:"Interface: collect element - Invalid ValidationRule params at index %s1 in validations array",MISSING_REGEX_IN_REGEX_MATCH_RULE:"Interface: collect element - Missing regex in ValidationRule params at index %s1 in validations array",INVALID_REGEX_IN_REGEX_MATCH_RULE:"Interface: collect element - Invalid regex in ValidationRule params at index %s1 in validations array",MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE:"Interface: collect element - Either min or max is required in ValidationRule params at index %s1 in validations array",MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE:"Interface: collect element - Missing element in ValidationRule params at index %s1 in validations array",INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE:"Interface: collect element - Invalid collect element in ValidationRule params at index %s1 in validations array",ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE:"Interface: collect element - collect element is not mounted in ValidationRule params at index %s1 in validations array",EMPTY_ELEMENT_IN_MOUNT:"Interface: mount element with type %s1 - Mount cannot be empty.",VALIDATION_FAILED:"Validation failed",REVEAL_ELEMENT_ERROR_STATE:"unable to reveal, since one or more element(s) have setError",INVALID_FILE_TYPE:"Interface: collect element - Invalid File Type",INVALID_FILE_SIZE:"Interface: collect element - Invalid File Size",NO_FILE_SELECTED:"Interface: collect element - No File Selected",INVALID_UPSERT_OPTION_TYPE:"Invalid upsert option, should be an array",EMPTY_UPSERT_OPTIONS_ARRAY:"upsert option cannot be an empty array, atleast one object of table and column is required.",INVALID_UPSERT_OPTION_OBJECT_TYPE:"Invalid upsert object at index %s1, an object of table and column is required.",MISSING_TABLE_IN_UPSERT_OPTION:'"table" key is required in upsert options object at index %s1',MISSING_COLUMN_IN_UPSERT_OPTION:'"column" key is required in upsert option at index %s1',INVALID_TABLE_IN_UPSERT_OPTION:"Invalid table in upsert object at index %s1, table of type non empty string is required",INVALID_COLUMN_IN_UPSERT_OPTION:"Invalid column in upsert object at index %s1, column of type non empty string is required",INVALID_RECORD_COLUMN_VALUE:"Invalid Record Column value.",MISSING_RECORD_COLUMN_VALUE:"Column Values is required when Column Name is specified.",MISSING_RECORD_COLUMN_NAME:"Column Name is required when Column Values are specified.",INVALID_RECORD_COLUMN_VALUE_TYPE:"Invalid Type of Records Column Values.",INVALID_COLUMN_VALUES_TYPE:"Invalid column values type, should be an Array.",EMPTY_RECORD_COLUMN_VALUES:"Record column values cannot be empty.",EMPTY_COLUMN_VALUE:"Column Value is empty.",MISSING_IDS_OR_COLUMN_VALUES_IN_GET:'Interface: client get - "ids" key or "columnValues" key is missing.',SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED:"ids and columnName can not be specified together.",GET_BY_SKYFLOWID_RESOLVED:"%s1 - GetById request is resolved.",RECORDS_KEY_NOT_FOUND_GETBYID:"Interface: client getById - records object is required.",INVALID_RECORDS_IN_GETBYID:"Interface: client getById - Invalid records. records object should be an array.",EMPTY_RECORDS_GETBYID:"Interface: client getById - records array cannot be empty.",MISSING_IDS_IN_GETBYID:'Interface: client getById - "ids" key is required in records array at index %s1',INVALID_IDS_IN_GETBYID:"Interface: client getById - Invalid ids. ids object should be an array.",EMPTY_IDS_IN_GETBYID:"Interface: client getById - ids array cannot be empty at index %s1",INVALID_SKYFLOWID_TYPE_IN_GETBYID:"Interface: client getById - Invalid skyflowId in ids array at index %s1",MISSING_TABLE_IN_GETBYID:'Interface: client getById - "table" key is required in records array at index %s1',INVALID_TABLE_IN_GETBYID:"Interface: client getById - table of type string is required at index %s1 in records array.",MISSING_REDACTION_IN_GETBYID:'Interface: client getById - "redaction" key is required in records array at index %s1',INVALID_REDACTION_TYPE_IN_GETBYID:"Interface: client getById - Invalid redaction type in records array at index %s1",EMPTY_SKYFLOWID_IN_GETBYID:"Interface: client getById - id cannot be empty in records array at index %s1",EMPTY_TABLE_IN_GETBYID:"Interface: client getById - table cannot be empty in records array at index %s1",EMPTY_REDACTION_TYPE_IN_GETBYID:"Interface: client getById - redaction cannot be empty in records array at index %s1",GET_BY_SKYFLOWID_REJECTED:"Interface: client getById - getById request is rejected.",MISSING_COMPOSABLE_LAYOUT_KEY:"Interface: client container - layout is required in composable container options.",EMPTY_COMPOSABLE_LAYOUT_ARRAY:"Interface: client container - layout array cannot be empty in composable container options.",INVALID_COMPOSABLE_LAYOUT_TYPE:"Interface: client container - invalid layout value, layout should be of type array of numbers in composable container options.",NEGATIVE_VALUES_COMPOSABLE_LAYOUT:"Interface: client container - layout array should only have postive numbers in composable container options.",MISMATCH_ELEMENT_COUNT_LAYOUT_SUM:"Interface: composable container mount - created elements count should be equal to sum of layout values.",MISSING_COMPOSABLE_CONTAINER_OPTIONS:"Interface: client composable container - options object is required for composable container.",INVALID_COMPOSABLE_CONTAINER_OPTIONS:"Interface: client composable container - invalid options value, should be an object type.",COMPOSABLE_CONTAINER_NOT_MOUNTED:"Interface: composable collect - container should be mounted before invoking collect.",INVALID_BOOLEAN_OPTIONS:"Interface: container create - Invaild %s1 in options, %s1 of type boolean is required.",INVALID_INPUT_OPTIONS_FORMAT:"Interface: container create - Invalid type, format must be of non-empty string type.",INVALID_INPUT_OPTIONS_TRANSLATION:"Interface: container create - Invalid type, translation must be of non-empty object type.",EMPTY_COLLECT_CUSTOM_FORMAT:"Interface: container create - %s1 cannot be empty object.",INVALID_ALLOWED_OPTIONS:"Interface: collect element - Invalid options, allowedFileType must be of string array type.",EMPTY_ALLOWED_OPTIONS_ARRAY:"Interface: collect element - Invalid options value, allowedFileType array is empty.",INVALID_ALLOWED_FILETYPE_ARRAY:"Interface: collect element - Invalid options value, allowedFileType array must contain only string elements."},le={INVALID_EXPIRATION_DATE_FORMAT:"EXPIRATION_DATE format must be in one of %s1, the format is set to default MM/YY",INVALID_EXPIRATION_YEAR_FORMAT:"EXPIRATION_YEAR format must be in one of %s1, the format is set to default YY",UNABLE_TO_SET_VALUE_IN_PROD_ENV:"%s1 setValue() cannot invoked while in PROD env. It is Not Recommeded",UNABLE_TO_CLEAR_VALUE_IN_PROD_ENV:"%s1 clearValue() cannot invoked while in PROD env. It is Not Recommeded",COLLECT_ALT_TEXT_DEPERECATED:"altText is DEPERECATED, passing altText will not have any effect",GET_BY_ID_DEPRECATED:"getById is deprecated, use new get method",INPUT_FORMATTING_NOT_SUPPROTED:"format or translation are not supported on %s1 element type.",INVALID_INPUT_TRANSLATION:"invalid or unsupported translation provided for %s1 element type."},de="collect_controller",ce="reveal_controller",Ee="element",_e="INSERT",Ie="DETOKENIZE",he="GET_BY_SKYFLOWID",ue="GET",pe="DELETE",fe={CHANGE:"CHANGE",READY:"READY",FOCUS:"FOCUS",BLUR:"BLUR",ESCAPE:"ESCAPE",CLICK:"CLICK",ERROR:"ERROR",SUCCESS:"SUCCESS",SUBMIT:"SUBMIT",CREATED:"CREATED",MOUNTED:"MOUNTED",HEIGHT:"HEIGHT"},Ne="FRAME_READY",Te="TOKENIZATION_REQUEST",Oe="INPUT_EVENT",Le="DESTROY FRAME",ve="SET_VALUE",Ae="REVEAL_REQUEST",me="REVEAL_FRAME_READY",Re="PUREJS_REQUEST",ye="PUREJS_FRAME_READY",De="GET_BEARER_TOKEN",Se="COLLECT_ELEMENT_SET_ERROR",ge="REVEAL_ELEMENT_SET_ERROR",Ce="REVEAL_ELEMENT_UPDATE_OPTIONS",be="FILE_UPLOAD",we="COMPOSABLE_UPDATE_OPTIONS",Me="RENDER_FILE_REQUEST",Pe="TOKEN",Ve="ALT_TEXT",Ue="ELEMENT_MOUNTED",ke="ALL_ELEMENTS_MOUNTED",Ye="COMPOSABLE_CONTAINER_MOUNTED",Fe="COLLECT_CONTAINER_MOUNTED",xe="REVEAL_CONTAINER_MOUNTED";var Be,Ge;!function(e){e.CVV="CVV",e.EXPIRATION_DATE="EXPIRATION_DATE",e.CARD_NUMBER="CARD_NUMBER",e.CARDHOLDER_NAME="CARDHOLDER_NAME",e.INPUT_FIELD="INPUT_FIELD",e.PIN="PIN",e.EXPIRATION_MONTH="EXPIRATION_MONTH",e.EXPIRATION_YEAR="EXPIRATION_YEAR",e.FILE_INPUT="FILE_INPUT"}(Be||(Be={})),function(e){e.VISA="VISA",e.MASTERCARD="MASTERCARD",e.AMEX="AMEX",e.DINERS_CLUB="DINERS_CLUB",e.DISCOVER="DISCOVER",e.JCB="JCB",e.MAESTRO="MAESTRO",e.UNIONPAY="UNIONPAY",e.HIPERCARD="HIPERCARD",e.DEFAULT="DEFAULT",e.UNKNOWN="UNKNOWN"}(Ge||(Ge={}));const je={[Ge.AMEX]:["XXXX XXXXXX XXXXX",{X:"[0-9]"}],[Ge.VISA]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[Ge.MASTERCARD]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[Ge.DISCOVER]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.DINERS_CLUB]:["XXXX XXXXXX XXXXXX",{X:"[0-9]"}],[Ge.JCB]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.MAESTRO]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.UNIONPAY]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.HIPERCARD]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.DEFAULT]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ge.UNKNOWN]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}]},Xe={textarea:{name:"textarea",attributes:{type:"textarea"},sensitive:!1},checkbox:{name:"checkbox",attributes:{type:"checkbox"},sensitive:!1},radio:{name:"radio",attributes:{type:"radio"},sensitive:!1},dropdown:{name:"dropdown",attributes:{type:"select"},sensitive:!1},[Be.CARDHOLDER_NAME]:{name:"cardHolderName",attributes:{type:"text",autocomplete:"cc-name"},sensitive:!0,regex:/^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/},[Be.CARD_NUMBER]:{name:"CARD_NUMBER",attributes:{type:"text",autocomplete:"cc-number",inputmode:"numeric"},sensitive:!0,mask:je[Ge.DEFAULT],regex:/$|^[\s]*?([0-9]{2,6}[ -]?){3,5}[\s]*/},[Be.EXPIRATION_DATE]:{name:"EXPIRATION_DATE",attributes:{type:"text",autocomplete:"cc-exp",inputmode:"numeric"},sensitive:!0},[Be.EXPIRATION_MONTH]:{name:"EXPIRATION_MONTH",attributes:{maxLength:2,type:"text",inputmode:"numeric",autocomplete:"cc-exp-month"},sensitive:!0,mask:["XX",{X:"[0-9]"}]},[Be.EXPIRATION_YEAR]:{name:"EXPIRATION_YEAR",attributes:{type:"text",inputmode:"numeric",autocomplete:"cc-exp-year"},sensitive:!0},[Be.CVV]:{name:"CVV",attributes:{type:"text",inputmode:"numeric",maxLength:4},sensitive:!0,regex:/^$|^[0-9]{3,4}$/},[Be.INPUT_FIELD]:{name:"INPUT_FIELD",sensitive:!0,attributes:{type:"text"}},[Be.PIN]:{name:"PIN",attributes:{type:"text",inputmode:"numeric",maxLength:12,minLength:4},sensitive:!0,regex:/^$|^[0-9]{4,12}$/},[Be.FILE_INPUT]:{name:"FILE_INPUT",sensitive:!0,attributes:{type:"file"}}},Ke="XXXX-XXXX-XXXX-XXXX",We={height:"100%",width:"100%",margin:0,padding:0,border:0,position:"absolute",top:0,left:0,"user-select":"none"},$e={position:"absolute",top:0,width:0,height:0,visibility:"hidden",left:"-99999999px","user-select":"none"},He={width:"100%",height:"100%",border:"0",padding:"0",margin:"0",outline:"none"},ze={WEBPACKAUTOFILL:"-webkit-autofill",BASE:"base",FOCUS:"focus",COMPLETE:"complete",EMPTY:"empty",INVALID:"invalid",GLOBAL:"global",REQUIRED_ASTERISK:"requiredAsterisk"};ze.BASE,ze.BASE,ze.BASE,ze.BASE,ze.REQUIRED_ASTERISK;const qe={[Ge.VISA]:{regex:/^4\d*/,maxCardLength:19,cardLengthRange:[13,16]},[Ge.MASTERCARD]:{regex:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,maxCardLength:16,cardLengthRange:[16]},[Ge.AMEX]:{regex:/^3[47]\d*/,maxCardLength:15,cardLengthRange:[15]},[Ge.DINERS_CLUB]:{regex:/^(36|38|30[0-5])\d*/,maxCardLength:16,cardLengthRange:[14,15,16,17,18,19]},[Ge.DISCOVER]:{regex:/^(6011|65|64[4-9]|622)\d*/,maxCardLength:16,cardLengthRange:[16,17,18,19]},[Ge.JCB]:{regex:/^35\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[Ge.HIPERCARD]:{regex:/^606282\d*/,maxCardLength:19,cardLengthRange:[14,15,16,17,18,19]},[Ge.UNIONPAY]:{regex:/^62\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[Ge.MAESTRO]:{regex:/^(5018|5020|5038|5043|5[6-9]|6020|6304|6703|6759|676[1-3])\d*/,maxCardLength:19,cardLengthRange:[12,13,14,15,16,17,18,19]}};Ge.DEFAULT,Ge.AMEX,Ge.DINERS_CLUB,Ge.DISCOVER,Ge.HIPERCARD,Ge.JCB,Ge.MAESTRO,Ge.MASTERCARD,Ge.UNIONPAY,Ge.VISA;const Je="MM/YY",Ze=[Je,"YYYY/MM","YY/MM","MM/YYYY"],Qe=["YY","YYYY"];var et;!function(e){e.APPLICATIONORJSON="application/json",e.TEXTORPLAIN="text/plain",e.TEXTORXML="text/xml",e.FORMURLENCODED="application/x-www-form-urlencoded",e.FORMDATA="multipart/form-data"}(et||(et={})),Be.CARD_NUMBER,Be.EXPIRATION_DATE,Be.EXPIRATION_MONTH,Be.EXPIRATION_YEAR,Be.CVV,Be.EXPIRATION_DATE,Be.CARD_NUMBER,Be.CARDHOLDER_NAME,Be.INPUT_FIELD,ae.INVALID_COLLECT_VALUE,Be.PIN,Be.EXPIRATION_MONTH,Be.EXPIRATION_YEAR,Be.FILE_INPUT,ae.INVALID_COLLECT_VALUE,Be.CVV,Be.EXPIRATION_DATE,Be.CARD_NUMBER,Be.CARDHOLDER_NAME,Be.INPUT_FIELD,ae.DEFAULT_REQUIRED_COLLECT_VALUE,Be.PIN,Be.EXPIRATION_MONTH,Be.EXPIRATION_YEAR,Be.FILE_INPUT,ae.DEFAULT_REQUIRED_COLLECT_VALUE;const tt=[Be.CARDHOLDER_NAME,Be.EXPIRATION_MONTH,Be.FILE_INPUT,Be.PIN,Be.CVV],it={X:"[0-9]"};class nt{constructor(){this.events={}}on(e,t,i=!1){this.events[e]?this.events[e].push({priority:i,callback:t}):this.events[e]=[{priority:i,callback:t}]}off(e,t){const i=this.events[e];if(!i)return;const n=i.findIndex((e=>e.callback===t));i.splice(n,1)}_emit(e,...t){const i=this.events[e];i&&i.forEach((e=>{e.callback(...t)}))}hasListener(e){const t=this.events[e];return!!t&&t.length>0}resetEvents(){const e={};Object.keys(this.events).forEach((t=>{const i=this.events[t];if(i&&i.length>0){const n=[];i.forEach((e=>{e.priority&&n.push(e)})),e[t]=n}})),this.events=e}static createChild(e){e.prototype=Object.create(nt.prototype,{constructor:e})}}
1
+ !function(){"use strict";function e(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))}function t(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function i(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i}let n;exports.ElementType=void 0,function(e){e.CARD_NUMBER="CARD_NUMBER",e.CARDHOLDER_NAME="CARDHOLDER_NAME",e.CVV="CVV",e.EXPIRATION_MONTH="EXPIRATION_MONTH",e.EXPIRATION_YEAR="EXPIRATION_YEAR"}(exports.ElementType||(exports.ElementType={})),"function"==typeof SuppressedError&&SuppressedError;const o=new Uint8Array(16);function s(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(o)}const r=[];for(let e=0;e<256;++e)r.push((e+256).toString(16).slice(1));var a,l={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function d(e,t,i){if(l.randomUUID&&!t&&!e)return l.randomUUID();const n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]}(n)}!function(e){e.GET="GET",e.POST="POST"}(a||(a={}));const c=({url:t,method:i=a.GET,token:n,body:o})=>e(void 0,void 0,void 0,(function*(){const e={method:i,headers:Object.assign(Object.assign(Object.assign({},p()),u(n)),f())};i===a.POST&&(e.body=JSON.stringify(o||{}));const s=yield fetch(t,e),r=yield s.json();if([401,403].includes(s.status))throw new E(t,i);if(429===s.status)throw new I(t,i);if(!s.ok)throw new _(t,i);return{ok:s.ok,req:Object.assign({url:t},e),res:r}}));class E extends Error{constructor(e,t){super(`[${t}] ${e} unauthorized`)}}class _ extends Error{constructor(e,t){super(`[${t}] ${e} unsuccessful`)}}class I extends Error{constructor(e,t){super(`[${t}] ${e} too many requests`)}}class h extends Error{constructor(e,t){super(`[${t}] ${e} max poll attempts exceeded.`)}}const u=e=>({authorization:`Bearer ${e}`}),p=()=>({"x-idempotency-key":d()}),f=()=>({"x-client-version":"2.8.2","x-client-type":"web-sdk"}),N={success:"https://payrails.io/success",error:"https://payrails.io/error",cancel:"https://payrails.io/cancel"};class T{constructor(e,t,i=N,n=680,o=60,s=2e3,r=5){this.sdkConfig=e,this.execution=t,this.returnLinks=i,this.POLL_INTERVAL=n,this.MAX_POLL_ATTEMPTS=o,this.POLL_INITIAL_DELAY=s,this.POLL_ERROR_COUNT_MULTIPLIER=r}pay(t){return e(this,void 0,void 0,(function*(){const e=(yield this.authorize(t)).res.links.execution;return yield this.pollForAuthorizationResult(e)}))}confirm(t,i={}){return e(this,void 0,void 0,(function*(){const e=yield c({url:t,method:a.POST,token:this.sdkConfig.token,body:{data:i}}),n=yield this.pollForAuthorizationResult(e.res.links.execution);if(n.finalState)return n;const o=n.response.status.slice().sort(((e,t)=>new Date(t.time).getTime()-new Date(e.time).getTime()))[0].time,{res:s}=yield this.getExecution(e.res.links.execution,o);return{finalState:s.status.find((({code:e,time:t})=>["authorizeSuccessful","authorizeFailed"].includes(e)&&new Date(t)>new Date(o))),response:s}}))}getExecution(t,i,n=0){return e(this,void 0,void 0,(function*(){if(n>this.MAX_POLL_ATTEMPTS)throw new h(t,a.GET);0===n&&i&&(yield this.wait(this.POLL_INITIAL_DELAY));try{const e=yield c({url:t,token:this.sdkConfig.token});if(i){if(!e.res.status.find((({time:e})=>new Date(e)>new Date(i))))return yield this.wait(this.POLL_INTERVAL),this.getExecution(t,i,n+1)}return e}catch(e){if(e instanceof _)return yield this.wait(this.POLL_INTERVAL),this.getExecution(t,i,n+this.POLL_ERROR_COUNT_MULTIPLIER);if(e instanceof I)return yield this.wait(this.POLL_INTERVAL*n),this.getExecution(t,i,n+1);throw e}}))}createApplePaySession(t){return e(this,void 0,void 0,(function*(){return c({url:t.requestUrl,method:a.POST,token:this.sdkConfig.token,body:{integrationType:"api",paymentMethodCode:"applePay",amount:this.sdkConfig.amount,meta:{sessionURL:t.sessionUrl,clientDomain:t.clientDomain||window.location.host}}})}))}authorize(t){return e(this,void 0,void 0,(function*(){if(!this.execution.authorizeLink||!this.sdkConfig.amount)throw new Error("SDK was not initialized with workflow execution");const{success:e,error:i,cancel:n}=this.returnLinks;return c({url:this.execution.authorizeLink,method:a.POST,token:this.sdkConfig.token,body:{amount:this.sdkConfig.amount,paymentComposition:t,returnInfo:{success:e,cancel:n,error:i}}})}))}wait(t){return e(this,void 0,void 0,(function*(){return new Promise((e=>setTimeout(e,t)))}))}pollForAuthorizationResult(t,i=0){return e(this,void 0,void 0,(function*(){const e=(yield this.getExecution(t)).res,n=e.status,o=["authorizePending","authorizeSuccessful","authorizeFailed"],s=n.find((({code:e})=>"authorizeRequested"===e));if(!s&&i<10)return yield new Promise((e=>setTimeout(e,this.POLL_INTERVAL))),this.pollForAuthorizationResult(t,i+1);if(!s)throw new Error("Authorization was not requested");const r=n.find((({code:e,time:t})=>"confirmRequested"===e&&new Date(t)>new Date(s.time))),a=r?r.time:s.time;let l=n.find((({code:e,time:t})=>o.includes(e)&&new Date(t)>new Date(a)));if(!l){const{res:e}=yield this.getExecution(t,a);return l=e.status.find((({code:e,time:t})=>o.includes(e)&&new Date(t)>new Date(a))),{finalState:l,response:e}}return{finalState:l,response:e}}))}}var L,O,v;!function(e){e.CARD="card",e.GOOGLE_PAY="googlePay",e.PAYPAL="payPal",e.APPLE_PAY="applePay"}(L||(L={})),function(e){e.ENABLED="enabled",e.CREATED="created"}(O||(O={}));class A{constructor(e){this.executionResponse=e}get lookup(){return this.executionResponse.initialResults.find((({body:{name:e}})=>"lookup"===e))}get holderReference(){return this.executionResponse.holderReference}get savedCreditCards(){return this.getStoredInstrumentForPaymentMethod(L.CARD)}get savedPaypalAccounts(){return this.getStoredInstrumentForPaymentMethod(L.PAYPAL)}get savedGooglePayAccounts(){return this.getStoredInstrumentForPaymentMethod(L.GOOGLE_PAY)}get savedApplePayAccounts(){return this.getStoredInstrumentForPaymentMethod(L.APPLE_PAY)}get paypalConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===L.PAYPAL));if(!e)throw new Error("trying to initialize paypal without config");return e.config||{}}get googlePayConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===L.GOOGLE_PAY));if(!e)throw new Error("trying to initialize google pay without config");return e?[e.config]:[]}isPaymentMethodAvailable(e){return this.availablePaymentMethods.some((({paymentMethodCode:t})=>t===e))}get applePayConfig(){const e=this.availablePaymentMethods.find((({paymentMethodCode:e})=>e===L.APPLE_PAY));if(!e)throw new Error("apple pay config not found");return e.config.parameters}get url(){return this.response.links.self}get response(){return this.executionResponse}get meta(){return this.executionResponse.meta}get availablePaymentMethods(){var e;return(null===(e=this.lookup)||void 0===e?void 0:e.body.data.paymentCompositionOptions)||[]}get authorizeLink(){var e;return null===(e=this.lookup)||void 0===e?void 0:e.body.links.authorize.href}get createSessionLink(){var e;return null===(e=this.response.links.startPaymentSession)||void 0===e?void 0:e.href}get storedPaymentInstruments(){return this.availablePaymentMethods.flatMap((e=>e.paymentInstruments||[]))}getStoredInstrumentForPaymentMethod(e){var t;return(null===(t=this.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e)))||void 0===t?void 0:t.paymentInstruments)||[]}}class m{constructor(e,{id:t="",className:i=""}={}){this.subElements=[];const n=document.createElement(e);t&&(this.id=t,n.setAttribute("id",t)),i&&n.setAttribute("class",i),this.element=n}get parentElement(){return this.element.parentElement}get selector(){if(!this.id)throw new Error("Element id is not set");return`#${this.id}`}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);t.appendChild(this.element),this.subElements.forEach((e=>{if(!this.id)throw new Error("Sub elements can not be rendered, please set id for the element");e.mount(this.selector)}))}unmount(){var e;this.subElements.forEach((e=>e.unmount())),null===(e=this.parentElement)||void 0===e||e.removeChild(this.element)}}class R extends m{get bin(){var e;return this.selectedInstrument?this.selectedInstrument.data.bin?this.selectedInstrument.data.bin:"":(null===(e=this.cardForm)||void 0===e?void 0:e.bin)||""}constructor(e,t,i,n){var o;super("button",{id:"payrails-card-payment-button"}),this.sdkConfig=e,this.execution=t,this.options=i,this.returnLinks=n,this.selectedInstrument=null,this.element.innerText=(null===(o=null==i?void 0:i.translations)||void 0===o?void 0:o.label)||"Pay",this.element.addEventListener("click",this.onPay.bind(this)),this.element.addEventListener("mouseenter",(()=>{var e;this.element.classList.contains("disabled")||(this.element.classList.add("hover"),this.setStyles((null===(e=this.options.styles)||void 0===e?void 0:e.hover)||{}))})),this.element.addEventListener("mouseleave",(()=>{var e;this.element.classList.contains("disabled")||(this.element.classList.remove("hover"),this.removeStyles((null===(e=this.options.styles)||void 0===e?void 0:e.hover)||{}))})),this.paymentExecutor=new T(this.sdkConfig,this.execution,this.returnLinks)}setDisabled(e){var t,i,n,o,s;this.element.classList.contains("disabled")!==e&&(null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onStateChanged)||void 0===i||i.call(t,e?"disabled":"enabled")),this.element.disabled=e,e?(this.element.classList.add("disabled"),(null===(n=this.options.styles)||void 0===n?void 0:n.disabled)&&this.setStyles(this.options.styles.disabled)):(this.element.classList.remove("disabled"),this.removeStyles((null===(o=this.options.styles)||void 0===o?void 0:o.disabled)||{}),(null===(s=this.options.styles)||void 0===s?void 0:s.base)&&this.setStyles(this.options.styles.base))}setSavedCreditCard(e){console.warn("setSavedCreditCard is deprecated, please use setSavedInstrument"),this.setSavedInstrument(e)}setSavedInstrument(e){this.selectedInstrument=e,this.setDisabled(!1)}setStyles(e){var t;const i=Object.assign(Object.assign({},null===(t=this.options.styles)||void 0===t?void 0:t.base),e);Object.keys(i).forEach((e=>{this.element.style[e]=i[e]}))}removeStyles(e){var t;const i=Object.keys((null===(t=this.options.styles)||void 0===t?void 0:t.base)||{});Object.keys(e).forEach((e=>{var t,n;i.includes(e)?this.element.style[e]=null===(n=null===(t=this.options.styles)||void 0===t?void 0:t.base)||void 0===n?void 0:n[e]:this.element.style[e]=""}))}setLabel(e){this.element.innerText=e}setCardForm(e){this.cardForm=e}triggerLoading(e){var t,i,n,o;const s=this.element.offsetWidth;this.element.style.minWidth=`${s}px`,e?(this.element.innerHTML='<div class="dot-flashing"></div>',this.element.classList.add("loading"),(null===(t=this.options.styles)||void 0===t?void 0:t.loading)&&this.setStyles(this.options.styles.loading)):(this.element.innerText=(null===(n=null===(i=this.options)||void 0===i?void 0:i.translations)||void 0===n?void 0:n.label)||"Pay",this.element.classList.remove("loading"),this.removeStyles((null===(o=this.options.styles)||void 0===o?void 0:o.loading)||{}))}onAuthorizationFailed(e){var t,i;this.setDisabled(!1),this.triggerLoading(!1),(null===(t=this.options.events)||void 0===t?void 0:t.onAuthorizeFailed)&&(null===(i=this.options.events)||void 0===i||i.onAuthorizeFailed(e))}onPay(){var t,i,n,o,s,r,a,l,d,c;return e(this,void 0,void 0,(function*(){if(this.setDisabled(!0),this.triggerLoading(!0),null===(t=this.options.events)||void 0===t?void 0:t.onPaymentButtonClicked)try{if(!1===(yield null===(i=this.options.events)||void 0===i?void 0:i.onPaymentButtonClicked({bin:this.bin||""})))return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.VALIDATION_FAILED,message:"Callback passed to onPaymentButtonClicked resolved to false"})}catch(e){return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.VALIDATION_FAILED,message:"Callback passed to onPaymentButtonClicked threw an error"})}try{const e=[{paymentMethodCode:L.CARD,integrationType:"api",amount:this.sdkConfig.amount,storeInstrument:!1}];if(null===(n=this.selectedInstrument)||void 0===n?void 0:n.id)e[0].paymentInstrumentId=null===(o=this.selectedInstrument)||void 0===o?void 0:o.id,e[0].paymentMethodCode=null===(s=this.selectedInstrument)||void 0===s?void 0:s.paymentMethod;else{const{tokenizedCardData:t,storeInstrument:i,enrollInstrumentToNetworkOffers:n}=yield this.collectCardFormValues();e[0].paymentInstrumentData={vaultToken:null==t?void 0:t.instrumentId,card:{numberToken:null==t?void 0:t.card_number,securityCodeToken:null==t?void 0:t.security_code}},e[0].storeInstrument=i,e[0].enrollInstrumentToNetworkOffers=n}const t=yield this.paymentExecutor.pay(e);this.handleAuthorizationResult(t)}catch(e){e instanceof E||[401,403].includes(null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.code)?(null===(l=null===(a=this.options.events)||void 0===a?void 0:a.onPaymentSessionExpired)||void 0===l||l.call(a),this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:"API token is not valid or expired."})):e.toString().includes("Invalid token")?(null===(c=null===(d=this.options.events)||void 0===d?void 0:d.onPaymentSessionExpired)||void 0===c||c.call(d),this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:"Vault token is not valid or expired."})):this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.UNKNOWN_ERROR,message:e.toString(),rawError:e})}}))}handleAuthorizationResult(e){var t,i,n;switch(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code){case"authorizeSuccessful":this.triggerLoading(!1),(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)&&this.options.events.onAuthorizeSuccess();break;case"authorizePending":"3ds"===(null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.actionRequired)&&this.handle3ds(e);break;default:this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed."})}}handle3ds(t){var i,n,o,s;try{null===(n=null===(i=this.options.events)||void 0===i?void 0:i.onThreeDSecureChallenge)||void 0===n||n.call(i)}catch(e){}const r=null===(o=null==t?void 0:t.response)||void 0===o?void 0:o.links["3ds"];if(r){const t=[[250,400],[390,400],[500,600],[600,400]],i=screen.width,n=t.reduce(((e,t)=>i>t[0]?t:e),[250,400]),o=document.createElement("iframe");o.setAttribute("id","payrails-3ds-frame"),o.setAttribute("src",r),o.setAttribute("width",n[0].toString()),o.setAttribute("height",n[1].toString());const a=document.createElement("div");a.setAttribute("id","payrails-3ds-challenge"),a.appendChild(o);const l=document.createElement("div");l.addEventListener("click",(()=>e(this,void 0,void 0,(function*(){l.remove()})))),l.setAttribute("id","payrails-3ds-popup-background"),l.appendChild(a);const d=t=>e(this,void 0,void 0,(function*(){var e,i,n;if(t.data&&'{"type":"3DS-challenge-completed"}'===t.data){window.removeEventListener("message",d),l.remove();if(!(yield this.paymentExecutor.getExecution(this.execution.url)).res.status.find((({code:e})=>"authorizeSuccessful"===e))&&(null===(e=this.options.events)||void 0===e?void 0:e.onAuthorizeFailed))return void this.onAuthorizationFailed({code:exports.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed after 3DS challenge."});if(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)return void(null===(n=this.options.events)||void 0===n||n.onAuthorizeSuccess())}}));null===(s=document.querySelector("body"))||void 0===s||s.appendChild(l),window.addEventListener("message",d),a.style.width=`${n[0]+4}px`,a.style.height=`${n[1]+4}px`}}collectCardFormValues(){return e(this,void 0,void 0,(function*(){if(!this.cardForm)throw new Error("Trying to collect values from non-existent card form");return yield this.cardForm.collectValues()}))}}exports.AuthorizationFailureReasons=void 0,(v=exports.AuthorizationFailureReasons||(exports.AuthorizationFailureReasons={})).VALIDATION_FAILED="VALIDATION_FAILED",v.AUTHORIZATION_ERROR="AUTHORIZATION_ERROR",v.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",v.UNKNOWN_ERROR="UNKNOWN_ERROR";var y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S={},g={},C={};Object.defineProperty(C,"__esModule",{value:!0}),C.isntString=void 0,C.isntString=function(e){return"string"!=typeof e};var b={},w={};Object.defineProperty(w,"__esModule",{value:!0}),w.subscribers=w.childWindows=w.prefix=void 0,w.prefix="/*framebus*/",w.childWindows=[],w.subscribers={};var M={},P={},V={},U={};Object.defineProperty(U,"__esModule",{value:!0}),U.subscriptionArgsInvalid=void 0;var k=C;U.subscriptionArgsInvalid=function(e,t,i){return!!k.isntString(e)||("function"!=typeof t||k.isntString(i))};var Y={},F={};Object.defineProperty(F,"__esModule",{value:!0}),F.hasOpener=void 0,F.hasOpener=function(e){return e.top===e&&(null!=e.opener&&(e.opener!==e&&!0!==e.opener.closed))},Object.defineProperty(Y,"__esModule",{value:!0}),Y.broadcast=void 0;var x,G=F;function B(){if(x)return V;x=1,Object.defineProperty(V,"__esModule",{value:!0}),V.Framebus=void 0;var e=C,t=U,i=Y,n=W(),o=w,s=function(){function s(e){void 0===e&&(e="*"),this.origin=e}return s.target=function(e){return void 0===e&&(e="*"),new s(e)},s.prototype.include=function(e){return null!=e&&(null!=e.Window&&(e.constructor===e.Window&&(o.childWindows.push(e),!0)))},s.prototype.target=function(e){return s.target(e)},s.prototype.emit=function(t,o,s){var r=this.origin;if(e.isntString(t))return!1;if(e.isntString(r))return!1;"function"==typeof o&&(s=o,o=void 0);var a=n.packagePayload(t,r,o,s);return!!a&&(i.broadcast(window.top||window.self,a,r),!0)},s.prototype.on=function(e,i){var n=this.origin;return!t.subscriptionArgsInvalid(e,i,n)&&(o.subscribers[n]=o.subscribers[n]||{},o.subscribers[n][e]=o.subscribers[n][e]||[],o.subscribers[n][e].push(i),!0)},s.prototype.off=function(e,i){var n=this.origin;if(t.subscriptionArgsInvalid(e,i,n))return!1;var s=o.subscribers[n]&&o.subscribers[n][e];if(!s)return!1;for(var r=0;r<s.length;r++)if(s[r]===i)return s.splice(r,1),!0;return!1},s}();return V.Framebus=s,V}Y.broadcast=function e(t,i,n){var o,s=0;try{for(t.postMessage(i,n),G.hasOpener(t)&&e(t.opener.top,i,n);o=t.frames[s];)e(o,i,n),s++}catch(e){}};var j,X,K=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))};function W(){if(X)return M;X=1,Object.defineProperty(M,"__esModule",{value:!0}),M.packagePayload=void 0;var e=function(){if(j)return P;j=1;var e=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(P,"__esModule",{value:!0}),P.subscribeReplier=void 0;var t=B(),i=e(K);return P.subscribeReplier=function(e,n){var o=i.default();return t.Framebus.target(n).on(o,(function i(s,r){e(s,r),t.Framebus.target(n).off(o,i)})),o},P}(),t=w;return M.packagePayload=function(i,n,o,s){var r,a={event:i,origin:n};"function"==typeof s&&(a.reply=e.subscribeReplier(s,n)),a.eventData=o;try{r=t.prefix+JSON.stringify(a)}catch(e){throw new Error("Could not stringify event: "+e.message)}return r},M}Object.defineProperty(b,"__esModule",{value:!0}),b.unpackPayload=void 0;var $=w,H=W();b.unpackPayload=function(e){var t;if(e.data.slice(0,$.prefix.length)!==$.prefix)return!1;try{t=JSON.parse(e.data.slice($.prefix.length))}catch(e){return!1}if(t.reply){var i=e.origin,n=e.source,o=t.reply;t.reply=function(e){if(n){var t=H.packagePayload(o,i,e);t&&n.postMessage(t,i)}}}return t};var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.dispatch=void 0;var q=w;z.dispatch=function(e,t,i,n,o){if(q.subscribers[e]&&q.subscribers[e][t]){var s=[];i&&s.push(i),n&&s.push(n);for(var r=0;r<q.subscribers[e][t].length;r++)q.subscribers[e][t][r].apply(o,s)}};var J={};Object.defineProperty(J,"__esModule",{value:!0}),J.broadcastToChildWindows=void 0;var Z=Y,Q=w;J.broadcastToChildWindows=function(e,t,i){for(var n=Q.childWindows.length-1;n>=0;n--){var o=Q.childWindows[n];o.closed?Q.childWindows.splice(n,1):i!==o&&Z.broadcast(o.top,e,t)}},Object.defineProperty(g,"__esModule",{value:!0}),g.onmessage=void 0;var ee=C,te=b,ie=z,ne=J;g.onmessage=function(e){if(!ee.isntString(e.data)){var t=te.unpackPayload(e);if(t){var i=t.eventData,n=t.reply;ie.dispatch("*",t.event,i,n,e),ie.dispatch(e.origin,t.event,i,n,e),ne.broadcastToChildWindows(e.data,t.origin,e.source)}}},Object.defineProperty(S,"__esModule",{value:!0}),S.detach=S.attach=void 0;var oe=g,se=!1;S.attach=function(){se||"undefined"==typeof window||(se=!0,window.addEventListener("message",oe.onmessage,!1))},S.detach=function(){se=!1,window.removeEventListener("message",oe.onmessage,!1)};var re=S,ae=new(B().Framebus);re.attach();var le=D(ae);const de={INITIALIZE_CLIENT:"%s1 - Initializing skyflow client.",CLIENT_INITIALIZED:"%s1 - Initialized skyflow client successfully.",CREATE_COLLECT_CONTAINER:"%s1 - Creating Collect container.",COLLECT_CONTAINER_CREATED:"%s1 - Created Collect container successfully.",CREATE_REVEAL_CONTAINER:"%s1 - Creating Reveal container.",REVEAL_CONTAINER_CREATED:"%s1 - Created Reveal container successfully.",VALIDATE_RECORDS:"%s1 - Validating insert records.",VALIDATE_DETOKENIZE_INPUT:"%s1 - Validating detokenize input.",VALIDATE_GET_INPUT:"%s1 - Validating get input.",VALIDATE_DELETE_INPUT:"%s1 - Validating delete input.",VALIDATE_COLLECT_RECORDS:"%s1 - Validating collect element input.",VALIDATE_REVEAL_RECORDS:"%s1 - Validating reveal element input.",VALIDATE_RENDER_RECORDS:"%s1 - Validating file render element input.",CREATED_ELEMENT:"%s1 - Created %s2 element.",ELEMENT_MOUNTED:"%s1 - %s2 Element mounted.",ELEMENT_REVEALED:"%s1 - %s2 Element revealed.",FILE_RENDERED:"%s1 - %s2 File rendered.",COLLECT_SUBMIT_SUCCESS:"%s1 - Data has been collected successfully.",REVEAL_SUBMIT_SUCCESS:"%s1 - Data has been revealed successfully.",RENDER_SUBMIT_SUCCESS:"%s1 - File download URL has been fetched successfully.",INSERT_DATA_SUCCESS:"%s1 - Data has been inserted successfully.",DETOKENIZE_SUCCESS:"%s1 - Data has been revealed successfully.",GET_SUCCESS:"%s1 - Data has been revealed successfully.",DELETE_SUCCESS:"%s1 - Data has been deleted successfully.",BEARER_TOKEN_LISTENER:"%s1 - Get bearer token listener added.",CAPTURED_BEARER_TOKEN_EVENT:"%s1 - Captured bearer token event.",BEARER_TOKEN_RESOLVED:"%s1 - GetBearerToken promise resolved successfully.",REUSE_BEARER_TOKEN:"%s1 - Reusing the bearer token.",PUREJS_CONTROLLER_INITIALIZED:"%s1 - SkyflowController initialized.",PUREJS_LISTENER_READY:"%s1 - Purejs listener ready.",EMIT_PURE_JS_CONTROLLER:"%s1 - Emitted Skyflow controller event.",INSERT_TRIGGERED:"%s1 - Insert method triggered.",DETOKENIZE_TRIGGERED:"%s1 - Detokenize method triggered.",GET_TRIGGERED:"%s1 - Get method triggered.",GET_BY_ID_TRIGGERED:"%s1 - Get method triggered.",DELETE_TRIGGERED:"%s1 - Delete method triggered.",EMIT_PURE_JS_REQUEST:"%s1 - Emitted %s2 request.",CAPTURE_PURE_JS_REQUEST:"%s1 - Captured %s2 event.",LISTEN_PURE_JS_REQUEST:"%s1 - Listening to %s2 event.",CAPTURE_PUREJS_FRAME:"%s1 - Captured SkyflowController frame ready event.",FETCH_RECORDS_RESOLVED:"%s1 - Detokenize request is resolved.",INSERT_RECORDS_RESOLVED:"%s1 - Insert request is resolved.",GET_RESOLVED:"%s1 - Get request is resolved.",GET_BY_SKYFLOWID_RESOLVED:"%s1 - GetById request is resolved.",DELETE_RESOLVED:"%s1 - Delete request is resolved",EMIT_EVENT:"%s1 - %s2 event emitted",CAPTURE_EVENT:"%s1 - Captured event %s2",LISTEN_COLLECT_FRAME_READY:"%s1 - Listening to collect FRAME_READY event",EMIT_COLLECT_ELEMENT_FRAME_READY:"%s1 - Emitting collect element %s2 FRAME_READY event",ENTERED_COLLECT_FRAME_READY_CB:"%s1 - In IFrameForm constructor, Entered FRAME_READY callback",EXECUTE_COLLECT_ELEMENT_FRAME_READY_CB:"%s1 - In IFrameForm, executing collect element, %s2 FRAME_READY callback",CLIENT_METADATA_NOT_SET:"%s1 - Client metadata not set",EXECUTE_COLLECT_ELEMENT_INIT:"%s1 - calling Collect element init",INSIDE__COLLECT_ELEMENT_INIT:"%s1 - Inside Collect element init for %s2",CREATING_COLLECT_ELEMENT_FORM:"%s1 - Start, creating iframe form for %s2",COLLECT_FRAME_READY_CB:"%s1 - In FrameElements, executing collect element FRAME_READY cb for %s2, sending metadata",INSIDE_FRAME_ELEMENTS_CONSTRUCOTR:"%s1 - Inside FrameElements constructor",SETUP_IN_START:"%s1 - Inside FrameElements start(), calling setup",SETUP_IN_CONSTRUCTOR:"%s1 - Inside FrameElements constructor, calling setup",COLLECT_ELEMET_START:"%s1 - %s2, Collect Element start",COLLECT_CONTROLLER_START:"%s1 - %s2, Collect Controller start",REVEAL_ELEMENT_START:"%s1 - %s2, Reveal Element start",EMIT_COLLECT_FRAME_CONTROLLER_EVENT:"%s1 - Emit collect FrameController FRAME_READY event",EXECUTE_COLLECT_CONTROLLER_READY_CB:"%s1 - Executing collect FrameController FRAME_READY callback, set client metadata",IFRAMEFORM_CONSTRUCTOR_FRAME_READY_LISTNER:"%s1 - In IFrameForm constructor, Adding listner for FRAME_READY event",IFRAMEFORM_CONSTRUCTOR_TOKENIZATION_LISTNER:"%s1 - In IFrameForm constructor, Adding listner for TOKENIZATION_REQUEST event",CURRENT_ENV:"%s1 - Client Env is %s2",CURRENT_LOG_LEVEL:"%s1 - Client LogLevel is %s2",VALIDATE_GET_BY_ID_INPUT:"%s1 - Validating getByID input."},ce={CLIENT_CONNECTION:"Interface: collect container - client connection not established. client info has not reached iframes",INVALID_BEARER_TOKEN:"Interface: init - Invalid token is generated from getBearerToken callback",BEARER_TOKEN_REJECTED:"Interface: init - GetBearerToken promise got rejected.",VAULTID_IS_REQUIRED:"Interface: init - Invalid client credentials. vaultID is required.",EMPTY_VAULTID_IN_INIT:"Interface: init - Invalid client credentials. vaultID cannot be empty.",VAULTURL_IS_REQUIRED:"Interface: init - Invalid client credentials. vaultURL is required.",EMPTY_VAULTURL_IN_INIT:"Interface: init - Invalid client credentials. vaultURL cannot be empty.",INVALID_VAULTURL_IN_INIT:"Interface: init - Invalid client credentials. Expecting https://XYZ for vaultURL",GET_BEARER_TOKEN_IS_REQUIRED:"Interface: init - Invalid client credentials. getBearerToken is required.",EMPTY_CONTAINER_TYPE:"Interface: client {containerType} container - Invalid container type. Container object cannot be empty.",INVALID_CONTAINER_TYPE:"Interface: client {containerType} container - Invalid container type. Invalid container object.",INVALID_COLLECT_VALUE:"Invalid value",INVALID_COLLECT_VALUE_WITH_LABEL:"Invalid %s1",REQUIRED_COLLECT_VALUE:"%s1 is required",DEFAULT_REQUIRED_COLLECT_VALUE:"Field is required",RECORDS_KEY_NOT_FOUND:"Interface: client insert - records object is required.",INVALID_RECORDS_IN_INSERT:"Interface: client insert - Invalid records. records object should be an array.",EMPTY_RECORDS_IN_INSERT:"Interface: client insert - records array cannot be empty.",MISSING_TABLE_IN_INSERT:'Interface: client insert - "table" key is required in records array at index %s1',EMPTY_TABLE_IN_INSERT:"Interface: client insert - table cannot be empty in records array at index %s1",INVALID_TABLE_IN_INSERT:"Interface: client insert - table of type string is required at index %s1 in records array.",EMPTY_FIELDS_IN_INSERT:"Interface: client insert - fields cannot be empty in records array at index %s1",MISSING_FIELDS_IN_INSERT:'Interface: client insert - "fields" key is required in records array at index %s1',INVALID_FIELDS_IN_INSERT:"Interface: client insert - fields of type object is required at index %s1 in records array.",INVALID_TOKENS_IN_INSERT:"Interface: client insert - Invalid tokens in options. tokens of type boolean is required.",RECORDS_KEY_NOT_FOUND_DELETE:"Interface: client delete - records object is required.",INVALID_RECORDS_IN_DELETE:"Interface: client delete - Invalid records. records object should be an array.",EMPTY_RECORDS_IN_DELETE:"Interface: client delete - records array cannot be empty.",MISSING_TABLE_IN_DELETE:'Interface: client delete - "table" key is required in records array at index %s1',EMPTY_TABLE_IN_DELETE:"Interface: client delete - table cannot be empty in records array at index %s1",INVALID_TABLE_IN_DELETE:"Interface: client delete - table of type string is required at index %s1 in records array.",MISSING_ID_IN_DELETE:'Interface: client delete - "id" key is required in records array at index %s1',EMPTY_ID_IN_DELETE:"Interface: client delete - id cannot be empty in records array at index %s1",INVALID_ID_IN_DELETE:"Interface: client delete - id of type string is required at index %s1 in records array.",DELETE_RECORDS_REJECTED:"Interface: client delete - delete request is rejected.",INVALID_TOKENS_IN_COLLECT:"Interface: collect container - Invalid tokens. tokens of type boolean is required.",RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS:'Interface: collect container - "records" key not found in additionalFields',INVALID_RECORDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - records should be an array inside additionalFields",EMPTY_RECORDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - records object cannot be empty in additionalFields",MISSING_TABLE_IN_ADDITIONAL_FIELDS:'Interface: collect container - "table" key not found in additionalFields records at index %s1',INVALID_TABLE_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid table name in additionalFields records at index %s1",INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid skyflow id in additionalFields records at index %s1",MISSING_FIELDS_IN_ADDITIONAL_FIELDS:'Interface: collect container - "fields" key not found in additionalFields records at index %s1',INVALID_FIELDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - Provide valid fields in additionalFields records at index %s1",RECORDS_KEY_NOT_FOUND_DETOKENIZE:"Interface: client detokenize - records object is required.",EMPTY_RECORDS_DETOKENIZE:"Interface: client detokenize - records array cannot be empty.",INVALID_RECORDS_IN_DETOKENIZE:"Interface: client detokenize - Invalid records. records object should be an array.",MISSING_TOKEN_IN_DETOKENIZE:'Interface: client detokenize - "token" key is required in records array at index %s1 ',INVALID_TOKEN_IN_DETOKENIZE:"Interface: client detokenize - Invalid token. token of type string is required at index %s1 in records array.",RECORDS_KEY_NOT_FOUND_GET:"Interface: client get - records object is required.",INVALID_RECORDS_IN_GET:"Interface: client get - Invalid records. records object should be an array.",EMPTY_RECORDS_GET:"Interface: client get - records array cannot be empty.",MISSING_IDS_IN_GET:'Interface: client get - "ids" key is required in records array at index %s1',INVALID_IDS_IN_GET:"Interface: client get - Invalid ids. ids object should be an array.",INVALID_COLUMN_VALUES_IN_GET:"Interface: client get - Invalid column values. column values object should be an array.",EMPTY_IDS_IN_GET:"Interface: client get - ids array cannot be empty at index %s1",INVALID_SKYFLOWID_TYPE_IN_GET:"Interface: client get - Invalid skyflowId in ids array at index %s1",MISSING_TABLE_IN_GET:'Interface: client get - "table" key is required in records array at index %s1',INVALID_TABLE_IN_GET:"Interface: client get - table of type string is required at index %s1 in records array.",MISSING_REDACTION_IN_GET:'Interface: client get - "redaction" key is required in records array at index %s1',INVALID_REDACTION_TYPE_IN_GET:"Interface: client get - Invalid redaction type in records array at index %s1",INVALID_TOKENS_IN_GET:"Interface: client get - Invalid tokens in options. tokens of type boolean is required.",TOKENS_GET_COLUMN_NOT_SUPPORTED:"Interface: client get - column_name or column_values cannot be used with tokens in options.",REDACTION_WITH_TOKENS_NOT_SUPPORTED:"Interface: client get - redaction cannot be used when tokens are true in options.",INVALID_REDACTION_TYPE_IN_DETOKENIZE:"Interface: client get - Invalid redaction type in records array at index %s1",EMPTY_RECORDS_REVEAL:"Interface: reveal container - cannot invoke reveal method before creating reveal elements",MISSING_TOKEN_KEY_REVEAL:"Interface: RevealElement - token key is required ",MISSING_SKYFLOWID_KEY_REVEAL:"Interface: FileRenderElement - skyflowID key is required ",MISSING_TABLE_KEY_REVEAL:"Interface: FileRenderElement - table key is required ",MISSING_COLUMN_KEY_REVEAL:"Interface: FileRenderElement - column key is required ",INVALID_SKYFLOW_ID_REVEAL:"Interface: FileRenderElement - skyflowID is invalid. skyflowID of type string is required",INVALID_TABLE_REVEAL:"Interface: FileRenderElement - table is invalid. table of type string is required",INVALID_COLUMN_NAME_REVEAL:"Interface: FileRenderElement - column name is invalid. column of type string is required",EMPTY_SKYFLOW_ID_REVEAL:"Interface: FileRenderElement - skyflowID is empty.",EMPTY_TABLE_REVEAL:"Interface: FileRenderElement - table is empty.",EMPTY_COLUMN_NAME_REVEAL:"Interface: FIleRenderElement - column is empty.",INVALID_TOKEN_ID_REVEAL:"Interface: RevealElement - token is invalid. token of type string is required",INVALID_LABEL_REVEAL:"Interface: RevealElement - label is invalid.",INVALID_ALT_TEXT_REVEAL:"Interface: RevealElement - Invalid altText.",INVALID_ALT_TEXT_RENDER:"Interface: RevealElement - Invalid altText.",INVALID_FORMAT_REVEAL:"Interface: RevealElement - Invalid format type.",EMPTY_FORMAT_REVEAL:"Interface: RevealElement - Empty format value provided.",INVALID_FORMAT_VALUE_REVEAL:"Interface: RevealElement - Invalid format value provided.",INVALID_REDACTION_TYPE_REVEAL:"Interface: RevealElement - Invalid Redaction type.",ELEMENTS_NOT_MOUNTED_REVEAL:"Interface: reveal container - Cannot invoke reveal before mounting the elements",ELEMENT_NOT_MOUNTED_RENDER:"Interface: render container - Cannot invoke renderFile before mounting the elements",EMPTY_TABLE_IN_ADDITIONAL_FIELDS:"Interface: collect container - table cannot be empty in additionalFields at index %s1",EMPTY_FIELDS_IN_ADDITIONAL_FIELDS:"Interface: collect container - fields cannot be empty in additionalFields at index %s1",EMPTY_TOKEN_IN_DETOKENIZE:"Interface: client detokenize - token cannot be empty in records array at index %s1",EMPTY_SKYFLOWID_IN_GET:"Interface: client get - id cannot be empty in records array at index %s1",EMPTY_TABLE_IN_GET:"Interface: client get - table cannot be empty in records array at index %s1",EMPTY_REDACTION_TYPE_IN_GET:"Interface: client get - redaction cannot be empty in records array at index %s1",EMPTY_TOKEN_ID_REVEAL:"Interface: RevealElement - token cannot be empty",FETCH_RECORDS_REJECTED:"Interface: client detokenize - detokenize request is rejected.",INSERT_RECORDS_REJECTED:"Interface: client insert - insert request is rejected.",GET_REJECTED:"Interface: client get - get request is rejected.",FAILED_REVEAL:"Interface: reveal container - Failed to reveal data",FAILED_RENDER:"Interface: reveal container - Failed to render file",SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED:"Interface: FileRenderElement: skyflowID and token can not be specified together.",MISSING_TABLE_IN_COLLECT:'Interface: collect element - "table" key is required.',EMPTY_TABLE_IN_COLLECT:"Interface: collect element - table cannot be empty.",EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:"Interface: collect element - id cannot be empty.",INVALID_TABLE_IN_COLLECT:"Interface: collect element - Invalid table. table of type string is required",INVALID_SKYFLOWID_IN_COLLECT:"Interface: collect element - Invalid id. id of type string is required",MISSING_COLUMN_IN_COLLECT:'Interface: collect element - "column" key is required.',MISSING_SKYFLOWID_IN_COLLECT:'Interface: collect element - "skyflowID" key is required in file type element',EMPTY_COLUMN_IN_COLLECT:"Interface: collect element - column cannot be empty.",INVALID_COLUMN_IN_COLLECT:"Interface: collect element - Invalid column. column of type string is required",UNIQUE_ELEMENT_NAME:"The element name has to unique: %s1",ELEMENTS_NOT_MOUNTED:"Interface: collect container - Elements should be mounted before invoking collect",DUPLICATE_ELEMENT:"Interface: collect container - Duplicate column %s1 found in %s2.",DUPLICATE_ELEMENT_ADDITIONAL_FIELDS:"Interface: collect container - Duplicate column %s1 found in %s2 in additional fields",MISSING_ELEMENT_TYPE:'Interface:container element with type {TYPE} - Invalid element type. "type" key is required.',EMPTY_ELEMENT_TYPE:"Interface:container element with type {TYPE} - Invalid element type. type cannot be empty.",INVALID_ELEMENT_TYPE:"Interface:container element with type {TYPE} - invalid element type. type not found",INVALID_ELEMENT_SELECTOR:"Interface: container element with type {TYPE} - Div cannot be found.",CANNOT_CHANGE_ELEMENT:"Element can't be changed.",INVALID_IFRAME:"Error occured while creating an iframe",INVALID_FIELD:"Invalid Field.",FRAME_NOT_FOUND:"Interface: collect element - %s1 frame not found:",COMPLETE_AND_VALID_INPUTS:"Interface: collect container - Provide complete and valid inputs for %s1",REQUIRED_PARAMS_NOT_PROVIDED:"Interface: collect element - Required params are not provided.",INVALID_EVENT_TYPE:"Interface: collect element - Provide a valid event type.",INVALID_EVENT_LISTENER:'Interface: "on" on CollectElement - Provide valid event listener.',MISSING_HANDLER_IN_EVENT_LISTENER:'Interface: "on" on CollectElement - Second argument is missing. handler cannot be empty.',INVALID_HANDLER_IN_EVENT_LISTENER:'Interface: "on" on CollectElement - Invalid handler. handler should be of type function.',UNKNOWN_ERROR:"Unknown Error.",NETWORK_ERROR:"A network error occurred. This could be a CORS issue or a dropped internet connection. It is not possible for us to know. Please reach out to skyflow if you see this error",CONNECTION_ERROR:"Error while initializing the connection.",ERROR_OCCURED:"Error occurred.",INVALID_VALIDATIONS_TYPE:"Interface: collect element - Invalid validations type.",MISSING_VALIDATION_RULE_TYPE:"Interface: collect element - Type is missing in validationRule at index %s1 in validations array",INVALID_VALIDATION_RULE_TYPE:"Interface: collect element - Invalid ValidationRuleType at index %s1 in validations array",MISSING_VALIDATION_RULE_PARAMS:"Interface: collect element - params are missing in validationRule at index %s1 in validations array",INVALID_VALIDATION_RULE_PARAMS:"Interface: collect element - Invalid ValidationRule params at index %s1 in validations array",MISSING_REGEX_IN_REGEX_MATCH_RULE:"Interface: collect element - Missing regex in ValidationRule params at index %s1 in validations array",INVALID_REGEX_IN_REGEX_MATCH_RULE:"Interface: collect element - Invalid regex in ValidationRule params at index %s1 in validations array",MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE:"Interface: collect element - Either min or max is required in ValidationRule params at index %s1 in validations array",MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE:"Interface: collect element - Missing element in ValidationRule params at index %s1 in validations array",INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE:"Interface: collect element - Invalid collect element in ValidationRule params at index %s1 in validations array",ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE:"Interface: collect element - collect element is not mounted in ValidationRule params at index %s1 in validations array",EMPTY_ELEMENT_IN_MOUNT:"Interface: mount element with type %s1 - Mount cannot be empty.",VALIDATION_FAILED:"Validation failed",REVEAL_ELEMENT_ERROR_STATE:"unable to reveal, since one or more element(s) have setError",INVALID_FILE_TYPE:"Interface: collect element - Invalid File Type",INVALID_FILE_SIZE:"Interface: collect element - Invalid File Size",NO_FILE_SELECTED:"Interface: collect element - No File Selected",INVALID_UPSERT_OPTION_TYPE:"Invalid upsert option, should be an array",EMPTY_UPSERT_OPTIONS_ARRAY:"upsert option cannot be an empty array, atleast one object of table and column is required.",INVALID_UPSERT_OPTION_OBJECT_TYPE:"Invalid upsert object at index %s1, an object of table and column is required.",MISSING_TABLE_IN_UPSERT_OPTION:'"table" key is required in upsert options object at index %s1',MISSING_COLUMN_IN_UPSERT_OPTION:'"column" key is required in upsert option at index %s1',INVALID_TABLE_IN_UPSERT_OPTION:"Invalid table in upsert object at index %s1, table of type non empty string is required",INVALID_COLUMN_IN_UPSERT_OPTION:"Invalid column in upsert object at index %s1, column of type non empty string is required",INVALID_RECORD_COLUMN_VALUE:"Invalid Record Column value.",MISSING_RECORD_COLUMN_VALUE:"Column Values is required when Column Name is specified.",MISSING_RECORD_COLUMN_NAME:"Column Name is required when Column Values are specified.",INVALID_RECORD_COLUMN_VALUE_TYPE:"Invalid Type of Records Column Values.",INVALID_COLUMN_VALUES_TYPE:"Invalid column values type, should be an Array.",EMPTY_RECORD_COLUMN_VALUES:"Record column values cannot be empty.",EMPTY_COLUMN_VALUE:"Column Value is empty.",MISSING_IDS_OR_COLUMN_VALUES_IN_GET:'Interface: client get - "ids" key or "columnValues" key is missing.',SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED:"ids and columnName can not be specified together.",GET_BY_SKYFLOWID_RESOLVED:"%s1 - GetById request is resolved.",RECORDS_KEY_NOT_FOUND_GETBYID:"Interface: client getById - records object is required.",INVALID_RECORDS_IN_GETBYID:"Interface: client getById - Invalid records. records object should be an array.",EMPTY_RECORDS_GETBYID:"Interface: client getById - records array cannot be empty.",MISSING_IDS_IN_GETBYID:'Interface: client getById - "ids" key is required in records array at index %s1',INVALID_IDS_IN_GETBYID:"Interface: client getById - Invalid ids. ids object should be an array.",EMPTY_IDS_IN_GETBYID:"Interface: client getById - ids array cannot be empty at index %s1",INVALID_SKYFLOWID_TYPE_IN_GETBYID:"Interface: client getById - Invalid skyflowId in ids array at index %s1",MISSING_TABLE_IN_GETBYID:'Interface: client getById - "table" key is required in records array at index %s1',INVALID_TABLE_IN_GETBYID:"Interface: client getById - table of type string is required at index %s1 in records array.",MISSING_REDACTION_IN_GETBYID:'Interface: client getById - "redaction" key is required in records array at index %s1',INVALID_REDACTION_TYPE_IN_GETBYID:"Interface: client getById - Invalid redaction type in records array at index %s1",EMPTY_SKYFLOWID_IN_GETBYID:"Interface: client getById - id cannot be empty in records array at index %s1",EMPTY_TABLE_IN_GETBYID:"Interface: client getById - table cannot be empty in records array at index %s1",EMPTY_REDACTION_TYPE_IN_GETBYID:"Interface: client getById - redaction cannot be empty in records array at index %s1",GET_BY_SKYFLOWID_REJECTED:"Interface: client getById - getById request is rejected.",MISSING_COMPOSABLE_LAYOUT_KEY:"Interface: client container - layout is required in composable container options.",EMPTY_COMPOSABLE_LAYOUT_ARRAY:"Interface: client container - layout array cannot be empty in composable container options.",INVALID_COMPOSABLE_LAYOUT_TYPE:"Interface: client container - invalid layout value, layout should be of type array of numbers in composable container options.",NEGATIVE_VALUES_COMPOSABLE_LAYOUT:"Interface: client container - layout array should only have postive numbers in composable container options.",MISMATCH_ELEMENT_COUNT_LAYOUT_SUM:"Interface: composable container mount - created elements count should be equal to sum of layout values.",MISSING_COMPOSABLE_CONTAINER_OPTIONS:"Interface: client composable container - options object is required for composable container.",INVALID_COMPOSABLE_CONTAINER_OPTIONS:"Interface: client composable container - invalid options value, should be an object type.",COMPOSABLE_CONTAINER_NOT_MOUNTED:"Interface: composable collect - container should be mounted before invoking collect.",INVALID_BOOLEAN_OPTIONS:"Interface: container create - Invaild %s1 in options, %s1 of type boolean is required.",INVALID_INPUT_OPTIONS_FORMAT:"Interface: container create - Invalid type, format must be of non-empty string type.",INVALID_INPUT_OPTIONS_TRANSLATION:"Interface: container create - Invalid type, translation must be of non-empty object type.",EMPTY_COLLECT_CUSTOM_FORMAT:"Interface: container create - %s1 cannot be empty object.",INVALID_ALLOWED_OPTIONS:"Interface: collect element - Invalid options, allowedFileType must be of string array type.",EMPTY_ALLOWED_OPTIONS_ARRAY:"Interface: collect element - Invalid options value, allowedFileType array is empty.",INVALID_ALLOWED_FILETYPE_ARRAY:"Interface: collect element - Invalid options value, allowedFileType array must contain only string elements."},Ee={INVALID_EXPIRATION_DATE_FORMAT:"EXPIRATION_DATE format must be in one of %s1, the format is set to default MM/YY",INVALID_EXPIRATION_YEAR_FORMAT:"EXPIRATION_YEAR format must be in one of %s1, the format is set to default YY",UNABLE_TO_SET_VALUE_IN_PROD_ENV:"%s1 setValue() cannot invoked while in PROD env. It is Not Recommeded",UNABLE_TO_CLEAR_VALUE_IN_PROD_ENV:"%s1 clearValue() cannot invoked while in PROD env. It is Not Recommeded",COLLECT_ALT_TEXT_DEPERECATED:"altText is DEPERECATED, passing altText will not have any effect",GET_BY_ID_DEPRECATED:"getById is deprecated, use new get method",INPUT_FORMATTING_NOT_SUPPROTED:"format or translation are not supported on %s1 element type.",INVALID_INPUT_TRANSLATION:"invalid or unsupported translation provided for %s1 element type."},_e="collect_controller",Ie="reveal_controller",he="element",ue="INSERT",pe="DETOKENIZE",fe="GET_BY_SKYFLOWID",Ne="GET",Te="DELETE",Le={CHANGE:"CHANGE",READY:"READY",FOCUS:"FOCUS",BLUR:"BLUR",ESCAPE:"ESCAPE",CLICK:"CLICK",ERROR:"ERROR",SUCCESS:"SUCCESS",SUBMIT:"SUBMIT",CREATED:"CREATED",MOUNTED:"MOUNTED",HEIGHT:"HEIGHT"},Oe="FRAME_READY",ve="TOKENIZATION_REQUEST",Ae="INPUT_EVENT",me="DESTROY FRAME",Re="SET_VALUE",ye="REVEAL_REQUEST",De="REVEAL_FRAME_READY",Se="PUREJS_REQUEST",ge="PUREJS_FRAME_READY",Ce="GET_BEARER_TOKEN",be="COLLECT_ELEMENT_SET_ERROR",we="REVEAL_ELEMENT_SET_ERROR",Me="REVEAL_ELEMENT_UPDATE_OPTIONS",Pe="FILE_UPLOAD",Ve="COMPOSABLE_UPDATE_OPTIONS",Ue="RENDER_FILE_REQUEST",ke="TOKEN",Ye="ALT_TEXT",Fe="ELEMENT_MOUNTED",xe="ALL_ELEMENTS_MOUNTED",Ge="COMPOSABLE_CONTAINER_MOUNTED",Be="COLLECT_CONTAINER_MOUNTED",je="REVEAL_CONTAINER_MOUNTED";var Xe,Ke;!function(e){e.CVV="CVV",e.EXPIRATION_DATE="EXPIRATION_DATE",e.CARD_NUMBER="CARD_NUMBER",e.CARDHOLDER_NAME="CARDHOLDER_NAME",e.INPUT_FIELD="INPUT_FIELD",e.PIN="PIN",e.EXPIRATION_MONTH="EXPIRATION_MONTH",e.EXPIRATION_YEAR="EXPIRATION_YEAR",e.FILE_INPUT="FILE_INPUT"}(Xe||(Xe={})),function(e){e.VISA="VISA",e.MASTERCARD="MASTERCARD",e.AMEX="AMEX",e.DINERS_CLUB="DINERS_CLUB",e.DISCOVER="DISCOVER",e.JCB="JCB",e.MAESTRO="MAESTRO",e.UNIONPAY="UNIONPAY",e.HIPERCARD="HIPERCARD",e.DEFAULT="DEFAULT",e.UNKNOWN="UNKNOWN"}(Ke||(Ke={}));const We={[Ke.AMEX]:["XXXX XXXXXX XXXXX",{X:"[0-9]"}],[Ke.VISA]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[Ke.MASTERCARD]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[Ke.DISCOVER]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.DINERS_CLUB]:["XXXX XXXXXX XXXXXX",{X:"[0-9]"}],[Ke.JCB]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.MAESTRO]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.UNIONPAY]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.HIPERCARD]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.DEFAULT]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[Ke.UNKNOWN]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}]},$e={textarea:{name:"textarea",attributes:{type:"textarea"},sensitive:!1},checkbox:{name:"checkbox",attributes:{type:"checkbox"},sensitive:!1},radio:{name:"radio",attributes:{type:"radio"},sensitive:!1},dropdown:{name:"dropdown",attributes:{type:"select"},sensitive:!1},[Xe.CARDHOLDER_NAME]:{name:"cardHolderName",attributes:{type:"text",autocomplete:"cc-name"},sensitive:!0,regex:/^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/},[Xe.CARD_NUMBER]:{name:"CARD_NUMBER",attributes:{type:"text",autocomplete:"cc-number",inputmode:"numeric"},sensitive:!0,mask:We[Ke.DEFAULT],regex:/$|^[\s]*?([0-9]{2,6}[ -]?){3,5}[\s]*/},[Xe.EXPIRATION_DATE]:{name:"EXPIRATION_DATE",attributes:{type:"text",autocomplete:"cc-exp",inputmode:"numeric"},sensitive:!0},[Xe.EXPIRATION_MONTH]:{name:"EXPIRATION_MONTH",attributes:{maxLength:2,type:"text",inputmode:"numeric",autocomplete:"cc-exp-month"},sensitive:!0,mask:["XX",{X:"[0-9]"}]},[Xe.EXPIRATION_YEAR]:{name:"EXPIRATION_YEAR",attributes:{type:"text",inputmode:"numeric",autocomplete:"cc-exp-year"},sensitive:!0},[Xe.CVV]:{name:"CVV",attributes:{type:"text",inputmode:"numeric",maxLength:4},sensitive:!0,regex:/^$|^[0-9]{3,4}$/},[Xe.INPUT_FIELD]:{name:"INPUT_FIELD",sensitive:!0,attributes:{type:"text"}},[Xe.PIN]:{name:"PIN",attributes:{type:"text",inputmode:"numeric",maxLength:12,minLength:4},sensitive:!0,regex:/^$|^[0-9]{4,12}$/},[Xe.FILE_INPUT]:{name:"FILE_INPUT",sensitive:!0,attributes:{type:"file"}}},He="XXXX-XXXX-XXXX-XXXX",ze={height:"100%",width:"100%",margin:0,padding:0,border:0,position:"absolute",top:0,left:0,"user-select":"none"},qe={position:"absolute",top:0,width:0,height:0,visibility:"hidden",left:"-99999999px","user-select":"none"},Je={width:"100%",height:"100%",border:"0",padding:"0",margin:"0",outline:"none"},Ze={WEBPACKAUTOFILL:"-webkit-autofill",BASE:"base",FOCUS:"focus",COMPLETE:"complete",EMPTY:"empty",INVALID:"invalid",GLOBAL:"global",REQUIRED_ASTERISK:"requiredAsterisk"};Ze.BASE,Ze.BASE,Ze.BASE,Ze.BASE,Ze.REQUIRED_ASTERISK;const Qe={[Ke.VISA]:{regex:/^4\d*/,maxCardLength:19,cardLengthRange:[13,16]},[Ke.MASTERCARD]:{regex:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,maxCardLength:16,cardLengthRange:[16]},[Ke.AMEX]:{regex:/^3[47]\d*/,maxCardLength:15,cardLengthRange:[15]},[Ke.DINERS_CLUB]:{regex:/^(36|38|30[0-5])\d*/,maxCardLength:16,cardLengthRange:[14,15,16,17,18,19]},[Ke.DISCOVER]:{regex:/^(6011|65|64[4-9]|622)\d*/,maxCardLength:16,cardLengthRange:[16,17,18,19]},[Ke.JCB]:{regex:/^35\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[Ke.HIPERCARD]:{regex:/^606282\d*/,maxCardLength:19,cardLengthRange:[14,15,16,17,18,19]},[Ke.UNIONPAY]:{regex:/^62\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[Ke.MAESTRO]:{regex:/^(5018|5020|5038|5043|5[6-9]|6020|6304|6703|6759|676[1-3])\d*/,maxCardLength:19,cardLengthRange:[12,13,14,15,16,17,18,19]}};Ke.DEFAULT,Ke.AMEX,Ke.DINERS_CLUB,Ke.DISCOVER,Ke.HIPERCARD,Ke.JCB,Ke.MAESTRO,Ke.MASTERCARD,Ke.UNIONPAY,Ke.VISA;const et="MM/YY",tt=[et,"YYYY/MM","YY/MM","MM/YYYY"],it=["YY","YYYY"];var nt;!function(e){e.APPLICATIONORJSON="application/json",e.TEXTORPLAIN="text/plain",e.TEXTORXML="text/xml",e.FORMURLENCODED="application/x-www-form-urlencoded",e.FORMDATA="multipart/form-data"}(nt||(nt={})),Xe.CARD_NUMBER,Xe.EXPIRATION_DATE,Xe.EXPIRATION_MONTH,Xe.EXPIRATION_YEAR,Xe.CVV,Xe.EXPIRATION_DATE,Xe.CARD_NUMBER,Xe.CARDHOLDER_NAME,Xe.INPUT_FIELD,ce.INVALID_COLLECT_VALUE,Xe.PIN,Xe.EXPIRATION_MONTH,Xe.EXPIRATION_YEAR,Xe.FILE_INPUT,ce.INVALID_COLLECT_VALUE,Xe.CVV,Xe.EXPIRATION_DATE,Xe.CARD_NUMBER,Xe.CARDHOLDER_NAME,Xe.INPUT_FIELD,ce.DEFAULT_REQUIRED_COLLECT_VALUE,Xe.PIN,Xe.EXPIRATION_MONTH,Xe.EXPIRATION_YEAR,Xe.FILE_INPUT,ce.DEFAULT_REQUIRED_COLLECT_VALUE;const ot=[Xe.CARDHOLDER_NAME,Xe.EXPIRATION_MONTH,Xe.FILE_INPUT,Xe.PIN,Xe.CVV],st={X:"[0-9]"};class rt{constructor(){this.events={}}on(e,t,i=!1){this.events[e]?this.events[e].push({priority:i,callback:t}):this.events[e]=[{priority:i,callback:t}]}off(e,t){const i=this.events[e];if(!i)return;const n=i.findIndex((e=>e.callback===t));i.splice(n,1)}_emit(e,...t){const i=this.events[e];i&&i.forEach((e=>{e.callback(...t)}))}hasListener(e){const t=this.events[e];return!!t&&t.length>0}resetEvents(){const e={};Object.keys(this.events).forEach((t=>{const i=this.events[t];if(i&&i.length>0){const n=[];i.forEach((e=>{e.priority&&n.push(e)})),e[t]=n}})),this.events=e}static createChild(e){e.prototype=Object.create(rt.prototype,{constructor:e})}}
2
2
  /* @copyright
3
3
  Copyright (c) 2022 Skyflow, Inc.
4
- */const ot={IFRAME_SECURE_SITE:"https://js.skyflow.com/v1/elements/index.html",IFRAME_SECURE_ORGIN:"https://js.skyflow.com"},st={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no",style:"width: 100%;",allow:"clipboard-read; clipboard-write"},rt=(e,t)=>{Object.keys(t).forEach((i=>{if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];null==n?e.removeAttribute(i):e.setAttribute(i,n)}}))};var at=(e={})=>{const t=document.createElement("iframe"),i=Object.assign(Object.assign({},st),e);return Object.assign(t.style,We),rt(t,i),t.getAttribute("id")||(t.id=t.name),t};const lt=()=>ot.IFRAME_SECURE_SITE,dt=(e,t)=>{Object.keys(t).forEach((i=>{Object.prototype.hasOwnProperty.call(t,i)&&(e.style[i]=t[i])}))};function ct(e){return JSON.parse(JSON.stringify(e))}class Et{constructor(){this.listeners=[],this.isDestroyed=!1}on(e,t){se.on(e,t),this.listeners.push({eventName:e,callback:t})}off(e,t){se.off(e,t);const i=this.listeners.findIndex((t=>t.eventName===e));-1!==i&&this.listeners.splice(i,1)}emit(e,t,i=void 0){se.emit(e,t,i)}hasListener(e){return-1!==this.listeners.findIndex((t=>t.eventName===e))}teardown(){this.listeners.forEach((e=>{se.off(e.eventName,e.handler)})),this.listeners=[]}}var _t,It,ht,ut,pt,ft,Nt;!function(e){e.DEFAULT="DEFAULT",e.PLAIN_TEXT="PLAIN_TEXT",e.MASKED="MASKED",e.REDACTED="REDACTED"}(_t||(_t={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(It||(It={})),function(e){e.CHANGE="CHANGE",e.READY="READY",e.FOCUS="FOCUS",e.BLUR="BLUR",e.SUBMIT="SUBMIT"}(ht||(ht={})),function(e){e.WARN="WARN",e.INFO="INFO",e.DEBUG="DEBUG",e.ERROR="ERROR"}(ut||(ut={})),function(e){e.DEV="DEV",e.PROD="PROD"}(pt||(pt={})),function(e){e.LOG="LOG",e.WARN="WARN",e.ERROR="ERROR"}(ft||(ft={})),function(e){e.REGEX_MATCH_RULE="REGEX_MATCH_RULE",e.LENGTH_MATCH_RULE="LENGTH_MATCH_RULE",e.ELEMENT_VALUE_MATCH_RULE="ELEMENT_VALUE_MATCH_RULE"}(Nt||(Nt={}));const Tt={DEBUG:{showDebugLogs:!0,showInfoLogs:!0,showWarnLogs:!0,showErrorLogs:!0},INFO:{showDebugLogs:!1,showInfoLogs:!0,showWarnLogs:!0,showErrorLogs:!0},WARN:{showDebugLogs:!1,showInfoLogs:!1,showWarnLogs:!0,showErrorLogs:!0},ERROR:{showDebugLogs:!1,showInfoLogs:!1,showWarnLogs:!1,showErrorLogs:!0}},Ot={PROD:{doesReturnValue:!1},DEV:{doesReturnValue:!0}},Lt="[Skyflow]",vt=(e,t,i)=>{if(i&&Tt[i]){const{showDebugLogs:n,showInfoLogs:o,showWarnLogs:s,showErrorLogs:r}=Tt[i];t===ft.LOG&&n?console.log(`${ut.DEBUG}: ${Lt} ${e}`):t===ft.LOG&&o?console.log(`${ut.INFO}: ${Lt} ${e}`):t===ft.WARN&&s?console.warn(`${ut.WARN}: ${Lt} ${e}`):t===ft.ERROR&&r&&console.error(`${ut.ERROR}: ${Lt} ${e}`)}},At=(...e)=>{const t=e[0],i=e.filter(((e,t)=>0!==t));return t?t.replace(/%s[0-9]+/g,(e=>{const t=e.replace("%s","")-1;return i[t]})):""},mt=(e="")=>{const t=e.split(":");if("group"===t[1])return"composable container";let i=atob(t[2]);return-1!==i.indexOf(":")&&(i=i.substring(0,i.indexOf(":"))),i};class Rt extends Error{constructor(e,t,i=!1){const n={code:e.code,description:t&&(null==t?void 0:t.length)>0?At(e.description,...t):e.description};super(n.description),i?this.error=n:this.errors=[n]}}const yt={INVALID_FIELD:{code:400,description:ae.INVALID_FIELD},VAULTID_IS_REQUIRED:{code:400,description:ae.VAULTID_IS_REQUIRED},EMPTY_VAULTID_IN_INIT:{code:400,description:ae.EMPTY_VAULTID_IN_INIT},VAULTURL_IS_REQUIRED:{code:400,description:ae.VAULTURL_IS_REQUIRED},EMPTY_VAULTURL_IN_INIT:{code:400,description:ae.EMPTY_VAULTURL_IN_INIT},INVALID_VAULTURL_IN_INIT:{code:400,description:ae.INVALID_VAULTURL_IN_INIT},GET_BEARER_TOKEN_IS_REQUIRED:{code:400,description:ae.GET_BEARER_TOKEN_IS_REQUIRED},EMPTY_CONTAINER_TYPE:{code:400,description:ae.EMPTY_CONTAINER_TYPE},INVALID_CONTAINER_TYPE:{code:400,description:ae.INVALID_CONTAINER_TYPE},UNIQUE_ELEMENT_NAME:{code:400,description:ae.UNIQUE_ELEMENT_NAME},ELEMENTS_NOT_MOUNTED:{code:400,description:ae.ELEMENTS_NOT_MOUNTED},MISSING_TABLE_IN_COLLECT:{code:400,description:ae.MISSING_TABLE_IN_COLLECT},MISSING_SKYFLOWID_KEY_REVEAL:{code:400,description:ae.MISSING_SKYFLOWID_KEY_REVEAL},EMPTY_TABLE_IN_COLLECT:{code:400,description:ae.EMPTY_TABLE_IN_COLLECT},EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:{code:400,description:ae.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS},INVALID_TABLE_IN_COLLECT:{code:400,description:ae.INVALID_TABLE_IN_COLLECT},INVALID_SKYFLOWID_IN_COLLECT:{code:400,description:ae.INVALID_SKYFLOWID_IN_COLLECT},MISSING_COLUMN_IN_COLLECT:{code:400,description:ae.MISSING_COLUMN_IN_COLLECT},MISSING_SKYFLOWID_IN_COLLECT:{code:400,description:ae.MISSING_SKYFLOWID_IN_COLLECT},EMPTY_COLUMN_IN_COLLECT:{code:400,description:ae.EMPTY_TABLE_IN_COLLECT},INVALID_COLUMN_IN_COLLECT:{code:400,description:ae.INVALID_COLUMN_IN_COLLECT},CLIENT_CONNECTION:{code:400,description:ae.CLIENT_CONNECTION},RECORDS_KEY_NOT_FOUND:{code:404,description:ae.RECORDS_KEY_NOT_FOUND},EMPTY_RECORDS_IN_INSERT:{code:400,description:ae.EMPTY_RECORDS_IN_INSERT},INVALID_RECORDS_IN_INSERT:{code:404,description:ae.INVALID_RECORDS_IN_INSERT},INVALID_TABLE_IN_INSERT:{code:400,description:ae.INVALID_TABLE_IN_INSERT},EMPTY_TABLE_IN_INSERT:{code:400,description:ae.EMPTY_TABLE_IN_INSERT},MISSING_TABLE_IN_INSERT:{code:400,description:ae.MISSING_TABLE_IN_INSERT},EMPTY_FIELDS_IN_INSERT:{code:400,description:ae.EMPTY_FIELDS_IN_INSERT},MISSING_FIELDS_IN_INSERT:{code:404,description:ae.MISSING_FIELDS_IN_INSERT},INVALID_FIELDS_IN_INSERT:{code:404,description:ae.INVALID_FIELDS_IN_INSERT},INVALID_TOKENS_IN_INSERT:{code:404,description:ae.INVALID_TOKENS_IN_INSERT},RECORDS_KEY_NOT_FOUND_DETOKENIZE:{code:404,description:ae.RECORDS_KEY_NOT_FOUND_DETOKENIZE},EMPTY_RECORDS_DETOKENIZE:{code:400,description:ae.EMPTY_RECORDS_DETOKENIZE},INVALID_RECORDS_IN_DETOKENIZE:{code:404,description:ae.INVALID_RECORDS_IN_DETOKENIZE},MISSING_TOKEN_IN_DETOKENIZE:{code:400,description:ae.MISSING_TOKEN_IN_DETOKENIZE},INVALID_TOKEN_IN_DETOKENIZE:{code:400,description:ae.INVALID_TOKEN_IN_DETOKENIZE},RECORDS_KEY_NOT_FOUND_GET:{code:400,description:ae.RECORDS_KEY_NOT_FOUND_GET},INVALID_RECORDS_IN_GET:{code:400,description:ae.INVALID_RECORDS_IN_GET},EMPTY_RECORDS_GET:{code:400,description:ae.EMPTY_RECORDS_GET},MISSING_IDS_IN_GET:{code:400,description:ae.MISSING_IDS_IN_GET},INVALID_IDS_IN_GET:{code:400,description:ae.INVALID_IDS_IN_GET},INVALID_COLUMN_VALUES_IN_GET:{code:400,description:ae.INVALID_COLUMN_VALUES_IN_GET},EMPTY_IDS_IN_GET:{code:400,description:ae.EMPTY_IDS_IN_GET},INVALID_SKYFLOWID_TYPE_IN_GET:{code:400,description:ae.INVALID_SKYFLOWID_TYPE_IN_GET},MISSING_TABLE_IN_GET:{code:400,description:ae.MISSING_TABLE_IN_GET},INVALID_TABLE_IN_GET:{code:400,description:ae.INVALID_TABLE_IN_GET},MISSING_REDACTION_IN_GET:{code:400,description:ae.MISSING_REDACTION_IN_GET},INVALID_REDACTION_TYPE_IN_GET:{code:400,description:ae.INVALID_REDACTION_TYPE_IN_GET},INVALID_TOKENS_IN_GET:{code:400,description:ae.INVALID_TOKENS_IN_GET},TOKENS_GET_COLUMN_NOT_SUPPORTED:{code:400,description:ae.TOKENS_GET_COLUMN_NOT_SUPPORTED},REDACTION_WITH_TOKENS_NOT_SUPPORTED:{code:400,description:ae.REDACTION_WITH_TOKENS_NOT_SUPPORTED},INVALID_REDACTION_TYPE_IN_DETOKENIZE:{code:400,description:ae.INVALID_REDACTION_TYPE_IN_DETOKENIZE},INVALID_TOKENS_IN_COLLECT:{code:404,description:ae.INVALID_TOKENS_IN_COLLECT},RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS:{code:404,description:ae.RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS},INVALID_RECORDS_IN_ADDITIONAL_FIELDS:{code:404,description:ae.INVALID_RECORDS_IN_ADDITIONAL_FIELDS},EMPTY_RECORDS_IN_ADDITIONAL_FIELDS:{code:400,description:ae.EMPTY_RECORDS_IN_ADDITIONAL_FIELDS},MISSING_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ae.MISSING_TABLE_IN_ADDITIONAL_FIELDS},INVALID_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ae.INVALID_TABLE_IN_ADDITIONAL_FIELDS},INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:{code:400,description:ae.INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS},MISSING_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ae.MISSING_FIELDS_IN_ADDITIONAL_FIELDS},INVALID_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ae.INVALID_FIELDS_IN_ADDITIONAL_FIELDS},RECORDS_KEY_NOT_FOUND_DELETE:{code:400,description:ae.RECORDS_KEY_NOT_FOUND_DELETE},EMPTY_RECORDS_IN_DELETE:{code:400,description:ae.EMPTY_RECORDS_IN_DELETE},INVALID_RECORDS_IN_DELETE:{code:404,description:ae.INVALID_RECORDS_IN_DELETE},INVALID_TABLE_IN_DELETE:{code:400,description:ae.INVALID_TABLE_IN_DELETE},EMPTY_TABLE_IN_DELETE:{code:400,description:ae.EMPTY_TABLE_IN_DELETE},MISSING_TABLE_IN_DELETE:{code:400,description:ae.MISSING_TABLE_IN_DELETE},EMPTY_ID_IN_DELETE:{code:400,description:ae.EMPTY_ID_IN_DELETE},MISSING_ID_IN_DELETE:{code:404,description:ae.MISSING_ID_IN_DELETE},INVALID_ID_IN_DELETE:{code:404,description:ae.INVALID_ID_IN_DELETE},EMPTY_RECORDS_REVEAL:{code:400,description:ae.EMPTY_RECORDS_REVEAL},MISSING_TOKEN_KEY_REVEAL:{code:400,description:ae.MISSING_TOKEN_KEY_REVEAL},INVALID_TOKEN_ID_REVEAL:{code:400,description:ae.INVALID_TOKEN_ID_REVEAL},INVALID_LABEL_REVEAL:{code:400,description:ae.INVALID_LABEL_REVEAL},INVALID_ALT_TEXT_REVEAL:{code:400,description:ae.INVALID_ALT_TEXT_REVEAL},INVALID_ALT_TEXT_RENDER:{code:400,description:ae.INVALID_ALT_TEXT_RENDER},INVALID_FORMAT_REVEAL:{code:400,description:ae.INVALID_FORMAT_REVEAL},EMPTY_FORMAT_REVEAL:{code:400,description:ae.EMPTY_FORMAT_REVEAL},INVALID_FORMAT_VALUE_REVEAL:{code:400,description:ae.INVALID_FORMAT_VALUE_REVEAL},INVALID_REDACTION_TYPE_REVEAL:{code:400,description:ae.INVALID_REDACTION_TYPE_REVEAL},EMPTY_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ae.EMPTY_TABLE_IN_ADDITIONAL_FIELDS},EMPTY_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ae.EMPTY_FIELDS_IN_ADDITIONAL_FIELDS},EMPTY_TOKEN_IN_DETOKENIZE:{code:400,description:ae.EMPTY_TOKEN_IN_DETOKENIZE},EMPTY_SKYFLOWID_IN_GET:{code:400,description:ae.EMPTY_SKYFLOWID_IN_GET},EMPTY_TABLE_IN_GET:{code:400,description:ae.EMPTY_TABLE_IN_GET},EMPTY_REDACTION_TYPE_IN_GET:{code:400,description:ae.EMPTY_REDACTION_TYPE_IN_GET},EMPTY_TOKEN_ID_REVEAL:{code:400,description:ae.EMPTY_TOKEN_ID_REVEAL},DUPLICATE_ELEMENT:{code:400,description:ae.DUPLICATE_ELEMENT},DUPLICATE_ELEMENT_ADDITIONAL_FIELDS:{code:400,description:ae.DUPLICATE_ELEMENT_ADDITIONAL_FIELDS},MISSING_ELEMENT_TYPE:{code:400,description:ae.MISSING_ELEMENT_TYPE},EMPTY_ELEMENT_TYPE:{code:400,description:ae.EMPTY_ELEMENT_TYPE},INVALID_ALLOWED_OPTIONS:{code:400,description:ae.INVALID_ALLOWED_OPTIONS},EMPTY_ALLOWED_OPTIONS_ARRAY:{code:400,description:ae.EMPTY_ALLOWED_OPTIONS_ARRAY},INVALID_ALLOWED_FILETYPE_ARRAY:{code:400,description:ae.INVALID_ALLOWED_FILETYPE_ARRAY},INVALID_ELEMENT_TYPE:{code:400,description:ae.INVALID_ELEMENT_TYPE},INVALID_ELEMENT_SELECTOR:{code:400,description:ae.INVALID_ELEMENT_SELECTOR},FRAME_NOT_FOUND:{code:400,description:ae.FRAME_NOT_FOUND},REQUIRED_PARAMS_NOT_PROVIDED:{code:400,description:ae.REQUIRED_PARAMS_NOT_PROVIDED},INVALID_RECORD_COLUMN_VALUE:{code:400,description:ae.INVALID_RECORD_COLUMN_VALUE},MISSING_RECORD_COLUMN_VALUE:{code:400,description:ae.MISSING_RECORD_COLUMN_VALUE},MISSING_RECORD_COLUMN_NAME:{code:400,description:ae.MISSING_RECORD_COLUMN_NAME},INVALID_EVENT_TYPE:{code:400,description:ae.INVALID_EVENT_TYPE},INVALID_EVENT_LISTENER:{code:400,description:ae.INVALID_EVENT_LISTENER},MISSING_HANDLER_IN_EVENT_LISTENER:{code:400,description:ae.MISSING_HANDLER_IN_EVENT_LISTENER},INVALID_HANDLER_IN_EVENT_LISTENER:{code:400,description:ae.INVALID_HANDLER_IN_EVENT_LISTENER},UNKNOWN_ERROR:{code:400,description:ae.UNKNOWN_ERROR},CONNECTION_ERROR:{code:400,description:ae.CONNECTION_ERROR},NETWORK_ERROR:{code:500,description:ae.NETWORK_ERROR},COMPLETE_AND_VALID_INPUTS:{code:400,description:ae.COMPLETE_AND_VALID_INPUTS},INVALID_VALIDATIONS_TYPE:{code:400,description:ae.INVALID_VALIDATIONS_TYPE},MISSING_VALIDATION_RULE_TYPE:{code:400,description:ae.MISSING_VALIDATION_RULE_TYPE},INVALID_VALIDATION_RULE_TYPE:{code:400,description:ae.INVALID_VALIDATION_RULE_TYPE},MISSING_VALIDATION_RULE_PARAMS:{code:400,description:ae.MISSING_VALIDATION_RULE_PARAMS},INVALID_VALIDATION_RULE_PARAMS:{code:400,description:ae.INVALID_VALIDATION_RULE_PARAMS},MISSING_REGEX_IN_REGEX_MATCH_RULE:{code:400,description:ae.MISSING_REGEX_IN_REGEX_MATCH_RULE},INVALID_REGEX_IN_REGEX_MATCH_RULE:{code:400,description:ae.INVALID_REGEX_IN_REGEX_MATCH_RULE},MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE:{code:400,description:ae.MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE},MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE:{code:400,description:ae.MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE},INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE:{code:400,description:ae.INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE},ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE:{code:400,description:ae.ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE},EMPTY_ELEMENT_IN_MOUNT:{code:400,description:ae.EMPTY_ELEMENT_IN_MOUNT},REVEAL_ELEMENT_ERROR_STATE:{code:400,description:ae.REVEAL_ELEMENT_ERROR_STATE},INVALID_FILE_TYPE:{code:400,description:ae.INVALID_FILE_TYPE},INVALID_FILE_SIZE:{code:400,description:ae.INVALID_FILE_SIZE},NO_FILE_SELECTED:{code:400,description:ae.NO_FILE_SELECTED},INVALID_TABLE_IN_UPSERT_OPTION:{code:400,description:ae.INVALID_TABLE_IN_UPSERT_OPTION},INVALID_COLUMN_IN_UPSERT_OPTION:{code:400,description:ae.INVALID_COLUMN_IN_UPSERT_OPTION},INVALID_UPSERT_OPTION_TYPE:{code:400,description:ae.INVALID_UPSERT_OPTION_TYPE},EMPTY_UPSERT_OPTIONS_ARRAY:{code:400,description:ae.EMPTY_UPSERT_OPTIONS_ARRAY},INVALID_UPSERT_OPTION_OBJECT_TYPE:{code:400,description:ae.INVALID_UPSERT_OPTION_OBJECT_TYPE},MISSING_TABLE_IN_UPSERT_OPTION:{code:400,description:ae.MISSING_TABLE_IN_UPSERT_OPTION},MISSING_COLUMN_IN_UPSERT_OPTION:{code:400,description:ae.MISSING_COLUMN_IN_UPSERT_OPTION},INVALID_RECORD_COLUMN_VALUE_TYPE:{code:400,description:ae.INVALID_RECORD_COLUMN_VALUE_TYPE},INVALID_COLUMN_VALUES_TYPE:{code:400,description:ae.INVALID_COLUMN_VALUES_TYPE},EMPTY_RECORD_COLUMN_VALUES:{code:400,description:ae.EMPTY_RECORD_COLUMN_VALUES},EMPTY_COLUMN_VALUE:{code:400,description:ae.EMPTY_COLUMN_VALUE},MISSING_IDS_OR_COLUMN_VALUES_IN_GET:{code:400,description:ae.MISSING_IDS_OR_COLUMN_VALUES_IN_GET},SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED:{code:400,description:ae.SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED},SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED:{code:400,description:ae.SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED},MISSING_TABLE_KEY_REVEAL:{code:400,description:ae.MISSING_TABLE_KEY_REVEAL},MISSING_COLUMN_KEY_REVEAL:{code:400,description:ae.MISSING_COLUMN_KEY_REVEAL},INVALID_SKYFLOW_ID_REVEAL:{code:400,description:ae.INVALID_SKYFLOW_ID_REVEAL},INVALID_TABLE_REVEAL:{code:400,description:ae.INVALID_TABLE_REVEAL},INVALID_COLUMN_NAME_REVEAL:{code:400,description:ae.INVALID_COLUMN_NAME_REVEAL},EMPTY_SKYFLOW_ID_REVEAL:{code:400,description:ae.EMPTY_SKYFLOW_ID_REVEAL},EMPTY_TABLE_REVEAL:{code:400,description:ae.EMPTY_TABLE_REVEAL},EMPTY_COLUMN_NAME_REVEAL:{code:400,description:ae.EMPTY_COLUMN_NAME_REVEAL},RECORDS_KEY_NOT_FOUND_GETBYID:{code:400,description:ae.RECORDS_KEY_NOT_FOUND_GETBYID},INVALID_RECORDS_IN_GETBYID:{code:400,description:ae.INVALID_RECORDS_IN_GETBYID},EMPTY_RECORDS_GETBYID:{code:400,description:ae.EMPTY_RECORDS_GETBYID},MISSING_IDS_IN_GETBYID:{code:400,description:ae.MISSING_IDS_IN_GETBYID},INVALID_IDS_IN_GETBYID:{code:400,description:ae.INVALID_IDS_IN_GETBYID},EMPTY_IDS_IN_GETBYID:{code:400,description:ae.EMPTY_IDS_IN_GETBYID},INVALID_SKYFLOWID_TYPE_IN_GETBYID:{code:400,description:ae.INVALID_SKYFLOWID_TYPE_IN_GETBYID},MISSING_TABLE_IN_GETBYID:{code:400,description:ae.MISSING_TABLE_IN_GETBYID},INVALID_TABLE_IN_GETBYID:{code:400,description:ae.INVALID_TABLE_IN_GETBYID},MISSING_REDACTION_IN_GETBYID:{code:400,description:ae.MISSING_REDACTION_IN_GETBYID},INVALID_REDACTION_TYPE_IN_GETBYID:{code:400,description:ae.INVALID_REDACTION_TYPE_IN_GETBYID},EMPTY_SKYFLOWID_IN_GETBYID:{code:400,description:ae.EMPTY_SKYFLOWID_IN_GETBYID},EMPTY_TABLE_IN_GETBYID:{code:400,description:ae.EMPTY_TABLE_IN_GETBYID},EMPTY_REDACTION_TYPE_IN_GETBYID:{code:400,description:ae.EMPTY_REDACTION_TYPE_IN_GETBYID},MISSING_COMPOSABLE_LAYOUT_KEY:{code:400,description:ae.MISSING_COMPOSABLE_LAYOUT_KEY},EMPTY_COMPOSABLE_LAYOUT_ARRAY:{code:400,description:ae.EMPTY_COMPOSABLE_LAYOUT_ARRAY},INVALID_COMPOSABLE_LAYOUT_TYPE:{code:400,description:ae.INVALID_COMPOSABLE_LAYOUT_TYPE},NEGATIVE_VALUES_COMPOSABLE_LAYOUT:{code:400,description:ae.NEGATIVE_VALUES_COMPOSABLE_LAYOUT},MISMATCH_ELEMENT_COUNT_LAYOUT_SUM:{code:400,description:ae.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM},MISSING_COMPOSABLE_CONTAINER_OPTIONS:{code:400,description:ae.MISSING_COMPOSABLE_CONTAINER_OPTIONS},INVALID_COMPOSABLE_CONTAINER_OPTIONS:{code:400,description:ae.INVALID_COMPOSABLE_CONTAINER_OPTIONS},COMPOSABLE_CONTAINER_NOT_MOUNTED:{code:400,description:ae.COMPOSABLE_CONTAINER_NOT_MOUNTED},INVALID_BOOLEAN_OPTIONS:{code:400,description:ae.INVALID_BOOLEAN_OPTIONS},EMPTY_COLLECT_CUSTOM_FORMAT:{code:400,description:ae.EMPTY_COLLECT_CUSTOM_FORMAT},INVALID_INPUT_OPTIONS_FORMAT:{code:400,description:ae.INVALID_INPUT_OPTIONS_FORMAT},INVALID_INPUT_OPTIONS_TRANSLATION:{code:400,description:ae.INVALID_INPUT_OPTIONS_TRANSLATION}},Dt=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND,[],!0);const{records:i}=e;if(!i||!Array.isArray(i))throw new Rt(yt.INVALID_RECORDS_IN_INSERT,[],!0);if(0===i.length)throw new Rt(yt.EMPTY_RECORDS_IN_INSERT,[],!0);if(i.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_INSERT,[`${t}`],!0);if(!e.table)throw new Rt(yt.EMPTY_TABLE_IN_INSERT,[`${t}`],!0);if(!("string"==typeof e.table||e.table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_INSERT,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"fields"))throw new Rt(yt.MISSING_FIELDS_IN_INSERT,[`${t}`],!0);if(!e.fields)throw new Rt(yt.EMPTY_FIELDS_IN_INSERT,[`${t}`],!0);if("object"!=typeof e.fields||Array.isArray(e.fields))throw new Rt(yt.INVALID_FIELDS_IN_INSERT,[`${t}`],!0)})),t&&t.tokens&&"boolean"!=typeof t.tokens)throw new Rt(yt.INVALID_TOKENS_IN_INSERT,[],!0)},St=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS,[],!0);const{records:t}=e;if(!t||!Array.isArray(t))throw new Rt(yt.INVALID_RECORDS_IN_ADDITIONAL_FIELDS,[],!0);if(0===t.length)throw new Rt(yt.EMPTY_RECORDS_IN_ADDITIONAL_FIELDS,[],!0);t.forEach(((e,t)=>{var i,n,o,s;if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!e.table)throw new Rt(yt.EMPTY_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(void 0!==(null===(i=e.fields)||void 0===i?void 0:i.skyflowID)){if(!(null===(n=e.fields)||void 0===n?void 0:n.skyflowID))throw new Rt(yt.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!("string"==typeof(null===(o=e.fields)||void 0===o?void 0:o.skyflowID)||(null===(s=e.fields)||void 0===s?void 0:s.skyflowID)instanceof String))throw new Rt(yt.INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[`${t}`],!0)}if(!("string"==typeof e.table||e.table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"fields"))throw new Rt(yt.MISSING_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!e.fields)throw new Rt(yt.EMPTY_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if("object"!=typeof e.fields||Array.isArray(e.fields))throw new Rt(yt.INVALID_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0)}))},gt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND_DETOKENIZE);const{records:t}=e;if(!t||!Array.isArray(t))throw new Rt(yt.INVALID_RECORDS_IN_DETOKENIZE);if(0===t.length)throw new Rt(yt.EMPTY_RECORDS_DETOKENIZE);t.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"token"))throw new Rt(yt.MISSING_TOKEN_IN_DETOKENIZE,[`${t}`]);if(!e.token)throw new Rt(yt.EMPTY_TOKEN_IN_DETOKENIZE,[`${t}`]);if(!("string"==typeof e.token||e.token instanceof String))throw new Rt(yt.INVALID_TOKEN_IN_DETOKENIZE,[`${t}`]);const i=e.redaction;if(i&&!Object.values(_t).includes(i))throw new Rt(yt.INVALID_REDACTION_TYPE_IN_DETOKENIZE,[`${t}`])}))},Ct=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND_GET);const{records:i}=e;if(!i||!Array.isArray(i))throw new Rt(yt.INVALID_RECORDS_IN_GET,[]);if(0===i.length)throw new Rt(yt.EMPTY_RECORDS_GET);if(t&&Object.prototype.hasOwnProperty.call(t,"tokens")&&"boolean"!=typeof(null==t?void 0:t.tokens))throw new Rt(yt.INVALID_TOKENS_IN_GET);i.forEach(((e,i)=>{var n,o,s;if(0===Object.keys(e).length)throw new Rt(yt.EMPTY_RECORDS_GET);if(0===(null===(n=e.ids)||void 0===n?void 0:n.length))throw new Rt(yt.EMPTY_IDS_IN_GET,[`${i}`]);if(!(null==e.ids||e.ids&&Array.isArray(e.ids)))throw new Rt(yt.INVALID_IDS_IN_GET,[`${i}`]);if(null===(o=e.ids)||void 0===o||o.forEach((e=>{if(!e)throw new Rt(yt.EMPTY_SKYFLOWID_IN_GET,[`${i}`]);if(!("string"==typeof e||e instanceof String))throw new Rt(yt.INVALID_SKYFLOWID_TYPE_IN_GET,[`${i}`])})),!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_GET,[`${i}`]);if(!e.table)throw new Rt(yt.EMPTY_TABLE_IN_GET,[`${i}`]);if(!("string"==typeof e.table||e.table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_GET,[`${i}`]);if(!t||!Object.prototype.hasOwnProperty.call(t,"tokens")||!0!==(null==t?void 0:t.tokens)){if(!Object.prototype.hasOwnProperty.call(e,"redaction"))throw new Rt(yt.MISSING_REDACTION_IN_GET,[`${i}`]);if(!e.redaction)throw new Rt(yt.EMPTY_REDACTION_TYPE_IN_GET,[`${i}`]);if(!Object.values(_t).includes(e.redaction))throw new Rt(yt.INVALID_REDACTION_TYPE_IN_GET,[`${i}`])}if(!0===Object.prototype.hasOwnProperty.call(e,"ids")&&!0===Object.prototype.hasOwnProperty.call(e,"columnName"))throw new Rt(yt.SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED,[`${i}`]);if(Object.prototype.hasOwnProperty.call(e,"columnName")){if(!Object.prototype.hasOwnProperty.call(e,"columnName")||!Object.prototype.hasOwnProperty.call(e,"columnValues"))throw new Rt(yt.MISSING_RECORD_COLUMN_VALUE,[`${i}`])}else if(!1===Object.prototype.hasOwnProperty.call(e,"ids")&&!1===Object.prototype.hasOwnProperty.call(e,"columnValues"))throw new Rt(yt.MISSING_IDS_OR_COLUMN_VALUES_IN_GET,[`${i}`]);if(0===(null===(s=e.columnValues)||void 0===s?void 0:s.length))throw new Rt(yt.EMPTY_RECORD_COLUMN_VALUES,[`${i}`]);if(!(null==e.columnValues||e.columnValues&&Array.isArray(e.columnValues)))throw new Rt(yt.INVALID_COLUMN_VALUES_IN_GET,[`${i}`]);if(void 0!==e.columnName&&void 0===e.columnValues)throw new Rt(yt.MISSING_RECORD_COLUMN_VALUE,[`${i}`]);if(void 0===e.columnName&&void 0!==e.columnValues)throw new Rt(yt.MISSING_RECORD_COLUMN_NAME,[`${i}`]);const r=e.columnName;if(null!=r&&"string"!=typeof r)throw new Rt(yt.INVALID_RECORD_COLUMN_VALUE,[`${i}`]);const a=e.columnValues;if(null!=a){if(0===a.length||null===a)throw new Rt(yt.EMPTY_RECORD_COLUMN_VALUES,[`${i}`]);a.forEach((e=>{if(""===e||null===e)throw new Rt(yt.EMPTY_COLUMN_VALUE,[`${i}`]);if("string"!=typeof e)throw new Rt(yt.INVALID_RECORD_COLUMN_VALUE_TYPE,[`${i}`])}))}if(t&&Object.prototype.hasOwnProperty.call(t,"tokens")&&!0===(null==t?void 0:t.tokens)){if(r||a)throw new Rt(yt.TOKENS_GET_COLUMN_NOT_SUPPORTED);if(e.redaction)throw new Rt(yt.REDACTION_WITH_TOKENS_NOT_SUPPORTED)}}))},bt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND_GETBYID);const{records:t}=e;if(!t||!Array.isArray(t))throw new Rt(yt.INVALID_RECORDS_IN_GETBYID,[]);if(0===t.length)throw new Rt(yt.EMPTY_RECORDS_GETBYID);t.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"ids"))throw new Rt(yt.MISSING_IDS_IN_GETBYID,[`${t}`]);if(!e.ids||!Array.isArray(e.ids))throw new Rt(yt.INVALID_IDS_IN_GETBYID,[`${t}`]);if(0===e.ids.length)throw new Rt(yt.EMPTY_IDS_IN_GETBYID,[`${t}`]);if(e.ids.forEach((e=>{if(!e)throw new Rt(yt.EMPTY_SKYFLOWID_IN_GETBYID,[`${t}`]);if(!("string"==typeof e||e instanceof String))throw new Rt(yt.INVALID_SKYFLOWID_TYPE_IN_GETBYID,[`${t}`])})),!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_GETBYID,[`${t}`]);if(!e.table)throw new Rt(yt.EMPTY_TABLE_IN_GETBYID,[`${t}`]);if(!("string"==typeof e.table||e.table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_GETBYID,[`${t}`]);if(!Object.prototype.hasOwnProperty.call(e,"redaction"))throw new Rt(yt.MISSING_REDACTION_IN_GETBYID,[`${t}`]);if(!e.redaction)throw new Rt(yt.EMPTY_REDACTION_TYPE_IN_GETBYID,[`${t}`]);if(!Object.values(_t).includes(e.redaction))throw new Rt(yt.INVALID_REDACTION_TYPE_IN_GETBYID,[`${t}`])}))},wt=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new Rt(yt.RECORDS_KEY_NOT_FOUND_DELETE,[],!0);const{records:i}=e;if(!i||!Array.isArray(i))throw new Rt(yt.INVALID_RECORDS_IN_DELETE,[],!0);if(0===i.length)throw new Rt(yt.EMPTY_RECORDS_IN_DELETE,[],!0);i.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_DELETE,[`${t}`],!0);if(!e.table)throw new Rt(yt.EMPTY_TABLE_IN_DELETE,[`${t}`],!0);if(!("string"==typeof e.table||e.table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_DELETE,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"id"))throw new Rt(yt.MISSING_ID_IN_DELETE,[`${t}`],!0);if(!e.id)throw new Rt(yt.EMPTY_ID_IN_DELETE,[`${t}`],!0);if(!("string"==typeof e.id||e.id instanceof String))throw new Rt(yt.INVALID_ID_IN_DELETE,[`${t}`],!0)}))},Mt=e=>{if(0===e.length)throw new Rt(yt.EMPTY_RECORDS_REVEAL);e.forEach((e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"skyflowID")){if(!e||!Object.prototype.hasOwnProperty.call(e,"token"))throw new Rt(yt.MISSING_TOKEN_KEY_REVEAL);if(!e.token)throw new Rt(yt.EMPTY_TOKEN_ID_REVEAL);if(!("string"==typeof e.token||e.token instanceof String))throw new Rt(yt.INVALID_TOKEN_ID_REVEAL)}const t=e.redaction;if(t&&!Object.values(_t).includes(t))throw new Rt(yt.INVALID_REDACTION_TYPE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"label")&&"string"!=typeof e.label)throw new Rt(yt.INVALID_LABEL_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"altText")&&"string"!=typeof e.altText)throw new Rt(yt.INVALID_ALT_TEXT_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"format")&&"string"!=typeof e.format)throw new Rt(yt.INVALID_FORMAT_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"format")&&""===e.format)throw new Rt(yt.EMPTY_FORMAT_REVEAL)}))},Pt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"skyflowID"))throw new Rt(yt.MISSING_SKYFLOWID_KEY_REVEAL);if(!e.skyflowID)throw new Rt(yt.EMPTY_SKYFLOW_ID_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"skyflowID")&&"string"!=typeof e.skyflowID)throw new Rt(yt.INVALID_SKYFLOW_ID_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"skyflowID")&&Object.prototype.hasOwnProperty.call(e,"token"))throw new Rt(yt.SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED);if(!e||!Object.prototype.hasOwnProperty.call(e,"column"))throw new Rt(yt.MISSING_COLUMN_KEY_REVEAL);if(!e.column)throw new Rt(yt.EMPTY_COLUMN_NAME_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"column")&&"string"!=typeof e.column)throw new Rt(yt.INVALID_COLUMN_NAME_REVEAL);if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_KEY_REVEAL);if(!e.table)throw new Rt(yt.EMPTY_TABLE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"table")&&"string"!=typeof e.table)throw new Rt(yt.INVALID_TABLE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"altText")&&"string"!=typeof e.altText)throw new Rt(yt.INVALID_ALT_TEXT_RENDER)},Vt=e=>{if(!e||"https"!==e.substring(0,5).toLowerCase())return!1;try{if(new URL(e))return!0}catch(e){return!1}return!0},Ut=e=>{let t=!0;try{new RegExp(e)}catch(e){t=!1}return t},kt=e=>{if(!Object.prototype.hasOwnProperty.call(e,"vaultID"))throw new Rt(yt.VAULTID_IS_REQUIRED,[],!0);if(!e.vaultID)throw new Rt(yt.EMPTY_VAULTID_IN_INIT,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"vaultURL"))throw new Rt(yt.VAULTURL_IS_REQUIRED,[],!0);if(!e.vaultURL)throw new Rt(yt.EMPTY_VAULTURL_IN_INIT,[],!0);if(e.vaultURL&&!Vt(e.vaultURL))throw new Rt(yt.INVALID_VAULTURL_IN_INIT,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"getBearerToken"))throw new Rt(yt.GET_BEARER_TOKEN_IS_REQUIRED,[],!0)},Yt=(e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new Rt(yt.MISSING_ELEMENT_TYPE,[],!0);if(!e.type)throw new Rt(yt.EMPTY_ELEMENT_TYPE,[],!0);if(Object.prototype.hasOwnProperty.call(e,"altText")&&vt(le.COLLECT_ALT_TEXT_DEPERECATED,ft.WARN,t),Object.prototype.hasOwnProperty.call(e,"skyflowID")&&"string"!=typeof e.skyflowID)throw new Rt(yt.INVALID_SKYFLOWID_IN_COLLECT,[],!0);if(e.type===Be.FILE_INPUT&&!Object.keys(e).includes("skyflowID"))throw new Rt(yt.MISSING_SKYFLOWID_IN_COLLECT,[],!0)},Ft=e=>{if(!e||!Array.isArray(e))throw new Rt(yt.INVALID_UPSERT_OPTION_TYPE,[],!0);if(!e.length)throw new Rt(yt.EMPTY_UPSERT_OPTIONS_ARRAY,[],!0);e.forEach(((e,t)=>{if(!e||"object"!=typeof e)throw new Rt(yt.INVALID_UPSERT_OPTION_OBJECT_TYPE,[t],!0);if(!Object.prototype.hasOwnProperty.call(e,"table"))throw new Rt(yt.MISSING_TABLE_IN_UPSERT_OPTION,[t],!0);if(!e.table||"string"!=typeof e.table||!e.table.length)throw new Rt(yt.INVALID_TABLE_IN_UPSERT_OPTION,[t],!0);if(!Object.prototype.hasOwnProperty.call(e,"column"))throw new Rt(yt.MISSING_COLUMN_IN_UPSERT_OPTION,[t],!0);if(!e.column||"string"!=typeof e.column||!e.column.length)throw new Rt(yt.INVALID_COLUMN_IN_UPSERT_OPTION,[t],!0)}))},xt=e=>"boolean"==typeof e,Bt=e=>{if(e){if(Object.prototype.hasOwnProperty.call(e,"format")&&"string"!=typeof e.format)throw new Rt(yt.INVALID_INPUT_OPTIONS_FORMAT,[],!0);if(Object.prototype.hasOwnProperty.call(e,"translation")&&("object"!=typeof e.translation||"[object Object]"!==Object.prototype.toString.call(e.translation)))throw new Rt(yt.INVALID_INPUT_OPTIONS_TRANSLATION,[],!0)}};function Gt(e){const t=e.split(":");return t.length>2?(t.pop(),t.pop(),t.join(":")):""}const jt=(e,t,i)=>{if("string"!=typeof e)return e;if(t===Be.CARD_NUMBER){if(e=e&&e.replace(/\s/g,""),!i){const t=((e="")=>{const t=e.replace(/[\s-]/g,"");let i=Ge.DEFAULT;return Object.entries(qe).forEach((([e,n])=>{n.regex.test(t)&&(i=e)})),i})(e),i=t!==Ge.DEFAULT&&t===Ge.AMEX?6:8;return e.length>i?e.replace(new RegExp(`.(?=.{0,${(null==e?void 0:e.length)-i-1}}$)`,"g"),"X"):e}return e}return i?e:void 0};class Xt{constructor(e,t,i,n){this.setAttributess=e=>{rt(this.iframe,{src:e})},this.mount=e=>{var t;this.unmount();try{if("string"==typeof e){if(this.container=document.querySelector(e)||void 0,!this.container)throw new Rt(yt.INVALID_ELEMENT_SELECTOR,[],!0)}else{if(!(e instanceof HTMLElement))throw new Rt(yt.INVALID_ELEMENT_SELECTOR,[],!0);this.container=e}}catch(e){console.error(e)}rt(this.iframe,{src:lt()}),null===(t=this.container)||void 0===t||t.appendChild(this.iframe)},this.setIframeHeight=e=>{this.iframe.getAttribute("height")!==e&&this.iframe.setAttribute("height",`${e}px`)},this.unmount=()=>{this.iframe.remove()},this.name=`${e}:${i}:${n}`,this.metadata=t,this.iframe=at({name:this.name})}}class Kt{}var Wt,$t,Ht,zt,qt,Jt,Zt,Qt,ei,ti,ii,ni,oi,si,ri,ai,li,di,ci,Ei;const _i="Element";class Ii extends Kt{constructor(e,n,o,s,r=!1,a,l,d,c){var E;super(),this.type=no.COLLECT,Wt.set(this,void 0),$t.set(this,!1),Ht.set(this,void 0),zt.set(this,void 0),qt.set(this,{isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:void 0,isRequired:!1}),Jt.set(this,void 0),Zt.set(this,new nt),Qt.set(this,void 0),ei.set(this,new Et),ti.set(this,void 0),ii.set(this,[]),ni.set(this,!1),oi.set(this,void 0),si.set(this,void 0),ri.set(this,!1),this.getID=()=>t(this,Wt,"f"),this.mount=e=>{var n;if(!e)throw new Rt(yt.EMPTY_ELEMENT_IN_MOUNT,["CollectElement"],!0);const o=(e,n)=>{if(e.name===t(this,ti,"f").name){n(t(this,Jt,"f")),t(this,Ei,"f").call(this);const e=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}return i}(t(this,Ht,"f")[0],["name"]);t(this,zt,"f").length>1?t(this,zt,"f").forEach(((e,i)=>{t(this,Qt,"f")&&t(this,Qt,"f")._emit(`${fe.READY}:${e.elementName}`,Object.assign(Object.assign({},t(this,Ht,"f")[i]),{elementType:e.elementType}))})):t(this,Zt,"f")._emit(fe.READY,Object.assign({},e)),t(this,ei,"f").off(Ne+this.containerId,o),vt(`${At(re.ELEMENT_MOUNTED,_i,mt(t(this,ti,"f").name))} `,ft.LOG,t(this,oi,"f").logLevel),t(this,ii,"f").forEach((e=>e())),i(this,ii,[],"f")}};if(t(this,zt,"f").length>1)t(this,ti,"f").mount(e),t(this,ei,"f").on(Ne+this.containerId,o);else{if(t(this,ri,"f"))return t(this,ti,"f").mount(e),void t(this,ei,"f").on(Ne+this.containerId,o);null===(n=t(this,Qt,"f"))||void 0===n||n.on(Fe,(i=>{(null==i?void 0:i.containerId)===this.containerId&&(t(this,ti,"f").mount(e),t(this,ei,"f").on(Ne+this.containerId,o))}))}},this.unmount=()=>{t(this,ti,"f").unmount()},this.update=e=>{let n=ct(e);const o=()=>{t(this,$t,"f")&&(n={rows:[{elements:[Object.assign({},n)]}]}),i(this,Jt,ui(t(this,Jt,"f"),n),"f"),i(this,zt,pi(t(this,Jt,"f")),"f"),t(this,$t,"f")?t(this,ei,"f").emit(ve,{name:t(this,ti,"f").name,options:t(this,zt,"f")[0],isSingleElementAPI:!0}):(t(this,zt,"f").forEach((e=>{t(this,ei,"f").emit(ve,{name:e.elementName,options:e,isSingleElementAPI:!0})})),t(this,ei,"f").emit(ve,{name:t(this,ti,"f").name,options:t(this,Jt,"f"),isSingleElementAPI:!1})),t(this,Ei,"f").call(this)};t(this,ni,"f")?o():t(this,ii,"f").push(o)},ai.set(this,(e=>{t(this,$t,"f")||t(this,Zt,"f").on(ve,(()=>{e(t(this,zt,"f"))}),!0)})),this.updateElement=e=>{t(this,ei,"f").emit(ve,{name:e.elementName,options:e,isSingleElementAPI:!0})},li.set(this,(()=>{t(this,Ht,"f").forEach(((e,i)=>{if(0===i){t(this,qt,"f").isEmpty=e.isEmpty,t(this,qt,"f").isComplete=e.isComplete,t(this,qt,"f").isValid=e.isValid,t(this,qt,"f").isFocused=e.isFocused,t(this,qt,"f").isRequired=e.isRequired,t(this,qt,"f").value={};const n=t(this,zt,"f")[i].elementName,o=e.value&&jt(e.value,e.elementType,t(this,si,"f"));t(this,$t,"f")?t(this,qt,"f").value=o:t(this,qt,"f").value[n]=o}else t(this,qt,"f").isEmpty=t(this,qt,"f").isEmpty||e.isEmpty,t(this,qt,"f").isComplete=t(this,qt,"f").isComplete&&e.isComplete,t(this,qt,"f").isValid=t(this,qt,"f").isValid&&e.isValid,t(this,qt,"f").isFocused=t(this,qt,"f").isFocused||e.isFocused,t(this,qt,"f").isRequired=t(this,qt,"f").isRequired||e.isRequired,t(this,qt,"f").value||(t(this,qt,"f").value={}),t(this,zt,"f")[i].sensitive||(t(this,qt,"f").value[t(this,zt,"f")[i].elementName]=e.value||"")}))})),this.getState=()=>({isEmpty:t(this,qt,"f").isEmpty,isComplete:t(this,qt,"f").isComplete,isValid:t(this,qt,"f").isValid,isFocused:t(this,qt,"f").isFocused,value:t(this,qt,"f").value,required:t(this,qt,"f").isRequired}),this.getOptions=()=>{let e=ct(t(this,Jt,"f"));return t(this,$t,"f")?e=e.rows[0].elements[0]:e.rows.forEach((e=>{e.elements.forEach((e=>{delete e.elementName}))})),delete e.elementName,e},di.set(this,(e=>{t(this,Zt,"f").on(Le,(()=>{const i=t(this,zt,"f").map((e=>e.elementName));t(this,$t,"f")||i.push(t(this,ti,"f").name),e(i)}),!0)})),ci.set(this,(()=>{t(this,ei,"f").on(Oe,(e=>{if(t(this,$t,"f")&&e.event===fe.READY&&e.name===t(this,ti,"f").name)t(this,Zt,"f")._emit(fe.READY);else{const i=t(this,zt,"f").length>1;t(this,zt,"f").forEach(((n,o)=>{var s;if(e.name===n.elementName){let r="";switch(e.event){case fe.FOCUS:r=fe.FOCUS;break;case fe.BLUR:r=fe.BLUR;break;case fe.CHANGE:r=fe.CHANGE;break;case fe.READY:r=fe.READY;break;case fe.SUBMIT:return void(null===(s=t(this,Qt,"f"))||void 0===s||s._emit(fe.SUBMIT));default:throw new Rt(yt.INVALID_EVENT_TYPE,[],!0)}t(this,Ht,"f")[o].isEmpty=e.value.isEmpty,t(this,Ht,"f")[o].isValid=e.value.isValid,t(this,Ht,"f")[o].isComplete=e.value.isComplete,t(this,Ht,"f")[o].isFocused=e.value.isFocused,t(this,Ht,"f")[o].isRequired=e.value.isRequired,Object.prototype.hasOwnProperty.call(e.value,"value")?t(this,Ht,"f")[o].value=e.value.value:t(this,Ht,"f")[o].value=void 0,r=i?`${r}:${e.name}`:r,t(this,ei,"f").emit(fe.HEIGHT+t(this,ti,"f").name,{},(e=>{t(this,ti,"f").setIframeHeight(e.height)})),t(this,li,"f").call(this);const a=Object.assign(Object.assign({},t(this,Ht,"f")[o]),{elementType:n.elementType});i&&t(this,Qt,"f")?t(this,Qt,"f")._emit(r,a):t(this,Zt,"f")._emit(r,a)}}))}}))})),Ei.set(this,(()=>{const{rows:e}=t(this,Jt,"f");e.forEach((e=>{e.elements.forEach((e=>{e.elementType!==Xe.radio.name&&e.elementType!==Xe.checkbox.name&&(e.value=void 0)}))})),i(this,zt,pi(t(this,Jt,"f")),"f")})),this.containerId=s.containerId,i(this,Wt,e,"f"),i(this,oi,d,"f"),i(this,Jt,ui(n),"f"),i(this,zt,pi(n),"f"),i(this,$t,r,"f"),c&&i(this,Qt,c,"f"),i(this,si,Ot[t(this,oi,"f").env].doesReturnValue,"f"),this.elementType=t(this,$t,"f")?t(this,zt,"f")[0].elementType:"group",i(this,Ht,[],"f"),t(this,zt,"f").forEach((e=>{t(this,Ht,"f").push({isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:t(this,si,"f")?"":void 0,elementType:e.elementType,name:e.elementName,isRequired:!1})})),i(this,ti,new Xt(t(this,Jt,"f").elementName,o,this.containerId,t(this,oi,"f").logLevel),"f"),t(this,ci,"f").call(this),t(this,di,"f").call(this,a),t(this,ai,"f").call(this,l),vt(At(re.CREATED_ELEMENT,_i,mt(t(this,ti,"f").name)),ft.LOG,t(this,oi,"f").logLevel),i(this,ri,s.isMounted,"f"),null===(E=t(this,Qt,"f"))||void 0===E||E.on(Fe,(e=>{(null==e?void 0:e.containerId)===this.containerId&&i(this,ri,!0,"f")})),t(this,ei,"f").on(fe.MOUNTED,(e=>{s.type===no.COMPOSABLE?t(this,zt,"f").forEach((t=>{e.name===t.elementName&&(t.isMounted=!0,i(this,ni,!0,"f"))})):e.name===t(this,zt,"f")[0].elementName&&(t(this,zt,"f")[0].isMounted=!0,i(this,ni,!0,"f")),t(this,ei,"f").emit(fe.HEIGHT+t(this,ti,"f").name,{},(e=>{t(this,ti,"f").setIframeHeight(e.height)}))}))}on(e,i){if(!Object.values(fe).includes(e))throw new Rt(yt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new Rt(yt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new Rt(yt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,Zt,"f").on(e,(e=>{void 0===e.value&&(e.value=""),delete e.isComplete,delete e.name,i(e)}))}iframeName(){return t(this,ti,"f").name}isMounted(){return t(this,ni,"f")}isValidElement(){for(let e=0;e<t(this,zt,"f").length;e+=1){if(!Object.prototype.hasOwnProperty.call(t(this,zt,"f")[e],"table"))throw new Rt(yt.MISSING_TABLE_IN_COLLECT,[],!0);if(!t(this,zt,"f")[e].table)throw new Rt(yt.EMPTY_TABLE_IN_COLLECT,[],!0);if(!("string"==typeof t(this,zt,"f")[e].table||t(this,zt,"f")[e].table instanceof String))throw new Rt(yt.INVALID_TABLE_IN_COLLECT,[],!0);if(!Object.prototype.hasOwnProperty.call(t(this,zt,"f")[e],"column"))throw new Rt(yt.MISSING_COLUMN_IN_COLLECT,[],!0);if(!t(this,zt,"f")[e].column)throw new Rt(yt.EMPTY_COLUMN_IN_COLLECT,[],!0);if(!("string"==typeof t(this,zt,"f")[e].column||t(this,zt,"f")[e].column instanceof String))throw new Rt(yt.INVALID_COLUMN_IN_COLLECT,[],!0);if(void 0!==t(this,zt,"f")[e].skyflowID&&!t(this,zt,"f")[e].skyflowID)throw new Rt(yt.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[],!0)}return!0}setError(e){t(this,ei,"f").emit(Se,{name:Gt(t(this,ti,"f").name),isTriggerError:!0,clientErrorText:e})}resetError(){t(this,ei,"f").emit(Se,{name:Gt(t(this,ti,"f").name),isTriggerError:!1})}setValue(e){t(this,oi,"f").env!==pt.PROD?t(this,$t,"f")&&t(this,ei,"f").emit(ve,{name:t(this,ti,"f").name,options:Object.assign(Object.assign({},t(this,zt,"f")[0]),{value:e}),isSingleElementAPI:!0}):vt(At(le.UNABLE_TO_SET_VALUE_IN_PROD_ENV,t(this,zt,"f")[0].elementType),ft.WARN,t(this,oi,"f").logLevel)}clearValue(){t(this,oi,"f").env!==pt.PROD?t(this,$t,"f")&&t(this,ei,"f").emit(ve,{name:t(this,ti,"f").name,options:Object.assign(Object.assign({},t(this,zt,"f")[0]),{value:""}),isSingleElementAPI:!0}):vt(At(le.UNABLE_TO_CLEAR_VALUE_IN_PROD_ENV,t(this,zt,"f")[0].elementType),ft.WARN,t(this,oi,"f").logLevel)}}function hi(e,t,i={}){if("group"!==e&&!Object.prototype.hasOwnProperty.call(Xe,e))throw new Rt(yt.INVALID_ELEMENT_TYPE,[],!0);if(Object.prototype.hasOwnProperty.call(t,"validations")){if(!Array.isArray(t.validations))throw new Rt(yt.INVALID_VALIDATIONS_TYPE,[],!0);t.validations.forEach(((e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new Rt(yt.MISSING_VALIDATION_RULE_TYPE,[`${t}`],!0);if(!Object.values(Nt).includes(e.type))throw new Rt(yt.INVALID_VALIDATION_RULE_TYPE,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"params"))throw new Rt(yt.MISSING_VALIDATION_RULE_PARAMS,[`${t}`],!0);if("object"!=typeof e.params||Array.isArray(e.params)||null===e.params)throw new Rt(yt.INVALID_VALIDATION_RULE_PARAMS,[`${t}`],!0);if(e.type===Nt.REGEX_MATCH_RULE){if(!Object.prototype.hasOwnProperty.call(e.params,"regex"))throw new Rt(yt.MISSING_REGEX_IN_REGEX_MATCH_RULE,[`${t}`],!0)}else if(e.type===Nt.LENGTH_MATCH_RULE&&!Object.prototype.hasOwnProperty.call(e.params,"min")&&!Object.prototype.hasOwnProperty.call(e.params,"max"))throw new Rt(yt.MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE,[`${t}`],!0)}))}if(Object.prototype.hasOwnProperty.call(i,"name")&&i.name!==t.name)throw new Error("Name attribute can't be updated");if((i=Object.assign(Object.assign({},t),i)).mask||i.replacePattern){const{type:t}=Xe[e].attributes;"text"===t&&"textarea"===t&&"email"===t||(delete i.mask,delete i.replacePattern)}if(void 0===!i.mask&&!Array.isArray(i.mask))throw new Error("mask option has to be array or undefined");if(Array.isArray(i.mask)){const e=i.mask;if("string"!=typeof e[0]||e[1]&&"object"!=typeof e[1])throw new Error("mask array values has to be string")}if(Array.isArray(i.replacePattern)){const e=i.replacePattern;if("string"!=typeof e[0]||e[1]&&"string"!=typeof e[1])throw new Error("replacePatterns array values has to be string")}if((e===Xe.radio.name||e===Xe.checkbox.name)&&!i.value)throw new Error("Elements radio and checkbox requires value attribute");if(!(e!==Xe.dropdown.name||i.options&&Array.isArray(i.options)&&0!==i.options.length))throw new Error("Element dropdown requires options attribute with an array of objects containing value and text attributes")}function ui(e,t={},i=!0){return(t=Object.assign(Object.assign({},e),t)).rows.forEach(((n,o)=>{const s=n,r=e.rows[o];t.rows[o]=Object.assign(Object.assign({},r),s),s.elements.forEach(((e,t)=>{var n,o;const a=r.elements[t],l=e;if(l.elementType&&a.elementType!==l.elementType&&a.elementName&&a.elementName!==l.elementName)throw new Error(ae.CANNOT_CHANGE_ELEMENT);hi(a.elementType,a,l),s.elements[t]=Object.assign(Object.assign(Object.assign({},a),l),{elementName:a.elementName});const d=l.classes||{},c=l.styles||{};c.base=Object.assign(Object.assign({},He),c.base),l.classes=d,l.styles=c;const E=(null===(n=null==l?void 0:l.labelStyles)||void 0===n?void 0:n.classes)||{},_=(null===(o=null==l?void 0:l.labelStyles)||void 0===o?void 0:o.styles)||{};i&&function(e,t){Object.values(ze).forEach((i=>{if(e[i]||t[i])switch(i){case ze.BASE:t[i]=Object.assign({},t[i]);break;case ze.FOCUS:t[ze.BASE]=Object.assign(Object.assign({},t[ze.BASE]),{":focus":Object.assign({},t[ze.BASE]&&t[ze.BASE][":focus"])});break;case ze.WEBPACKAUTOFILL:t[ze.BASE]=Object.assign(Object.assign({},t[ze.BASE]),{":-webkit-autofill":Object.assign({},t[ze.BASE]&&t[ze.BASE][":-webkit-autofill"])});break;default:t[i]=Object.assign(Object.assign({},t[ze.BASE]),t[i])}})),Object.keys(t).forEach((e=>{const i=t[e][":-webkit-autofill"];"object"==typeof i&&Object.keys(i).forEach((e=>{i[e]&&!i[e].includes("!important")&&(i[e]=`${i[e]} !important`)}))}))}(E,_),l.labelStyles={labelClasses:E},l.labelStyles.styles=_}))})),t}Wt=new WeakMap,$t=new WeakMap,Ht=new WeakMap,zt=new WeakMap,qt=new WeakMap,Jt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,ei=new WeakMap,ti=new WeakMap,ii=new WeakMap,ni=new WeakMap,oi=new WeakMap,si=new WeakMap,ri=new WeakMap,ai=new WeakMap,li=new WeakMap,di=new WeakMap,ci=new WeakMap,Ei=new WeakMap;const pi=e=>{const{rows:t}=e,i=[];return t.forEach((e=>{e.elements.forEach((e=>{i.push(e)}))})),i},fi=e=>{const t=e.validations;return t&&Array.isArray(t)&&t.length>0&&t.forEach(((e,t)=>{if(e&&e.type===Nt.ELEMENT_VALUE_MATCH_RULE){if(e.params&&!Object.prototype.hasOwnProperty.call(e.params,"element"))throw new Rt(yt.MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE,[`${t}`],!0);if(e.params&&(null==e.params.element||!(e.params.element instanceof Ii)))throw new Rt(yt.INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE,[`${t}`],!0);e.params&&e.params.element&&e.params.element instanceof Ii&&(e.params.element=e.params.element.iframeName())}else if(e&&e.type===Nt.REGEX_MATCH_RULE){if(e.params&&e.params.regex&&!Ut(e.params.regex))throw new Rt(yt.INVALID_REGEX_IN_REGEX_MATCH_RULE,[`${t}`],!0);e.params&&e.params.regex&&Ut(e.params.regex)&&(e.params.regex=e.params.regex.toString())}})),t},Ni=(e,t,i)=>{let n=Object.assign({required:!1},t);if((Object.prototype.hasOwnProperty.call(n,"format")||Object.prototype.hasOwnProperty.call(n,"translation"))&&(tt.includes(e)?(vt(At(le.INPUT_FORMATTING_NOT_SUPPROTED,e),ft.WARN,i),null==n||delete n.format,null==n||delete n.translation):e===Xe.INPUT_FIELD.name&&(Bt(t),n=Object.assign(Object.assign({},n),{mask:[n.format,n.translation?n.translation:it]}),null==n||delete n.format,null==n||delete n.translation)),e===Xe.CARD_NUMBER.name){Object.prototype.hasOwnProperty.call(n,"enableCardIcon")||(n=Object.assign(Object.assign({},n),{enableCardIcon:!0}));let e=" ";(null==n?void 0:n.format)===Ke&&(e="-"),n=Object.assign(Object.assign({},n),{cardSeperator:e}),null==n||delete n.format,null==n||delete n.translation}else if(e===Xe.EXPIRATION_DATE.name){let e=!1;n.format&&(e=!!(o=n.format.toUpperCase())&&Ze.includes(o),e||vt(At(le.INVALID_EXPIRATION_DATE_FORMAT,Ze.toString()),ft.WARN,i)),n=Object.assign(Object.assign({},n),{format:e?n.format.toUpperCase():Je}),null==n||delete n.translation}else if(e===Xe.EXPIRATION_YEAR.name){let e=!1;n.format&&(e=(e=>!!e&&Qe.includes(e))(n.format.toUpperCase()),e||vt(At(le.INVALID_EXPIRATION_YEAR_FORMAT,Qe.toString()),ft.WARN,i)),n=Object.assign(Object.assign({},n),{format:e?n.format.toUpperCase():"YY"}),null==n||delete n.translation}var o;if(Object.prototype.hasOwnProperty.call(n,"enableCardIcon")&&!xt(n.enableCardIcon))throw new Rt(yt.INVALID_BOOLEAN_OPTIONS,["enableCardIcon"],!0);if(Object.prototype.hasOwnProperty.call(n,"enableCopy")&&!xt(n.enableCopy))throw new Rt(yt.INVALID_BOOLEAN_OPTIONS,["enableCopy"],!0);if(Object.prototype.hasOwnProperty.call(n,"required")&&!xt(n.required))throw new Rt(yt.INVALID_BOOLEAN_OPTIONS,["required"],!0);if(e===Xe.FILE_INPUT.name&&t.allowedFileType){if(!Array.isArray(t.allowedFileType))throw new Rt(yt.INVALID_ALLOWED_OPTIONS,[],!0);if(t.allowedFileType.length<=0)throw new Rt(yt.EMPTY_ALLOWED_OPTIONS_ARRAY,[],!0);if(!t.allowedFileType.every((e=>"string"==typeof e)))throw new Rt(yt.INVALID_ALLOWED_FILETYPE_ARRAY,[],!0)}return n};function Ti(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=crypto.getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)*16|0;return("x"===e?t:3&t|8).toString(16)}))}class Oi{}var Li,vi,Ai,mi,Ri,yi,Di,Si,gi,Ci,bi,wi;const Mi="CollectContainer";class Pi extends Oi{constructor(e,n,o,s){super(),Li.set(this,void 0),vi.set(this,{}),Ai.set(this,void 0),mi.set(this,void 0),Ri.set(this,void 0),this.type=no.COLLECT,yi.set(this,void 0),Di.set(this,!1),this.create=(e,i={required:!1})=>{Yt(e,t(this,mi,"f").logLevel);const n=fi(e),o=Ni(e.type,i,t(this,mi,"f").logLevel),s={rows:[{elements:[Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column,accept:i.allowedFileType},e),o),{validations:n})]}]};return t(this,Si,"f").call(this,s,!0)},Si.set(this,((e,i=!1)=>{const n=[],o=ct(e);if(o.rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:i}=t;hi(i,t),t.sensitive=t.sensitive||Xe[i].sensitive,t.replacePattern=t.replacePattern||Xe[i].replacePattern,t.mask=t.mask||Xe[i].mask,t.isMounted=!1,t.elementType!==Xe.radio.name&&t.elementType!==Xe.checkbox.name||(t.elementName=`${t.elementName}:${btoa(t.value)}`),t.elementName=`${Ee}:${t.elementType}:${btoa(Ti())}`,t.label=e.label,t.skyflowID=e.skyflowID,n.push(t)}))})),o.elementName=i?n[0].elementName:`${Ee}:group:${btoa(o.name)}`,i&&!t(this,vi,"f")[n[0].elementName]&&t(this,wi,"f").call(this,n[0].name))throw new Rt(yt.UNIQUE_ELEMENT_NAME,[`${n[0].name}`],!0);let s=t(this,vi,"f")[o.elementName];if(s)i?s.update(n[0]):s.update(o);else{const e=Ti();s=new Ii(e,o,t(this,Ai,"f"),{containerId:t(this,Li,"f"),isMounted:t(this,Di,"f"),type:this.type},i,t(this,Ci,"f"),t(this,bi,"f"),t(this,mi,"f"),t(this,yi,"f")),t(this,vi,"f")[o.elementName]=s,t(this,Ri,"f")[e]=s}return i||n.forEach((e=>{const i=e.elementName;t(this,vi,"f")[i]?t(this,vi,"f")[i].update(e):t(this,vi,"f")[i]=this.create(e.elementType,s)})),s})),gi.set(this,(e=>{Object.keys(t(this,vi,"f")).forEach((i=>{i===e&&delete t(this,vi,"f")[i]}))})),Ci.set(this,(e=>{e.forEach((e=>{t(this,gi,"f").call(this,e)}))})),bi.set(this,(e=>{e.forEach((e=>{t(this,vi,"f")[e.elementName]&&t(this,vi,"f")[e.elementName].update(e)}))})),wi.set(this,(e=>{const i=Object.keys(t(this,vi,"f"));for(let t=0;t<i.length;t+=1)if(atob(i[t].split(":")[2])===e)return!0;return!1})),this.collect=(e={tokens:!0})=>new Promise(((i,n)=>{try{kt(t(this,Ai,"f").clientJSON.config);if(Object.values(t(this,vi,"f")).forEach((e=>{if(!e.isMounted())throw new Rt(yt.ELEMENTS_NOT_MOUNTED,[],!0);e.isValidElement()})),Object.prototype.hasOwnProperty.call(e,"tokens")&&!xt(e.tokens))throw new Rt(yt.INVALID_TOKENS_IN_COLLECT,[],!0);(null==e?void 0:e.additionalFields)&&St(e.additionalFields),(null==e?void 0:e.upsert)&&Ft(null==e?void 0:e.upsert),se.emit(Te+t(this,Li,"f"),Object.assign(Object.assign({},e),{tokens:void 0===(null==e?void 0:e.tokens)||e.tokens}),(e=>{!e||(null==e?void 0:e.error)?(vt(`${JSON.stringify(null==e?void 0:e.error)}`,ft.ERROR,t(this,mi,"f").logLevel),n(null==e?void 0:e.error)):(vt(At(re.COLLECT_SUBMIT_SUCCESS,Mi),ft.LOG,t(this,mi,"f").logLevel),i(e))})),vt(At(re.EMIT_EVENT,Mi,Te),ft.LOG,t(this,mi,"f").logLevel)}catch(e){vt(`${e.message}`,ft.ERROR,t(this,mi,"f").logLevel),n(e)}})),this.uploadFiles=e=>new Promise(((i,n)=>{try{kt(t(this,Ai,"f").clientJSON.config);Object.values(t(this,vi,"f")).forEach((e=>{if(!e.isMounted())throw new Rt(yt.ELEMENTS_NOT_MOUNTED,[],!0);e.isValidElement()})),se.emit(be+t(this,Li,"f"),Object.assign({},e),(e=>{!e||(null==e?void 0:e.error)?(vt(`${JSON.stringify(null==e?void 0:e.error)}`,ft.ERROR,t(this,mi,"f").logLevel),n(null==e?void 0:e.error)):(vt(At(re.COLLECT_SUBMIT_SUCCESS,Mi),ft.LOG,t(this,mi,"f").logLevel),i(e))})),vt(At(re.EMIT_EVENT,Mi,be),ft.LOG,t(this,mi,"f").logLevel)}catch(e){vt(`${e.message}`,ft.ERROR,t(this,mi,"f").logLevel),n(e)}})),i(this,Li,Ti(),"f"),i(this,Ai,n,"f"),i(this,Ri,o,"f"),i(this,mi,s,"f"),i(this,yi,new nt,"f");const r=at({name:`${de}:${t(this,Li,"f")}:${t(this,mi,"f").logLevel}`});rt(r,{src:lt()}),dt(r,Object.assign({},$e)),vt(At(re.CREATE_COLLECT_CONTAINER,Mi),ft.LOG,t(this,mi,"f").logLevel);const a=(e,o)=>{e.name===de+t(this,Li,"f")&&(o(Object.assign(Object.assign({},n),{clientJSON:Object.assign(Object.assign({},n.clientJSON),{config:Object.assign({},n.clientJSON.config)}),context:s})),i(this,Di,!0,"f"),t(this,yi,"f")._emit(Fe,{containerId:t(this,Li,"f")}),se.target(ot.IFRAME_SECURE_ORGIN).off(Ne+t(this,Li,"f"),a))};se.target(ot.IFRAME_SECURE_ORGIN).on(Ne+t(this,Li,"f"),a),document.body.append(r)}}Li=new WeakMap,vi=new WeakMap,Ai=new WeakMap,mi=new WeakMap,Ri=new WeakMap,yi=new WeakMap,Di=new WeakMap,Si=new WeakMap,gi=new WeakMap,Ci=new WeakMap,bi=new WeakMap,wi=new WeakMap;var Vi=function(e,t){for(var i,n=-1,o=e.length;++n<o;){var s=t(e[n]);void 0!==s&&(i=void 0===i?s:i+s)}return i},Ui=function(e){return e};var ki,Yi,Fi,xi,Bi,Gi,ji,Xi,Ki,Wi,$i,Hi,zi,qi,Ji,Zi,Qi,en,tn,nn,on,sn,rn,an=m((function(e){return e&&e.length?Vi(e,Ui):0}));class ln{constructor(e,n){ki.set(this,void 0),Yi.set(this,void 0),this.type=no.COMPOSABLE,Fi.set(this,!1),xi.set(this,!1),this.update=e=>{i(this,xi,!0,"f"),t(this,Fi,"f")?(t(this,Yi,"f")._emit(we,{elementName:t(this,ki,"f"),elementOptions:e}),i(this,xi,!1,"f")):t(this,xi,"f")&&t(this,Yi,"f").on(`${ht.READY}:${t(this,ki,"f")}`,(()=>{t(this,Yi,"f")._emit(we,{elementName:t(this,ki,"f"),elementOptions:e}),i(this,Fi,!0,"f"),i(this,xi,!1,"f")}))},i(this,ki,e,"f"),i(this,Yi,n,"f"),t(this,Yi,"f").on(`${ht.READY}:${t(this,ki,"f")}`,(()=>{i(this,Fi,!0,"f")}))}on(e,i){if(!Object.values(fe).includes(e))throw new Rt(yt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new Rt(yt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new Rt(yt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,Yi,"f").on(`${e}:${t(this,ki,"f")}`,(e=>{void 0===e.value&&(e.value=""),delete e.isComplete,delete e.name,i(e)}))}}ki=new WeakMap,Yi=new WeakMap,Fi=new WeakMap,xi=new WeakMap;const dn="CollectContainer";class cn extends Oi{constructor(e,n,o,s){super(),Bi.set(this,void 0),Gi.set(this,{}),ji.set(this,void 0),Xi.set(this,{rows:[]}),Ki.set(this,[]),Wi.set(this,void 0),$i.set(this,void 0),Hi.set(this,void 0),zi.set(this,!1),qi.set(this,void 0),Ji.set(this,void 0),this.type=no.COMPOSABLE,Zi.set(this,!1),Qi.set(this,{}),this.create=(e,i={required:!1})=>{Yt(e,t(this,Wi,"f").logLevel);const n=fi(e),o=Ni(e.type,i,t(this,Wi,"f").logLevel),s=`${Ee}:${e.type}:${btoa(Ti())}`;return t(this,Ki,"f").push(Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column},e),o),{validations:n,elementName:s})),new ln(s,t(this,Hi,"f"))},en.set(this,((e,n=!1)=>{const o=[];if(i(this,Qi,ct(e),"f"),t(this,Qi,"f").rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:i}=t;hi(i,t),t.sensitive=t.sensitive||Xe[i].sensitive,t.replacePattern=t.replacePattern||Xe[i].replacePattern,t.mask=t.mask||Xe[i].mask,t.isMounted=!1,t.label=e.label,t.skyflowID=e.skyflowID,o.push(t)}))})),t(this,Qi,"f").elementName=n?o[0].elementName:`${Ee}:group:${btoa(t(this,Qi,"f").name)}`,n&&!t(this,Gi,"f")[o[0].elementName]&&t(this,sn,"f").call(this,o[0].name))throw new Rt(yt.UNIQUE_ELEMENT_NAME,[`${o[0].name}`],!0);let s=t(this,Gi,"f")[t(this,Qi,"f").elementName];if(s)n?s.update(o[0]):s.update(t(this,Qi,"f"));else{const e=Ti();s=new Ii(e,t(this,Qi,"f"),t(this,ji,"f"),{containerId:t(this,Bi,"f"),isMounted:t(this,Zi,"f"),type:this.type},!0,t(this,nn,"f"),t(this,on,"f"),t(this,Wi,"f"),t(this,Hi,"f")),t(this,Gi,"f")[t(this,Qi,"f").elementName]=s,t(this,$i,"f")[e]=s}return s})),tn.set(this,(e=>{Object.keys(t(this,Gi,"f")).forEach((i=>{i===e&&delete t(this,Gi,"f")[i]}))})),nn.set(this,(e=>{e.forEach((e=>{t(this,tn,"f").call(this,e)}))})),on.set(this,(e=>{e.forEach((e=>{t(this,Gi,"f")[e.elementName]&&t(this,Gi,"f")[e.elementName].update(e)}))})),sn.set(this,(e=>{const i=Object.keys(t(this,Gi,"f"));for(let t=0;t<i.length;t+=1)if(atob(i[t].split(":")[2])===e)return!0;return!1})),this.on=(e,i)=>{if(!Object.values(fe).includes(e))throw new Rt(yt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new Rt(yt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new Rt(yt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,Hi,"f").on(fe.SUBMIT,(()=>{i()}))},this.mount=e=>{if(!e)throw new Rt(yt.EMPTY_ELEMENT_IN_MOUNT,["CollectElement"],!0);const{layout:n}=t(this,qi,"f");if(an(n)!==t(this,Ki,"f").length)throw new Rt(yt.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM,[],!0);let o=0;if(n.forEach(((e,i)=>{t(this,Xi,"f").rows=[...t(this,Xi,"f").rows,{elements:[]}];for(let n=0;n<e;n++)t(this,Xi,"f").rows[i].elements.push(t(this,Ki,"f")[o]),o++})),t(this,qi,"f").styles&&(t(this,Xi,"f").styles=Object.assign({},t(this,qi,"f").styles)),t(this,qi,"f").errorTextStyles&&(t(this,Xi,"f").errorTextStyles=Object.assign({},t(this,qi,"f").errorTextStyles)),t(this,Zi,"f"))return i(this,Ji,t(this,en,"f").call(this,t(this,Xi,"f"),!1),"f"),t(this,Ji,"f").mount(e),void i(this,zi,!0,"f");t(this,Hi,"f").on(Ye+t(this,Bi,"f"),(()=>{i(this,Ji,t(this,en,"f").call(this,t(this,Xi,"f"),!1),"f"),t(this,Ji,"f").mount(e),i(this,zi,!0,"f")}))},this.unmount=()=>{t(this,Ji,"f").unmount()},this.collect=(e={tokens:!0})=>new Promise(((i,n)=>{try{if(kt(t(this,ji,"f").clientJSON.config),!t(this,zi,"f"))throw new Rt(yt.COMPOSABLE_CONTAINER_NOT_MOUNTED,[],!0);pi(t(this,Qi,"f")).forEach((e=>{if(!(null==e?void 0:e.isMounted))throw new Rt(yt.ELEMENTS_NOT_MOUNTED,[],!0)}));if(Object.values(t(this,Gi,"f")).forEach((e=>{e.isValidElement()})),e&&e.tokens&&"boolean"!=typeof e.tokens)throw new Rt(yt.INVALID_TOKENS_IN_COLLECT,[],!0);(null==e?void 0:e.additionalFields)&&St(e.additionalFields),(null==e?void 0:e.upsert)&&Ft(null==e?void 0:e.upsert),se.emit(Te+t(this,Bi,"f"),Object.assign(Object.assign({},e),{tokens:void 0===(null==e?void 0:e.tokens)||e.tokens}),(e=>{!e||(null==e?void 0:e.error)?(vt(`${JSON.stringify(null==e?void 0:e.error)}`,ft.ERROR,t(this,Wi,"f").logLevel),n(null==e?void 0:e.error)):(vt(At(re.COLLECT_SUBMIT_SUCCESS,dn),ft.LOG,t(this,Wi,"f").logLevel),i(e))})),vt(At(re.EMIT_EVENT,dn,Te),ft.LOG,t(this,Wi,"f").logLevel)}catch(e){vt(`${e.message}`,ft.ERROR,t(this,Wi,"f").logLevel),n(e)}})),rn.set(this,(()=>{t(this,Hi,"f").on(we,(e=>{let i;const n=t(this,Ki,"f").map(((t,n)=>t.elementName===e.elementName?(i=n,Object.assign({elementName:t.elementName},e.elementOptions)):t));t(this,Ji,"f")&&t(this,Ji,"f").updateElement(Object.assign({},n[i]))}))})),i(this,Bi,Ti(),"f"),i(this,ji,n,"f"),i(this,$i,o,"f"),i(this,Wi,s,"f"),i(this,qi,e,"f"),i(this,Hi,new nt,"f");const r=at({name:`${de}:${t(this,Bi,"f")}:${t(this,Wi,"f").logLevel}`});rt(r,{src:lt()}),dt(r,Object.assign({},$e)),vt(At(re.CREATE_COLLECT_CONTAINER,dn),ft.LOG,t(this,Wi,"f").logLevel);const a=(e,o)=>{e.name===de+t(this,Bi,"f")&&(o(Object.assign(Object.assign({},n),{clientJSON:Object.assign(Object.assign({},n.clientJSON),{config:Object.assign({},n.clientJSON.config)}),context:s})),i(this,Zi,!0,"f"),t(this,Hi,"f")._emit(Ye+t(this,Bi,"f"),{containerId:t(this,Bi,"f")}),se.target(ot.IFRAME_SECURE_ORGIN).off(Ne+t(this,Bi,"f"),a))};se.target(ot.IFRAME_SECURE_ORGIN).on(Ne+t(this,Bi,"f"),a),document.body.append(r),t(this,rn,"f").call(this)}}var En,_n,In,hn,un,pn,fn,Nn,Tn,On;Bi=new WeakMap,Gi=new WeakMap,ji=new WeakMap,Xi=new WeakMap,Ki=new WeakMap,Wi=new WeakMap,$i=new WeakMap,Hi=new WeakMap,zi=new WeakMap,qi=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,en=new WeakMap,tn=new WeakMap,nn=new WeakMap,on=new WeakMap,sn=new WeakMap,rn=new WeakMap;class Ln extends Kt{constructor(e,n={},o,s,r,a){super(),En.set(this,void 0),_n.set(this,void 0),In.set(this,void 0),hn.set(this,void 0),un.set(this,!1),pn.set(this,!1),fn.set(this,void 0),Nn.set(this,void 0),Tn.set(this,!1),On.set(this,void 0),i(this,Nn,r,"f"),i(this,_n,o,"f"),i(this,In,Object.assign(Object.assign({},e),(e=>{let t={};if(e){if(t=Object.assign({},e),Object.prototype.hasOwnProperty.call(t,"enableCopy")&&!xt(t.enableCopy))throw new Rt(yt.INVALID_BOOLEAN_OPTIONS,["enableCopy"],!0);if(Object.prototype.hasOwnProperty.call(t,"format")||Object.prototype.hasOwnProperty.call(t,"translation")){const e=[];t.format&&e.push(t.format),e.push(null),t.translation?e.push(t.translation):t.format&&e.push(it),t=Object.assign(Object.assign({},t),3===e.length?{mask:e}:{}),null==t||delete t.format,null==t||delete t.translation}}return t})(n)),"f"),i(this,hn,s.containerId,"f"),i(this,Tn,s.isMounted,"f"),i(this,On,s.eventEmitter,"f"),i(this,fn,a,"f"),i(this,En,new Xt(`reveal:${btoa(Ti())}`,{metaData:o},t(this,hn,"f"),t(this,fn,"f").logLevel),"f"),t(this,Tn,"f")||t(this,On,"f").on(xe,(e=>{(null==e?void 0:e.containerId)===t(this,hn,"f")&&i(this,Tn,!0,"f")})),vt(At(re.CREATED_ELEMENT,"RevealElement",`${e.token||""} reveal `),ft.LOG,t(this,fn,"f").logLevel)}getID(){return t(this,Nn,"f")}mount(e){var n;if(!e)throw new Rt(yt.EMPTY_ELEMENT_IN_MOUNT,["RevealElement"],!0);const o=(e,n)=>{e.name===t(this,En,"f").name&&(n(Object.assign(Object.assign({},t(this,_n,"f")),{record:t(this,In,"f"),context:t(this,fn,"f")})),se.off(me,o),se.emit(Ue+t(this,hn,"f"),{id:t(this,In,"f").token,containerId:t(this,hn,"f")}),i(this,un,!0,"f"))};if(t(this,Tn,"f"))return t(this,En,"f").mount(e),void se.target(ot.IFRAME_SECURE_ORGIN).on(me,o);null===(n=t(this,On,"f"))||void 0===n||n.on(xe,(i=>{(null==i?void 0:i.containerId)===t(this,hn,"f")&&(t(this,En,"f").mount(e),se.target(ot.IFRAME_SECURE_ORGIN).on(me,o))}))}iframeName(){return t(this,En,"f").name}isMounted(){return t(this,un,"f")}hasToken(){return!!t(this,In,"f").token}isClientSetError(){return t(this,pn,"f")}getRecordData(){return t(this,In,"f")}setError(e){se.emit(ge,{name:t(this,En,"f").name,isTriggerError:!0,clientErrorText:e}),i(this,pn,!0,"f")}resetError(){se.emit(ge,{name:t(this,En,"f").name,isTriggerError:!1}),i(this,pn,!1,"f")}setAltText(e){se.emit(Ce,{name:t(this,En,"f").name,updateType:Ve,updatedValue:e})}clearAltText(){se.emit(Ce,{name:t(this,En,"f").name,updateType:Ve,updatedValue:null})}setToken(e){i(this,In,Object.assign(Object.assign({},t(this,In,"f")),{token:e}),"f"),se.emit(Ce,{name:t(this,En,"f").name,updateType:Pe,updatedValue:e})}unmount(){t(this,En,"f").unmount()}}var vn,An,mn,Rn,yn,Dn,Sn,gn,Cn,bn,wn;En=new WeakMap,_n=new WeakMap,In=new WeakMap,hn=new WeakMap,un=new WeakMap,pn=new WeakMap,fn=new WeakMap,Nn=new WeakMap,Tn=new WeakMap,On=new WeakMap;const Mn="RevealContainer";class Pn extends Oi{constructor(e,n,o){super(),vn.set(this,[]),An.set(this,[]),mn.set(this,[]),Rn.set(this,void 0),yn.set(this,void 0),Dn.set(this,void 0),Sn.set(this,!1),gn.set(this,!1),Cn.set(this,void 0),bn.set(this,void 0),wn.set(this,void 0),this.type=no.REVEAL,i(this,Rn,e,"f"),i(this,bn,n,"f"),i(this,yn,Ti(),"f"),i(this,Dn,new nt,"f"),i(this,Cn,o,"f");const s=at({name:`${ce}:${t(this,yn,"f")}`});rt(s,{src:lt()}),dt(s,Object.assign({},$e)),vt(At(re.CREATE_REVEAL_CONTAINER,Mn),ft.LOG,t(this,Cn,"f").logLevel);const r=(n,s)=>{n.name===ce&&(s(Object.assign(Object.assign({},e),{clientJSON:Object.assign(Object.assign({},e.clientJSON),{config:Object.assign({},e.clientJSON.config),context:o})})),i(this,wn,!0,"f"),t(this,Dn,"f")._emit(xe,{containerId:t(this,yn,"f")}),se.target(ot.IFRAME_SECURE_ORGIN).off(me+t(this,yn,"f"),r))};se.target(ot.IFRAME_SECURE_ORGIN).on(me+t(this,yn,"f"),r),document.body.append(s),se.target(window.location.origin).on(Ue+t(this,yn,"f"),(e=>{t(this,mn,"f").push(e);let n=0;t(this,An,"f").forEach((e=>{e.getRecordData().skyflowID||(n+=1)})),i(this,gn,t(this,mn,"f").length===n,"f"),t(this,Sn,"f")&&t(this,gn,"f")&&t(this,Dn,"f")._emit(ke+t(this,yn,"f"),{containerId:t(this,yn,"f")})}))}create(e,i){const n=Ti();Bt(i);const o=new Ln(e,i,t(this,Rn,"f"),{containerId:t(this,yn,"f"),isMounted:t(this,wn,"f"),eventEmitter:t(this,Dn,"f")},n,t(this,Cn,"f"));return t(this,An,"f").push(o),t(this,bn,"f")[n]=o,o}reveal(){return i(this,Sn,!0,"f"),t(this,gn,"f")?new Promise(((e,n)=>{try{kt(t(this,Rn,"f").clientJSON.config),vt(At(re.VALIDATE_REVEAL_RECORDS,Mn),ft.LOG,t(this,Cn,"f").logLevel),t(this,An,"f").forEach((e=>{if(e.isClientSetError())throw new Rt(yt.REVEAL_ELEMENT_ERROR_STATE);e.getRecordData().skyflowID||t(this,vn,"f").push(e.getRecordData())})),Mt(t(this,vn,"f")),se.emit(Ae+t(this,yn,"f"),{records:t(this,vn,"f")},(o=>{i(this,mn,[],"f"),i(this,vn,[],"f"),o.error?(vt(ae.FAILED_REVEAL,ft.ERROR,t(this,Cn,"f").logLevel),n(o.error)):(vt(At(re.REVEAL_SUBMIT_SUCCESS,Mn),ft.LOG,t(this,Cn,"f").logLevel),e(o))})),vt(At(re.EMIT_EVENT,Mn,Ae),ft.LOG,t(this,Cn,"f").logLevel)}catch(e){vt(`Error: ${e.message}`,ft.ERROR,t(this,Cn,"f").logLevel),n(e)}})):new Promise(((e,n)=>{try{kt(t(this,Rn,"f").clientJSON.config),vt(At(re.VALIDATE_REVEAL_RECORDS,Mn),ft.LOG,t(this,Cn,"f").logLevel);const o=setTimeout((()=>{vt(ae.ELEMENTS_NOT_MOUNTED_REVEAL,ft.ERROR,t(this,Cn,"f").logLevel),n(ae.ELEMENTS_NOT_MOUNTED_REVEAL)}),3e4);t(this,An,"f").forEach((e=>{if(e.isClientSetError())throw clearTimeout(o),new Rt(yt.REVEAL_ELEMENT_ERROR_STATE);e.getRecordData().skyflowID||t(this,vn,"f").push(e.getRecordData())})),Mt(t(this,vn,"f")),t(this,Dn,"f").on(ke+t(this,yn,"f"),(()=>{clearTimeout(o),se.emit(Ae+t(this,yn,"f"),{records:t(this,vn,"f")},(o=>{i(this,vn,[],"f"),i(this,mn,[],"f"),o.error?(vt(ae.FAILED_REVEAL,ft.ERROR,t(this,Cn,"f").logLevel),n(o.error)):(vt(At(re.REVEAL_SUBMIT_SUCCESS,Mn),ft.LOG,t(this,Cn,"f").logLevel),e(o))}))}))}catch(e){vt(e.message,ft.ERROR,t(this,Cn,"f").logLevel),n(e)}}))}}vn=new WeakMap,An=new WeakMap,mn=new WeakMap,Rn=new WeakMap,yn=new WeakMap,Dn=new WeakMap,Sn=new WeakMap,gn=new WeakMap,Cn=new WeakMap,bn=new WeakMap,wn=new WeakMap;const Vn=(e,t)=>{if(e.fields){return{success:{skyflow_id:e.fields.skyflow_id,column:t}}}return e};var Un,kn,Yn,Fn;const xn="SkyflowContainer";class Bn{constructor(e,n){var o,s;Un.set(this,void 0),kn.set(this,void 0),Yn.set(this,!1),Fn.set(this,void 0),i(this,kn,e,"f"),i(this,Un,(null===(s=null===(o=t(this,kn,"f").toJSON())||void 0===o?void 0:o.metaData)||void 0===s?void 0:s.uuid)||"","f"),i(this,Fn,n,"f");const r=at({name:`skyflow_controller:${t(this,Un,"f")}`});rt(r,{src:lt()}),dt(r,Object.assign({},$e)),document.body.append(r),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),((e,o)=>{vt(At(re.CAPTURE_PUREJS_FRAME,xn),ft.LOG,t(this,Fn,"f").logLevel),o({client:t(this,kn,"f"),context:n}),i(this,Yn,!0,"f")})),vt(At(re.PUREJS_CONTROLLER_INITIALIZED,xn),ft.LOG,t(this,Fn,"f").logLevel)}detokenize(e){return t(this,Yn,"f")?new Promise(((i,n)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_DETOKENIZE_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),gt(e),se.emit(Re+t(this,Un,"f"),{type:Ie,records:e.records},(e=>{e.error?n(e.error):i(e)})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,Ie),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),n(e)}})):new Promise(((i,n)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_DETOKENIZE_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),gt(e),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Re+t(this,Un,"f"),{type:Ie,records:e.records},(e=>{e.error?n(e.error):i(e)}))})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,Ie),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),n(e)}}))}insert(e,i){return t(this,Yn,"f")?new Promise(((n,o)=>{kt(t(this,kn,"f").config);try{vt(At(re.VALIDATE_RECORDS,xn),ft.LOG,t(this,Fn,"f").logLevel),(null==(i=i?Object.assign(Object.assign({},i),{tokens:void 0===(null==i?void 0:i.tokens)||i.tokens}):{tokens:!0})?void 0:i.upsert)&&Ft(i.upsert),Dt(e,i),se.emit(Re+t(this,Un,"f"),{type:_e,records:e,options:i},(e=>{e.error?(vt(`${JSON.stringify(e.error)}`,ft.ERROR,t(this,Fn,"f").logLevel),o(e.error)):n(e)})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,_e),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_RECORDS,xn),ft.LOG,t(this,Fn,"f").logLevel),(null==(i=i?Object.assign(Object.assign({},i),{tokens:void 0===(null==i?void 0:i.tokens)||i.tokens}):{tokens:!0})?void 0:i.upsert)&&Ft(i.upsert),Dt(e,i),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Re+t(this,Un,"f"),{type:_e,records:e,options:i},(e=>{e.error?(vt(`${JSON.stringify(e.error)}`,ft.ERROR,t(this,Fn,"f").logLevel),o(e.error)):n(e)}))})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,_e),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}}))}getById(e){return t(this,Yn,"f")?new Promise(((i,n)=>{kt(t(this,kn,"f").config);try{vt(At(re.VALIDATE_GET_BY_ID_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),bt(e),se.emit(Re+t(this,Un,"f"),{type:he,records:e.records},(e=>{e.error?n(e.error):i(e)})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,he),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),n(e)}})):new Promise(((i,n)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_GET_BY_ID_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),bt(e),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Re+t(this,Un,"f"),{type:he,records:e.records},(e=>{e.error?n(e.error):i(e)}))})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,he),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),n(e)}}))}get(e,i){return t(this,Yn,"f")?new Promise(((n,o)=>{kt(t(this,kn,"f").config);try{vt(At(re.VALIDATE_GET_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),Ct(e,i),se.emit(Re+t(this,Un,"f"),{type:ue,records:e.records,options:i},(e=>{e.error?o(e.error):n(e)})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,ue),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_GET_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),Ct(e,i),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Re+t(this,Un,"f"),{type:ue,records:e.records,options:i},(e=>{e.error?o(e.error):n(e)}))})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,ue),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}}))}delete(e,i){return t(this,Yn,"f")?new Promise(((n,o)=>{kt(t(this,kn,"f").config);try{vt(At(re.VALIDATE_DELETE_INPUT,xn),ft.LOG,t(this,Fn,"f").logLevel),wt(e),se.emit(Re+t(this,Un,"f"),{type:pe,records:e,options:i},(e=>{e.error?(vt(`${JSON.stringify(e.error)}`,ft.ERROR,t(this,Fn,"f").logLevel),o(e.error)):n(e)})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,pe),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_RECORDS,xn),ft.LOG,t(this,Fn,"f").logLevel),wt(e),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Re+t(this,Un,"f"),{type:pe,records:e,options:i},(e=>{e.error?(vt(`${JSON.stringify(e.error)}`,ft.ERROR,t(this,Fn,"f").logLevel),o(e.error)):n(e)}))})),vt(At(re.EMIT_PURE_JS_REQUEST,xn,pe),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(e.message,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}}))}renderFile(e,i){return t(this,Yn,"f")?new Promise(((i,n)=>{try{kt(t(this,kn,"f").config),vt(At(re.VALIDATE_RENDER_RECORDS,xn),ft.LOG,t(this,Fn,"f").logLevel),Pt(e),se.emit(Me+t(this,Un,"f"),{records:e},(t=>{t.errors?n(Vn(t,e.column)):i(t)})),vt(At(re.EMIT_EVENT,xn,Me),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(`Error: ${e.message}`,ft.ERROR,t(this,Fn,"f").logLevel),n(e)}})):new Promise(((n,o)=>{try{kt(i.clientJSON.config),vt(At(re.VALIDATE_RENDER_RECORDS,xn),ft.LOG,t(this,Fn,"f").logLevel),Pt(e),se.target(ot.IFRAME_SECURE_ORGIN).on(ye+t(this,Un,"f"),(()=>{se.emit(Me+t(this,Un,"f"),{records:e,metaData:i.clientJSON},(t=>{t.errors?o(Vn(t,e.column)):n(t)})),vt(At(re.EMIT_EVENT,xn,Me),ft.LOG,t(this,Fn,"f").logLevel)})),vt(At(re.EMIT_EVENT,xn,Me),ft.LOG,t(this,Fn,"f").logLevel)}catch(e){vt(`Error: ${e.message}`,ft.ERROR,t(this,Fn,"f").logLevel),o(e)}}))}}function Gn(e){this.message=e}Un=new WeakMap,kn=new WeakMap,Yn=new WeakMap,Fn=new WeakMap,Gn.prototype=new Error,Gn.prototype.name="InvalidCharacterError";var jn="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Gn("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,n,o=0,s=0,r="";n=t.charAt(s++);~n&&(i=o%4?64*i+n:n,o++%4)?r+=String.fromCharCode(255&i>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return r};function Xn(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(jn(e).replace(/(.)/g,(function(e,t){var i=t.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}(t)}catch(e){return jn(t)}}function Kn(e){this.message=e}Kn.prototype=new Error,Kn.prototype.name="InvalidTokenError";const Wn=e=>{try{if(!e)return!1;if(t=e,"[object String]"!==Object.prototype.toString.call(t))return!1;let i=!1;const n=function(e,t){if("string"!=typeof e)throw new Kn("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse(Xn(e.split(".")[i]))}catch(e){throw new Kn("Invalid token specified: "+e.message)}}(e),o=(new Date).getTime()/1e3,s=n.exp;return s&&o>s&&(i=!0),!i}catch(e){return!1}var t};var $n,Hn,zn,qn,Jn,Zn,Qn,eo,to,io,no,oo={name:"skyflow-js",preferGlobal:!0,analyze:!1,version:"1.30.1",author:"Skyflow",description:"Skyflow JavaScript SDK"};class so{constructor(e,n){$n.set(this,void 0),this.request=e=>new Promise(((i,n)=>{var o,s,r,a;const l=new XMLHttpRequest;if(l){if(l.open(e.requestMethod,e.url),e.headers){const i=function(e,t,i){var n,o,s,r,a;const l={sdkName:e.name,sdkVersion:e.version},d=function(e,t){return""!==e?`${e}`:`${t.sdkName}@${t.sdkVersion}`}(t.sdkVersion,l),c=function(e){var t,i,n,o,s,r,a,l,d,c,E,_;let I=null,h=null;return/Windows/.test(e)?(I="Windows",h=null!==(i=null===(t=/Windows NT (\d+\.\d+)/.exec(e))||void 0===t?void 0:t[1])&&void 0!==i?i:null):/Android/.test(e)?(I="Android",h=null!==(o=null===(n=/Android (\d+\.\d+)/.exec(e))||void 0===n?void 0:n[1])&&void 0!==o?o:null):/iOS/.test(e)||/iPhone/.test(e)?(I="iOS",h=null!==(a=null===(r=null===(s=/OS (\d+[._]\d+[._]?\d*)/.exec(e))||void 0===s?void 0:s[1])||void 0===r?void 0:r.replace(/_/g,"."))&&void 0!==a?a:null):/Mac OS X/.test(e)?(I="Mac OS X",h=null!==(c=null===(d=null===(l=/Mac OS X (\d+([._]\d+)*)/.exec(e))||void 0===l?void 0:l[1])||void 0===d?void 0:d.replace(/_/g,"."))&&void 0!==c?c:null):/Linux/.test(e)&&(I="Linux",h=null!==(_=null===(E=/Linux( \w+)*?\/([\w.]+)/.exec(e))||void 0===E?void 0:E[2])&&void 0!==_?_:null),{os:I,version:h}}(i.userAgent),E=function(e){let t="",i="";if(-1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")){t="Internet Explorer";const n=e.match(/(MSIE|rv:)\s?([\d.]+)/);n&&(i=n[2])}else if(-1!==e.indexOf("Edge")){t="Microsoft Edge";const n=e.match(/Edge\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Chrome")){t="Google Chrome";const n=e.match(/Chrome\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Firefox")){t="Mozilla Firefox";const n=e.match(/Firefox\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Safari")){t="Apple Safari";const n=e.match(/Version\/([\d.]+)/);n&&(i=n[1])}return{browserName:t,browserVersion:i}}(i.userAgent);var _;return{sdk_name_version:d,sdk_client_device_model:(_=i.userAgent,/(ipad|tablet)/gi.test(_)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile/.test(_)?"mobile":"desktop"),sdk_os_version:null!==(n=i.platform)&&void 0!==n?n:`${null!==(o=c.os)&&void 0!==o?o:""} ${null!==(s=c.version)&&void 0!==s?s:""}`,sdk_runtime_details:`${null!==(r=E.browserName)&&void 0!==r?r:""} ${null!==(a=E.browserVersion)&&void 0!==a?a:""}`}}(oo,t(this,$n,"f"),navigator);e.headers["sky-metadata"]=JSON.stringify(i);const{headers:n}=e;Object.keys(e.headers).forEach((e=>{"content-type"===e&&n[e]&&n[e].includes(et.FORMDATA)||l.setRequestHeader(e,n[e])}))}(null===(s=null===(o=e.headers)||void 0===o?void 0:o["content-type"])||void 0===s?void 0:s.includes(et.FORMURLENCODED))||(null===(a=null===(r=e.headers)||void 0===r?void 0:r["content-type"])||void 0===a?void 0:a.includes(et.FORMDATA))?l.send(e.body):l.send(JSON.stringify(Object.assign({},e.body))),l.onload=()=>{var e,t,o;const s=l.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};s.forEach((e=>{const t=e.split(": "),i=t.shift()||"",n=t.join(": ");r[i]=n}));const a=r["content-type"],d=r["x-request-id"];if(l.status<200||l.status>=400)if(a&&a.includes("application/json")){let i=JSON.parse(l.response);(null===(e=null==i?void 0:i.error)||void 0===e?void 0:e.message)&&(i=d?`${null===(t=null==i?void 0:i.error)||void 0===t?void 0:t.message} - requestId: ${d}`:null===(o=null==i?void 0:i.error)||void 0===o?void 0:o.message),n(new Rt({code:l.status,description:i},[],!0))}else a&&a.includes("text/plain")?n(new Rt({code:l.status,description:d?`${l.response} - requestId: ${d}`:l.response},[],!0)):n(new Rt({code:l.status,description:d?`${ae.ERROR_OCCURED} - requestId: ${d}`:ae.ERROR_OCCURED},[],!0));a&&a.includes("application/json")&&i(JSON.parse(l.response)),i(l.response)},l.onerror=()=>{n(new Rt(yt.NETWORK_ERROR,[],!0))}}else n(new Rt(yt.CONNECTION_ERROR,[],!0))})),this.config=e,i(this,$n,n,"f")}toJSON(){return{config:this.config,metaData:t(this,$n,"f")}}static fromJSON(e){return new so(e.config,e.metaData)}}$n=new WeakMap,function(e){e.COLLECT="COLLECT",e.REVEAL="REVEAL",e.COMPOSABLE="COMPOSABLE"}(no||(no={}));const ro="Skyflow";class ao{constructor(e){var n,o;Hn.set(this,void 0),zn.set(this,Ti()),qn.set(this,{uuid:t(this,zn,"f"),clientDomain:window.location.origin}),Jn.set(this,void 0),Zn.set(this,""),Qn.set(this,void 0),eo.set(this,void 0),to.set(this,void 0),io.set(this,void 0);const s=localStorage.getItem("sdk_version")||"";t(this,qn,"f").sdkVersion=s,i(this,Hn,new so(Object.assign({},e),t(this,qn,"f")),"f"),i(this,eo,(null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.logLevel)||ut.ERROR,"f"),i(this,to,(null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.env)||pt.PROD,"f"),i(this,io,{},"f"),i(this,Jn,new Bn(t(this,Hn,"f"),{logLevel:t(this,eo,"f"),env:t(this,to,"f")}),"f");se.target(ot.IFRAME_SECURE_ORGIN).on(De+t(this,zn,"f"),((e,n)=>{vt(At(re.CAPTURED_BEARER_TOKEN_EVENT,ro),ft.LOG,t(this,eo,"f")),!t(this,Hn,"f").config.getBearerToken||t(this,Zn,"f")&&Wn(t(this,Zn,"f"))?(vt(At(re.REUSE_BEARER_TOKEN,ro),ft.LOG,t(this,eo,"f")),n({authToken:t(this,Zn,"f")})):t(this,Hn,"f").config.getBearerToken().then((e=>{Wn(e)?(vt(At(re.BEARER_TOKEN_RESOLVED,ro),ft.LOG,t(this,eo,"f")),i(this,Zn,e,"f"),n({authToken:t(this,Zn,"f")})):(vt(ae.INVALID_BEARER_TOKEN,ft.ERROR,t(this,eo,"f")),n({error:ae.INVALID_BEARER_TOKEN}))})).catch((e=>{vt(ae.BEARER_TOKEN_REJECTED,ft.ERROR,t(this,eo,"f")),n({error:e})}))})),vt(At(re.BEARER_TOKEN_LISTENER,ro),ft.LOG,t(this,eo,"f")),vt(At(re.CURRENT_ENV,ro,t(this,to,"f")),ft.LOG,t(this,eo,"f")),vt(At(re.CURRENT_LOG_LEVEL,ro,t(this,eo,"f")),ft.LOG,t(this,eo,"f"))}static init(e){var t;const i=(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.logLevel)||ut.ERROR;!function(e){var t,i,n,o;if((null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.customElementsURL)&&Vt(null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.customElementsURL)){const t=null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.customElementsURL,i=new URL(t),s=`${i.protocol}//${i.hostname}`;ot.IFRAME_SECURE_ORGIN=s,ot.IFRAME_SECURE_SITE=null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.customElementsURL}}(e),vt(At(re.INITIALIZE_CLIENT,ro),ft.LOG,i);const n=e;var o;n.vaultURL="string"!=typeof(o=e.vaultURL)?o:"/"===(null==o?void 0:o.trim().slice(-1))?o.slice(0,-1):o.trim();const s=new ao(n);return vt(At(re.CLIENT_INITIALIZED,ro),ft.LOG,i),s}container(e,i){switch(e){case no.COLLECT:{const n=new Pi(i,Object.assign(Object.assign({},t(this,qn,"f")),{clientJSON:t(this,Hn,"f").toJSON(),containerType:e}),t(this,io,"f"),{logLevel:t(this,eo,"f"),env:t(this,to,"f")});return vt(At(re.COLLECT_CONTAINER_CREATED,ro),ft.LOG,t(this,eo,"f")),n}case no.REVEAL:{const i=new Pn(Object.assign(Object.assign({},t(this,qn,"f")),{clientJSON:t(this,Hn,"f").toJSON(),containerType:e,skyflowContainer:t(this,Jn,"f")}),t(this,io,"f"),{logLevel:t(this,eo,"f")});return vt(At(re.REVEAL_CONTAINER_CREATED,ro),ft.LOG,t(this,eo,"f")),i}case no.COMPOSABLE:{(e=>{if(!e)throw new Rt(yt.MISSING_COMPOSABLE_CONTAINER_OPTIONS,[],!0);if("object"!=typeof e)throw new Rt(yt.INVALID_COMPOSABLE_CONTAINER_OPTIONS,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"layout"))throw new Rt(yt.MISSING_COMPOSABLE_LAYOUT_KEY,[],!0);if(!e.layout)throw new Rt(yt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(!Array.isArray(e.layout))throw new Rt(yt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(0===e.layout.length)throw new Rt(yt.EMPTY_COMPOSABLE_LAYOUT_ARRAY,[],!0);e.layout.forEach((e=>{if("number"!=typeof e)throw new Rt(yt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(e<0)throw new Rt(yt.NEGATIVE_VALUES_COMPOSABLE_LAYOUT,[],!0)}))})(i);const n=new cn(i,Object.assign(Object.assign({},t(this,qn,"f")),{clientJSON:t(this,Hn,"f").toJSON(),containerType:e}),t(this,io,"f"),{logLevel:t(this,eo,"f"),env:t(this,to,"f")});return vt(At(re.COLLECT_CONTAINER_CREATED,ro),ft.LOG,t(this,eo,"f")),n}default:if(!e)throw new Rt(yt.EMPTY_CONTAINER_TYPE,[],!0);throw new Rt(yt.INVALID_CONTAINER_TYPE,[],!0)}}insert(e,i){return vt(At(re.INSERT_TRIGGERED,ro),ft.LOG,t(this,eo,"f")),t(this,Jn,"f").insert(e,i)}detokenize(e){return vt(At(re.DETOKENIZE_TRIGGERED,ro),ft.LOG,t(this,eo,"f")),t(this,Jn,"f").detokenize(e)}getById(e){return vt(le.GET_BY_ID_DEPRECATED,ft.WARN,t(this,eo,"f")),vt(At(re.GET_BY_ID_TRIGGERED,ro),ft.LOG,t(this,eo,"f")),t(this,Jn,"f").getById(e)}get(e,i){return vt(At(re.GET_TRIGGERED,ro),ft.LOG,t(this,eo,"f")),t(this,Jn,"f").get(e,i)}delete(e,i){return vt(At(re.DELETE_TRIGGERED,ro),ft.LOG,t(this,eo,"f")),t(this,Jn,"f").delete(e,i)}static get ContainerType(){return no}static get ElementType(){return Be}static get RedactionType(){return _t}static get RequestMethod(){return It}static get LogLevel(){return ut}static get EventName(){return ht}static get Env(){return pt}static get ValidationRuleType(){return Nt}}Hn=new WeakMap,zn=new WeakMap,qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,eo=new WeakMap,to=new WeakMap,io=new WeakMap;class lo{constructor(e){this.loadFunction=e,this.loadScript()}get loader(){return this.loadingPromise||(this.loadingPromise=this.loadScript()),this.loadingPromise}loadScript(){return e(this,void 0,void 0,(function*(){return this.loadingPromise||(this.loadingPromise=new Promise(((e,t)=>{this.loadFunction().then((t=>{t&&e(t)}),(()=>{t()})).catch((()=>{}))}))),this.loadingPromise}))}}class co extends L{constructor(e){super("span",{id:e.id,className:"payrails-store-instrument"}),this.options=e,this.createHTML(),this.applyStyles(),this.addListeners()}get isChecked(){var e;return!!(null===(e=this.element.querySelector("input"))||void 0===e?void 0:e.checked)}createHTML(){var e,t,i,n,o,s,r,a,l;const d=(null===(i=null===(t=null===(e=this.options)||void 0===e?void 0:e.translations)||void 0===t?void 0:t.labels)||void 0===i?void 0:i.saveInstrument)||(null===(s=null===(o=null===(n=this.options)||void 0===n?void 0:n.translations)||void 0===o?void 0:o.labels)||void 0===s?void 0:s.storeInstrument)||"Save instrument for future payments",c=`${this.id}-checkbox`;(null===(l=null===(a=null===(r=this.options)||void 0===r?void 0:r.translations)||void 0===a?void 0:a.labels)||void 0===l?void 0:l.saveInstrument)&&console.warn("The saveInstrument label is deprecated, please use storeInstrument instead"),this.element.innerHTML=`<label for="${c}"><input type="checkbox" id="${c}" name="${c}" class="payrails-store-instrument-checkbox">${d}</label>`}applyStyles(){var e,t;Object.keys((null===(t=null===(e=this.options)||void 0===e?void 0:e.styles)||void 0===t?void 0:t.storeInstrumentCheckbox)||{}).forEach((e=>{var t,i,n;this.element.style[e]=null===(n=null===(i=null===(t=this.options)||void 0===t?void 0:t.styles)||void 0===i?void 0:i.storeInstrumentCheckbox)||void 0===n?void 0:n[e]}))}addListeners(){this.element.addEventListener("change",(e=>{var t,i,n,o;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onSaveInstrumentCheckboxChanged)&&(null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o||o.onSaveInstrumentCheckboxChanged({checked:this.isChecked})),e.stopPropagation(),e.stopImmediatePropagation()}))}}class Eo extends L{constructor(t,i){var n,o;super(t,i),this.options=i,this.storeInstrumentCheckbox=null,(null===(n=this.options)||void 0===n?void 0:n.showStoreInstrumentCheckbox)&&(this.storeInstrumentCheckbox=new co(Object.assign(Object.assign({},i),{id:`${null===(o=this.options)||void 0===o?void 0:o.id}-store-instrument-checkbox`,events:{onSaveInstrumentCheckboxChanged:t=>e(this,void 0,void 0,(function*(){var e,n;null===(n=null===(e=null==i?void 0:i.events)||void 0===e?void 0:e.onSaveInstrumentCheckboxChanged)||void 0===n||n.call(e,t)}))}})),this.subElements.push(this.storeInstrumentCheckbox))}get shouldStoreInstrument(){var e,t;return(null===(e=this.storeInstrumentCheckbox)||void 0===e?void 0:e.isChecked)||(null===(t=this.options)||void 0===t?void 0:t.alwaysStoreInstrument)||!1}}class _o extends Eo{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-apple-pay-button"})),this.sdkConfig=t,this.execution=i,this.options=n,this.appleButton=null,this.paymentExecutor=new p(t,i),this.loadScript=new lo((()=>e(this,void 0,void 0,(function*(){const t=document.createElement("script");return t.src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",new Promise(((i,n)=>{t.onload=()=>e(this,void 0,void 0,(function*(){var e,t,n;(yield this.isApplePayAvailable())?(null===(n=null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onApplePayAvailable)||void 0===n||n.call(t),i(!0)):i(!1)})),t.onerror=()=>{n()},document.body.appendChild(t)}))}))))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){try{yield this.loadScript.loader,yield this.mountApplePayButton()}catch(e){}}))})()}unmount(){var e,t;null===(t=null===(e=this.appleButton)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this.appleButton),super.unmount()}isApplePayAvailable(){return e(this,void 0,void 0,(function*(){if(!(null===window||void 0===window?void 0:window.ApplePaySession))return!1;return yield ApplePaySession.canMakePayments()}))}mountApplePayButton(){var t,i,n,o,s;return e(this,void 0,void 0,(function*(){if(null===window||void 0===window?void 0:window.ApplePaySession)try{if(!this.isApplePayAvailable())return;null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onApplePayAvailable)||void 0===i||i.call(t);const e=(null===(n=this.options.styles)||void 0===n?void 0:n.type)||"buy",r=(null===(o=this.options.styles)||void 0===o?void 0:o.style)||"black";this.element.innerHTML=`<apple-pay-button buttonstyle="${r}" type="${e}" locale="en-GB"></apple-pay-button>`,null===(s=this.storeInstrumentCheckbox)||void 0===s||s.mount(this.selector);const a=this.element.querySelector("apple-pay-button");null==a||a.setAttribute("style","width: 100%;"),null==a||a.addEventListener("click",(()=>{this.createApplePaySession()}))}catch(e){}}))}createApplePaySession(){const t=this.execution.applePayConfig,{countryCode:i,supportedNetworks:n,merchantCapabilities:o}=t,{amount:s}=this.sdkConfig;try{const t={countryCode:i,currencyCode:s.currency,merchantCapabilities:o,supportedNetworks:n,total:{label:"",type:"final",amount:s.value}},r=new ApplePaySession(3,t);return r.onvalidatemerchant=t=>e(this,void 0,void 0,(function*(){const{res:e}=yield this.paymentExecutor.createApplePaySession({requestUrl:this.execution.createSessionLink,sessionUrl:t.validationURL,clientDomain:this.options.clientDomain}),i=e.data.data;r.completeMerchantValidation(i)})),r.onpaymentauthorized=t=>e(this,void 0,void 0,(function*(){var e,i,n,o,s,a,l,d,c,E,_,I;try{const E=yield this.onApplePayAuthorized(t.payment.token);if("authorizeSuccessful"===(null===(e=null==E?void 0:E.finalState)||void 0===e?void 0:e.code))(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)&&this.options.events.onAuthorizeSuccess();else r.completePayment(ApplePaySession.STATUS_FAILURE),(null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o?void 0:o.onAuthorizeFailed)&&(null===(s=this.options)||void 0===s||s.events.onAuthorizeFailed());r.completePayment(ApplePaySession.STATUS_SUCCESS),(null===(l=null===(a=this.options)||void 0===a?void 0:a.events)||void 0===l?void 0:l.onAuthorizeSuccess)&&(null===(c=null===(d=this.options)||void 0===d?void 0:d.events)||void 0===c||c.onAuthorizeSuccess(E))}catch(e){r.completePayment(ApplePaySession.STATUS_FAILURE),(null===(_=null===(E=this.options)||void 0===E?void 0:E.events)||void 0===_?void 0:_.onAuthorizeFailed)&&(null===(I=this.options)||void 0===I||I.events.onAuthorizeFailed(e))}})),r.begin(),r}catch(e){return null}}onApplePayAuthorized(t){return e(this,void 0,void 0,(function*(){const e={paymentData:t.paymentData,transactionIdentifier:t.transactionIdentifier,paymentNetwork:t.paymentMethod.network,paymentInstrumentName:t.paymentMethod.displayName},i=[{paymentMethodCode:"applePay",integrationType:"api",paymentInstrumentData:{paymentToken:JSON.stringify(e)},amount:this.sdkConfig.amount,storeInstrument:this.shouldStoreInstrument}];return yield this.paymentExecutor.pay(i)}))}}const{CARD_NUMBER:Io,CVV:ho,CARDHOLDER_NAME:uo,EXPIRATION_MONTH:po,EXPIRATION_YEAR:fo}=exports.ElementType,No={base:{border:"none",padding:"10px 16px",color:"#1d1d1d",backgroundColor:"#fff"},invalid:{backgroundColor:"#f9e1e1",borderColor:"#f25226",border:"1px solid"}},To=[{type:uo,placeholder:"Card holder",styles:Object.assign(Object.assign({},No),{base:Object.assign(Object.assign({},No.base),{border:"1px solid #eae8ee",padding:"10px 16px",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"})})},{type:Io,placeholder:"1234 1234 1234 1234",styles:Object.assign(Object.assign({},No),{base:Object.assign(Object.assign({},No.base),{border:"1px solid #eae8ee",padding:"10px 16px",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",textIndent:"0"}),cardIcon:{position:"absolute",right:"8px",height:"24px",bottom:"calc(50% - 12px)"}})},{type:po,placeholder:"MM",styles:Object.assign(Object.assign({},No),{base:Object.assign(Object.assign({},No.base),{borderBottom:"1px solid #eae8ee",borderLeft:"1px solid #eae8ee",borderRight:"1px solid #eae8ee",borderBottomLeftRadius:"4px"})})},{type:fo,placeholder:"YY",format:"YY",styles:Object.assign(Object.assign({},No),{base:Object.assign(Object.assign({},No.base),{borderBottom:"1px solid #eae8ee",borderRight:"1px solid #eae8ee"})})},{type:ho,placeholder:"CVC",styles:Object.assign(Object.assign({},No),{base:Object.assign(Object.assign({},No.base),{borderBottom:"1px solid #eae8ee",borderRight:"1px solid #eae8ee",borderBottomRightRadius:"4px"})})}];class Oo extends Eo{get bin(){return this.collectContainer.bin}constructor(e,t){var i,n,o,s,r;super("div",Object.assign(Object.assign({},t),{translations:Object.assign(Object.assign({},null==t?void 0:t.translations),{labels:Object.assign(Object.assign({},null===(i=null==t?void 0:t.translations)||void 0===i?void 0:i.labels),{saveInstrument:null===(o=null===(n=null==t?void 0:t.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.saveCreditCard})}),styles:Object.assign({storeInstrumentCheckbox:null===(s=null==t?void 0:t.styles)||void 0===s?void 0:s.storeCardCheckbox},null==t?void 0:t.styles),id:"payrails-card-form"})),this.collectContainer=e,this.options=t,this.formFields=[],(null===(r=null==t?void 0:t.styles)||void 0===r?void 0:r.storeCardCheckbox)&&console.warn("The `storeCardCheckbox` option for styles is deprecated. Please use `storeInstrumentCheckbox` instead."),To.forEach((({type:e,styles:i,format:n,placeholder:o})=>{var s,r,a,l,d,c,E;if(!(null===(s=this.options)||void 0===s?void 0:s.showCardHolderName)&&e===exports.ElementType.CARDHOLDER_NAME)return;const _=new Lo(this.collectContainer,{type:e,label:null===(a=null===(r=null==t?void 0:t.translations)||void 0===r?void 0:r.labels)||void 0===a?void 0:a[e],placeholder:(null===(d=null===(l=null==t?void 0:t.translations)||void 0===l?void 0:l.placeholders)||void 0===d?void 0:d[e])||o,labelStyles:this.prepareLabelStyles(e),inputStyles:this.prepareInputStyles(i,e),format:n,events:{onFocus:null===(E=null===(c=this.options)||void 0===c?void 0:c.events)||void 0===E?void 0:E.onFocus,onChange:this.onChange.bind(this),onReady:this.triggerOnReady.bind(this)}});this.formFields.push(_)})),this.subElements.push(this.collectContainer),this.storeInstrumentCheckbox&&this.subElements.push(this.storeInstrumentCheckbox)}show(){var e,t;const i=document.getElementById(this.collectContainer.id);if(!i)throw new Error("Container is not mounted.");Object.assign(i.style,null===(t=null===(e=this.options)||void 0===e?void 0:e.styles)||void 0===t?void 0:t.wrapper),this.element.style.display="flex"}hide(){this.element.style.display="none"}triggerOnReady(){var e,t,i;this.formFields.reduce(((e,t)=>e&&t.isReady),!0)&&(null===(i=null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onReady)||void 0===i||i.call(t))}prepareLabelStyles(e){return["base"].reduce(((t,i)=>{var n,o,s,r,a,l,d,c;return t[i]=Object.assign(Object.assign(Object.assign({},null===(o=null===(n=this.options)||void 0===n?void 0:n.styles)||void 0===o?void 0:o.base),null===(a=null===(r=null===(s=this.options)||void 0===s?void 0:s.styles)||void 0===r?void 0:r.labels)||void 0===a?void 0:a.all),null===(c=null===(d=null===(l=this.options)||void 0===l?void 0:l.styles)||void 0===d?void 0:d.labels)||void 0===c?void 0:c[e]),t}),{})}prepareInputStyles(e,t){var i;let n=JSON.parse(JSON.stringify(e));return(null===(i=this.options)||void 0===i?void 0:i.showCardHolderName)&&t===exports.ElementType.CARD_NUMBER&&(this.element.setAttribute("class","with-card-holder"),n=Object.assign(Object.assign({},e),{base:Object.assign(Object.assign({},No.base),{border:"1px solid #eae8ee",borderTop:"none",padding:"10px 16px",textIndent:"0"})})),["base","complete","empty","focus","invalid","cardIcon","copyIcon"].forEach((e=>{var i,o,s,r,a,l,d,c;n[e]=Object.assign(Object.assign(Object.assign({},n[e]),null===(r=null===(s=null===(o=null===(i=this.options)||void 0===i?void 0:i.styles)||void 0===o?void 0:o.inputFields)||void 0===s?void 0:s.all)||void 0===r?void 0:r[e]),null===(c=null===(d=null===(l=null===(a=this.options)||void 0===a?void 0:a.styles)||void 0===l?void 0:l.inputFields)||void 0===d?void 0:d[t])||void 0===c?void 0:c[e])})),n}get isValid(){return this.formFields.reduce(((e,t)=>e&&t.isValid),!0)}get cardNetwork(){var e,t;return null!==(t=null===(e=this.formFields.find((e=>Boolean(e.cardNetwork))))||void 0===e?void 0:e.cardNetwork)&&void 0!==t?t:""}onChange(){var e,t,i,n;(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onChange)&&(null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n||n.onChange({isValid:this.isValid,cardNetwork:this.cardNetwork,bin:this.bin}))}collectValues(){return e(this,void 0,void 0,(function*(){return{tokenizedCardData:yield this.collectContainer.collect(),storeInstrument:this.shouldStoreInstrument,enrollInstrumentToNetworkOffers:Boolean(this.enforceEnrollInstrumentToNetworkOffersForMasterCard())}}))}enforceEnrollInstrumentToNetworkOffersForMasterCard(){var e;return"mastercard"!==this.cardNetwork&&(null===(e=this.options)||void 0===e?void 0:e.enrollInstrumentToNetworkOffers)}}class Lo{constructor(e,t){this.isValid=!1,this.isReady=!1,this.cardNetwork="";const{events:i}=t,n=e.createCollectElement(t);(null==i?void 0:i.onFocus)&&n.on("FOCUS",i.onFocus),n.on("READY",(()=>{var e,i;this.isReady=!0,null===(i=null===(e=t.events)||void 0===e?void 0:e.onReady)||void 0===i||i.call(e)})),n.on("CHANGE",(e=>{const{isEmpty:t,isValid:n,network:o}=e;this.isValid=!t&&n,this.cardNetwork=null!=o?o:"",(null==i?void 0:i.onChange)&&i.onChange(this)}))}}class vo extends L{constructor(e,t){super("div",{id:"payrails-card-list"}),this.workflowExecution=e,this.listItems=[],this.workflowExecution.savedCreditCards.forEach((e=>{const i=new Ao((()=>{(null==t?void 0:t.onCardChange)&&t.onCardChange(e)}),e);this.listItems.push(i),this.subElements.push(i)}))}reset(){this.element.querySelectorAll("input").forEach((e=>e.checked=!1))}}class Ao extends L{constructor(e,t){super("div",{className:"payrails-card-list-item",id:`payrails-card-list-item-${t.id}`});const{id:i}=t,n=this.createCardLabel(t),o=document.createElement("label");o.setAttribute("for",i),o.addEventListener("click",e);const s=document.createElement("input");s.setAttribute("type","radio"),s.setAttribute("name","payment-option"),s.setAttribute("id",i),s.setAttribute("value",i),o.appendChild(s);const r=document.createElement("span");r.innerText=n,o.appendChild(r),this.element.appendChild(o)}createCardLabel({data:e={}}){return`****${null==e?void 0:e.suffix}`}}class mo extends L{constructor(e="Authorization failed, please try again."){super("div",{id:"authorization-failed-message"}),this.element.innerText=e,this.element.innerHTML=`\n <div>\n <svg class="checkmark-cross" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">\n <circle class="checkmark-cross_circle" cx="26" cy="26" r="25" fill="none"/>\n <path class="checkmark-cross_check" fill="none" d="M14.1 14.1l23.8 23.8 m0,-23.8 l-23.8,23.8"/>\n </svg>\n </div>\n <div>${e}</div>`,this.element.addEventListener("click",(e=>{e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),this.unmount()}))}}class Ro extends L{constructor(e){var t;super("div",{id:"payrails-authorization-success-msg"}),this.element.innerHTML=`\n <div class="checkmark-wrapper">\n <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">\n <circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>\n <path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>\n </svg>\n </div>\n <div id="payrails-authorization-success">${(null===(t=null==e?void 0:e.translations)||void 0===t?void 0:t.label)||"Payment successful"}</div`}}class yo extends L{constructor(e,t,i,n){super("div",{id:e,className:"payrails-dropin-item"}),this.events=i,this.styles=n,this.isActive=!1,this.applyBaseStyles();const o=`payrails-dropin-item-${e}`,s=document.createElement("label");s.setAttribute("for",o);const r=document.createElement("input");r.setAttribute("type","radio"),r.setAttribute("name","payment-option"),r.setAttribute("id",o),r.setAttribute("value",o),this.input=r,s.appendChild(r),this.label=s;const a=document.createElement("span");s.appendChild(a),a.innerText=t,this.element.appendChild(s)}get identifier(){return`payrails-dropin-item-${this.id}`}deactivate(){var e,t;this.isActive&&(this.isActive=!1,this.label.style.marginBottom="0",this.applyBaseStyles(),null===(e=this.component)||void 0===e||e.unmount(),(null===(t=this.events)||void 0===t?void 0:t.onDeactivate)&&this.events.onDeactivate())}applyBaseStyles(){var e,t;Object.keys((null===(e=this.styles)||void 0===e?void 0:e.active)||{}).forEach((e=>{this.element.style.removeProperty(e)})),Object.assign(this.element.style,null===(t=this.styles)||void 0===t?void 0:t.base)}applyActiveStyles(){var e,t;Object.assign(this.element.style,null===(e=this.styles)||void 0===e?void 0:e.base,null===(t=this.styles)||void 0===t?void 0:t.active)}activate(){var e,t;this.isActive||(null===(e=this.component)||void 0===e||e.mount(this.selector),this.label.style.marginBottom="8px",this.applyActiveStyles(),this.isActive=!0,(null===(t=this.events)||void 0===t?void 0:t.onActivate)&&this.events.onActivate())}}class Do extends yo{constructor(){super(...arguments),this.buttonShown=!1}activate(){if(!this.buttonShown)return super.activate(),void(this.buttonShown=!0);this.label.style.marginBottom="8px",this.applyActiveStyles(),this.isActive=!0,this.element.querySelector(this.component.selector).style.display="block"}deactivate(){this.isActive&&(this.isActive=!1,this.label.style.marginBottom="0",this.applyBaseStyles(),this.element.querySelector(this.component.selector).style.display="none")}mountAfterAvailable(){super.mount(`#${this.loadElementId}`)}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}unmount(){var e;super.unmount(),null===(e=document.querySelector(`#${this.loadElementId}`))||void 0===e||e.remove()}}class So extends Do{constructor(e,t,i){var n,o;super("apple-pay-dropin",(null===(o=null===(n=i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"Apple Pay",void 0,i.styles),this.loadElementId="apple-pay-dropin-load-element",this.component=new _o(e,t,Object.assign(Object.assign({},i),{events:{onApplePayAvailable:()=>{this.mountAfterAvailable()}}}))}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}}class go extends yo{constructor(e,t,i){super("payrails-credit-card-wrapper","Card",void 0,i),this.cardForm=e,this.paymentButton=t,this.cardFormShown=!1,this.component=new Co(e,t)}activate(){var e,t;this.label.style.marginBottom="8px",this.applyActiveStyles(),this.cardFormShown||(this.cardFormShown=!0,null===(e=this.component)||void 0===e||e.mount(this.selector)),this.isActive||(this.paymentButton.selectedInstrument=null,this.paymentButton.mount(this.selector),this.paymentButton.setDisabled(!this.cardForm.isValid),this.paymentButton.mount("#payrails-card-form"),this.input.checked=!0,this.cardForm.show(),this.isActive=!0,(null===(t=this.events)||void 0===t?void 0:t.onActivate)&&this.events.onActivate())}deactivate(){var e;this.isActive&&(this.label.style.marginBottom="0",this.applyBaseStyles(),this.paymentButton.unmount(),this.cardForm.hide(),this.isActive=!1,(null===(e=this.events)||void 0===e?void 0:e.onDeactivate)&&this.events.onDeactivate())}}class Co extends L{constructor(e,t){super("div",{id:"payrails-form-container"}),this.subElements.push(e,t)}}const bo={apiVersion:2,apiVersionMinor:0};class wo extends Eo{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-google-pay-button"})),this.sdkConfig=t,this.execution=i,this.options=n,this.googleButton=null,this.paymentExecutor=new p(t,i),this.loadScript=new lo((()=>e(this,void 0,void 0,(function*(){const e=document.createElement("script");return e.src="https://pay.google.com/gp/p/js/pay.js",new Promise(((t,i)=>{e.onload=()=>{const e=new google.payments.api.PaymentsClient({environment:this.options.environment||"TEST"}),n=Object.assign(Object.assign({},bo),{allowedPaymentMethods:this.execution.googlePayConfig});e.isReadyToPay(n).then((n=>{var o,s,r;n?(null===(r=null===(s=null===(o=this.options)||void 0===o?void 0:o.events)||void 0===s?void 0:s.onGooglePayAvailable)||void 0===r||r.call(s),t(e)):i()}),i)},e.onerror=()=>{i()},document.body.appendChild(e)}))}))))}sdkLoaded(t){var i,n,o,s,r,a,l,d;return e(this,void 0,void 0,(function*(){try{const c=(null===(n=null===(i=this.options)||void 0===i?void 0:i.styles)||void 0===n?void 0:n.buttonColor)||"black",E=(null===(s=null===(o=this.options)||void 0===o?void 0:o.styles)||void 0===s?void 0:s.buttonType)||"long",_=(null===(a=null===(r=this.options)||void 0===r?void 0:r.styles)||void 0===a?void 0:a.buttonSizeMode)||"fill",I=(null===(d=null===(l=this.options)||void 0===l?void 0:l.styles)||void 0===d?void 0:d.buttonLocale)||void 0;return this.googleButton=t.createButton({buttonColor:c,buttonType:E,buttonSizeMode:_,buttonLocale:I,onClick:()=>e(this,void 0,void 0,(function*(){var e,t,i;if(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onPaymentButtonClicked){if(!(yield null===(i=this.options)||void 0===i?void 0:i.events.onPaymentButtonClicked()))return}yield this.onPaymentButtonClicked()})),allowedPaymentMethods:this.execution.googlePayConfig}),this.element.appendChild(this.googleButton),this.googleButton}catch(e){throw console.error("Google pay can not be initialized",e),new Error(e.message)}}))}onLoadPaymentData(t){var i,n,o,s;return e(this,void 0,void 0,(function*(){const e=[{paymentMethodCode:"googlePay",integrationType:"api",paymentInstrumentData:{paymentToken:t.paymentMethodData.tokenizationData.token},amount:this.sdkConfig.amount,storeInstrument:this.shouldStoreInstrument}],r=yield this.paymentExecutor.pay(e);(null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onAuthorizeSuccess)&&(null===(s=null===(o=this.options)||void 0===o?void 0:o.events)||void 0===s||s.onAuthorizeSuccess(r))}))}onPaymentButtonClicked(){var t,i,n,o,s;return e(this,void 0,void 0,(function*(){const e=Object.assign({},bo);e.allowedPaymentMethods=this.execution.googlePayConfig,e.transactionInfo={totalPriceStatus:"FINAL",totalPrice:null===(t=this.sdkConfig.amount)||void 0===t?void 0:t.value,currencyCode:null===(i=this.sdkConfig.amount)||void 0===i?void 0:i.currency,countryCode:null===(s=null===(o=null===(n=this.execution.meta)||void 0===n?void 0:n.customer)||void 0===o?void 0:o.country)||void 0===s?void 0:s.code};(yield this.loadScript.loader).loadPaymentData(e).then((e=>{this.onLoadPaymentData(e)})).catch((e=>{var t,i,n;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onAuthorizeFailed)&&(null===(n=this.options)||void 0===n||n.events.onAuthorizeFailed(e))}))}))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){var e;try{const t=yield this.loadScript.loader,i=yield this.sdkLoaded(t);this.element.appendChild(i),null===(e=this.storeInstrumentCheckbox)||void 0===e||e.mount(this.selector)}catch(e){}}))})()}unmount(){var e,t,i;null===(t=null===(e=this.googleButton)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this.googleButton),null===(i=this.storeInstrumentCheckbox)||void 0===i||i.unmount(),super.unmount()}}class Mo extends Do{constructor(e,t,i){var n,o;super("google-pay-dropin",(null===(o=null===(n=i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"Google Pay",void 0,i.styles),this.loadElementId="google-pay-dropin-load-element",this.component=new wo(e,t,Object.assign(Object.assign({},i),{events:Object.assign(Object.assign({},i.events),{onGooglePayAvailable:()=>{this.mountAfterAvailable()}})}))}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}}
4
+ */const at={IFRAME_SECURE_SITE:"https://js.skyflow.com/v1/elements/index.html",IFRAME_SECURE_ORGIN:"https://js.skyflow.com"},lt={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no",style:"width: 100%;",allow:"clipboard-read; clipboard-write"},dt=(e,t)=>{Object.keys(t).forEach((i=>{if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];null==n?e.removeAttribute(i):e.setAttribute(i,n)}}))};var ct=(e={})=>{const t=document.createElement("iframe"),i=Object.assign(Object.assign({},lt),e);return Object.assign(t.style,ze),dt(t,i),t.getAttribute("id")||(t.id=t.name),t};const Et=()=>at.IFRAME_SECURE_SITE,_t=(e,t)=>{Object.keys(t).forEach((i=>{Object.prototype.hasOwnProperty.call(t,i)&&(e.style[i]=t[i])}))};function It(e){return JSON.parse(JSON.stringify(e))}class ht{constructor(){this.listeners=[],this.isDestroyed=!1}on(e,t){le.on(e,t),this.listeners.push({eventName:e,callback:t})}off(e,t){le.off(e,t);const i=this.listeners.findIndex((t=>t.eventName===e));-1!==i&&this.listeners.splice(i,1)}emit(e,t,i=void 0){le.emit(e,t,i)}hasListener(e){return-1!==this.listeners.findIndex((t=>t.eventName===e))}teardown(){this.listeners.forEach((e=>{le.off(e.eventName,e.handler)})),this.listeners=[]}}var ut,pt,ft,Nt,Tt,Lt,Ot;!function(e){e.DEFAULT="DEFAULT",e.PLAIN_TEXT="PLAIN_TEXT",e.MASKED="MASKED",e.REDACTED="REDACTED"}(ut||(ut={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(pt||(pt={})),function(e){e.CHANGE="CHANGE",e.READY="READY",e.FOCUS="FOCUS",e.BLUR="BLUR",e.SUBMIT="SUBMIT"}(ft||(ft={})),function(e){e.WARN="WARN",e.INFO="INFO",e.DEBUG="DEBUG",e.ERROR="ERROR"}(Nt||(Nt={})),function(e){e.DEV="DEV",e.PROD="PROD"}(Tt||(Tt={})),function(e){e.LOG="LOG",e.WARN="WARN",e.ERROR="ERROR"}(Lt||(Lt={})),function(e){e.REGEX_MATCH_RULE="REGEX_MATCH_RULE",e.LENGTH_MATCH_RULE="LENGTH_MATCH_RULE",e.ELEMENT_VALUE_MATCH_RULE="ELEMENT_VALUE_MATCH_RULE"}(Ot||(Ot={}));const vt={DEBUG:{showDebugLogs:!0,showInfoLogs:!0,showWarnLogs:!0,showErrorLogs:!0},INFO:{showDebugLogs:!1,showInfoLogs:!0,showWarnLogs:!0,showErrorLogs:!0},WARN:{showDebugLogs:!1,showInfoLogs:!1,showWarnLogs:!0,showErrorLogs:!0},ERROR:{showDebugLogs:!1,showInfoLogs:!1,showWarnLogs:!1,showErrorLogs:!0}},At={PROD:{doesReturnValue:!1},DEV:{doesReturnValue:!0}},mt="[Skyflow]",Rt=(e,t,i)=>{if(i&&vt[i]){const{showDebugLogs:n,showInfoLogs:o,showWarnLogs:s,showErrorLogs:r}=vt[i];t===Lt.LOG&&n?console.log(`${Nt.DEBUG}: ${mt} ${e}`):t===Lt.LOG&&o?console.log(`${Nt.INFO}: ${mt} ${e}`):t===Lt.WARN&&s?console.warn(`${Nt.WARN}: ${mt} ${e}`):t===Lt.ERROR&&r&&console.error(`${Nt.ERROR}: ${mt} ${e}`)}},yt=(...e)=>{const t=e[0],i=e.filter(((e,t)=>0!==t));return t?t.replace(/%s[0-9]+/g,(e=>{const t=e.replace("%s","")-1;return i[t]})):""},Dt=(e="")=>{const t=e.split(":");if("group"===t[1])return"composable container";let i=atob(t[2]);return-1!==i.indexOf(":")&&(i=i.substring(0,i.indexOf(":"))),i};class St extends Error{constructor(e,t,i=!1){const n={code:e.code,description:t&&(null==t?void 0:t.length)>0?yt(e.description,...t):e.description};super(n.description),i?this.error=n:this.errors=[n]}}const gt={INVALID_FIELD:{code:400,description:ce.INVALID_FIELD},VAULTID_IS_REQUIRED:{code:400,description:ce.VAULTID_IS_REQUIRED},EMPTY_VAULTID_IN_INIT:{code:400,description:ce.EMPTY_VAULTID_IN_INIT},VAULTURL_IS_REQUIRED:{code:400,description:ce.VAULTURL_IS_REQUIRED},EMPTY_VAULTURL_IN_INIT:{code:400,description:ce.EMPTY_VAULTURL_IN_INIT},INVALID_VAULTURL_IN_INIT:{code:400,description:ce.INVALID_VAULTURL_IN_INIT},GET_BEARER_TOKEN_IS_REQUIRED:{code:400,description:ce.GET_BEARER_TOKEN_IS_REQUIRED},EMPTY_CONTAINER_TYPE:{code:400,description:ce.EMPTY_CONTAINER_TYPE},INVALID_CONTAINER_TYPE:{code:400,description:ce.INVALID_CONTAINER_TYPE},UNIQUE_ELEMENT_NAME:{code:400,description:ce.UNIQUE_ELEMENT_NAME},ELEMENTS_NOT_MOUNTED:{code:400,description:ce.ELEMENTS_NOT_MOUNTED},MISSING_TABLE_IN_COLLECT:{code:400,description:ce.MISSING_TABLE_IN_COLLECT},MISSING_SKYFLOWID_KEY_REVEAL:{code:400,description:ce.MISSING_SKYFLOWID_KEY_REVEAL},EMPTY_TABLE_IN_COLLECT:{code:400,description:ce.EMPTY_TABLE_IN_COLLECT},EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:{code:400,description:ce.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS},INVALID_TABLE_IN_COLLECT:{code:400,description:ce.INVALID_TABLE_IN_COLLECT},INVALID_SKYFLOWID_IN_COLLECT:{code:400,description:ce.INVALID_SKYFLOWID_IN_COLLECT},MISSING_COLUMN_IN_COLLECT:{code:400,description:ce.MISSING_COLUMN_IN_COLLECT},MISSING_SKYFLOWID_IN_COLLECT:{code:400,description:ce.MISSING_SKYFLOWID_IN_COLLECT},EMPTY_COLUMN_IN_COLLECT:{code:400,description:ce.EMPTY_TABLE_IN_COLLECT},INVALID_COLUMN_IN_COLLECT:{code:400,description:ce.INVALID_COLUMN_IN_COLLECT},CLIENT_CONNECTION:{code:400,description:ce.CLIENT_CONNECTION},RECORDS_KEY_NOT_FOUND:{code:404,description:ce.RECORDS_KEY_NOT_FOUND},EMPTY_RECORDS_IN_INSERT:{code:400,description:ce.EMPTY_RECORDS_IN_INSERT},INVALID_RECORDS_IN_INSERT:{code:404,description:ce.INVALID_RECORDS_IN_INSERT},INVALID_TABLE_IN_INSERT:{code:400,description:ce.INVALID_TABLE_IN_INSERT},EMPTY_TABLE_IN_INSERT:{code:400,description:ce.EMPTY_TABLE_IN_INSERT},MISSING_TABLE_IN_INSERT:{code:400,description:ce.MISSING_TABLE_IN_INSERT},EMPTY_FIELDS_IN_INSERT:{code:400,description:ce.EMPTY_FIELDS_IN_INSERT},MISSING_FIELDS_IN_INSERT:{code:404,description:ce.MISSING_FIELDS_IN_INSERT},INVALID_FIELDS_IN_INSERT:{code:404,description:ce.INVALID_FIELDS_IN_INSERT},INVALID_TOKENS_IN_INSERT:{code:404,description:ce.INVALID_TOKENS_IN_INSERT},RECORDS_KEY_NOT_FOUND_DETOKENIZE:{code:404,description:ce.RECORDS_KEY_NOT_FOUND_DETOKENIZE},EMPTY_RECORDS_DETOKENIZE:{code:400,description:ce.EMPTY_RECORDS_DETOKENIZE},INVALID_RECORDS_IN_DETOKENIZE:{code:404,description:ce.INVALID_RECORDS_IN_DETOKENIZE},MISSING_TOKEN_IN_DETOKENIZE:{code:400,description:ce.MISSING_TOKEN_IN_DETOKENIZE},INVALID_TOKEN_IN_DETOKENIZE:{code:400,description:ce.INVALID_TOKEN_IN_DETOKENIZE},RECORDS_KEY_NOT_FOUND_GET:{code:400,description:ce.RECORDS_KEY_NOT_FOUND_GET},INVALID_RECORDS_IN_GET:{code:400,description:ce.INVALID_RECORDS_IN_GET},EMPTY_RECORDS_GET:{code:400,description:ce.EMPTY_RECORDS_GET},MISSING_IDS_IN_GET:{code:400,description:ce.MISSING_IDS_IN_GET},INVALID_IDS_IN_GET:{code:400,description:ce.INVALID_IDS_IN_GET},INVALID_COLUMN_VALUES_IN_GET:{code:400,description:ce.INVALID_COLUMN_VALUES_IN_GET},EMPTY_IDS_IN_GET:{code:400,description:ce.EMPTY_IDS_IN_GET},INVALID_SKYFLOWID_TYPE_IN_GET:{code:400,description:ce.INVALID_SKYFLOWID_TYPE_IN_GET},MISSING_TABLE_IN_GET:{code:400,description:ce.MISSING_TABLE_IN_GET},INVALID_TABLE_IN_GET:{code:400,description:ce.INVALID_TABLE_IN_GET},MISSING_REDACTION_IN_GET:{code:400,description:ce.MISSING_REDACTION_IN_GET},INVALID_REDACTION_TYPE_IN_GET:{code:400,description:ce.INVALID_REDACTION_TYPE_IN_GET},INVALID_TOKENS_IN_GET:{code:400,description:ce.INVALID_TOKENS_IN_GET},TOKENS_GET_COLUMN_NOT_SUPPORTED:{code:400,description:ce.TOKENS_GET_COLUMN_NOT_SUPPORTED},REDACTION_WITH_TOKENS_NOT_SUPPORTED:{code:400,description:ce.REDACTION_WITH_TOKENS_NOT_SUPPORTED},INVALID_REDACTION_TYPE_IN_DETOKENIZE:{code:400,description:ce.INVALID_REDACTION_TYPE_IN_DETOKENIZE},INVALID_TOKENS_IN_COLLECT:{code:404,description:ce.INVALID_TOKENS_IN_COLLECT},RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS:{code:404,description:ce.RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS},INVALID_RECORDS_IN_ADDITIONAL_FIELDS:{code:404,description:ce.INVALID_RECORDS_IN_ADDITIONAL_FIELDS},EMPTY_RECORDS_IN_ADDITIONAL_FIELDS:{code:400,description:ce.EMPTY_RECORDS_IN_ADDITIONAL_FIELDS},MISSING_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ce.MISSING_TABLE_IN_ADDITIONAL_FIELDS},INVALID_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ce.INVALID_TABLE_IN_ADDITIONAL_FIELDS},INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS:{code:400,description:ce.INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS},MISSING_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ce.MISSING_FIELDS_IN_ADDITIONAL_FIELDS},INVALID_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ce.INVALID_FIELDS_IN_ADDITIONAL_FIELDS},RECORDS_KEY_NOT_FOUND_DELETE:{code:400,description:ce.RECORDS_KEY_NOT_FOUND_DELETE},EMPTY_RECORDS_IN_DELETE:{code:400,description:ce.EMPTY_RECORDS_IN_DELETE},INVALID_RECORDS_IN_DELETE:{code:404,description:ce.INVALID_RECORDS_IN_DELETE},INVALID_TABLE_IN_DELETE:{code:400,description:ce.INVALID_TABLE_IN_DELETE},EMPTY_TABLE_IN_DELETE:{code:400,description:ce.EMPTY_TABLE_IN_DELETE},MISSING_TABLE_IN_DELETE:{code:400,description:ce.MISSING_TABLE_IN_DELETE},EMPTY_ID_IN_DELETE:{code:400,description:ce.EMPTY_ID_IN_DELETE},MISSING_ID_IN_DELETE:{code:404,description:ce.MISSING_ID_IN_DELETE},INVALID_ID_IN_DELETE:{code:404,description:ce.INVALID_ID_IN_DELETE},EMPTY_RECORDS_REVEAL:{code:400,description:ce.EMPTY_RECORDS_REVEAL},MISSING_TOKEN_KEY_REVEAL:{code:400,description:ce.MISSING_TOKEN_KEY_REVEAL},INVALID_TOKEN_ID_REVEAL:{code:400,description:ce.INVALID_TOKEN_ID_REVEAL},INVALID_LABEL_REVEAL:{code:400,description:ce.INVALID_LABEL_REVEAL},INVALID_ALT_TEXT_REVEAL:{code:400,description:ce.INVALID_ALT_TEXT_REVEAL},INVALID_ALT_TEXT_RENDER:{code:400,description:ce.INVALID_ALT_TEXT_RENDER},INVALID_FORMAT_REVEAL:{code:400,description:ce.INVALID_FORMAT_REVEAL},EMPTY_FORMAT_REVEAL:{code:400,description:ce.EMPTY_FORMAT_REVEAL},INVALID_FORMAT_VALUE_REVEAL:{code:400,description:ce.INVALID_FORMAT_VALUE_REVEAL},INVALID_REDACTION_TYPE_REVEAL:{code:400,description:ce.INVALID_REDACTION_TYPE_REVEAL},EMPTY_TABLE_IN_ADDITIONAL_FIELDS:{code:400,description:ce.EMPTY_TABLE_IN_ADDITIONAL_FIELDS},EMPTY_FIELDS_IN_ADDITIONAL_FIELDS:{code:400,description:ce.EMPTY_FIELDS_IN_ADDITIONAL_FIELDS},EMPTY_TOKEN_IN_DETOKENIZE:{code:400,description:ce.EMPTY_TOKEN_IN_DETOKENIZE},EMPTY_SKYFLOWID_IN_GET:{code:400,description:ce.EMPTY_SKYFLOWID_IN_GET},EMPTY_TABLE_IN_GET:{code:400,description:ce.EMPTY_TABLE_IN_GET},EMPTY_REDACTION_TYPE_IN_GET:{code:400,description:ce.EMPTY_REDACTION_TYPE_IN_GET},EMPTY_TOKEN_ID_REVEAL:{code:400,description:ce.EMPTY_TOKEN_ID_REVEAL},DUPLICATE_ELEMENT:{code:400,description:ce.DUPLICATE_ELEMENT},DUPLICATE_ELEMENT_ADDITIONAL_FIELDS:{code:400,description:ce.DUPLICATE_ELEMENT_ADDITIONAL_FIELDS},MISSING_ELEMENT_TYPE:{code:400,description:ce.MISSING_ELEMENT_TYPE},EMPTY_ELEMENT_TYPE:{code:400,description:ce.EMPTY_ELEMENT_TYPE},INVALID_ALLOWED_OPTIONS:{code:400,description:ce.INVALID_ALLOWED_OPTIONS},EMPTY_ALLOWED_OPTIONS_ARRAY:{code:400,description:ce.EMPTY_ALLOWED_OPTIONS_ARRAY},INVALID_ALLOWED_FILETYPE_ARRAY:{code:400,description:ce.INVALID_ALLOWED_FILETYPE_ARRAY},INVALID_ELEMENT_TYPE:{code:400,description:ce.INVALID_ELEMENT_TYPE},INVALID_ELEMENT_SELECTOR:{code:400,description:ce.INVALID_ELEMENT_SELECTOR},FRAME_NOT_FOUND:{code:400,description:ce.FRAME_NOT_FOUND},REQUIRED_PARAMS_NOT_PROVIDED:{code:400,description:ce.REQUIRED_PARAMS_NOT_PROVIDED},INVALID_RECORD_COLUMN_VALUE:{code:400,description:ce.INVALID_RECORD_COLUMN_VALUE},MISSING_RECORD_COLUMN_VALUE:{code:400,description:ce.MISSING_RECORD_COLUMN_VALUE},MISSING_RECORD_COLUMN_NAME:{code:400,description:ce.MISSING_RECORD_COLUMN_NAME},INVALID_EVENT_TYPE:{code:400,description:ce.INVALID_EVENT_TYPE},INVALID_EVENT_LISTENER:{code:400,description:ce.INVALID_EVENT_LISTENER},MISSING_HANDLER_IN_EVENT_LISTENER:{code:400,description:ce.MISSING_HANDLER_IN_EVENT_LISTENER},INVALID_HANDLER_IN_EVENT_LISTENER:{code:400,description:ce.INVALID_HANDLER_IN_EVENT_LISTENER},UNKNOWN_ERROR:{code:400,description:ce.UNKNOWN_ERROR},CONNECTION_ERROR:{code:400,description:ce.CONNECTION_ERROR},NETWORK_ERROR:{code:500,description:ce.NETWORK_ERROR},COMPLETE_AND_VALID_INPUTS:{code:400,description:ce.COMPLETE_AND_VALID_INPUTS},INVALID_VALIDATIONS_TYPE:{code:400,description:ce.INVALID_VALIDATIONS_TYPE},MISSING_VALIDATION_RULE_TYPE:{code:400,description:ce.MISSING_VALIDATION_RULE_TYPE},INVALID_VALIDATION_RULE_TYPE:{code:400,description:ce.INVALID_VALIDATION_RULE_TYPE},MISSING_VALIDATION_RULE_PARAMS:{code:400,description:ce.MISSING_VALIDATION_RULE_PARAMS},INVALID_VALIDATION_RULE_PARAMS:{code:400,description:ce.INVALID_VALIDATION_RULE_PARAMS},MISSING_REGEX_IN_REGEX_MATCH_RULE:{code:400,description:ce.MISSING_REGEX_IN_REGEX_MATCH_RULE},INVALID_REGEX_IN_REGEX_MATCH_RULE:{code:400,description:ce.INVALID_REGEX_IN_REGEX_MATCH_RULE},MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE:{code:400,description:ce.MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE},MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE:{code:400,description:ce.MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE},INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE:{code:400,description:ce.INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE},ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE:{code:400,description:ce.ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE},EMPTY_ELEMENT_IN_MOUNT:{code:400,description:ce.EMPTY_ELEMENT_IN_MOUNT},REVEAL_ELEMENT_ERROR_STATE:{code:400,description:ce.REVEAL_ELEMENT_ERROR_STATE},INVALID_FILE_TYPE:{code:400,description:ce.INVALID_FILE_TYPE},INVALID_FILE_SIZE:{code:400,description:ce.INVALID_FILE_SIZE},NO_FILE_SELECTED:{code:400,description:ce.NO_FILE_SELECTED},INVALID_TABLE_IN_UPSERT_OPTION:{code:400,description:ce.INVALID_TABLE_IN_UPSERT_OPTION},INVALID_COLUMN_IN_UPSERT_OPTION:{code:400,description:ce.INVALID_COLUMN_IN_UPSERT_OPTION},INVALID_UPSERT_OPTION_TYPE:{code:400,description:ce.INVALID_UPSERT_OPTION_TYPE},EMPTY_UPSERT_OPTIONS_ARRAY:{code:400,description:ce.EMPTY_UPSERT_OPTIONS_ARRAY},INVALID_UPSERT_OPTION_OBJECT_TYPE:{code:400,description:ce.INVALID_UPSERT_OPTION_OBJECT_TYPE},MISSING_TABLE_IN_UPSERT_OPTION:{code:400,description:ce.MISSING_TABLE_IN_UPSERT_OPTION},MISSING_COLUMN_IN_UPSERT_OPTION:{code:400,description:ce.MISSING_COLUMN_IN_UPSERT_OPTION},INVALID_RECORD_COLUMN_VALUE_TYPE:{code:400,description:ce.INVALID_RECORD_COLUMN_VALUE_TYPE},INVALID_COLUMN_VALUES_TYPE:{code:400,description:ce.INVALID_COLUMN_VALUES_TYPE},EMPTY_RECORD_COLUMN_VALUES:{code:400,description:ce.EMPTY_RECORD_COLUMN_VALUES},EMPTY_COLUMN_VALUE:{code:400,description:ce.EMPTY_COLUMN_VALUE},MISSING_IDS_OR_COLUMN_VALUES_IN_GET:{code:400,description:ce.MISSING_IDS_OR_COLUMN_VALUES_IN_GET},SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED:{code:400,description:ce.SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED},SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED:{code:400,description:ce.SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED},MISSING_TABLE_KEY_REVEAL:{code:400,description:ce.MISSING_TABLE_KEY_REVEAL},MISSING_COLUMN_KEY_REVEAL:{code:400,description:ce.MISSING_COLUMN_KEY_REVEAL},INVALID_SKYFLOW_ID_REVEAL:{code:400,description:ce.INVALID_SKYFLOW_ID_REVEAL},INVALID_TABLE_REVEAL:{code:400,description:ce.INVALID_TABLE_REVEAL},INVALID_COLUMN_NAME_REVEAL:{code:400,description:ce.INVALID_COLUMN_NAME_REVEAL},EMPTY_SKYFLOW_ID_REVEAL:{code:400,description:ce.EMPTY_SKYFLOW_ID_REVEAL},EMPTY_TABLE_REVEAL:{code:400,description:ce.EMPTY_TABLE_REVEAL},EMPTY_COLUMN_NAME_REVEAL:{code:400,description:ce.EMPTY_COLUMN_NAME_REVEAL},RECORDS_KEY_NOT_FOUND_GETBYID:{code:400,description:ce.RECORDS_KEY_NOT_FOUND_GETBYID},INVALID_RECORDS_IN_GETBYID:{code:400,description:ce.INVALID_RECORDS_IN_GETBYID},EMPTY_RECORDS_GETBYID:{code:400,description:ce.EMPTY_RECORDS_GETBYID},MISSING_IDS_IN_GETBYID:{code:400,description:ce.MISSING_IDS_IN_GETBYID},INVALID_IDS_IN_GETBYID:{code:400,description:ce.INVALID_IDS_IN_GETBYID},EMPTY_IDS_IN_GETBYID:{code:400,description:ce.EMPTY_IDS_IN_GETBYID},INVALID_SKYFLOWID_TYPE_IN_GETBYID:{code:400,description:ce.INVALID_SKYFLOWID_TYPE_IN_GETBYID},MISSING_TABLE_IN_GETBYID:{code:400,description:ce.MISSING_TABLE_IN_GETBYID},INVALID_TABLE_IN_GETBYID:{code:400,description:ce.INVALID_TABLE_IN_GETBYID},MISSING_REDACTION_IN_GETBYID:{code:400,description:ce.MISSING_REDACTION_IN_GETBYID},INVALID_REDACTION_TYPE_IN_GETBYID:{code:400,description:ce.INVALID_REDACTION_TYPE_IN_GETBYID},EMPTY_SKYFLOWID_IN_GETBYID:{code:400,description:ce.EMPTY_SKYFLOWID_IN_GETBYID},EMPTY_TABLE_IN_GETBYID:{code:400,description:ce.EMPTY_TABLE_IN_GETBYID},EMPTY_REDACTION_TYPE_IN_GETBYID:{code:400,description:ce.EMPTY_REDACTION_TYPE_IN_GETBYID},MISSING_COMPOSABLE_LAYOUT_KEY:{code:400,description:ce.MISSING_COMPOSABLE_LAYOUT_KEY},EMPTY_COMPOSABLE_LAYOUT_ARRAY:{code:400,description:ce.EMPTY_COMPOSABLE_LAYOUT_ARRAY},INVALID_COMPOSABLE_LAYOUT_TYPE:{code:400,description:ce.INVALID_COMPOSABLE_LAYOUT_TYPE},NEGATIVE_VALUES_COMPOSABLE_LAYOUT:{code:400,description:ce.NEGATIVE_VALUES_COMPOSABLE_LAYOUT},MISMATCH_ELEMENT_COUNT_LAYOUT_SUM:{code:400,description:ce.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM},MISSING_COMPOSABLE_CONTAINER_OPTIONS:{code:400,description:ce.MISSING_COMPOSABLE_CONTAINER_OPTIONS},INVALID_COMPOSABLE_CONTAINER_OPTIONS:{code:400,description:ce.INVALID_COMPOSABLE_CONTAINER_OPTIONS},COMPOSABLE_CONTAINER_NOT_MOUNTED:{code:400,description:ce.COMPOSABLE_CONTAINER_NOT_MOUNTED},INVALID_BOOLEAN_OPTIONS:{code:400,description:ce.INVALID_BOOLEAN_OPTIONS},EMPTY_COLLECT_CUSTOM_FORMAT:{code:400,description:ce.EMPTY_COLLECT_CUSTOM_FORMAT},INVALID_INPUT_OPTIONS_FORMAT:{code:400,description:ce.INVALID_INPUT_OPTIONS_FORMAT},INVALID_INPUT_OPTIONS_TRANSLATION:{code:400,description:ce.INVALID_INPUT_OPTIONS_TRANSLATION}},Ct=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND,[],!0);const{records:i}=e;if(!i||!Array.isArray(i))throw new St(gt.INVALID_RECORDS_IN_INSERT,[],!0);if(0===i.length)throw new St(gt.EMPTY_RECORDS_IN_INSERT,[],!0);if(i.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_INSERT,[`${t}`],!0);if(!e.table)throw new St(gt.EMPTY_TABLE_IN_INSERT,[`${t}`],!0);if(!("string"==typeof e.table||e.table instanceof String))throw new St(gt.INVALID_TABLE_IN_INSERT,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"fields"))throw new St(gt.MISSING_FIELDS_IN_INSERT,[`${t}`],!0);if(!e.fields)throw new St(gt.EMPTY_FIELDS_IN_INSERT,[`${t}`],!0);if("object"!=typeof e.fields||Array.isArray(e.fields))throw new St(gt.INVALID_FIELDS_IN_INSERT,[`${t}`],!0)})),t&&t.tokens&&"boolean"!=typeof t.tokens)throw new St(gt.INVALID_TOKENS_IN_INSERT,[],!0)},bt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND_IN_ADDITIONAL_FIELDS,[],!0);const{records:t}=e;if(!t||!Array.isArray(t))throw new St(gt.INVALID_RECORDS_IN_ADDITIONAL_FIELDS,[],!0);if(0===t.length)throw new St(gt.EMPTY_RECORDS_IN_ADDITIONAL_FIELDS,[],!0);t.forEach(((e,t)=>{var i,n,o,s;if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!e.table)throw new St(gt.EMPTY_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(void 0!==(null===(i=e.fields)||void 0===i?void 0:i.skyflowID)){if(!(null===(n=e.fields)||void 0===n?void 0:n.skyflowID))throw new St(gt.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!("string"==typeof(null===(o=e.fields)||void 0===o?void 0:o.skyflowID)||(null===(s=e.fields)||void 0===s?void 0:s.skyflowID)instanceof String))throw new St(gt.INVALID_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[`${t}`],!0)}if(!("string"==typeof e.table||e.table instanceof String))throw new St(gt.INVALID_TABLE_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"fields"))throw new St(gt.MISSING_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if(!e.fields)throw new St(gt.EMPTY_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0);if("object"!=typeof e.fields||Array.isArray(e.fields))throw new St(gt.INVALID_FIELDS_IN_ADDITIONAL_FIELDS,[`${t}`],!0)}))},wt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND_DETOKENIZE);const{records:t}=e;if(!t||!Array.isArray(t))throw new St(gt.INVALID_RECORDS_IN_DETOKENIZE);if(0===t.length)throw new St(gt.EMPTY_RECORDS_DETOKENIZE);t.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"token"))throw new St(gt.MISSING_TOKEN_IN_DETOKENIZE,[`${t}`]);if(!e.token)throw new St(gt.EMPTY_TOKEN_IN_DETOKENIZE,[`${t}`]);if(!("string"==typeof e.token||e.token instanceof String))throw new St(gt.INVALID_TOKEN_IN_DETOKENIZE,[`${t}`]);const i=e.redaction;if(i&&!Object.values(ut).includes(i))throw new St(gt.INVALID_REDACTION_TYPE_IN_DETOKENIZE,[`${t}`])}))},Mt=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND_GET);const{records:i}=e;if(!i||!Array.isArray(i))throw new St(gt.INVALID_RECORDS_IN_GET,[]);if(0===i.length)throw new St(gt.EMPTY_RECORDS_GET);if(t&&Object.prototype.hasOwnProperty.call(t,"tokens")&&"boolean"!=typeof(null==t?void 0:t.tokens))throw new St(gt.INVALID_TOKENS_IN_GET);i.forEach(((e,i)=>{var n,o,s;if(0===Object.keys(e).length)throw new St(gt.EMPTY_RECORDS_GET);if(0===(null===(n=e.ids)||void 0===n?void 0:n.length))throw new St(gt.EMPTY_IDS_IN_GET,[`${i}`]);if(!(null==e.ids||e.ids&&Array.isArray(e.ids)))throw new St(gt.INVALID_IDS_IN_GET,[`${i}`]);if(null===(o=e.ids)||void 0===o||o.forEach((e=>{if(!e)throw new St(gt.EMPTY_SKYFLOWID_IN_GET,[`${i}`]);if(!("string"==typeof e||e instanceof String))throw new St(gt.INVALID_SKYFLOWID_TYPE_IN_GET,[`${i}`])})),!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_GET,[`${i}`]);if(!e.table)throw new St(gt.EMPTY_TABLE_IN_GET,[`${i}`]);if(!("string"==typeof e.table||e.table instanceof String))throw new St(gt.INVALID_TABLE_IN_GET,[`${i}`]);if(!t||!Object.prototype.hasOwnProperty.call(t,"tokens")||!0!==(null==t?void 0:t.tokens)){if(!Object.prototype.hasOwnProperty.call(e,"redaction"))throw new St(gt.MISSING_REDACTION_IN_GET,[`${i}`]);if(!e.redaction)throw new St(gt.EMPTY_REDACTION_TYPE_IN_GET,[`${i}`]);if(!Object.values(ut).includes(e.redaction))throw new St(gt.INVALID_REDACTION_TYPE_IN_GET,[`${i}`])}if(!0===Object.prototype.hasOwnProperty.call(e,"ids")&&!0===Object.prototype.hasOwnProperty.call(e,"columnName"))throw new St(gt.SKYFLOW_IDS_AND_COLUMN_NAME_BOTH_SPECIFIED,[`${i}`]);if(Object.prototype.hasOwnProperty.call(e,"columnName")){if(!Object.prototype.hasOwnProperty.call(e,"columnName")||!Object.prototype.hasOwnProperty.call(e,"columnValues"))throw new St(gt.MISSING_RECORD_COLUMN_VALUE,[`${i}`])}else if(!1===Object.prototype.hasOwnProperty.call(e,"ids")&&!1===Object.prototype.hasOwnProperty.call(e,"columnValues"))throw new St(gt.MISSING_IDS_OR_COLUMN_VALUES_IN_GET,[`${i}`]);if(0===(null===(s=e.columnValues)||void 0===s?void 0:s.length))throw new St(gt.EMPTY_RECORD_COLUMN_VALUES,[`${i}`]);if(!(null==e.columnValues||e.columnValues&&Array.isArray(e.columnValues)))throw new St(gt.INVALID_COLUMN_VALUES_IN_GET,[`${i}`]);if(void 0!==e.columnName&&void 0===e.columnValues)throw new St(gt.MISSING_RECORD_COLUMN_VALUE,[`${i}`]);if(void 0===e.columnName&&void 0!==e.columnValues)throw new St(gt.MISSING_RECORD_COLUMN_NAME,[`${i}`]);const r=e.columnName;if(null!=r&&"string"!=typeof r)throw new St(gt.INVALID_RECORD_COLUMN_VALUE,[`${i}`]);const a=e.columnValues;if(null!=a){if(0===a.length||null===a)throw new St(gt.EMPTY_RECORD_COLUMN_VALUES,[`${i}`]);a.forEach((e=>{if(""===e||null===e)throw new St(gt.EMPTY_COLUMN_VALUE,[`${i}`]);if("string"!=typeof e)throw new St(gt.INVALID_RECORD_COLUMN_VALUE_TYPE,[`${i}`])}))}if(t&&Object.prototype.hasOwnProperty.call(t,"tokens")&&!0===(null==t?void 0:t.tokens)){if(r||a)throw new St(gt.TOKENS_GET_COLUMN_NOT_SUPPORTED);if(e.redaction)throw new St(gt.REDACTION_WITH_TOKENS_NOT_SUPPORTED)}}))},Pt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND_GETBYID);const{records:t}=e;if(!t||!Array.isArray(t))throw new St(gt.INVALID_RECORDS_IN_GETBYID,[]);if(0===t.length)throw new St(gt.EMPTY_RECORDS_GETBYID);t.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"ids"))throw new St(gt.MISSING_IDS_IN_GETBYID,[`${t}`]);if(!e.ids||!Array.isArray(e.ids))throw new St(gt.INVALID_IDS_IN_GETBYID,[`${t}`]);if(0===e.ids.length)throw new St(gt.EMPTY_IDS_IN_GETBYID,[`${t}`]);if(e.ids.forEach((e=>{if(!e)throw new St(gt.EMPTY_SKYFLOWID_IN_GETBYID,[`${t}`]);if(!("string"==typeof e||e instanceof String))throw new St(gt.INVALID_SKYFLOWID_TYPE_IN_GETBYID,[`${t}`])})),!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_GETBYID,[`${t}`]);if(!e.table)throw new St(gt.EMPTY_TABLE_IN_GETBYID,[`${t}`]);if(!("string"==typeof e.table||e.table instanceof String))throw new St(gt.INVALID_TABLE_IN_GETBYID,[`${t}`]);if(!Object.prototype.hasOwnProperty.call(e,"redaction"))throw new St(gt.MISSING_REDACTION_IN_GETBYID,[`${t}`]);if(!e.redaction)throw new St(gt.EMPTY_REDACTION_TYPE_IN_GETBYID,[`${t}`]);if(!Object.values(ut).includes(e.redaction))throw new St(gt.INVALID_REDACTION_TYPE_IN_GETBYID,[`${t}`])}))},Vt=(e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new St(gt.RECORDS_KEY_NOT_FOUND_DELETE,[],!0);const{records:i}=e;if(!i||!Array.isArray(i))throw new St(gt.INVALID_RECORDS_IN_DELETE,[],!0);if(0===i.length)throw new St(gt.EMPTY_RECORDS_IN_DELETE,[],!0);i.forEach(((e,t)=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_DELETE,[`${t}`],!0);if(!e.table)throw new St(gt.EMPTY_TABLE_IN_DELETE,[`${t}`],!0);if(!("string"==typeof e.table||e.table instanceof String))throw new St(gt.INVALID_TABLE_IN_DELETE,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"id"))throw new St(gt.MISSING_ID_IN_DELETE,[`${t}`],!0);if(!e.id)throw new St(gt.EMPTY_ID_IN_DELETE,[`${t}`],!0);if(!("string"==typeof e.id||e.id instanceof String))throw new St(gt.INVALID_ID_IN_DELETE,[`${t}`],!0)}))},Ut=e=>{if(0===e.length)throw new St(gt.EMPTY_RECORDS_REVEAL);e.forEach((e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"skyflowID")){if(!e||!Object.prototype.hasOwnProperty.call(e,"token"))throw new St(gt.MISSING_TOKEN_KEY_REVEAL);if(!e.token)throw new St(gt.EMPTY_TOKEN_ID_REVEAL);if(!("string"==typeof e.token||e.token instanceof String))throw new St(gt.INVALID_TOKEN_ID_REVEAL)}const t=e.redaction;if(t&&!Object.values(ut).includes(t))throw new St(gt.INVALID_REDACTION_TYPE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"label")&&"string"!=typeof e.label)throw new St(gt.INVALID_LABEL_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"altText")&&"string"!=typeof e.altText)throw new St(gt.INVALID_ALT_TEXT_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"format")&&"string"!=typeof e.format)throw new St(gt.INVALID_FORMAT_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"format")&&""===e.format)throw new St(gt.EMPTY_FORMAT_REVEAL)}))},kt=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"skyflowID"))throw new St(gt.MISSING_SKYFLOWID_KEY_REVEAL);if(!e.skyflowID)throw new St(gt.EMPTY_SKYFLOW_ID_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"skyflowID")&&"string"!=typeof e.skyflowID)throw new St(gt.INVALID_SKYFLOW_ID_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"skyflowID")&&Object.prototype.hasOwnProperty.call(e,"token"))throw new St(gt.SKYFLOW_IDS_AND_TOKEN_BOTH_SPECIFIED);if(!e||!Object.prototype.hasOwnProperty.call(e,"column"))throw new St(gt.MISSING_COLUMN_KEY_REVEAL);if(!e.column)throw new St(gt.EMPTY_COLUMN_NAME_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"column")&&"string"!=typeof e.column)throw new St(gt.INVALID_COLUMN_NAME_REVEAL);if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_KEY_REVEAL);if(!e.table)throw new St(gt.EMPTY_TABLE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"table")&&"string"!=typeof e.table)throw new St(gt.INVALID_TABLE_REVEAL);if(Object.prototype.hasOwnProperty.call(e,"altText")&&"string"!=typeof e.altText)throw new St(gt.INVALID_ALT_TEXT_RENDER)},Yt=e=>{if(!e||"https"!==e.substring(0,5).toLowerCase())return!1;try{if(new URL(e))return!0}catch(e){return!1}return!0},Ft=e=>{let t=!0;try{new RegExp(e)}catch(e){t=!1}return t},xt=e=>{if(!Object.prototype.hasOwnProperty.call(e,"vaultID"))throw new St(gt.VAULTID_IS_REQUIRED,[],!0);if(!e.vaultID)throw new St(gt.EMPTY_VAULTID_IN_INIT,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"vaultURL"))throw new St(gt.VAULTURL_IS_REQUIRED,[],!0);if(!e.vaultURL)throw new St(gt.EMPTY_VAULTURL_IN_INIT,[],!0);if(e.vaultURL&&!Yt(e.vaultURL))throw new St(gt.INVALID_VAULTURL_IN_INIT,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"getBearerToken"))throw new St(gt.GET_BEARER_TOKEN_IS_REQUIRED,[],!0)},Gt=(e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new St(gt.MISSING_ELEMENT_TYPE,[],!0);if(!e.type)throw new St(gt.EMPTY_ELEMENT_TYPE,[],!0);if(Object.prototype.hasOwnProperty.call(e,"altText")&&Rt(Ee.COLLECT_ALT_TEXT_DEPERECATED,Lt.WARN,t),Object.prototype.hasOwnProperty.call(e,"skyflowID")&&"string"!=typeof e.skyflowID)throw new St(gt.INVALID_SKYFLOWID_IN_COLLECT,[],!0);if(e.type===Xe.FILE_INPUT&&!Object.keys(e).includes("skyflowID"))throw new St(gt.MISSING_SKYFLOWID_IN_COLLECT,[],!0)},Bt=e=>{if(!e||!Array.isArray(e))throw new St(gt.INVALID_UPSERT_OPTION_TYPE,[],!0);if(!e.length)throw new St(gt.EMPTY_UPSERT_OPTIONS_ARRAY,[],!0);e.forEach(((e,t)=>{if(!e||"object"!=typeof e)throw new St(gt.INVALID_UPSERT_OPTION_OBJECT_TYPE,[t],!0);if(!Object.prototype.hasOwnProperty.call(e,"table"))throw new St(gt.MISSING_TABLE_IN_UPSERT_OPTION,[t],!0);if(!e.table||"string"!=typeof e.table||!e.table.length)throw new St(gt.INVALID_TABLE_IN_UPSERT_OPTION,[t],!0);if(!Object.prototype.hasOwnProperty.call(e,"column"))throw new St(gt.MISSING_COLUMN_IN_UPSERT_OPTION,[t],!0);if(!e.column||"string"!=typeof e.column||!e.column.length)throw new St(gt.INVALID_COLUMN_IN_UPSERT_OPTION,[t],!0)}))},jt=e=>"boolean"==typeof e,Xt=e=>{if(e){if(Object.prototype.hasOwnProperty.call(e,"format")&&"string"!=typeof e.format)throw new St(gt.INVALID_INPUT_OPTIONS_FORMAT,[],!0);if(Object.prototype.hasOwnProperty.call(e,"translation")&&("object"!=typeof e.translation||"[object Object]"!==Object.prototype.toString.call(e.translation)))throw new St(gt.INVALID_INPUT_OPTIONS_TRANSLATION,[],!0)}};function Kt(e){const t=e.split(":");return t.length>2?(t.pop(),t.pop(),t.join(":")):""}const Wt=(e,t,i)=>{if("string"!=typeof e)return e;if(t===Xe.CARD_NUMBER){if(e=e&&e.replace(/\s/g,""),!i){const t=((e="")=>{const t=e.replace(/[\s-]/g,"");let i=Ke.DEFAULT;return Object.entries(Qe).forEach((([e,n])=>{n.regex.test(t)&&(i=e)})),i})(e),i=t!==Ke.DEFAULT&&t===Ke.AMEX?6:8;return e.length>i?e.replace(new RegExp(`.(?=.{0,${(null==e?void 0:e.length)-i-1}}$)`,"g"),"X"):e}return e}return i?e:void 0};class $t{constructor(e,t,i,n){this.setAttributess=e=>{dt(this.iframe,{src:e})},this.mount=e=>{var t;this.unmount();try{if("string"==typeof e){if(this.container=document.querySelector(e)||void 0,!this.container)throw new St(gt.INVALID_ELEMENT_SELECTOR,[],!0)}else{if(!(e instanceof HTMLElement))throw new St(gt.INVALID_ELEMENT_SELECTOR,[],!0);this.container=e}}catch(e){console.error(e)}dt(this.iframe,{src:Et()}),null===(t=this.container)||void 0===t||t.appendChild(this.iframe)},this.setIframeHeight=e=>{this.iframe.getAttribute("height")!==e&&this.iframe.setAttribute("height",`${e}px`)},this.unmount=()=>{this.iframe.remove()},this.name=`${e}:${i}:${n}`,this.metadata=t,this.iframe=ct({name:this.name})}}class Ht{}var zt,qt,Jt,Zt,Qt,ei,ti,ii,ni,oi,si,ri,ai,li,di,ci,Ei,_i,Ii,hi;const ui="Element";class pi extends Ht{constructor(e,n,o,s,r=!1,a,l,d,c){var E;super(),this.type=ro.COLLECT,zt.set(this,void 0),qt.set(this,!1),Jt.set(this,void 0),Zt.set(this,void 0),Qt.set(this,{isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:void 0,isRequired:!1}),ei.set(this,void 0),ti.set(this,new rt),ii.set(this,void 0),ni.set(this,new ht),oi.set(this,void 0),si.set(this,[]),ri.set(this,!1),ai.set(this,void 0),li.set(this,void 0),di.set(this,!1),this.getID=()=>t(this,zt,"f"),this.mount=e=>{var n;if(!e)throw new St(gt.EMPTY_ELEMENT_IN_MOUNT,["CollectElement"],!0);const o=(e,n)=>{if(e.name===t(this,oi,"f").name){n(t(this,ei,"f")),t(this,hi,"f").call(this);const e=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}return i}(t(this,Jt,"f")[0],["name"]);t(this,Zt,"f").length>1?t(this,Zt,"f").forEach(((e,i)=>{t(this,ii,"f")&&t(this,ii,"f")._emit(`${Le.READY}:${e.elementName}`,Object.assign(Object.assign({},t(this,Jt,"f")[i]),{elementType:e.elementType}))})):t(this,ti,"f")._emit(Le.READY,Object.assign({},e)),t(this,ni,"f").off(Oe+this.containerId,o),Rt(`${yt(de.ELEMENT_MOUNTED,ui,Dt(t(this,oi,"f").name))} `,Lt.LOG,t(this,ai,"f").logLevel),t(this,si,"f").forEach((e=>e())),i(this,si,[],"f")}};if(t(this,Zt,"f").length>1)t(this,oi,"f").mount(e),t(this,ni,"f").on(Oe+this.containerId,o);else{if(t(this,di,"f"))return t(this,oi,"f").mount(e),void t(this,ni,"f").on(Oe+this.containerId,o);null===(n=t(this,ii,"f"))||void 0===n||n.on(Be,(i=>{(null==i?void 0:i.containerId)===this.containerId&&(t(this,oi,"f").mount(e),t(this,ni,"f").on(Oe+this.containerId,o))}))}},this.unmount=()=>{t(this,oi,"f").unmount()},this.update=e=>{let n=It(e);const o=()=>{t(this,qt,"f")&&(n={rows:[{elements:[Object.assign({},n)]}]}),i(this,ei,Ni(t(this,ei,"f"),n),"f"),i(this,Zt,Ti(t(this,ei,"f")),"f"),t(this,qt,"f")?t(this,ni,"f").emit(Re,{name:t(this,oi,"f").name,options:t(this,Zt,"f")[0],isSingleElementAPI:!0}):(t(this,Zt,"f").forEach((e=>{t(this,ni,"f").emit(Re,{name:e.elementName,options:e,isSingleElementAPI:!0})})),t(this,ni,"f").emit(Re,{name:t(this,oi,"f").name,options:t(this,ei,"f"),isSingleElementAPI:!1})),t(this,hi,"f").call(this)};t(this,ri,"f")?o():t(this,si,"f").push(o)},ci.set(this,(e=>{t(this,qt,"f")||t(this,ti,"f").on(Re,(()=>{e(t(this,Zt,"f"))}),!0)})),this.updateElement=e=>{t(this,ni,"f").emit(Re,{name:e.elementName,options:e,isSingleElementAPI:!0})},Ei.set(this,(()=>{t(this,Jt,"f").forEach(((e,i)=>{if(0===i){t(this,Qt,"f").isEmpty=e.isEmpty,t(this,Qt,"f").isComplete=e.isComplete,t(this,Qt,"f").isValid=e.isValid,t(this,Qt,"f").isFocused=e.isFocused,t(this,Qt,"f").isRequired=e.isRequired,t(this,Qt,"f").value={};const n=t(this,Zt,"f")[i].elementName,o=e.value&&Wt(e.value,e.elementType,t(this,li,"f"));t(this,qt,"f")?t(this,Qt,"f").value=o:t(this,Qt,"f").value[n]=o}else t(this,Qt,"f").isEmpty=t(this,Qt,"f").isEmpty||e.isEmpty,t(this,Qt,"f").isComplete=t(this,Qt,"f").isComplete&&e.isComplete,t(this,Qt,"f").isValid=t(this,Qt,"f").isValid&&e.isValid,t(this,Qt,"f").isFocused=t(this,Qt,"f").isFocused||e.isFocused,t(this,Qt,"f").isRequired=t(this,Qt,"f").isRequired||e.isRequired,t(this,Qt,"f").value||(t(this,Qt,"f").value={}),t(this,Zt,"f")[i].sensitive||(t(this,Qt,"f").value[t(this,Zt,"f")[i].elementName]=e.value||"")}))})),this.getState=()=>({isEmpty:t(this,Qt,"f").isEmpty,isComplete:t(this,Qt,"f").isComplete,isValid:t(this,Qt,"f").isValid,isFocused:t(this,Qt,"f").isFocused,value:t(this,Qt,"f").value,required:t(this,Qt,"f").isRequired}),this.getOptions=()=>{let e=It(t(this,ei,"f"));return t(this,qt,"f")?e=e.rows[0].elements[0]:e.rows.forEach((e=>{e.elements.forEach((e=>{delete e.elementName}))})),delete e.elementName,e},_i.set(this,(e=>{t(this,ti,"f").on(me,(()=>{const i=t(this,Zt,"f").map((e=>e.elementName));t(this,qt,"f")||i.push(t(this,oi,"f").name),e(i)}),!0)})),Ii.set(this,(()=>{t(this,ni,"f").on(Ae,(e=>{if(t(this,qt,"f")&&e.event===Le.READY&&e.name===t(this,oi,"f").name)t(this,ti,"f")._emit(Le.READY);else{const i=t(this,Zt,"f").length>1;t(this,Zt,"f").forEach(((n,o)=>{var s;if(e.name===n.elementName){let r="";switch(e.event){case Le.FOCUS:r=Le.FOCUS;break;case Le.BLUR:r=Le.BLUR;break;case Le.CHANGE:r=Le.CHANGE;break;case Le.READY:r=Le.READY;break;case Le.SUBMIT:return void(null===(s=t(this,ii,"f"))||void 0===s||s._emit(Le.SUBMIT));default:throw new St(gt.INVALID_EVENT_TYPE,[],!0)}t(this,Jt,"f")[o].isEmpty=e.value.isEmpty,t(this,Jt,"f")[o].isValid=e.value.isValid,t(this,Jt,"f")[o].isComplete=e.value.isComplete,t(this,Jt,"f")[o].isFocused=e.value.isFocused,t(this,Jt,"f")[o].isRequired=e.value.isRequired,Object.prototype.hasOwnProperty.call(e.value,"value")?t(this,Jt,"f")[o].value=e.value.value:t(this,Jt,"f")[o].value=void 0,r=i?`${r}:${e.name}`:r,t(this,ni,"f").emit(Le.HEIGHT+t(this,oi,"f").name,{},(e=>{t(this,oi,"f").setIframeHeight(e.height)})),t(this,Ei,"f").call(this);const a=Object.assign(Object.assign({},t(this,Jt,"f")[o]),{elementType:n.elementType});i&&t(this,ii,"f")?t(this,ii,"f")._emit(r,a):t(this,ti,"f")._emit(r,a)}}))}}))})),hi.set(this,(()=>{const{rows:e}=t(this,ei,"f");e.forEach((e=>{e.elements.forEach((e=>{e.elementType!==$e.radio.name&&e.elementType!==$e.checkbox.name&&(e.value=void 0)}))})),i(this,Zt,Ti(t(this,ei,"f")),"f")})),this.containerId=s.containerId,i(this,zt,e,"f"),i(this,ai,d,"f"),i(this,ei,Ni(n),"f"),i(this,Zt,Ti(n),"f"),i(this,qt,r,"f"),c&&i(this,ii,c,"f"),i(this,li,At[t(this,ai,"f").env].doesReturnValue,"f"),this.elementType=t(this,qt,"f")?t(this,Zt,"f")[0].elementType:"group",i(this,Jt,[],"f"),t(this,Zt,"f").forEach((e=>{t(this,Jt,"f").push({isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:t(this,li,"f")?"":void 0,elementType:e.elementType,name:e.elementName,isRequired:!1})})),i(this,oi,new $t(t(this,ei,"f").elementName,o,this.containerId,t(this,ai,"f").logLevel),"f"),t(this,Ii,"f").call(this),t(this,_i,"f").call(this,a),t(this,ci,"f").call(this,l),Rt(yt(de.CREATED_ELEMENT,ui,Dt(t(this,oi,"f").name)),Lt.LOG,t(this,ai,"f").logLevel),i(this,di,s.isMounted,"f"),null===(E=t(this,ii,"f"))||void 0===E||E.on(Be,(e=>{(null==e?void 0:e.containerId)===this.containerId&&i(this,di,!0,"f")})),t(this,ni,"f").on(Le.MOUNTED,(e=>{s.type===ro.COMPOSABLE?t(this,Zt,"f").forEach((t=>{e.name===t.elementName&&(t.isMounted=!0,i(this,ri,!0,"f"))})):e.name===t(this,Zt,"f")[0].elementName&&(t(this,Zt,"f")[0].isMounted=!0,i(this,ri,!0,"f")),t(this,ni,"f").emit(Le.HEIGHT+t(this,oi,"f").name,{},(e=>{t(this,oi,"f").setIframeHeight(e.height)}))}))}on(e,i){if(!Object.values(Le).includes(e))throw new St(gt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new St(gt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new St(gt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,ti,"f").on(e,(e=>{void 0===e.value&&(e.value=""),delete e.isComplete,delete e.name,i(e)}))}iframeName(){return t(this,oi,"f").name}isMounted(){return t(this,ri,"f")}isValidElement(){for(let e=0;e<t(this,Zt,"f").length;e+=1){if(!Object.prototype.hasOwnProperty.call(t(this,Zt,"f")[e],"table"))throw new St(gt.MISSING_TABLE_IN_COLLECT,[],!0);if(!t(this,Zt,"f")[e].table)throw new St(gt.EMPTY_TABLE_IN_COLLECT,[],!0);if(!("string"==typeof t(this,Zt,"f")[e].table||t(this,Zt,"f")[e].table instanceof String))throw new St(gt.INVALID_TABLE_IN_COLLECT,[],!0);if(!Object.prototype.hasOwnProperty.call(t(this,Zt,"f")[e],"column"))throw new St(gt.MISSING_COLUMN_IN_COLLECT,[],!0);if(!t(this,Zt,"f")[e].column)throw new St(gt.EMPTY_COLUMN_IN_COLLECT,[],!0);if(!("string"==typeof t(this,Zt,"f")[e].column||t(this,Zt,"f")[e].column instanceof String))throw new St(gt.INVALID_COLUMN_IN_COLLECT,[],!0);if(void 0!==t(this,Zt,"f")[e].skyflowID&&!t(this,Zt,"f")[e].skyflowID)throw new St(gt.EMPTY_SKYFLOW_ID_IN_ADDITIONAL_FIELDS,[],!0)}return!0}setError(e){t(this,ni,"f").emit(be,{name:Kt(t(this,oi,"f").name),isTriggerError:!0,clientErrorText:e})}resetError(){t(this,ni,"f").emit(be,{name:Kt(t(this,oi,"f").name),isTriggerError:!1})}setValue(e){t(this,ai,"f").env!==Tt.PROD?t(this,qt,"f")&&t(this,ni,"f").emit(Re,{name:t(this,oi,"f").name,options:Object.assign(Object.assign({},t(this,Zt,"f")[0]),{value:e}),isSingleElementAPI:!0}):Rt(yt(Ee.UNABLE_TO_SET_VALUE_IN_PROD_ENV,t(this,Zt,"f")[0].elementType),Lt.WARN,t(this,ai,"f").logLevel)}clearValue(){t(this,ai,"f").env!==Tt.PROD?t(this,qt,"f")&&t(this,ni,"f").emit(Re,{name:t(this,oi,"f").name,options:Object.assign(Object.assign({},t(this,Zt,"f")[0]),{value:""}),isSingleElementAPI:!0}):Rt(yt(Ee.UNABLE_TO_CLEAR_VALUE_IN_PROD_ENV,t(this,Zt,"f")[0].elementType),Lt.WARN,t(this,ai,"f").logLevel)}}function fi(e,t,i={}){if("group"!==e&&!Object.prototype.hasOwnProperty.call($e,e))throw new St(gt.INVALID_ELEMENT_TYPE,[],!0);if(Object.prototype.hasOwnProperty.call(t,"validations")){if(!Array.isArray(t.validations))throw new St(gt.INVALID_VALIDATIONS_TYPE,[],!0);t.validations.forEach(((e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new St(gt.MISSING_VALIDATION_RULE_TYPE,[`${t}`],!0);if(!Object.values(Ot).includes(e.type))throw new St(gt.INVALID_VALIDATION_RULE_TYPE,[`${t}`],!0);if(!Object.prototype.hasOwnProperty.call(e,"params"))throw new St(gt.MISSING_VALIDATION_RULE_PARAMS,[`${t}`],!0);if("object"!=typeof e.params||Array.isArray(e.params)||null===e.params)throw new St(gt.INVALID_VALIDATION_RULE_PARAMS,[`${t}`],!0);if(e.type===Ot.REGEX_MATCH_RULE){if(!Object.prototype.hasOwnProperty.call(e.params,"regex"))throw new St(gt.MISSING_REGEX_IN_REGEX_MATCH_RULE,[`${t}`],!0)}else if(e.type===Ot.LENGTH_MATCH_RULE&&!Object.prototype.hasOwnProperty.call(e.params,"min")&&!Object.prototype.hasOwnProperty.call(e.params,"max"))throw new St(gt.MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE,[`${t}`],!0)}))}if(Object.prototype.hasOwnProperty.call(i,"name")&&i.name!==t.name)throw new Error("Name attribute can't be updated");if((i=Object.assign(Object.assign({},t),i)).mask||i.replacePattern){const{type:t}=$e[e].attributes;"text"===t&&"textarea"===t&&"email"===t||(delete i.mask,delete i.replacePattern)}if(void 0===!i.mask&&!Array.isArray(i.mask))throw new Error("mask option has to be array or undefined");if(Array.isArray(i.mask)){const e=i.mask;if("string"!=typeof e[0]||e[1]&&"object"!=typeof e[1])throw new Error("mask array values has to be string")}if(Array.isArray(i.replacePattern)){const e=i.replacePattern;if("string"!=typeof e[0]||e[1]&&"string"!=typeof e[1])throw new Error("replacePatterns array values has to be string")}if((e===$e.radio.name||e===$e.checkbox.name)&&!i.value)throw new Error("Elements radio and checkbox requires value attribute");if(!(e!==$e.dropdown.name||i.options&&Array.isArray(i.options)&&0!==i.options.length))throw new Error("Element dropdown requires options attribute with an array of objects containing value and text attributes")}function Ni(e,t={},i=!0){return(t=Object.assign(Object.assign({},e),t)).rows.forEach(((n,o)=>{const s=n,r=e.rows[o];t.rows[o]=Object.assign(Object.assign({},r),s),s.elements.forEach(((e,t)=>{var n,o;const a=r.elements[t],l=e;if(l.elementType&&a.elementType!==l.elementType&&a.elementName&&a.elementName!==l.elementName)throw new Error(ce.CANNOT_CHANGE_ELEMENT);fi(a.elementType,a,l),s.elements[t]=Object.assign(Object.assign(Object.assign({},a),l),{elementName:a.elementName});const d=l.classes||{},c=l.styles||{};c.base=Object.assign(Object.assign({},Je),c.base),l.classes=d,l.styles=c;const E=(null===(n=null==l?void 0:l.labelStyles)||void 0===n?void 0:n.classes)||{},_=(null===(o=null==l?void 0:l.labelStyles)||void 0===o?void 0:o.styles)||{};i&&function(e,t){Object.values(Ze).forEach((i=>{if(e[i]||t[i])switch(i){case Ze.BASE:t[i]=Object.assign({},t[i]);break;case Ze.FOCUS:t[Ze.BASE]=Object.assign(Object.assign({},t[Ze.BASE]),{":focus":Object.assign({},t[Ze.BASE]&&t[Ze.BASE][":focus"])});break;case Ze.WEBPACKAUTOFILL:t[Ze.BASE]=Object.assign(Object.assign({},t[Ze.BASE]),{":-webkit-autofill":Object.assign({},t[Ze.BASE]&&t[Ze.BASE][":-webkit-autofill"])});break;default:t[i]=Object.assign(Object.assign({},t[Ze.BASE]),t[i])}})),Object.keys(t).forEach((e=>{const i=t[e][":-webkit-autofill"];"object"==typeof i&&Object.keys(i).forEach((e=>{i[e]&&!i[e].includes("!important")&&(i[e]=`${i[e]} !important`)}))}))}(E,_),l.labelStyles={labelClasses:E},l.labelStyles.styles=_}))})),t}zt=new WeakMap,qt=new WeakMap,Jt=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,ei=new WeakMap,ti=new WeakMap,ii=new WeakMap,ni=new WeakMap,oi=new WeakMap,si=new WeakMap,ri=new WeakMap,ai=new WeakMap,li=new WeakMap,di=new WeakMap,ci=new WeakMap,Ei=new WeakMap,_i=new WeakMap,Ii=new WeakMap,hi=new WeakMap;const Ti=e=>{const{rows:t}=e,i=[];return t.forEach((e=>{e.elements.forEach((e=>{i.push(e)}))})),i},Li=e=>{const t=e.validations;return t&&Array.isArray(t)&&t.length>0&&t.forEach(((e,t)=>{if(e&&e.type===Ot.ELEMENT_VALUE_MATCH_RULE){if(e.params&&!Object.prototype.hasOwnProperty.call(e.params,"element"))throw new St(gt.MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE,[`${t}`],!0);if(e.params&&(null==e.params.element||!(e.params.element instanceof pi)))throw new St(gt.INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE,[`${t}`],!0);e.params&&e.params.element&&e.params.element instanceof pi&&(e.params.element=e.params.element.iframeName())}else if(e&&e.type===Ot.REGEX_MATCH_RULE){if(e.params&&e.params.regex&&!Ft(e.params.regex))throw new St(gt.INVALID_REGEX_IN_REGEX_MATCH_RULE,[`${t}`],!0);e.params&&e.params.regex&&Ft(e.params.regex)&&(e.params.regex=e.params.regex.toString())}})),t},Oi=(e,t,i)=>{let n=Object.assign({required:!1},t);if((Object.prototype.hasOwnProperty.call(n,"format")||Object.prototype.hasOwnProperty.call(n,"translation"))&&(ot.includes(e)?(Rt(yt(Ee.INPUT_FORMATTING_NOT_SUPPROTED,e),Lt.WARN,i),null==n||delete n.format,null==n||delete n.translation):e===$e.INPUT_FIELD.name&&(Xt(t),n=Object.assign(Object.assign({},n),{mask:[n.format,n.translation?n.translation:st]}),null==n||delete n.format,null==n||delete n.translation)),e===$e.CARD_NUMBER.name){Object.prototype.hasOwnProperty.call(n,"enableCardIcon")||(n=Object.assign(Object.assign({},n),{enableCardIcon:!0}));let e=" ";(null==n?void 0:n.format)===He&&(e="-"),n=Object.assign(Object.assign({},n),{cardSeperator:e}),null==n||delete n.format,null==n||delete n.translation}else if(e===$e.EXPIRATION_DATE.name){let e=!1;n.format&&(e=!!(o=n.format.toUpperCase())&&tt.includes(o),e||Rt(yt(Ee.INVALID_EXPIRATION_DATE_FORMAT,tt.toString()),Lt.WARN,i)),n=Object.assign(Object.assign({},n),{format:e?n.format.toUpperCase():et}),null==n||delete n.translation}else if(e===$e.EXPIRATION_YEAR.name){let e=!1;n.format&&(e=(e=>!!e&&it.includes(e))(n.format.toUpperCase()),e||Rt(yt(Ee.INVALID_EXPIRATION_YEAR_FORMAT,it.toString()),Lt.WARN,i)),n=Object.assign(Object.assign({},n),{format:e?n.format.toUpperCase():"YY"}),null==n||delete n.translation}var o;if(Object.prototype.hasOwnProperty.call(n,"enableCardIcon")&&!jt(n.enableCardIcon))throw new St(gt.INVALID_BOOLEAN_OPTIONS,["enableCardIcon"],!0);if(Object.prototype.hasOwnProperty.call(n,"enableCopy")&&!jt(n.enableCopy))throw new St(gt.INVALID_BOOLEAN_OPTIONS,["enableCopy"],!0);if(Object.prototype.hasOwnProperty.call(n,"required")&&!jt(n.required))throw new St(gt.INVALID_BOOLEAN_OPTIONS,["required"],!0);if(e===$e.FILE_INPUT.name&&t.allowedFileType){if(!Array.isArray(t.allowedFileType))throw new St(gt.INVALID_ALLOWED_OPTIONS,[],!0);if(t.allowedFileType.length<=0)throw new St(gt.EMPTY_ALLOWED_OPTIONS_ARRAY,[],!0);if(!t.allowedFileType.every((e=>"string"==typeof e)))throw new St(gt.INVALID_ALLOWED_FILETYPE_ARRAY,[],!0)}return n};function vi(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=crypto.getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)*16|0;return("x"===e?t:3&t|8).toString(16)}))}class Ai{}var mi,Ri,yi,Di,Si,gi,Ci,bi,wi,Mi,Pi,Vi;const Ui="CollectContainer";class ki extends Ai{constructor(e,n,o,s){super(),mi.set(this,void 0),Ri.set(this,{}),yi.set(this,void 0),Di.set(this,void 0),Si.set(this,void 0),this.type=ro.COLLECT,gi.set(this,void 0),Ci.set(this,!1),this.create=(e,i={required:!1})=>{Gt(e,t(this,Di,"f").logLevel);const n=Li(e),o=Oi(e.type,i,t(this,Di,"f").logLevel),s={rows:[{elements:[Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column,accept:i.allowedFileType},e),o),{validations:n})]}]};return t(this,bi,"f").call(this,s,!0)},bi.set(this,((e,i=!1)=>{const n=[],o=It(e);if(o.rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:i}=t;fi(i,t),t.sensitive=t.sensitive||$e[i].sensitive,t.replacePattern=t.replacePattern||$e[i].replacePattern,t.mask=t.mask||$e[i].mask,t.isMounted=!1,t.elementType!==$e.radio.name&&t.elementType!==$e.checkbox.name||(t.elementName=`${t.elementName}:${btoa(t.value)}`),t.elementName=`${he}:${t.elementType}:${btoa(vi())}`,t.label=e.label,t.skyflowID=e.skyflowID,n.push(t)}))})),o.elementName=i?n[0].elementName:`${he}:group:${btoa(o.name)}`,i&&!t(this,Ri,"f")[n[0].elementName]&&t(this,Vi,"f").call(this,n[0].name))throw new St(gt.UNIQUE_ELEMENT_NAME,[`${n[0].name}`],!0);let s=t(this,Ri,"f")[o.elementName];if(s)i?s.update(n[0]):s.update(o);else{const e=vi();s=new pi(e,o,t(this,yi,"f"),{containerId:t(this,mi,"f"),isMounted:t(this,Ci,"f"),type:this.type},i,t(this,Mi,"f"),t(this,Pi,"f"),t(this,Di,"f"),t(this,gi,"f")),t(this,Ri,"f")[o.elementName]=s,t(this,Si,"f")[e]=s}return i||n.forEach((e=>{const i=e.elementName;t(this,Ri,"f")[i]?t(this,Ri,"f")[i].update(e):t(this,Ri,"f")[i]=this.create(e.elementType,s)})),s})),wi.set(this,(e=>{Object.keys(t(this,Ri,"f")).forEach((i=>{i===e&&delete t(this,Ri,"f")[i]}))})),Mi.set(this,(e=>{e.forEach((e=>{t(this,wi,"f").call(this,e)}))})),Pi.set(this,(e=>{e.forEach((e=>{t(this,Ri,"f")[e.elementName]&&t(this,Ri,"f")[e.elementName].update(e)}))})),Vi.set(this,(e=>{const i=Object.keys(t(this,Ri,"f"));for(let t=0;t<i.length;t+=1)if(atob(i[t].split(":")[2])===e)return!0;return!1})),this.collect=(e={tokens:!0})=>new Promise(((i,n)=>{try{xt(t(this,yi,"f").clientJSON.config);if(Object.values(t(this,Ri,"f")).forEach((e=>{if(!e.isMounted())throw new St(gt.ELEMENTS_NOT_MOUNTED,[],!0);e.isValidElement()})),Object.prototype.hasOwnProperty.call(e,"tokens")&&!jt(e.tokens))throw new St(gt.INVALID_TOKENS_IN_COLLECT,[],!0);(null==e?void 0:e.additionalFields)&&bt(e.additionalFields),(null==e?void 0:e.upsert)&&Bt(null==e?void 0:e.upsert),le.emit(ve+t(this,mi,"f"),Object.assign(Object.assign({},e),{tokens:void 0===(null==e?void 0:e.tokens)||e.tokens}),(e=>{!e||(null==e?void 0:e.error)?(Rt(`${JSON.stringify(null==e?void 0:e.error)}`,Lt.ERROR,t(this,Di,"f").logLevel),n(null==e?void 0:e.error)):(Rt(yt(de.COLLECT_SUBMIT_SUCCESS,Ui),Lt.LOG,t(this,Di,"f").logLevel),i(e))})),Rt(yt(de.EMIT_EVENT,Ui,ve),Lt.LOG,t(this,Di,"f").logLevel)}catch(e){Rt(`${e.message}`,Lt.ERROR,t(this,Di,"f").logLevel),n(e)}})),this.uploadFiles=e=>new Promise(((i,n)=>{try{xt(t(this,yi,"f").clientJSON.config);Object.values(t(this,Ri,"f")).forEach((e=>{if(!e.isMounted())throw new St(gt.ELEMENTS_NOT_MOUNTED,[],!0);e.isValidElement()})),le.emit(Pe+t(this,mi,"f"),Object.assign({},e),(e=>{!e||(null==e?void 0:e.error)?(Rt(`${JSON.stringify(null==e?void 0:e.error)}`,Lt.ERROR,t(this,Di,"f").logLevel),n(null==e?void 0:e.error)):(Rt(yt(de.COLLECT_SUBMIT_SUCCESS,Ui),Lt.LOG,t(this,Di,"f").logLevel),i(e))})),Rt(yt(de.EMIT_EVENT,Ui,Pe),Lt.LOG,t(this,Di,"f").logLevel)}catch(e){Rt(`${e.message}`,Lt.ERROR,t(this,Di,"f").logLevel),n(e)}})),i(this,mi,vi(),"f"),i(this,yi,n,"f"),i(this,Si,o,"f"),i(this,Di,s,"f"),i(this,gi,new rt,"f");const r=ct({name:`${_e}:${t(this,mi,"f")}:${t(this,Di,"f").logLevel}`});dt(r,{src:Et()}),_t(r,Object.assign({},qe)),Rt(yt(de.CREATE_COLLECT_CONTAINER,Ui),Lt.LOG,t(this,Di,"f").logLevel);const a=(e,o)=>{e.name===_e+t(this,mi,"f")&&(o(Object.assign(Object.assign({},n),{clientJSON:Object.assign(Object.assign({},n.clientJSON),{config:Object.assign({},n.clientJSON.config)}),context:s})),i(this,Ci,!0,"f"),t(this,gi,"f")._emit(Be,{containerId:t(this,mi,"f")}),le.target(at.IFRAME_SECURE_ORGIN).off(Oe+t(this,mi,"f"),a))};le.target(at.IFRAME_SECURE_ORGIN).on(Oe+t(this,mi,"f"),a),document.body.append(r)}}mi=new WeakMap,Ri=new WeakMap,yi=new WeakMap,Di=new WeakMap,Si=new WeakMap,gi=new WeakMap,Ci=new WeakMap,bi=new WeakMap,wi=new WeakMap,Mi=new WeakMap,Pi=new WeakMap,Vi=new WeakMap;var Yi=function(e,t){for(var i,n=-1,o=e.length;++n<o;){var s=t(e[n]);void 0!==s&&(i=void 0===i?s:i+s)}return i},Fi=function(e){return e};var xi,Gi,Bi,ji,Xi,Ki,Wi,$i,Hi,zi,qi,Ji,Zi,Qi,en,tn,nn,on,sn,rn,an,ln,dn,cn=D((function(e){return e&&e.length?Yi(e,Fi):0}));class En{constructor(e,n){xi.set(this,void 0),Gi.set(this,void 0),this.type=ro.COMPOSABLE,Bi.set(this,!1),ji.set(this,!1),this.update=e=>{i(this,ji,!0,"f"),t(this,Bi,"f")?(t(this,Gi,"f")._emit(Ve,{elementName:t(this,xi,"f"),elementOptions:e}),i(this,ji,!1,"f")):t(this,ji,"f")&&t(this,Gi,"f").on(`${ft.READY}:${t(this,xi,"f")}`,(()=>{t(this,Gi,"f")._emit(Ve,{elementName:t(this,xi,"f"),elementOptions:e}),i(this,Bi,!0,"f"),i(this,ji,!1,"f")}))},i(this,xi,e,"f"),i(this,Gi,n,"f"),t(this,Gi,"f").on(`${ft.READY}:${t(this,xi,"f")}`,(()=>{i(this,Bi,!0,"f")}))}on(e,i){if(!Object.values(Le).includes(e))throw new St(gt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new St(gt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new St(gt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,Gi,"f").on(`${e}:${t(this,xi,"f")}`,(e=>{void 0===e.value&&(e.value=""),delete e.isComplete,delete e.name,i(e)}))}}xi=new WeakMap,Gi=new WeakMap,Bi=new WeakMap,ji=new WeakMap;const _n="CollectContainer";class In extends Ai{constructor(e,n,o,s){super(),Xi.set(this,void 0),Ki.set(this,{}),Wi.set(this,void 0),$i.set(this,{rows:[]}),Hi.set(this,[]),zi.set(this,void 0),qi.set(this,void 0),Ji.set(this,void 0),Zi.set(this,!1),Qi.set(this,void 0),en.set(this,void 0),this.type=ro.COMPOSABLE,tn.set(this,!1),nn.set(this,{}),this.create=(e,i={required:!1})=>{Gt(e,t(this,zi,"f").logLevel);const n=Li(e),o=Oi(e.type,i,t(this,zi,"f").logLevel),s=`${he}:${e.type}:${btoa(vi())}`;return t(this,Hi,"f").push(Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column},e),o),{validations:n,elementName:s})),new En(s,t(this,Ji,"f"))},on.set(this,((e,n=!1)=>{const o=[];if(i(this,nn,It(e),"f"),t(this,nn,"f").rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:i}=t;fi(i,t),t.sensitive=t.sensitive||$e[i].sensitive,t.replacePattern=t.replacePattern||$e[i].replacePattern,t.mask=t.mask||$e[i].mask,t.isMounted=!1,t.label=e.label,t.skyflowID=e.skyflowID,o.push(t)}))})),t(this,nn,"f").elementName=n?o[0].elementName:`${he}:group:${btoa(t(this,nn,"f").name)}`,n&&!t(this,Ki,"f")[o[0].elementName]&&t(this,ln,"f").call(this,o[0].name))throw new St(gt.UNIQUE_ELEMENT_NAME,[`${o[0].name}`],!0);let s=t(this,Ki,"f")[t(this,nn,"f").elementName];if(s)n?s.update(o[0]):s.update(t(this,nn,"f"));else{const e=vi();s=new pi(e,t(this,nn,"f"),t(this,Wi,"f"),{containerId:t(this,Xi,"f"),isMounted:t(this,tn,"f"),type:this.type},!0,t(this,rn,"f"),t(this,an,"f"),t(this,zi,"f"),t(this,Ji,"f")),t(this,Ki,"f")[t(this,nn,"f").elementName]=s,t(this,qi,"f")[e]=s}return s})),sn.set(this,(e=>{Object.keys(t(this,Ki,"f")).forEach((i=>{i===e&&delete t(this,Ki,"f")[i]}))})),rn.set(this,(e=>{e.forEach((e=>{t(this,sn,"f").call(this,e)}))})),an.set(this,(e=>{e.forEach((e=>{t(this,Ki,"f")[e.elementName]&&t(this,Ki,"f")[e.elementName].update(e)}))})),ln.set(this,(e=>{const i=Object.keys(t(this,Ki,"f"));for(let t=0;t<i.length;t+=1)if(atob(i[t].split(":")[2])===e)return!0;return!1})),this.on=(e,i)=>{if(!Object.values(Le).includes(e))throw new St(gt.INVALID_EVENT_LISTENER,[],!0);if(!i)throw new St(gt.MISSING_HANDLER_IN_EVENT_LISTENER,[],!0);if("function"!=typeof i)throw new St(gt.INVALID_HANDLER_IN_EVENT_LISTENER,[],!0);t(this,Ji,"f").on(Le.SUBMIT,(()=>{i()}))},this.mount=e=>{if(!e)throw new St(gt.EMPTY_ELEMENT_IN_MOUNT,["CollectElement"],!0);const{layout:n}=t(this,Qi,"f");if(cn(n)!==t(this,Hi,"f").length)throw new St(gt.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM,[],!0);let o=0;if(n.forEach(((e,i)=>{t(this,$i,"f").rows=[...t(this,$i,"f").rows,{elements:[]}];for(let n=0;n<e;n++)t(this,$i,"f").rows[i].elements.push(t(this,Hi,"f")[o]),o++})),t(this,Qi,"f").styles&&(t(this,$i,"f").styles=Object.assign({},t(this,Qi,"f").styles)),t(this,Qi,"f").errorTextStyles&&(t(this,$i,"f").errorTextStyles=Object.assign({},t(this,Qi,"f").errorTextStyles)),t(this,tn,"f"))return i(this,en,t(this,on,"f").call(this,t(this,$i,"f"),!1),"f"),t(this,en,"f").mount(e),void i(this,Zi,!0,"f");t(this,Ji,"f").on(Ge+t(this,Xi,"f"),(()=>{i(this,en,t(this,on,"f").call(this,t(this,$i,"f"),!1),"f"),t(this,en,"f").mount(e),i(this,Zi,!0,"f")}))},this.unmount=()=>{t(this,en,"f").unmount()},this.collect=(e={tokens:!0})=>new Promise(((i,n)=>{try{if(xt(t(this,Wi,"f").clientJSON.config),!t(this,Zi,"f"))throw new St(gt.COMPOSABLE_CONTAINER_NOT_MOUNTED,[],!0);Ti(t(this,nn,"f")).forEach((e=>{if(!(null==e?void 0:e.isMounted))throw new St(gt.ELEMENTS_NOT_MOUNTED,[],!0)}));if(Object.values(t(this,Ki,"f")).forEach((e=>{e.isValidElement()})),e&&e.tokens&&"boolean"!=typeof e.tokens)throw new St(gt.INVALID_TOKENS_IN_COLLECT,[],!0);(null==e?void 0:e.additionalFields)&&bt(e.additionalFields),(null==e?void 0:e.upsert)&&Bt(null==e?void 0:e.upsert),le.emit(ve+t(this,Xi,"f"),Object.assign(Object.assign({},e),{tokens:void 0===(null==e?void 0:e.tokens)||e.tokens}),(e=>{!e||(null==e?void 0:e.error)?(Rt(`${JSON.stringify(null==e?void 0:e.error)}`,Lt.ERROR,t(this,zi,"f").logLevel),n(null==e?void 0:e.error)):(Rt(yt(de.COLLECT_SUBMIT_SUCCESS,_n),Lt.LOG,t(this,zi,"f").logLevel),i(e))})),Rt(yt(de.EMIT_EVENT,_n,ve),Lt.LOG,t(this,zi,"f").logLevel)}catch(e){Rt(`${e.message}`,Lt.ERROR,t(this,zi,"f").logLevel),n(e)}})),dn.set(this,(()=>{t(this,Ji,"f").on(Ve,(e=>{let i;const n=t(this,Hi,"f").map(((t,n)=>t.elementName===e.elementName?(i=n,Object.assign({elementName:t.elementName},e.elementOptions)):t));t(this,en,"f")&&t(this,en,"f").updateElement(Object.assign({},n[i]))}))})),i(this,Xi,vi(),"f"),i(this,Wi,n,"f"),i(this,qi,o,"f"),i(this,zi,s,"f"),i(this,Qi,e,"f"),i(this,Ji,new rt,"f");const r=ct({name:`${_e}:${t(this,Xi,"f")}:${t(this,zi,"f").logLevel}`});dt(r,{src:Et()}),_t(r,Object.assign({},qe)),Rt(yt(de.CREATE_COLLECT_CONTAINER,_n),Lt.LOG,t(this,zi,"f").logLevel);const a=(e,o)=>{e.name===_e+t(this,Xi,"f")&&(o(Object.assign(Object.assign({},n),{clientJSON:Object.assign(Object.assign({},n.clientJSON),{config:Object.assign({},n.clientJSON.config)}),context:s})),i(this,tn,!0,"f"),t(this,Ji,"f")._emit(Ge+t(this,Xi,"f"),{containerId:t(this,Xi,"f")}),le.target(at.IFRAME_SECURE_ORGIN).off(Oe+t(this,Xi,"f"),a))};le.target(at.IFRAME_SECURE_ORGIN).on(Oe+t(this,Xi,"f"),a),document.body.append(r),t(this,dn,"f").call(this)}}var hn,un,pn,fn,Nn,Tn,Ln,On,vn,An;Xi=new WeakMap,Ki=new WeakMap,Wi=new WeakMap,$i=new WeakMap,Hi=new WeakMap,zi=new WeakMap,qi=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,en=new WeakMap,tn=new WeakMap,nn=new WeakMap,on=new WeakMap,sn=new WeakMap,rn=new WeakMap,an=new WeakMap,ln=new WeakMap,dn=new WeakMap;class mn extends Ht{constructor(e,n={},o,s,r,a){super(),hn.set(this,void 0),un.set(this,void 0),pn.set(this,void 0),fn.set(this,void 0),Nn.set(this,!1),Tn.set(this,!1),Ln.set(this,void 0),On.set(this,void 0),vn.set(this,!1),An.set(this,void 0),i(this,On,r,"f"),i(this,un,o,"f"),i(this,pn,Object.assign(Object.assign({},e),(e=>{let t={};if(e){if(t=Object.assign({},e),Object.prototype.hasOwnProperty.call(t,"enableCopy")&&!jt(t.enableCopy))throw new St(gt.INVALID_BOOLEAN_OPTIONS,["enableCopy"],!0);if(Object.prototype.hasOwnProperty.call(t,"format")||Object.prototype.hasOwnProperty.call(t,"translation")){const e=[];t.format&&e.push(t.format),e.push(null),t.translation?e.push(t.translation):t.format&&e.push(st),t=Object.assign(Object.assign({},t),3===e.length?{mask:e}:{}),null==t||delete t.format,null==t||delete t.translation}}return t})(n)),"f"),i(this,fn,s.containerId,"f"),i(this,vn,s.isMounted,"f"),i(this,An,s.eventEmitter,"f"),i(this,Ln,a,"f"),i(this,hn,new $t(`reveal:${btoa(vi())}`,{metaData:o},t(this,fn,"f"),t(this,Ln,"f").logLevel),"f"),t(this,vn,"f")||t(this,An,"f").on(je,(e=>{(null==e?void 0:e.containerId)===t(this,fn,"f")&&i(this,vn,!0,"f")})),Rt(yt(de.CREATED_ELEMENT,"RevealElement",`${e.token||""} reveal `),Lt.LOG,t(this,Ln,"f").logLevel)}getID(){return t(this,On,"f")}mount(e){var n;if(!e)throw new St(gt.EMPTY_ELEMENT_IN_MOUNT,["RevealElement"],!0);const o=(e,n)=>{e.name===t(this,hn,"f").name&&(n(Object.assign(Object.assign({},t(this,un,"f")),{record:t(this,pn,"f"),context:t(this,Ln,"f")})),le.off(De,o),le.emit(Fe+t(this,fn,"f"),{id:t(this,pn,"f").token,containerId:t(this,fn,"f")}),i(this,Nn,!0,"f"))};if(t(this,vn,"f"))return t(this,hn,"f").mount(e),void le.target(at.IFRAME_SECURE_ORGIN).on(De,o);null===(n=t(this,An,"f"))||void 0===n||n.on(je,(i=>{(null==i?void 0:i.containerId)===t(this,fn,"f")&&(t(this,hn,"f").mount(e),le.target(at.IFRAME_SECURE_ORGIN).on(De,o))}))}iframeName(){return t(this,hn,"f").name}isMounted(){return t(this,Nn,"f")}hasToken(){return!!t(this,pn,"f").token}isClientSetError(){return t(this,Tn,"f")}getRecordData(){return t(this,pn,"f")}setError(e){le.emit(we,{name:t(this,hn,"f").name,isTriggerError:!0,clientErrorText:e}),i(this,Tn,!0,"f")}resetError(){le.emit(we,{name:t(this,hn,"f").name,isTriggerError:!1}),i(this,Tn,!1,"f")}setAltText(e){le.emit(Me,{name:t(this,hn,"f").name,updateType:Ye,updatedValue:e})}clearAltText(){le.emit(Me,{name:t(this,hn,"f").name,updateType:Ye,updatedValue:null})}setToken(e){i(this,pn,Object.assign(Object.assign({},t(this,pn,"f")),{token:e}),"f"),le.emit(Me,{name:t(this,hn,"f").name,updateType:ke,updatedValue:e})}unmount(){t(this,hn,"f").unmount()}}var Rn,yn,Dn,Sn,gn,Cn,bn,wn,Mn,Pn,Vn;hn=new WeakMap,un=new WeakMap,pn=new WeakMap,fn=new WeakMap,Nn=new WeakMap,Tn=new WeakMap,Ln=new WeakMap,On=new WeakMap,vn=new WeakMap,An=new WeakMap;const Un="RevealContainer";class kn extends Ai{constructor(e,n,o){super(),Rn.set(this,[]),yn.set(this,[]),Dn.set(this,[]),Sn.set(this,void 0),gn.set(this,void 0),Cn.set(this,void 0),bn.set(this,!1),wn.set(this,!1),Mn.set(this,void 0),Pn.set(this,void 0),Vn.set(this,void 0),this.type=ro.REVEAL,i(this,Sn,e,"f"),i(this,Pn,n,"f"),i(this,gn,vi(),"f"),i(this,Cn,new rt,"f"),i(this,Mn,o,"f");const s=ct({name:`${Ie}:${t(this,gn,"f")}`});dt(s,{src:Et()}),_t(s,Object.assign({},qe)),Rt(yt(de.CREATE_REVEAL_CONTAINER,Un),Lt.LOG,t(this,Mn,"f").logLevel);const r=(n,s)=>{n.name===Ie&&(s(Object.assign(Object.assign({},e),{clientJSON:Object.assign(Object.assign({},e.clientJSON),{config:Object.assign({},e.clientJSON.config),context:o})})),i(this,Vn,!0,"f"),t(this,Cn,"f")._emit(je,{containerId:t(this,gn,"f")}),le.target(at.IFRAME_SECURE_ORGIN).off(De+t(this,gn,"f"),r))};le.target(at.IFRAME_SECURE_ORGIN).on(De+t(this,gn,"f"),r),document.body.append(s),le.target(window.location.origin).on(Fe+t(this,gn,"f"),(e=>{t(this,Dn,"f").push(e);let n=0;t(this,yn,"f").forEach((e=>{e.getRecordData().skyflowID||(n+=1)})),i(this,wn,t(this,Dn,"f").length===n,"f"),t(this,bn,"f")&&t(this,wn,"f")&&t(this,Cn,"f")._emit(xe+t(this,gn,"f"),{containerId:t(this,gn,"f")})}))}create(e,i){const n=vi();Xt(i);const o=new mn(e,i,t(this,Sn,"f"),{containerId:t(this,gn,"f"),isMounted:t(this,Vn,"f"),eventEmitter:t(this,Cn,"f")},n,t(this,Mn,"f"));return t(this,yn,"f").push(o),t(this,Pn,"f")[n]=o,o}reveal(){return i(this,bn,!0,"f"),t(this,wn,"f")?new Promise(((e,n)=>{try{xt(t(this,Sn,"f").clientJSON.config),Rt(yt(de.VALIDATE_REVEAL_RECORDS,Un),Lt.LOG,t(this,Mn,"f").logLevel),t(this,yn,"f").forEach((e=>{if(e.isClientSetError())throw new St(gt.REVEAL_ELEMENT_ERROR_STATE);e.getRecordData().skyflowID||t(this,Rn,"f").push(e.getRecordData())})),Ut(t(this,Rn,"f")),le.emit(ye+t(this,gn,"f"),{records:t(this,Rn,"f")},(o=>{i(this,Dn,[],"f"),i(this,Rn,[],"f"),o.error?(Rt(ce.FAILED_REVEAL,Lt.ERROR,t(this,Mn,"f").logLevel),n(o.error)):(Rt(yt(de.REVEAL_SUBMIT_SUCCESS,Un),Lt.LOG,t(this,Mn,"f").logLevel),e(o))})),Rt(yt(de.EMIT_EVENT,Un,ye),Lt.LOG,t(this,Mn,"f").logLevel)}catch(e){Rt(`Error: ${e.message}`,Lt.ERROR,t(this,Mn,"f").logLevel),n(e)}})):new Promise(((e,n)=>{try{xt(t(this,Sn,"f").clientJSON.config),Rt(yt(de.VALIDATE_REVEAL_RECORDS,Un),Lt.LOG,t(this,Mn,"f").logLevel);const o=setTimeout((()=>{Rt(ce.ELEMENTS_NOT_MOUNTED_REVEAL,Lt.ERROR,t(this,Mn,"f").logLevel),n(ce.ELEMENTS_NOT_MOUNTED_REVEAL)}),3e4);t(this,yn,"f").forEach((e=>{if(e.isClientSetError())throw clearTimeout(o),new St(gt.REVEAL_ELEMENT_ERROR_STATE);e.getRecordData().skyflowID||t(this,Rn,"f").push(e.getRecordData())})),Ut(t(this,Rn,"f")),t(this,Cn,"f").on(xe+t(this,gn,"f"),(()=>{clearTimeout(o),le.emit(ye+t(this,gn,"f"),{records:t(this,Rn,"f")},(o=>{i(this,Rn,[],"f"),i(this,Dn,[],"f"),o.error?(Rt(ce.FAILED_REVEAL,Lt.ERROR,t(this,Mn,"f").logLevel),n(o.error)):(Rt(yt(de.REVEAL_SUBMIT_SUCCESS,Un),Lt.LOG,t(this,Mn,"f").logLevel),e(o))}))}))}catch(e){Rt(e.message,Lt.ERROR,t(this,Mn,"f").logLevel),n(e)}}))}}Rn=new WeakMap,yn=new WeakMap,Dn=new WeakMap,Sn=new WeakMap,gn=new WeakMap,Cn=new WeakMap,bn=new WeakMap,wn=new WeakMap,Mn=new WeakMap,Pn=new WeakMap,Vn=new WeakMap;const Yn=(e,t)=>{if(e.fields){return{success:{skyflow_id:e.fields.skyflow_id,column:t}}}return e};var Fn,xn,Gn,Bn;const jn="SkyflowContainer";class Xn{constructor(e,n){var o,s;Fn.set(this,void 0),xn.set(this,void 0),Gn.set(this,!1),Bn.set(this,void 0),i(this,xn,e,"f"),i(this,Fn,(null===(s=null===(o=t(this,xn,"f").toJSON())||void 0===o?void 0:o.metaData)||void 0===s?void 0:s.uuid)||"","f"),i(this,Bn,n,"f");const r=ct({name:`skyflow_controller:${t(this,Fn,"f")}`});dt(r,{src:Et()}),_t(r,Object.assign({},qe)),document.body.append(r),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),((e,o)=>{Rt(yt(de.CAPTURE_PUREJS_FRAME,jn),Lt.LOG,t(this,Bn,"f").logLevel),o({client:t(this,xn,"f"),context:n}),i(this,Gn,!0,"f")})),Rt(yt(de.PUREJS_CONTROLLER_INITIALIZED,jn),Lt.LOG,t(this,Bn,"f").logLevel)}detokenize(e){return t(this,Gn,"f")?new Promise(((i,n)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_DETOKENIZE_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),wt(e),le.emit(Se+t(this,Fn,"f"),{type:pe,records:e.records},(e=>{e.error?n(e.error):i(e)})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,pe),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),n(e)}})):new Promise(((i,n)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_DETOKENIZE_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),wt(e),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Se+t(this,Fn,"f"),{type:pe,records:e.records},(e=>{e.error?n(e.error):i(e)}))})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,pe),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),n(e)}}))}insert(e,i){return t(this,Gn,"f")?new Promise(((n,o)=>{xt(t(this,xn,"f").config);try{Rt(yt(de.VALIDATE_RECORDS,jn),Lt.LOG,t(this,Bn,"f").logLevel),(null==(i=i?Object.assign(Object.assign({},i),{tokens:void 0===(null==i?void 0:i.tokens)||i.tokens}):{tokens:!0})?void 0:i.upsert)&&Bt(i.upsert),Ct(e,i),le.emit(Se+t(this,Fn,"f"),{type:ue,records:e,options:i},(e=>{e.error?(Rt(`${JSON.stringify(e.error)}`,Lt.ERROR,t(this,Bn,"f").logLevel),o(e.error)):n(e)})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,ue),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_RECORDS,jn),Lt.LOG,t(this,Bn,"f").logLevel),(null==(i=i?Object.assign(Object.assign({},i),{tokens:void 0===(null==i?void 0:i.tokens)||i.tokens}):{tokens:!0})?void 0:i.upsert)&&Bt(i.upsert),Ct(e,i),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Se+t(this,Fn,"f"),{type:ue,records:e,options:i},(e=>{e.error?(Rt(`${JSON.stringify(e.error)}`,Lt.ERROR,t(this,Bn,"f").logLevel),o(e.error)):n(e)}))})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,ue),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}}))}getById(e){return t(this,Gn,"f")?new Promise(((i,n)=>{xt(t(this,xn,"f").config);try{Rt(yt(de.VALIDATE_GET_BY_ID_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),Pt(e),le.emit(Se+t(this,Fn,"f"),{type:fe,records:e.records},(e=>{e.error?n(e.error):i(e)})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,fe),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),n(e)}})):new Promise(((i,n)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_GET_BY_ID_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),Pt(e),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Se+t(this,Fn,"f"),{type:fe,records:e.records},(e=>{e.error?n(e.error):i(e)}))})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,fe),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),n(e)}}))}get(e,i){return t(this,Gn,"f")?new Promise(((n,o)=>{xt(t(this,xn,"f").config);try{Rt(yt(de.VALIDATE_GET_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),Mt(e,i),le.emit(Se+t(this,Fn,"f"),{type:Ne,records:e.records,options:i},(e=>{e.error?o(e.error):n(e)})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,Ne),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_GET_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),Mt(e,i),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Se+t(this,Fn,"f"),{type:Ne,records:e.records,options:i},(e=>{e.error?o(e.error):n(e)}))})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,Ne),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}}))}delete(e,i){return t(this,Gn,"f")?new Promise(((n,o)=>{xt(t(this,xn,"f").config);try{Rt(yt(de.VALIDATE_DELETE_INPUT,jn),Lt.LOG,t(this,Bn,"f").logLevel),Vt(e),le.emit(Se+t(this,Fn,"f"),{type:Te,records:e,options:i},(e=>{e.error?(Rt(`${JSON.stringify(e.error)}`,Lt.ERROR,t(this,Bn,"f").logLevel),o(e.error)):n(e)})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,Te),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}})):new Promise(((n,o)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_RECORDS,jn),Lt.LOG,t(this,Bn,"f").logLevel),Vt(e),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Se+t(this,Fn,"f"),{type:Te,records:e,options:i},(e=>{e.error?(Rt(`${JSON.stringify(e.error)}`,Lt.ERROR,t(this,Bn,"f").logLevel),o(e.error)):n(e)}))})),Rt(yt(de.EMIT_PURE_JS_REQUEST,jn,Te),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(e.message,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}}))}renderFile(e,i){return t(this,Gn,"f")?new Promise(((i,n)=>{try{xt(t(this,xn,"f").config),Rt(yt(de.VALIDATE_RENDER_RECORDS,jn),Lt.LOG,t(this,Bn,"f").logLevel),kt(e),le.emit(Ue+t(this,Fn,"f"),{records:e},(t=>{t.errors?n(Yn(t,e.column)):i(t)})),Rt(yt(de.EMIT_EVENT,jn,Ue),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(`Error: ${e.message}`,Lt.ERROR,t(this,Bn,"f").logLevel),n(e)}})):new Promise(((n,o)=>{try{xt(i.clientJSON.config),Rt(yt(de.VALIDATE_RENDER_RECORDS,jn),Lt.LOG,t(this,Bn,"f").logLevel),kt(e),le.target(at.IFRAME_SECURE_ORGIN).on(ge+t(this,Fn,"f"),(()=>{le.emit(Ue+t(this,Fn,"f"),{records:e,metaData:i.clientJSON},(t=>{t.errors?o(Yn(t,e.column)):n(t)})),Rt(yt(de.EMIT_EVENT,jn,Ue),Lt.LOG,t(this,Bn,"f").logLevel)})),Rt(yt(de.EMIT_EVENT,jn,Ue),Lt.LOG,t(this,Bn,"f").logLevel)}catch(e){Rt(`Error: ${e.message}`,Lt.ERROR,t(this,Bn,"f").logLevel),o(e)}}))}}function Kn(e){this.message=e}Fn=new WeakMap,xn=new WeakMap,Gn=new WeakMap,Bn=new WeakMap,Kn.prototype=new Error,Kn.prototype.name="InvalidCharacterError";var Wn="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Kn("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,n,o=0,s=0,r="";n=t.charAt(s++);~n&&(i=o%4?64*i+n:n,o++%4)?r+=String.fromCharCode(255&i>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return r};function $n(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Wn(e).replace(/(.)/g,(function(e,t){var i=t.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}(t)}catch(e){return Wn(t)}}function Hn(e){this.message=e}Hn.prototype=new Error,Hn.prototype.name="InvalidTokenError";const zn=e=>{try{if(!e)return!1;if(t=e,"[object String]"!==Object.prototype.toString.call(t))return!1;let i=!1;const n=function(e,t){if("string"!=typeof e)throw new Hn("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse($n(e.split(".")[i]))}catch(e){throw new Hn("Invalid token specified: "+e.message)}}(e),o=(new Date).getTime()/1e3,s=n.exp;return s&&o>s&&(i=!0),!i}catch(e){return!1}var t};var qn,Jn,Zn,Qn,eo,to,io,no,oo,so,ro,ao={name:"skyflow-js",preferGlobal:!0,analyze:!1,version:"1.30.1",author:"Skyflow",description:"Skyflow JavaScript SDK"};class lo{constructor(e,n){qn.set(this,void 0),this.request=e=>new Promise(((i,n)=>{var o,s,r,a;const l=new XMLHttpRequest;if(l){if(l.open(e.requestMethod,e.url),e.headers){const i=function(e,t,i){var n,o,s,r,a;const l={sdkName:e.name,sdkVersion:e.version},d=function(e,t){return""!==e?`${e}`:`${t.sdkName}@${t.sdkVersion}`}(t.sdkVersion,l),c=function(e){var t,i,n,o,s,r,a,l,d,c,E,_;let I=null,h=null;return/Windows/.test(e)?(I="Windows",h=null!==(i=null===(t=/Windows NT (\d+\.\d+)/.exec(e))||void 0===t?void 0:t[1])&&void 0!==i?i:null):/Android/.test(e)?(I="Android",h=null!==(o=null===(n=/Android (\d+\.\d+)/.exec(e))||void 0===n?void 0:n[1])&&void 0!==o?o:null):/iOS/.test(e)||/iPhone/.test(e)?(I="iOS",h=null!==(a=null===(r=null===(s=/OS (\d+[._]\d+[._]?\d*)/.exec(e))||void 0===s?void 0:s[1])||void 0===r?void 0:r.replace(/_/g,"."))&&void 0!==a?a:null):/Mac OS X/.test(e)?(I="Mac OS X",h=null!==(c=null===(d=null===(l=/Mac OS X (\d+([._]\d+)*)/.exec(e))||void 0===l?void 0:l[1])||void 0===d?void 0:d.replace(/_/g,"."))&&void 0!==c?c:null):/Linux/.test(e)&&(I="Linux",h=null!==(_=null===(E=/Linux( \w+)*?\/([\w.]+)/.exec(e))||void 0===E?void 0:E[2])&&void 0!==_?_:null),{os:I,version:h}}(i.userAgent),E=function(e){let t="",i="";if(-1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")){t="Internet Explorer";const n=e.match(/(MSIE|rv:)\s?([\d.]+)/);n&&(i=n[2])}else if(-1!==e.indexOf("Edge")){t="Microsoft Edge";const n=e.match(/Edge\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Chrome")){t="Google Chrome";const n=e.match(/Chrome\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Firefox")){t="Mozilla Firefox";const n=e.match(/Firefox\/([\d.]+)/);n&&(i=n[1])}else if(-1!==e.indexOf("Safari")){t="Apple Safari";const n=e.match(/Version\/([\d.]+)/);n&&(i=n[1])}return{browserName:t,browserVersion:i}}(i.userAgent);var _;return{sdk_name_version:d,sdk_client_device_model:(_=i.userAgent,/(ipad|tablet)/gi.test(_)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile/.test(_)?"mobile":"desktop"),sdk_os_version:null!==(n=i.platform)&&void 0!==n?n:`${null!==(o=c.os)&&void 0!==o?o:""} ${null!==(s=c.version)&&void 0!==s?s:""}`,sdk_runtime_details:`${null!==(r=E.browserName)&&void 0!==r?r:""} ${null!==(a=E.browserVersion)&&void 0!==a?a:""}`}}(ao,t(this,qn,"f"),navigator);e.headers["sky-metadata"]=JSON.stringify(i);const{headers:n}=e;Object.keys(e.headers).forEach((e=>{"content-type"===e&&n[e]&&n[e].includes(nt.FORMDATA)||l.setRequestHeader(e,n[e])}))}(null===(s=null===(o=e.headers)||void 0===o?void 0:o["content-type"])||void 0===s?void 0:s.includes(nt.FORMURLENCODED))||(null===(a=null===(r=e.headers)||void 0===r?void 0:r["content-type"])||void 0===a?void 0:a.includes(nt.FORMDATA))?l.send(e.body):l.send(JSON.stringify(Object.assign({},e.body))),l.onload=()=>{var e,t,o;const s=l.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};s.forEach((e=>{const t=e.split(": "),i=t.shift()||"",n=t.join(": ");r[i]=n}));const a=r["content-type"],d=r["x-request-id"];if(l.status<200||l.status>=400)if(a&&a.includes("application/json")){let i=JSON.parse(l.response);(null===(e=null==i?void 0:i.error)||void 0===e?void 0:e.message)&&(i=d?`${null===(t=null==i?void 0:i.error)||void 0===t?void 0:t.message} - requestId: ${d}`:null===(o=null==i?void 0:i.error)||void 0===o?void 0:o.message),n(new St({code:l.status,description:i},[],!0))}else a&&a.includes("text/plain")?n(new St({code:l.status,description:d?`${l.response} - requestId: ${d}`:l.response},[],!0)):n(new St({code:l.status,description:d?`${ce.ERROR_OCCURED} - requestId: ${d}`:ce.ERROR_OCCURED},[],!0));a&&a.includes("application/json")&&i(JSON.parse(l.response)),i(l.response)},l.onerror=()=>{n(new St(gt.NETWORK_ERROR,[],!0))}}else n(new St(gt.CONNECTION_ERROR,[],!0))})),this.config=e,i(this,qn,n,"f")}toJSON(){return{config:this.config,metaData:t(this,qn,"f")}}static fromJSON(e){return new lo(e.config,e.metaData)}}qn=new WeakMap,function(e){e.COLLECT="COLLECT",e.REVEAL="REVEAL",e.COMPOSABLE="COMPOSABLE"}(ro||(ro={}));const co="Skyflow";class Eo{constructor(e){var n,o;Jn.set(this,void 0),Zn.set(this,vi()),Qn.set(this,{uuid:t(this,Zn,"f"),clientDomain:window.location.origin}),eo.set(this,void 0),to.set(this,""),io.set(this,void 0),no.set(this,void 0),oo.set(this,void 0),so.set(this,void 0);const s=localStorage.getItem("sdk_version")||"";t(this,Qn,"f").sdkVersion=s,i(this,Jn,new lo(Object.assign({},e),t(this,Qn,"f")),"f"),i(this,no,(null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.logLevel)||Nt.ERROR,"f"),i(this,oo,(null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.env)||Tt.PROD,"f"),i(this,so,{},"f"),i(this,eo,new Xn(t(this,Jn,"f"),{logLevel:t(this,no,"f"),env:t(this,oo,"f")}),"f");le.target(at.IFRAME_SECURE_ORGIN).on(Ce+t(this,Zn,"f"),((e,n)=>{Rt(yt(de.CAPTURED_BEARER_TOKEN_EVENT,co),Lt.LOG,t(this,no,"f")),!t(this,Jn,"f").config.getBearerToken||t(this,to,"f")&&zn(t(this,to,"f"))?(Rt(yt(de.REUSE_BEARER_TOKEN,co),Lt.LOG,t(this,no,"f")),n({authToken:t(this,to,"f")})):t(this,Jn,"f").config.getBearerToken().then((e=>{zn(e)?(Rt(yt(de.BEARER_TOKEN_RESOLVED,co),Lt.LOG,t(this,no,"f")),i(this,to,e,"f"),n({authToken:t(this,to,"f")})):(Rt(ce.INVALID_BEARER_TOKEN,Lt.ERROR,t(this,no,"f")),n({error:ce.INVALID_BEARER_TOKEN}))})).catch((e=>{Rt(ce.BEARER_TOKEN_REJECTED,Lt.ERROR,t(this,no,"f")),n({error:e})}))})),Rt(yt(de.BEARER_TOKEN_LISTENER,co),Lt.LOG,t(this,no,"f")),Rt(yt(de.CURRENT_ENV,co,t(this,oo,"f")),Lt.LOG,t(this,no,"f")),Rt(yt(de.CURRENT_LOG_LEVEL,co,t(this,no,"f")),Lt.LOG,t(this,no,"f"))}static init(e){var t;const i=(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.logLevel)||Nt.ERROR;!function(e){var t,i,n,o;if((null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.customElementsURL)&&Yt(null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.customElementsURL)){const t=null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.customElementsURL,i=new URL(t),s=`${i.protocol}//${i.hostname}`;at.IFRAME_SECURE_ORGIN=s,at.IFRAME_SECURE_SITE=null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.customElementsURL}}(e),Rt(yt(de.INITIALIZE_CLIENT,co),Lt.LOG,i);const n=e;var o;n.vaultURL="string"!=typeof(o=e.vaultURL)?o:"/"===(null==o?void 0:o.trim().slice(-1))?o.slice(0,-1):o.trim();const s=new Eo(n);return Rt(yt(de.CLIENT_INITIALIZED,co),Lt.LOG,i),s}container(e,i){switch(e){case ro.COLLECT:{const n=new ki(i,Object.assign(Object.assign({},t(this,Qn,"f")),{clientJSON:t(this,Jn,"f").toJSON(),containerType:e}),t(this,so,"f"),{logLevel:t(this,no,"f"),env:t(this,oo,"f")});return Rt(yt(de.COLLECT_CONTAINER_CREATED,co),Lt.LOG,t(this,no,"f")),n}case ro.REVEAL:{const i=new kn(Object.assign(Object.assign({},t(this,Qn,"f")),{clientJSON:t(this,Jn,"f").toJSON(),containerType:e,skyflowContainer:t(this,eo,"f")}),t(this,so,"f"),{logLevel:t(this,no,"f")});return Rt(yt(de.REVEAL_CONTAINER_CREATED,co),Lt.LOG,t(this,no,"f")),i}case ro.COMPOSABLE:{(e=>{if(!e)throw new St(gt.MISSING_COMPOSABLE_CONTAINER_OPTIONS,[],!0);if("object"!=typeof e)throw new St(gt.INVALID_COMPOSABLE_CONTAINER_OPTIONS,[],!0);if(!Object.prototype.hasOwnProperty.call(e,"layout"))throw new St(gt.MISSING_COMPOSABLE_LAYOUT_KEY,[],!0);if(!e.layout)throw new St(gt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(!Array.isArray(e.layout))throw new St(gt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(0===e.layout.length)throw new St(gt.EMPTY_COMPOSABLE_LAYOUT_ARRAY,[],!0);e.layout.forEach((e=>{if("number"!=typeof e)throw new St(gt.INVALID_COMPOSABLE_LAYOUT_TYPE,[],!0);if(e<0)throw new St(gt.NEGATIVE_VALUES_COMPOSABLE_LAYOUT,[],!0)}))})(i);const n=new In(i,Object.assign(Object.assign({},t(this,Qn,"f")),{clientJSON:t(this,Jn,"f").toJSON(),containerType:e}),t(this,so,"f"),{logLevel:t(this,no,"f"),env:t(this,oo,"f")});return Rt(yt(de.COLLECT_CONTAINER_CREATED,co),Lt.LOG,t(this,no,"f")),n}default:if(!e)throw new St(gt.EMPTY_CONTAINER_TYPE,[],!0);throw new St(gt.INVALID_CONTAINER_TYPE,[],!0)}}insert(e,i){return Rt(yt(de.INSERT_TRIGGERED,co),Lt.LOG,t(this,no,"f")),t(this,eo,"f").insert(e,i)}detokenize(e){return Rt(yt(de.DETOKENIZE_TRIGGERED,co),Lt.LOG,t(this,no,"f")),t(this,eo,"f").detokenize(e)}getById(e){return Rt(Ee.GET_BY_ID_DEPRECATED,Lt.WARN,t(this,no,"f")),Rt(yt(de.GET_BY_ID_TRIGGERED,co),Lt.LOG,t(this,no,"f")),t(this,eo,"f").getById(e)}get(e,i){return Rt(yt(de.GET_TRIGGERED,co),Lt.LOG,t(this,no,"f")),t(this,eo,"f").get(e,i)}delete(e,i){return Rt(yt(de.DELETE_TRIGGERED,co),Lt.LOG,t(this,no,"f")),t(this,eo,"f").delete(e,i)}static get ContainerType(){return ro}static get ElementType(){return Xe}static get RedactionType(){return ut}static get RequestMethod(){return pt}static get LogLevel(){return Nt}static get EventName(){return ft}static get Env(){return Tt}static get ValidationRuleType(){return Ot}}Jn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,eo=new WeakMap,to=new WeakMap,io=new WeakMap,no=new WeakMap,oo=new WeakMap,so=new WeakMap;class _o{constructor(e){this.loadFunction=e,this.loadScript()}get loader(){return this.loadingPromise||(this.loadingPromise=this.loadScript()),this.loadingPromise}loadScript(){return e(this,void 0,void 0,(function*(){return this.loadingPromise||(this.loadingPromise=new Promise(((e,t)=>{this.loadFunction().then((t=>{t&&e(t)}),(()=>{t()})).catch((()=>{}))}))),this.loadingPromise}))}}class Io extends m{constructor(e){super("span",{id:e.id,className:"payrails-store-instrument"}),this.options=e,this.createHTML(),this.applyStyles(),this.addListeners()}get isChecked(){var e;return!!(null===(e=this.element.querySelector("input"))||void 0===e?void 0:e.checked)}createHTML(){var e,t,i,n,o,s,r,a,l;const d=(null===(i=null===(t=null===(e=this.options)||void 0===e?void 0:e.translations)||void 0===t?void 0:t.labels)||void 0===i?void 0:i.saveInstrument)||(null===(s=null===(o=null===(n=this.options)||void 0===n?void 0:n.translations)||void 0===o?void 0:o.labels)||void 0===s?void 0:s.storeInstrument)||"Save instrument for future payments",c=`${this.id}-checkbox`;(null===(l=null===(a=null===(r=this.options)||void 0===r?void 0:r.translations)||void 0===a?void 0:a.labels)||void 0===l?void 0:l.saveInstrument)&&console.warn("The saveInstrument label is deprecated, please use storeInstrument instead"),this.element.innerHTML=`<label for="${c}"><input type="checkbox" id="${c}" name="${c}" class="payrails-store-instrument-checkbox">${d}</label>`}applyStyles(){var e,t;Object.keys((null===(t=null===(e=this.options)||void 0===e?void 0:e.styles)||void 0===t?void 0:t.storeInstrumentCheckbox)||{}).forEach((e=>{var t,i,n;this.element.style[e]=null===(n=null===(i=null===(t=this.options)||void 0===t?void 0:t.styles)||void 0===i?void 0:i.storeInstrumentCheckbox)||void 0===n?void 0:n[e]}))}addListeners(){this.element.addEventListener("change",(e=>{var t,i,n,o;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onSaveInstrumentCheckboxChanged)&&(null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o||o.onSaveInstrumentCheckboxChanged({checked:this.isChecked})),e.stopPropagation(),e.stopImmediatePropagation()}))}}class ho extends m{constructor(t,i){var n,o;super(t,i),this.options=i,this.storeInstrumentCheckbox=null,(null===(n=this.options)||void 0===n?void 0:n.showStoreInstrumentCheckbox)&&(this.storeInstrumentCheckbox=new Io(Object.assign(Object.assign({},i),{id:`${null===(o=this.options)||void 0===o?void 0:o.id}-store-instrument-checkbox`,events:{onSaveInstrumentCheckboxChanged:t=>e(this,void 0,void 0,(function*(){var e,n;null===(n=null===(e=null==i?void 0:i.events)||void 0===e?void 0:e.onSaveInstrumentCheckboxChanged)||void 0===n||n.call(e,t)}))}})),this.subElements.push(this.storeInstrumentCheckbox))}get shouldStoreInstrument(){var e,t;return(null===(e=this.storeInstrumentCheckbox)||void 0===e?void 0:e.isChecked)||(null===(t=this.options)||void 0===t?void 0:t.alwaysStoreInstrument)||!1}}class uo extends ho{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-apple-pay-button"})),this.sdkConfig=t,this.execution=i,this.options=n,this.appleButton=null,this.paymentExecutor=new T(t,i),this.loadScript=new _o((()=>e(this,void 0,void 0,(function*(){const t=document.createElement("script");return t.src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",new Promise(((i,n)=>{t.onload=()=>e(this,void 0,void 0,(function*(){var e,t,n;(yield this.isApplePayAvailable())?(null===(n=null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onApplePayAvailable)||void 0===n||n.call(t),i(!0)):i(!1)})),t.onerror=()=>{n()},document.body.appendChild(t)}))}))))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){try{yield this.loadScript.loader,yield this.mountApplePayButton()}catch(e){}}))})()}unmount(){var e,t;null===(t=null===(e=this.appleButton)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this.appleButton),super.unmount()}isApplePayAvailable(){return e(this,void 0,void 0,(function*(){if(!(null===window||void 0===window?void 0:window.ApplePaySession))return!1;return yield ApplePaySession.canMakePayments()}))}mountApplePayButton(){var t,i,n,o,s;return e(this,void 0,void 0,(function*(){if(null===window||void 0===window?void 0:window.ApplePaySession)try{if(!this.isApplePayAvailable())return;null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onApplePayAvailable)||void 0===i||i.call(t);const e=(null===(n=this.options.styles)||void 0===n?void 0:n.type)||"buy",r=(null===(o=this.options.styles)||void 0===o?void 0:o.style)||"black";this.element.innerHTML=`<apple-pay-button buttonstyle="${r}" type="${e}" locale="en-GB"></apple-pay-button>`,null===(s=this.storeInstrumentCheckbox)||void 0===s||s.mount(this.selector);const a=this.element.querySelector("apple-pay-button");null==a||a.setAttribute("style","width: 100%;"),null==a||a.addEventListener("click",(()=>{this.createApplePaySession()}))}catch(e){}}))}createApplePaySession(){const t=this.execution.applePayConfig,{countryCode:i,supportedNetworks:n,merchantCapabilities:o}=t,{amount:s}=this.sdkConfig;try{const t={countryCode:i,currencyCode:s.currency,merchantCapabilities:o,supportedNetworks:n,total:{label:"",type:"final",amount:s.value}},r=new ApplePaySession(3,t);return r.onvalidatemerchant=t=>e(this,void 0,void 0,(function*(){const{res:e}=yield this.paymentExecutor.createApplePaySession({requestUrl:this.execution.createSessionLink,sessionUrl:t.validationURL,clientDomain:this.options.clientDomain}),i=e.data.data;r.completeMerchantValidation(i)})),r.onpaymentauthorized=t=>e(this,void 0,void 0,(function*(){var e,i,n,o,s,a,l,d,c,E,_,I;try{const E=yield this.onApplePayAuthorized(t.payment.token);if("authorizeSuccessful"===(null===(e=null==E?void 0:E.finalState)||void 0===e?void 0:e.code))(null===(i=this.options.events)||void 0===i?void 0:i.onAuthorizeSuccess)&&this.options.events.onAuthorizeSuccess();else r.completePayment(ApplePaySession.STATUS_FAILURE),(null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o?void 0:o.onAuthorizeFailed)&&(null===(s=this.options)||void 0===s||s.events.onAuthorizeFailed());r.completePayment(ApplePaySession.STATUS_SUCCESS),(null===(l=null===(a=this.options)||void 0===a?void 0:a.events)||void 0===l?void 0:l.onAuthorizeSuccess)&&(null===(c=null===(d=this.options)||void 0===d?void 0:d.events)||void 0===c||c.onAuthorizeSuccess(E))}catch(e){r.completePayment(ApplePaySession.STATUS_FAILURE),(null===(_=null===(E=this.options)||void 0===E?void 0:E.events)||void 0===_?void 0:_.onAuthorizeFailed)&&(null===(I=this.options)||void 0===I||I.events.onAuthorizeFailed(e))}})),r.begin(),r}catch(e){return null}}onApplePayAuthorized(t){return e(this,void 0,void 0,(function*(){const e={paymentData:t.paymentData,transactionIdentifier:t.transactionIdentifier,paymentNetwork:t.paymentMethod.network,paymentInstrumentName:t.paymentMethod.displayName},i=[{paymentMethodCode:"applePay",integrationType:"api",paymentInstrumentData:{paymentToken:JSON.stringify(e)},amount:this.sdkConfig.amount,storeInstrument:this.shouldStoreInstrument}];return yield this.paymentExecutor.pay(i)}))}}const{CARD_NUMBER:po,CVV:fo,CARDHOLDER_NAME:No,EXPIRATION_MONTH:To,EXPIRATION_YEAR:Lo}=exports.ElementType,Oo={base:{border:"none",padding:"10px 16px",color:"#1d1d1d",backgroundColor:"#fff"},invalid:{backgroundColor:"#f9e1e1",borderColor:"#f25226",border:"1px solid"}},vo=[{type:No,placeholder:"Card holder",styles:Object.assign(Object.assign({},Oo),{base:Object.assign(Object.assign({},Oo.base),{border:"1px solid #eae8ee",padding:"10px 16px",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"})})},{type:po,placeholder:"1234 1234 1234 1234",styles:Object.assign(Object.assign({},Oo),{base:Object.assign(Object.assign({},Oo.base),{border:"1px solid #eae8ee",padding:"10px 16px",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",textIndent:"0"}),cardIcon:{position:"absolute",right:"8px",height:"24px",bottom:"calc(50% - 12px)"}})},{type:To,placeholder:"MM",styles:Object.assign(Object.assign({},Oo),{base:Object.assign(Object.assign({},Oo.base),{borderBottom:"1px solid #eae8ee",borderLeft:"1px solid #eae8ee",borderRight:"1px solid #eae8ee",borderBottomLeftRadius:"4px"})})},{type:Lo,placeholder:"YY",format:"YY",styles:Object.assign(Object.assign({},Oo),{base:Object.assign(Object.assign({},Oo.base),{borderBottom:"1px solid #eae8ee",borderRight:"1px solid #eae8ee"})})},{type:fo,placeholder:"CVC",styles:Object.assign(Object.assign({},Oo),{base:Object.assign(Object.assign({},Oo.base),{borderBottom:"1px solid #eae8ee",borderRight:"1px solid #eae8ee",borderBottomRightRadius:"4px"})})}];class Ao extends ho{get bin(){return this.collectContainer.bin}constructor(e,t){var i,n,o,s,r;super("div",Object.assign(Object.assign({},t),{translations:Object.assign(Object.assign({},null==t?void 0:t.translations),{labels:Object.assign(Object.assign({},null===(i=null==t?void 0:t.translations)||void 0===i?void 0:i.labels),{saveInstrument:null===(o=null===(n=null==t?void 0:t.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.saveCreditCard})}),styles:Object.assign({storeInstrumentCheckbox:null===(s=null==t?void 0:t.styles)||void 0===s?void 0:s.storeCardCheckbox},null==t?void 0:t.styles),id:"payrails-card-form"})),this.collectContainer=e,this.options=t,this.formFields=[],(null===(r=null==t?void 0:t.styles)||void 0===r?void 0:r.storeCardCheckbox)&&console.warn("The `storeCardCheckbox` option for styles is deprecated. Please use `storeInstrumentCheckbox` instead."),vo.forEach((({type:e,styles:i,format:n,placeholder:o})=>{var s,r,a,l,d,c,E;if(!(null===(s=this.options)||void 0===s?void 0:s.showCardHolderName)&&e===exports.ElementType.CARDHOLDER_NAME)return;const _=new mo(this.collectContainer,{type:e,label:null===(a=null===(r=null==t?void 0:t.translations)||void 0===r?void 0:r.labels)||void 0===a?void 0:a[e],placeholder:(null===(d=null===(l=null==t?void 0:t.translations)||void 0===l?void 0:l.placeholders)||void 0===d?void 0:d[e])||o,labelStyles:this.prepareLabelStyles(e),inputStyles:this.prepareInputStyles(i,e),format:n,events:{onFocus:null===(E=null===(c=this.options)||void 0===c?void 0:c.events)||void 0===E?void 0:E.onFocus,onChange:this.onChange.bind(this),onReady:this.triggerOnReady.bind(this)}});this.formFields.push(_)})),this.subElements.push(this.collectContainer),this.storeInstrumentCheckbox&&this.subElements.push(this.storeInstrumentCheckbox)}show(){var e,t;const i=document.getElementById(this.collectContainer.id);if(!i)throw new Error("Container is not mounted.");Object.assign(i.style,null===(t=null===(e=this.options)||void 0===e?void 0:e.styles)||void 0===t?void 0:t.wrapper),this.element.style.display="flex"}hide(){this.element.style.display="none"}triggerOnReady(){var e,t,i;this.formFields.reduce(((e,t)=>e&&t.isReady),!0)&&(null===(i=null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onReady)||void 0===i||i.call(t))}prepareLabelStyles(e){return["base"].reduce(((t,i)=>{var n,o,s,r,a,l,d,c;return t[i]=Object.assign(Object.assign(Object.assign({},null===(o=null===(n=this.options)||void 0===n?void 0:n.styles)||void 0===o?void 0:o.base),null===(a=null===(r=null===(s=this.options)||void 0===s?void 0:s.styles)||void 0===r?void 0:r.labels)||void 0===a?void 0:a.all),null===(c=null===(d=null===(l=this.options)||void 0===l?void 0:l.styles)||void 0===d?void 0:d.labels)||void 0===c?void 0:c[e]),t}),{})}prepareInputStyles(e,t){var i;let n=JSON.parse(JSON.stringify(e));return(null===(i=this.options)||void 0===i?void 0:i.showCardHolderName)&&t===exports.ElementType.CARD_NUMBER&&(this.element.setAttribute("class","with-card-holder"),n=Object.assign(Object.assign({},e),{base:Object.assign(Object.assign({},Oo.base),{border:"1px solid #eae8ee",borderTop:"none",padding:"10px 16px",textIndent:"0"})})),["base","complete","empty","focus","invalid","cardIcon","copyIcon"].forEach((e=>{var i,o,s,r,a,l,d,c;n[e]=Object.assign(Object.assign(Object.assign({},n[e]),null===(r=null===(s=null===(o=null===(i=this.options)||void 0===i?void 0:i.styles)||void 0===o?void 0:o.inputFields)||void 0===s?void 0:s.all)||void 0===r?void 0:r[e]),null===(c=null===(d=null===(l=null===(a=this.options)||void 0===a?void 0:a.styles)||void 0===l?void 0:l.inputFields)||void 0===d?void 0:d[t])||void 0===c?void 0:c[e])})),n}get isValid(){return this.formFields.reduce(((e,t)=>e&&t.isValid),!0)}get cardNetwork(){var e,t;return null!==(t=null===(e=this.formFields.find((e=>Boolean(e.cardNetwork))))||void 0===e?void 0:e.cardNetwork)&&void 0!==t?t:""}onChange(){var e,t,i,n;(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onChange)&&(null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n||n.onChange({isValid:this.isValid,cardNetwork:this.cardNetwork,bin:this.bin}))}collectValues(){return e(this,void 0,void 0,(function*(){return{tokenizedCardData:yield this.collectContainer.collect(),storeInstrument:this.shouldStoreInstrument,enrollInstrumentToNetworkOffers:Boolean(this.enforceEnrollInstrumentToNetworkOffersForMasterCard())}}))}enforceEnrollInstrumentToNetworkOffersForMasterCard(){var e;return"mastercard"!==this.cardNetwork&&(null===(e=this.options)||void 0===e?void 0:e.enrollInstrumentToNetworkOffers)}}class mo{constructor(e,t){this.isValid=!1,this.isReady=!1,this.cardNetwork="";const{events:i}=t,n=e.createCollectElement(t);(null==i?void 0:i.onFocus)&&n.on("FOCUS",i.onFocus),n.on("READY",(()=>{var e,i;this.isReady=!0,null===(i=null===(e=t.events)||void 0===e?void 0:e.onReady)||void 0===i||i.call(e)})),n.on("CHANGE",(e=>{const{isEmpty:t,isValid:n,network:o}=e;this.isValid=!t&&n,this.cardNetwork=null!=o?o:"",(null==i?void 0:i.onChange)&&i.onChange(this)}))}}class Ro extends m{constructor(e,t){super("div",{id:"payrails-card-list"}),this.workflowExecution=e,this.listItems=[],this.workflowExecution.savedCreditCards.forEach((e=>{const i=new yo((()=>{(null==t?void 0:t.onCardChange)&&t.onCardChange(e)}),e);this.listItems.push(i),this.subElements.push(i)}))}reset(){this.element.querySelectorAll("input").forEach((e=>e.checked=!1))}}class yo extends m{constructor(e,t){super("div",{className:"payrails-card-list-item",id:`payrails-card-list-item-${t.id}`});const{id:i}=t,n=this.createCardLabel(t),o=document.createElement("label");o.setAttribute("for",i),o.addEventListener("click",e);const s=document.createElement("input");s.setAttribute("type","radio"),s.setAttribute("name","payment-option"),s.setAttribute("id",i),s.setAttribute("value",i),o.appendChild(s);const r=document.createElement("span");r.innerText=n,o.appendChild(r),this.element.appendChild(o)}createCardLabel({data:e={}}){return`****${null==e?void 0:e.suffix}`}}class Do extends m{constructor(e="Authorization failed, please try again."){super("div",{id:"authorization-failed-message"}),this.element.innerText=e,this.element.innerHTML=`\n <div>\n <svg class="checkmark-cross" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">\n <circle class="checkmark-cross_circle" cx="26" cy="26" r="25" fill="none"/>\n <path class="checkmark-cross_check" fill="none" d="M14.1 14.1l23.8 23.8 m0,-23.8 l-23.8,23.8"/>\n </svg>\n </div>\n <div>${e}</div>`,this.element.addEventListener("click",(e=>{e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),this.unmount()}))}}class So extends m{constructor(e){var t;super("div",{id:"payrails-authorization-success-msg"}),this.element.innerHTML=`\n <div class="checkmark-wrapper">\n <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">\n <circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>\n <path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>\n </svg>\n </div>\n <div id="payrails-authorization-success">${(null===(t=null==e?void 0:e.translations)||void 0===t?void 0:t.label)||"Payment successful"}</div`}}class go extends m{constructor(e,t,i,n){super("div",{id:e,className:"payrails-dropin-item"}),this.events=i,this.styles=n,this.isActive=!1,this.applyBaseStyles();const o=`payrails-dropin-item-${e}`,s=document.createElement("label");s.setAttribute("for",o);const r=document.createElement("input");r.setAttribute("type","radio"),r.setAttribute("name","payment-option"),r.setAttribute("id",o),r.setAttribute("value",o),this.input=r,s.appendChild(r),this.label=s;const a=document.createElement("span");s.appendChild(a),a.innerText=t,this.element.appendChild(s)}get identifier(){return`payrails-dropin-item-${this.id}`}deactivate(){var e,t;this.isActive&&(this.isActive=!1,this.label.style.marginBottom="0",this.applyBaseStyles(),null===(e=this.component)||void 0===e||e.unmount(),(null===(t=this.events)||void 0===t?void 0:t.onDeactivate)&&this.events.onDeactivate())}applyBaseStyles(){var e,t;Object.keys((null===(e=this.styles)||void 0===e?void 0:e.active)||{}).forEach((e=>{this.element.style.removeProperty(e)})),Object.assign(this.element.style,null===(t=this.styles)||void 0===t?void 0:t.base)}applyActiveStyles(){var e,t;Object.assign(this.element.style,null===(e=this.styles)||void 0===e?void 0:e.base,null===(t=this.styles)||void 0===t?void 0:t.active)}activate(){var e,t;this.isActive||(null===(e=this.component)||void 0===e||e.mount(this.selector),this.label.style.marginBottom="8px",this.applyActiveStyles(),this.isActive=!0,(null===(t=this.events)||void 0===t?void 0:t.onActivate)&&this.events.onActivate())}}class Co extends go{constructor(){super(...arguments),this.buttonShown=!1}activate(){if(!this.buttonShown)return super.activate(),void(this.buttonShown=!0);this.label.style.marginBottom="8px",this.applyActiveStyles(),this.isActive=!0,this.element.querySelector(this.component.selector).style.display="block"}deactivate(){this.isActive&&(this.isActive=!1,this.label.style.marginBottom="0",this.applyBaseStyles(),this.element.querySelector(this.component.selector).style.display="none")}mountAfterAvailable(){super.mount(`#${this.loadElementId}`)}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}unmount(){var e;super.unmount(),null===(e=document.querySelector(`#${this.loadElementId}`))||void 0===e||e.remove()}}class bo extends Co{constructor(e,t,i){var n,o;super("apple-pay-dropin",(null===(o=null===(n=i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"Apple Pay",void 0,i.styles),this.loadElementId="apple-pay-dropin-load-element",this.component=new uo(e,t,Object.assign(Object.assign({},i),{events:{onApplePayAvailable:()=>{this.mountAfterAvailable()}}}))}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}}class wo extends go{constructor(e,t,i){super("payrails-credit-card-wrapper","Card",void 0,i),this.cardForm=e,this.paymentButton=t,this.cardFormShown=!1,this.component=new Mo(e,t)}activate(){var e,t;this.label.style.marginBottom="8px",this.applyActiveStyles(),this.cardFormShown||(this.cardFormShown=!0,null===(e=this.component)||void 0===e||e.mount(this.selector)),this.isActive||(this.paymentButton.selectedInstrument=null,this.paymentButton.mount(this.selector),this.paymentButton.setDisabled(!this.cardForm.isValid),this.paymentButton.mount("#payrails-card-form"),this.input.checked=!0,this.cardForm.show(),this.isActive=!0,(null===(t=this.events)||void 0===t?void 0:t.onActivate)&&this.events.onActivate())}deactivate(){var e;this.isActive&&(this.label.style.marginBottom="0",this.applyBaseStyles(),this.paymentButton.unmount(),this.cardForm.hide(),this.isActive=!1,(null===(e=this.events)||void 0===e?void 0:e.onDeactivate)&&this.events.onDeactivate())}}class Mo extends m{constructor(e,t){super("div",{id:"payrails-form-container"}),this.subElements.push(e,t)}}const Po={apiVersion:2,apiVersionMinor:0};class Vo extends ho{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-google-pay-button"})),this.sdkConfig=t,this.execution=i,this.options=n,this.googleButton=null,this.paymentExecutor=new T(t,i),this.loadScript=new _o((()=>e(this,void 0,void 0,(function*(){const e=document.createElement("script");return e.src="https://pay.google.com/gp/p/js/pay.js",new Promise(((t,i)=>{e.onload=()=>{const e=new google.payments.api.PaymentsClient({environment:this.options.environment||"TEST"}),n=Object.assign(Object.assign({},Po),{allowedPaymentMethods:this.execution.googlePayConfig});e.isReadyToPay(n).then((n=>{var o,s,r;n?(null===(r=null===(s=null===(o=this.options)||void 0===o?void 0:o.events)||void 0===s?void 0:s.onGooglePayAvailable)||void 0===r||r.call(s),t(e)):i()}),i)},e.onerror=()=>{i()},document.body.appendChild(e)}))}))))}sdkLoaded(t){var i,n,o,s,r,a,l,d;return e(this,void 0,void 0,(function*(){try{const c=(null===(n=null===(i=this.options)||void 0===i?void 0:i.styles)||void 0===n?void 0:n.buttonColor)||"black",E=(null===(s=null===(o=this.options)||void 0===o?void 0:o.styles)||void 0===s?void 0:s.buttonType)||"long",_=(null===(a=null===(r=this.options)||void 0===r?void 0:r.styles)||void 0===a?void 0:a.buttonSizeMode)||"fill",I=(null===(d=null===(l=this.options)||void 0===l?void 0:l.styles)||void 0===d?void 0:d.buttonLocale)||void 0;return this.googleButton=t.createButton({buttonColor:c,buttonType:E,buttonSizeMode:_,buttonLocale:I,onClick:()=>e(this,void 0,void 0,(function*(){var e,t,i;if(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onPaymentButtonClicked){if(!(yield null===(i=this.options)||void 0===i?void 0:i.events.onPaymentButtonClicked()))return}yield this.onPaymentButtonClicked()})),allowedPaymentMethods:this.execution.googlePayConfig}),this.element.appendChild(this.googleButton),this.googleButton}catch(e){throw console.error("Google pay can not be initialized",e),new Error(e.message)}}))}onLoadPaymentData(t){var i,n,o,s;return e(this,void 0,void 0,(function*(){const e=[{paymentMethodCode:"googlePay",integrationType:"api",paymentInstrumentData:{paymentToken:t.paymentMethodData.tokenizationData.token},amount:this.sdkConfig.amount,storeInstrument:this.shouldStoreInstrument}],r=yield this.paymentExecutor.pay(e);(null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onAuthorizeSuccess)&&(null===(s=null===(o=this.options)||void 0===o?void 0:o.events)||void 0===s||s.onAuthorizeSuccess(r))}))}onPaymentButtonClicked(){var t,i,n,o,s;return e(this,void 0,void 0,(function*(){const e=Object.assign({},Po);e.allowedPaymentMethods=this.execution.googlePayConfig,e.transactionInfo={totalPriceStatus:"FINAL",totalPrice:null===(t=this.sdkConfig.amount)||void 0===t?void 0:t.value,currencyCode:null===(i=this.sdkConfig.amount)||void 0===i?void 0:i.currency,countryCode:null===(s=null===(o=null===(n=this.execution.meta)||void 0===n?void 0:n.customer)||void 0===o?void 0:o.country)||void 0===s?void 0:s.code};(yield this.loadScript.loader).loadPaymentData(e).then((e=>{this.onLoadPaymentData(e)})).catch((e=>{var t,i,n;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onAuthorizeFailed)&&(null===(n=this.options)||void 0===n||n.events.onAuthorizeFailed(e))}))}))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){var e;try{const t=yield this.loadScript.loader,i=yield this.sdkLoaded(t);this.element.appendChild(i),null===(e=this.storeInstrumentCheckbox)||void 0===e||e.mount(this.selector)}catch(e){}}))})()}unmount(){var e,t,i;null===(t=null===(e=this.googleButton)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this.googleButton),null===(i=this.storeInstrumentCheckbox)||void 0===i||i.unmount(),super.unmount()}}class Uo extends Co{constructor(e,t,i){var n,o;super("google-pay-dropin",(null===(o=null===(n=i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"Google Pay",void 0,i.styles),this.loadElementId="google-pay-dropin-load-element",this.component=new Vo(e,t,Object.assign(Object.assign({},i),{events:Object.assign(Object.assign({},i.events),{onGooglePayAvailable:()=>{this.mountAfterAvailable()}})}))}mount(e){const t=document.querySelector(e);if(!t)throw new Error(`Element with selector "${e}" not found in in the DOM`);const i=document.createElement("div");i.setAttribute("id",this.loadElementId),i.setAttribute("style","width: 100%;"),t.appendChild(i)}}
5
5
  /*!
6
6
  * paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
7
7
  * Copyright 2020-present, PayPal, Inc. All rights reserved.
@@ -17,7 +17,7 @@ Copyright (c) 2022 Skyflow, Inc.
17
17
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
18
  * See the License for the specific language governing permissions and
19
19
  * limitations under the License.
20
- */function Po(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL),function(e){var t=e["merchant-id"],i=e["data-merchant-id"],n="",o="";Array.isArray(t)?t.length>1?(n="*",o=t.toString()):n=t.toString():"string"==typeof t&&t.length>0?n=t:"string"==typeof i&&i.length>0&&(n="*",o=i);e["merchant-id"]=n,e["data-merchant-id"]=o}(e);var i=Object.keys(e).filter((function(t){return void 0!==e[t]&&null!==e[t]&&""!==e[t]})).reduce((function(t,i){var n=e[i].toString();return"data-"===i.substring(0,5)?t.dataAttributes[i]=n:t.queryParams[i]=n,t}),{queryParams:{},dataAttributes:{}}),n=i.queryParams,o=i.dataAttributes;return{url:"".concat(t,"?").concat(Vo(n)),dataAttributes:o}}function Vo(e){var t="";return Object.keys(e).forEach((function(i){0!==t.length&&(t+="&"),t+=i+"="+e[i]})),t}function Uo(e,t){void 0===t&&(t={});var i=document.createElement("script");return i.src=e,Object.keys(t).forEach((function(e){i.setAttribute(e,t[e]),"data-csp-nonce"===e&&i.setAttribute("nonce",t["data-csp-nonce"])})),i}function ko(e,t){if(void 0===t&&(t=Yo()),xo(e,t),"undefined"==typeof window)return t.resolve(null);var i=Po(e),n=i.url,o=i.dataAttributes,s=o["data-namespace"]||"paypal",r=Fo(s);return function(e,t){var i=document.querySelector('script[src="'.concat(e,'"]'));if(null===i)return null;var n=Uo(e,t),o=i.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(n.dataset).length)return null;var s=!0;return Object.keys(o.dataset).forEach((function(e){o.dataset[e]!==n.dataset[e]&&(s=!1)})),s?i:null}(n,o)&&r?t.resolve(r):function(e,t){void 0===t&&(t=Yo());xo(e,t);var i=e.url,n=e.attributes;if("string"!=typeof i||0===i.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"==typeof window)return e();!function(e){var t=e.url,i=e.attributes,n=e.onSuccess,o=e.onError,s=Uo(t,i);s.onerror=o,s.onload=n,document.head.insertBefore(s,document.head.firstElementChild)}({url:i,attributes:n,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(i,'" failed to load.'));return window.fetch?fetch(i).then((function(i){return 200===i.status&&t(e),i.text()})).then((function(e){var i=function(e){var t=e.split("/* Original Error:")[1];return t?t.replace(/\n/g,"").replace("*/","").trim():e}(e);t(new Error(i))})).catch((function(e){t(e)})):t(e)}})}))}({url:n,attributes:o},t).then((function(){var e=Fo(s);if(e)return e;throw new Error("The window.".concat(s," global variable is not available."))}))}function Yo(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function Fo(e){return window[e]}function xo(e,t){if("object"!=typeof e||null===e)throw new Error("Expected an options object.");if(void 0!==t&&"function"!=typeof t)throw new Error("Expected PromisePonyfill to be a function.")}class Bo extends Eo{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-paypal-button",events:Object.assign(Object.assign({},null==n?void 0:n.events),{onSaveInstrumentCheckboxChanged:t=>e(this,void 0,void 0,(function*(){var e,i,n,o;null===(e=this.button)||void 0===e||e.close(),this.paypalLoader=null,this.paypalLoader=new lo(this.loadPaypal.bind(this)),this.button=yield this.paypalLoader.loader,this.button.render(`#${this.buttonWrapperId}`),null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onSaveInstrumentCheckboxChanged)||void 0===o||o.call(n,t)}))})})),this.sdkConfig=t,this.execution=i,this.options=n,this.paypalLoader=null,this.buttonWrapperId="payrails-paypal-button-wrapper",this.checkboxWrapperId="payrails-paypal-checkbox-wrapper",this.createOneTimeOrder=()=>e(this,void 0,void 0,(function*(){var e,t,i,n,o,s,r;const a=[{paymentMethodCode:"payPal",integrationType:"api",amount:this.sdkConfig.amount,paymentInstrumentData:{providerData:{riskSessionCorrelationId:this.fraudNetGuid}},storeInstrument:!1}],l=yield this.paymentExecutor.pay(a),d=null===(i=null===(t=null===(e=l.response.links.confirm)||void 0===e?void 0:e.action)||void 0===t?void 0:t.parameters)||void 0===i?void 0:i.orderId;if(!d)throw null===(s=null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o?void 0:o.onAuthorizeFailed)||void 0===s||s.call(o),new Go("No order id returned");return this.confirmLink=null===(r=l.response.links.confirm)||void 0===r?void 0:r.href,d})),this.element.innerHTML=`<div id="${this.buttonWrapperId}"></div><div id="${this.checkboxWrapperId}"></div>`,this.paymentExecutor=new p(t,i),this.paypalLoader=new lo(this.loadPaypal.bind(this)),this.fraudNetGuid=null==n?void 0:n.fraudNetGuid}loadPaypal(){return e(this,void 0,void 0,(function*(){const e=this.execution.paypalConfig,t=this.shouldStoreInstrument?"tokenize":"Instant"===this.execution.paypalConfig.captureMode?"capture":"authorize",i=yield ko({"client-id":e.clientId,components:"buttons,funding-eligibility",intent:t,currency:this.sdkConfig.amount.currency,vault:this.shouldStoreInstrument,"data-namespace":"payrailsPaypal"});if(i){return yield this.createPaypalButton(i)}throw new Error("Paypal not available")}))}createPaypalButton(t){var i,n,o;return e(this,void 0,void 0,(function*(){if(!t.Buttons)throw new Error("Paypal button not available");const e=yield t.Buttons(this.createPayPalButtonConfig());return e.isEligible()?(null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onPaypalAvailable)||void 0===o||o.call(n),e):null}))}createPayPalButtonConfig(){return this.shouldStoreInstrument?this.createBillingAgreementConfig():this.createOneTimeOrderConfig()}createBillingAgreementConfig(){return Object.assign(Object.assign({},this.createBaseConfig()),{onApprove:this.approvePayment.bind(this),createBillingAgreement:()=>e(this,void 0,void 0,(function*(){var e,t,i,n;const o=[{paymentMethodCode:"payPal",integrationType:"api",amount:this.sdkConfig.amount,paymentInstrumentData:{providerData:{riskSessionCorrelationId:this.fraudNetGuid}},storeInstrument:!0}],s=yield this.paymentExecutor.pay(o);return this.confirmLink=null===(e=s.response.links.confirm)||void 0===e?void 0:e.href,(null===(n=null===(i=null===(t=s.response.links.confirm)||void 0===t?void 0:t.action)||void 0===i?void 0:i.parameters)||void 0===n?void 0:n.tokenId)||""}))})}createOneTimeOrderConfig(){return Object.assign(Object.assign({},this.createBaseConfig()),{createOrder:this.createOneTimeOrder.bind(this),onApprove:this.approvePayment.bind(this)})}createBaseConfig(){var t,i,n,o,s,r,a,l,d,c;return{fundingSource:"paypal",style:{color:(null===(i=null===(t=this.options)||void 0===t?void 0:t.styles)||void 0===i?void 0:i.color)||"gold",height:(null===(o=null===(n=this.options)||void 0===n?void 0:n.styles)||void 0===o?void 0:o.height)||40,label:(null===(r=null===(s=this.options)||void 0===s?void 0:s.styles)||void 0===r?void 0:r.label)||"paypal",shape:(null===(l=null===(a=this.options)||void 0===a?void 0:a.styles)||void 0===l?void 0:l.shape)||"rect",tagline:(null===(c=null===(d=this.options)||void 0===d?void 0:d.styles)||void 0===c?void 0:c.tagline)||!1},onError:e=>{var t,i;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onAuthorizeFailed)&&this.options.events.onAuthorizeFailed(e)},onClick:(t,i)=>e(this,void 0,void 0,(function*(){var e,t;if(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onPaymentButtonClicked){return(yield this.options.events.onPaymentButtonClicked())?i.resolve():i.reject()}}))}}approvePayment(t){var i,n,o,s,r,a,l,d,c,E;return e(this,void 0,void 0,(function*(){if(!this.confirmLink)throw null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onAuthorizeFailed)||void 0===o||o.call(n),new Go("No confirm link");const e={};this.shouldStoreInstrument&&t.billingToken&&(e.tokenId=t.billingToken),this.fraudNetGuid&&(e.riskSessionCorrelationId=this.fraudNetGuid);const _=yield this.paymentExecutor.confirm(this.confirmLink,e);"authorizeSuccessful"===(null===(s=_.finalState)||void 0===s?void 0:s.code)?null===(l=null===(a=null===(r=this.options)||void 0===r?void 0:r.events)||void 0===a?void 0:a.onAuthorizeSuccess)||void 0===l||l.call(a):null===(E=null===(c=null===(d=this.options)||void 0===d?void 0:d.events)||void 0===c?void 0:c.onAuthorizeFailed)||void 0===E||E.call(c)}))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){var e;this.paypalLoader||(this.paypalLoader=new lo(this.loadPaypal.bind(this)));const t=yield this.paypalLoader.loader;this.button=t;try{null===(e=this.storeInstrumentCheckbox)||void 0===e||e.mount(`#${this.checkboxWrapperId}`),yield null==t?void 0:t.render(`#${this.buttonWrapperId}`)}catch(e){throw new jo(e.message)}}))})()}unmount(){var e;null===(e=this.button)||void 0===e||e.close(),this.paypalLoader=null,super.unmount()}}class Go extends Error{constructor(e){super(`PaypalOrderError: ${e}`),this.name="PaypalOrderError"}}class jo extends Error{constructor(e){super(`PaypalButtonError: ${e}`),this.name="PaypalButtonError"}}class Xo extends Do{constructor(e,t,i){var n,o;super("payrails-paypal-button-dropin",(null===(o=null===(n=null==i?void 0:i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"PayPal",void 0,null==i?void 0:i.styles),this.loadElementId="paypal-dropin-load-element",this.component=new Bo(e,t,Object.assign(Object.assign({},i),{events:Object.assign(Object.assign({},null==i?void 0:i.events),{onPaypalAvailable:()=>{this.mountAfterAvailable()}})}))}}class Ko extends yo{constructor(e,t,i,n){var o,s,r;const a=e.paymentMethod===f.PAYPAL?`${null===(o=e.data)||void 0===o?void 0:o.email}`:`${null===(s=e.data)||void 0===s?void 0:s.bin}**${null===(r=e.data)||void 0===r?void 0:r.suffix}`;super(`payrails-payment-instrument-${e.id}`,a,{onActivate:()=>{i(e),this.component.setDisabled(!1)}},n),this.component=t}}class Wo extends L{constructor(e,t,i,n,o){var s,r;super("fieldset",{id:"payrails-dropin-component"}),this.collectContainer=e,this.dropinConfig=t,this.execution=i,this.sdkConfig=n,this.returnLinks=o;void 0!==(null===(r=null===(s=this.dropinConfig.paymentMethodsConfiguration)||void 0===s?void 0:s.cards)||void 0===r?void 0:r.showExistingCards)&&console.warn("The `showExistingCards` option is deprecated and will be removed in a future version. Please use `showStoredInstruments` instead.");const a=new Map;this.execution.storedPaymentInstruments.forEach((e=>{var t;if(this.isStoredInstrumentEnabled(e.paymentMethod)){this.cardPaymentButton=this.createCardPaymentButton(null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardPaymentButton);const i=this.createStoredInstrumentElement(e);a.set(i.identifier,i)}}));const l={[f.CARD]:this.createCreditCardButton.bind(this),[f.PAYPAL]:this.createPayPalButton.bind(this),[f.GOOGLE_PAY]:this.createGooglePayButton.bind(this),[f.APPLE_PAY]:this.createApplePayButton.bind(this)};this.execution.availablePaymentMethods.forEach((({paymentMethodCode:e})=>{if(e&&l[e]){l[e];const t=l[e]();a.set(t.identifier,t)}})),this.element.addEventListener("change",(e=>{var t,i;const n=(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)||"";a.forEach((e=>{e.deactivate()})),null===(i=a.get(n))||void 0===i||i.activate()})),this.subElements.push(...Array.from(a.values()))}createStoredInstrumentElement(e){var t,i;return this.cardPaymentButton=this.createCardPaymentButton(null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardPaymentButton),new Ko(e,this.cardPaymentButton,(e=>{this.cardPaymentButton&&(this.cardPaymentButton.selectedInstrument=e)}),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element)}createCreditCardButton(){var e,t;return this.creditCard=new go(this.createCardForm(),this.createCardPaymentButton(null===(e=this.dropinConfig.translations)||void 0===e?void 0:e.cardPaymentButton),null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.element),this.creditCard}createGooglePayButton(){var e,t,i,n;return this.googlePay=new Mo(this.sdkConfig,this.execution,Object.assign({events:{onAuthorizeSuccess:e=>{var t;if(e)if("authorizeSuccessful"===(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code))this.onAuthorizeSuccess();else this.onAuthorizeFailed()},onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onPaymentButtonClicked:null===(e=this.dropinConfig.events)||void 0===e?void 0:e.onPaymentButtonClicked},styles:Object.assign(Object.assign({},null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.googlePayButton),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element)},null===(n=this.dropinConfig.paymentMethodsConfiguration)||void 0===n?void 0:n.googlePay)),this.googlePay}createPayPalButton(){var e,t,i;return this.paypal=new Xo(this.sdkConfig,this.execution,Object.assign(Object.assign({},null===(e=this.dropinConfig.paymentMethodsConfiguration)||void 0===e?void 0:e.payPal),{styles:Object.assign(Object.assign({},null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.paypalButton),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element),events:{onAuthorizeSuccess:this.onAuthorizeSuccess.bind(this),onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onSaveInstrumentCheckboxChanged:e=>{var t,i;null===(i=null===(t=this.dropinConfig.events)||void 0===t?void 0:t.onSaveInstrumentCheckboxChanged)||void 0===i||i.call(t,e)}}})),this.paypal}createCardForm(){var e,t,i,n;if(!this.cardForm){const o=null===(e=this.dropinConfig.paymentMethodsConfiguration)||void 0===e?void 0:e.cards,s=Boolean(null==o?void 0:o.showStoreInstrumentCheckbox),r=Boolean(null==o?void 0:o.showCardHolderName),a=Boolean(null==o?void 0:o.alwaysStoreInstrument);this.cardForm=new Oo(this.collectContainer,{showStoreInstrumentCheckbox:s,showCardHolderName:r,alwaysStoreInstrument:a,translations:null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardForm,styles:Object.assign(Object.assign({},null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.cardForm),null===(n=this.dropinConfig.styles)||void 0===n?void 0:n.element),events:{onFocus:()=>{var e;null===(e=this.creditCard)||void 0===e||e.activate()},onChange:({isValid:e})=>{var t;null===(t=this.cardPaymentButton)||void 0===t||t.setDisabled(!e)},onSaveInstrumentCheckboxChanged:e=>{var t,i;null===(i=null===(t=this.dropinConfig.events)||void 0===t?void 0:t.onSaveInstrumentCheckboxChanged)||void 0===i||i.call(t,e)}}})}return this.cardPaymentButton&&this.cardPaymentButton.setCardForm(this.cardForm),this.cardForm}createApplePayButton(){var e,t,i,n;return this.applePay=new So(this.sdkConfig,this.execution,Object.assign(Object.assign({events:{onAuthorizeSuccess:e=>{var t;if(e)if("authorizeSuccessful"===(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code))this.onAuthorizeSuccess();else this.onAuthorizeFailed()},onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onPaymentButtonClicked:null===(e=this.dropinConfig.events)||void 0===e?void 0:e.onPaymentButtonClicked}},null===(t=this.dropinConfig.paymentMethodsConfiguration)||void 0===t?void 0:t.applePay),{styles:Object.assign(Object.assign({},null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.applePayButton),null===(n=this.dropinConfig.styles)||void 0===n?void 0:n.element)})),this.applePay}createCardPaymentButton(e){return this.cardPaymentButton||(this.cardPaymentButton=new v(this.sdkConfig,this.execution,{translations:e,events:Object.assign(Object.assign({},this.dropinConfig.events),{onAuthorizeSuccess:this.onAuthorizeSuccess.bind(this),onAuthorizeFailed:this.onAuthorizeFailed.bind(this)})},this.returnLinks)),this.cardForm&&this.cardPaymentButton.setCardForm(this.cardForm),this.cardPaymentButton}onAuthorizeSuccess(){var e,t,i,n;this.subElements.forEach((e=>e.unmount())),new Ro({translations:{label:null===(i=null===(t=null===(e=this.dropinConfig)||void 0===e?void 0:e.translations)||void 0===t?void 0:t.paymentResult)||void 0===i?void 0:i.success}}).mount(this.selector),(null===(n=this.dropinConfig.events)||void 0===n?void 0:n.onAuthorizeSuccess)&&this.dropinConfig.events.onAuthorizeSuccess()}onAuthorizeFailed(e){var t,i,n,o;new mo(null===(i=null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.paymentResult)||void 0===i?void 0:i.fail).mount(this.selector),null===(o=null===(n=this.dropinConfig.events)||void 0===n?void 0:n.onAuthorizeFailed)||void 0===o||o.call(n,e)}isStoredInstrumentEnabled(e){var t,i,n,o,s,r;switch(e){case f.CARD:return!1!==(null===(i=null===(t=this.dropinConfig.paymentMethodsConfiguration)||void 0===t?void 0:t.cards)||void 0===i?void 0:i.showStoredInstruments)||!1!==(null===(o=null===(n=this.dropinConfig.paymentMethodsConfiguration)||void 0===n?void 0:n.cards)||void 0===o?void 0:o.showExistingCards);case f.PAYPAL:case f.GOOGLE_PAY:case f.APPLE_PAY:return!1!==(null===(r=null===(s=this.dropinConfig.paymentMethodsConfiguration)||void 0===s?void 0:s[e])||void 0===r?void 0:r.showStoredInstruments);default:return!1}}}const $o=()=>{[["https://js.skyflow.com/v1/elements/index.js","payrails-iframe-js-v1"],["https://js.skyflow.com/v1/elements/index.html","payrails-iframe-html-v1"]].forEach((([e,t])=>{if(!document.getElementById(t)){const i=document.createElement("link");i.id=t,i.rel="preload",i.as="script",i.href=e,document.head.appendChild(i)}}))},Ho={visa:/^4\d*/,mastercard:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,amex:/^3[47]\d*/,diners:/^(36|38|30[0-5])\d*/,discover:/^(6011|65|64[4-9]|622)\d*/,jcb:/^35\d*/,hipercard:/^606282\d*/,unionpay:/^62\d*/,maestro:/^(5018|5020|5038|5043|5[6-9]|6020|6304|6703|6759|676[1-3])\d*/};class zo{constructor(e,t,i){this.sdkConfig=i,this.bin="",this.id="payrails-container-wrapper",this.containerType="COMPOSABLE",this.cardTableName=t.cardTableName||"cards",this.containerType=t.containerType||"COMPOSABLE",this.__container=e.container(this.containerType,t)}createCollectElement(e){const t={required:!!e.required,enableCardIcon:!1!==e.enableCardIcon},i=this.__container.create(Object.assign(Object.assign({table:this.cardTableName,labelStyles:{},errorTextStyles:{},column:this.elementToFieldMap.get(e.type)},e),{type:e.type===exports.ElementType.CARDHOLDER_NAME?"INPUT_FIELD":e.type}),e.format?Object.assign(Object.assign({},t),{format:e.format}):t);return this.attachCustomEventHandler(i)}mount(e){if("COLLECT"===this.containerType)throw new Error("Collect container cannot be mounted");this.element=document.createElement("span"),this.element.setAttribute("id",this.id);const t=document.querySelector(e);if(!t)throw new Error(`Element with selector ${e} does not exist`);t.appendChild(this.element),window.setTimeout((()=>{this.__container.mount(`#${this.id}`)}),50)}unmount(){this.element&&this.element.remove()}collect(){return e(this,void 0,void 0,(function*(){const{records:e}=yield this.__container.collect(),{skyflow_id:t,card_number:i,cardholder_name:n,expiry_month:o,expiry_year:s,security_code:r}=e[0].fields;return{instrumentId:t,card_number:i,cardholder_name:n,expiry_month:o,expiry_year:s,security_code:r}}))}tokenize(t){return e(this,void 0,void 0,(function*(){const e=yield this.collect(),{instrumentId:i,card_number:n,cardholder_name:o,expiry_month:s,expiry_year:r,security_code:l}=e,d=this.sdkConfig.vaultConfiguration.links.saveInstrument.href,E=this.sdkConfig.token,_=this.sdkConfig.holderReference;if(!d)throw new Error("Save instrument URL not available!");const I=yield(({url:e,token:t,instrumentId:i,holderReference:n,providerId:o,providerConfigId:s,meta:r,storeInstrument:l=!1,futureUsage:d="CardOnFile"})=>c({url:e,token:t,method:a.POST,body:{holderReference:n,storeInstrument:l,futureUsage:d,paymentMethod:"card",token:{providerId:o,providerConfigId:s,reference:i,type:"vault",meta:r}}}))({url:d,token:E,instrumentId:i,holderReference:_,providerId:this.sdkConfig.vaultConfiguration.providerId,providerConfigId:this.sdkConfig.vaultConfiguration.providerConfigId,meta:{skyflow_id:i,card_number:n,cardholder_name:o,expiry_month:s,expiry_year:r,security_code:l},storeInstrument:t.storeInstrument||!1,futureUsage:t.futureUsage||"CardOnFile"});return I.res}))}attachCustomEventHandler(e){return new Proxy(e,{get:(e,t)=>{if("on"!==t)return e[t];return((i,n)=>{e[t].call(e,i,(e=>{"CHANGE"===i?(e.elementType===exports.ElementType.CARD_NUMBER&&(e.network=function(e){for(const[t,i]of Object.entries(Ho))if(i.test(e))return t;return""}(e.value),e.bin=this.formatBin(e.value),this.bin=this.formatBin(e.value)),n(e)):n(e)}))}).bind(e)}})}formatBin(e){return e.replace(/-|X/g,"")}get elementToFieldMap(){return new Map([[exports.ElementType.CARD_NUMBER,"card_number"],[exports.ElementType.CARDHOLDER_NAME,"cardholder_name"],[exports.ElementType.CVV,"security_code"],[exports.ElementType.EXPIRATION_MONTH,"expiry_month"],[exports.ElementType.EXPIRATION_YEAR,"expiry_year"]])}}class qo{constructor(e,t,i){this.pageId=e,this.sdkConfig=t,this.environment=i,this.guid=d().replace(/-/g,""),this.fnclsVal="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",this.configId=d(),this.scriptId=d(),this.execution=new O(t.execution)}mount(){this.loadFraudnet(this.pageId)}unmount(){var e,t;null===(e=document.getElementById(this.configId))||void 0===e||e.remove(),null===(t=document.getElementById(this.scriptId))||void 0===t||t.remove()}loadFraudnet(e){this.unmount();const t=this.createFraudnetConfig(e);document.body.appendChild(t);const i=document.createElement("script");i.setAttribute("id",this.scriptId),i.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(i)}get payPalConfig(){return this.execution.paypalConfig}createFraudnetConfig(e){const t=document.createElement("script");return t.setAttribute("type","application/json"),t.setAttribute("fncls",this.fnclsVal),t.setAttribute("id",this.configId),t.innerText=JSON.stringify({f:this.guid,s:`${this.payPalConfig.merchantId}_${e}`,sandbox:"TEST"===this.environment}),t}}
20
+ */function ko(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL),function(e){var t=e["merchant-id"],i=e["data-merchant-id"],n="",o="";Array.isArray(t)?t.length>1?(n="*",o=t.toString()):n=t.toString():"string"==typeof t&&t.length>0?n=t:"string"==typeof i&&i.length>0&&(n="*",o=i);e["merchant-id"]=n,e["data-merchant-id"]=o}(e);var i=Object.keys(e).filter((function(t){return void 0!==e[t]&&null!==e[t]&&""!==e[t]})).reduce((function(t,i){var n=e[i].toString();return"data-"===i.substring(0,5)?t.dataAttributes[i]=n:t.queryParams[i]=n,t}),{queryParams:{},dataAttributes:{}}),n=i.queryParams,o=i.dataAttributes;return{url:"".concat(t,"?").concat(Yo(n)),dataAttributes:o}}function Yo(e){var t="";return Object.keys(e).forEach((function(i){0!==t.length&&(t+="&"),t+=i+"="+e[i]})),t}function Fo(e,t){void 0===t&&(t={});var i=document.createElement("script");return i.src=e,Object.keys(t).forEach((function(e){i.setAttribute(e,t[e]),"data-csp-nonce"===e&&i.setAttribute("nonce",t["data-csp-nonce"])})),i}function xo(e,t){if(void 0===t&&(t=Go()),jo(e,t),"undefined"==typeof window)return t.resolve(null);var i=ko(e),n=i.url,o=i.dataAttributes,s=o["data-namespace"]||"paypal",r=Bo(s);return function(e,t){var i=document.querySelector('script[src="'.concat(e,'"]'));if(null===i)return null;var n=Fo(e,t),o=i.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(n.dataset).length)return null;var s=!0;return Object.keys(o.dataset).forEach((function(e){o.dataset[e]!==n.dataset[e]&&(s=!1)})),s?i:null}(n,o)&&r?t.resolve(r):function(e,t){void 0===t&&(t=Go());jo(e,t);var i=e.url,n=e.attributes;if("string"!=typeof i||0===i.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"==typeof window)return e();!function(e){var t=e.url,i=e.attributes,n=e.onSuccess,o=e.onError,s=Fo(t,i);s.onerror=o,s.onload=n,document.head.insertBefore(s,document.head.firstElementChild)}({url:i,attributes:n,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(i,'" failed to load.'));return window.fetch?fetch(i).then((function(i){return 200===i.status&&t(e),i.text()})).then((function(e){var i=function(e){var t=e.split("/* Original Error:")[1];return t?t.replace(/\n/g,"").replace("*/","").trim():e}(e);t(new Error(i))})).catch((function(e){t(e)})):t(e)}})}))}({url:n,attributes:o},t).then((function(){var e=Bo(s);if(e)return e;throw new Error("The window.".concat(s," global variable is not available."))}))}function Go(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function Bo(e){return window[e]}function jo(e,t){if("object"!=typeof e||null===e)throw new Error("Expected an options object.");if(void 0!==t&&"function"!=typeof t)throw new Error("Expected PromisePonyfill to be a function.")}class Xo extends ho{constructor(t,i,n){super("div",Object.assign(Object.assign({},n),{id:"payrails-paypal-button",events:Object.assign(Object.assign({},null==n?void 0:n.events),{onSaveInstrumentCheckboxChanged:t=>e(this,void 0,void 0,(function*(){var e,i,n,o;null===(e=this.button)||void 0===e||e.close(),this.paypalLoader=null,this.paypalLoader=new _o(this.loadPaypal.bind(this)),this.button=yield this.paypalLoader.loader,this.button.render(`#${this.buttonWrapperId}`),null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onSaveInstrumentCheckboxChanged)||void 0===o||o.call(n,t)}))})})),this.sdkConfig=t,this.execution=i,this.options=n,this.paypalLoader=null,this.buttonWrapperId="payrails-paypal-button-wrapper",this.checkboxWrapperId="payrails-paypal-checkbox-wrapper",this.createOneTimeOrder=()=>e(this,void 0,void 0,(function*(){var e,t,i,n,o,s,r;const a=[{paymentMethodCode:"payPal",integrationType:"api",amount:this.sdkConfig.amount,paymentInstrumentData:{providerData:{riskSessionCorrelationId:this.fraudNetGuid}},storeInstrument:!1}],l=yield this.paymentExecutor.pay(a),d=null===(i=null===(t=null===(e=l.response.links.confirm)||void 0===e?void 0:e.action)||void 0===t?void 0:t.parameters)||void 0===i?void 0:i.orderId;if(!d)throw null===(s=null===(o=null===(n=this.options)||void 0===n?void 0:n.events)||void 0===o?void 0:o.onAuthorizeFailed)||void 0===s||s.call(o),new Ko("No order id returned");return this.confirmLink=null===(r=l.response.links.confirm)||void 0===r?void 0:r.href,d})),this.element.innerHTML=`<div id="${this.buttonWrapperId}"></div><div id="${this.checkboxWrapperId}"></div>`,this.paymentExecutor=new T(t,i),this.paypalLoader=new _o(this.loadPaypal.bind(this)),this.fraudNetGuid=null==n?void 0:n.fraudNetGuid}loadPaypal(){return e(this,void 0,void 0,(function*(){const e=this.execution.paypalConfig,t=this.shouldStoreInstrument?"tokenize":"Instant"===this.execution.paypalConfig.captureMode?"capture":"authorize",i=yield xo({"client-id":e.clientId,components:"buttons,funding-eligibility",intent:t,currency:this.sdkConfig.amount.currency,vault:this.shouldStoreInstrument,"data-namespace":"payrailsPaypal"});if(i){return yield this.createPaypalButton(i)}throw new Error("Paypal not available")}))}createPaypalButton(t){var i,n,o;return e(this,void 0,void 0,(function*(){if(!t.Buttons)throw new Error("Paypal button not available");const e=yield t.Buttons(this.createPayPalButtonConfig());return e.isEligible()?(null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onPaypalAvailable)||void 0===o||o.call(n),e):null}))}createPayPalButtonConfig(){return this.shouldStoreInstrument?this.createBillingAgreementConfig():this.createOneTimeOrderConfig()}createBillingAgreementConfig(){return Object.assign(Object.assign({},this.createBaseConfig()),{onApprove:this.approvePayment.bind(this),createBillingAgreement:()=>e(this,void 0,void 0,(function*(){var e,t,i,n;const o=[{paymentMethodCode:"payPal",integrationType:"api",amount:this.sdkConfig.amount,paymentInstrumentData:{providerData:{riskSessionCorrelationId:this.fraudNetGuid}},storeInstrument:!0}],s=yield this.paymentExecutor.pay(o);return this.confirmLink=null===(e=s.response.links.confirm)||void 0===e?void 0:e.href,(null===(n=null===(i=null===(t=s.response.links.confirm)||void 0===t?void 0:t.action)||void 0===i?void 0:i.parameters)||void 0===n?void 0:n.tokenId)||""}))})}createOneTimeOrderConfig(){return Object.assign(Object.assign({},this.createBaseConfig()),{createOrder:this.createOneTimeOrder.bind(this),onApprove:this.approvePayment.bind(this)})}createBaseConfig(){var t,i,n,o,s,r,a,l,d,c;return{fundingSource:"paypal",style:{color:(null===(i=null===(t=this.options)||void 0===t?void 0:t.styles)||void 0===i?void 0:i.color)||"gold",height:(null===(o=null===(n=this.options)||void 0===n?void 0:n.styles)||void 0===o?void 0:o.height)||40,label:(null===(r=null===(s=this.options)||void 0===s?void 0:s.styles)||void 0===r?void 0:r.label)||"paypal",shape:(null===(l=null===(a=this.options)||void 0===a?void 0:a.styles)||void 0===l?void 0:l.shape)||"rect",tagline:(null===(c=null===(d=this.options)||void 0===d?void 0:d.styles)||void 0===c?void 0:c.tagline)||!1},onError:e=>{var t,i;(null===(i=null===(t=this.options)||void 0===t?void 0:t.events)||void 0===i?void 0:i.onAuthorizeFailed)&&this.options.events.onAuthorizeFailed(e)},onClick:(t,i)=>e(this,void 0,void 0,(function*(){var e,t;if(null===(t=null===(e=this.options)||void 0===e?void 0:e.events)||void 0===t?void 0:t.onPaymentButtonClicked){return(yield this.options.events.onPaymentButtonClicked())?i.resolve():i.reject()}}))}}approvePayment(t){var i,n,o,s,r,a,l,d,c,E;return e(this,void 0,void 0,(function*(){if(!this.confirmLink)throw null===(o=null===(n=null===(i=this.options)||void 0===i?void 0:i.events)||void 0===n?void 0:n.onAuthorizeFailed)||void 0===o||o.call(n),new Ko("No confirm link");const e={};this.shouldStoreInstrument&&t.billingToken&&(e.tokenId=t.billingToken),this.fraudNetGuid&&(e.riskSessionCorrelationId=this.fraudNetGuid);const _=yield this.paymentExecutor.confirm(this.confirmLink,e);"authorizeSuccessful"===(null===(s=_.finalState)||void 0===s?void 0:s.code)?null===(l=null===(a=null===(r=this.options)||void 0===r?void 0:r.events)||void 0===a?void 0:a.onAuthorizeSuccess)||void 0===l||l.call(a):null===(E=null===(c=null===(d=this.options)||void 0===d?void 0:d.events)||void 0===c?void 0:c.onAuthorizeFailed)||void 0===E||E.call(c)}))}mount(t){super.mount(t),(()=>{e(this,void 0,void 0,(function*(){var e;this.paypalLoader||(this.paypalLoader=new _o(this.loadPaypal.bind(this)));const t=yield this.paypalLoader.loader;this.button=t;try{null===(e=this.storeInstrumentCheckbox)||void 0===e||e.mount(`#${this.checkboxWrapperId}`),yield null==t?void 0:t.render(`#${this.buttonWrapperId}`)}catch(e){throw new Wo(e.message)}}))})()}unmount(){var e;null===(e=this.button)||void 0===e||e.close(),this.paypalLoader=null,super.unmount()}}class Ko extends Error{constructor(e){super(`PaypalOrderError: ${e}`),this.name="PaypalOrderError"}}class Wo extends Error{constructor(e){super(`PaypalButtonError: ${e}`),this.name="PaypalButtonError"}}class $o extends Co{constructor(e,t,i){var n,o;super("payrails-paypal-button-dropin",(null===(o=null===(n=null==i?void 0:i.translations)||void 0===n?void 0:n.labels)||void 0===o?void 0:o.label)||"PayPal",void 0,null==i?void 0:i.styles),this.loadElementId="paypal-dropin-load-element",this.component=new Xo(e,t,Object.assign(Object.assign({},i),{events:Object.assign(Object.assign({},null==i?void 0:i.events),{onPaypalAvailable:()=>{this.mountAfterAvailable()}})}))}}class Ho extends go{constructor(e,t,i,n){var o,s,r;const a=e.paymentMethod===L.PAYPAL?`${null===(o=e.data)||void 0===o?void 0:o.email}`:`${null===(s=e.data)||void 0===s?void 0:s.bin}**${null===(r=e.data)||void 0===r?void 0:r.suffix}`;super(`payrails-payment-instrument-${e.id}`,a,{onActivate:()=>{i(e),this.component.setDisabled(!1)}},n),this.component=t}}class zo extends m{constructor(e,t,i,n,o){var s,r;super("fieldset",{id:"payrails-dropin-component"}),this.collectContainer=e,this.dropinConfig=t,this.execution=i,this.sdkConfig=n,this.returnLinks=o;void 0!==(null===(r=null===(s=this.dropinConfig.paymentMethodsConfiguration)||void 0===s?void 0:s.cards)||void 0===r?void 0:r.showExistingCards)&&console.warn("The `showExistingCards` option is deprecated and will be removed in a future version. Please use `showStoredInstruments` instead.");const a=new Map;this.execution.storedPaymentInstruments.forEach((e=>{var t;if(this.isStoredInstrumentEnabled(e.paymentMethod)){this.cardPaymentButton=this.createCardPaymentButton(null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardPaymentButton);const i=this.createStoredInstrumentElement(e);a.set(i.identifier,i)}}));const l={[L.CARD]:this.createCreditCardButton.bind(this),[L.PAYPAL]:this.createPayPalButton.bind(this),[L.GOOGLE_PAY]:this.createGooglePayButton.bind(this),[L.APPLE_PAY]:this.createApplePayButton.bind(this)};this.execution.availablePaymentMethods.forEach((({paymentMethodCode:e})=>{if(e&&l[e]){l[e];const t=l[e]();a.set(t.identifier,t)}})),this.element.addEventListener("change",(e=>{var t,i;const n=(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)||"";a.forEach((e=>{e.deactivate()})),null===(i=a.get(n))||void 0===i||i.activate()})),this.subElements.push(...Array.from(a.values()))}createStoredInstrumentElement(e){var t,i;return this.cardPaymentButton=this.createCardPaymentButton(null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardPaymentButton),new Ho(e,this.cardPaymentButton,(e=>{this.cardPaymentButton&&(this.cardPaymentButton.selectedInstrument=e)}),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element)}createCreditCardButton(){var e,t;return this.creditCard=new wo(this.createCardForm(),this.createCardPaymentButton(null===(e=this.dropinConfig.translations)||void 0===e?void 0:e.cardPaymentButton),null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.element),this.creditCard}createGooglePayButton(){var e,t,i,n;return this.googlePay=new Uo(this.sdkConfig,this.execution,Object.assign({events:{onAuthorizeSuccess:e=>{var t;if(e)if("authorizeSuccessful"===(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code))this.onAuthorizeSuccess();else this.onAuthorizeFailed()},onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onPaymentButtonClicked:null===(e=this.dropinConfig.events)||void 0===e?void 0:e.onPaymentButtonClicked},styles:Object.assign(Object.assign({},null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.googlePayButton),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element)},null===(n=this.dropinConfig.paymentMethodsConfiguration)||void 0===n?void 0:n.googlePay)),this.googlePay}createPayPalButton(){var e,t,i;return this.paypal=new $o(this.sdkConfig,this.execution,Object.assign(Object.assign({},null===(e=this.dropinConfig.paymentMethodsConfiguration)||void 0===e?void 0:e.payPal),{styles:Object.assign(Object.assign({},null===(t=this.dropinConfig.styles)||void 0===t?void 0:t.paypalButton),null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.element),events:{onAuthorizeSuccess:this.onAuthorizeSuccess.bind(this),onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onSaveInstrumentCheckboxChanged:e=>{var t,i;null===(i=null===(t=this.dropinConfig.events)||void 0===t?void 0:t.onSaveInstrumentCheckboxChanged)||void 0===i||i.call(t,e)}}})),this.paypal}createCardForm(){var e,t,i,n;if(!this.cardForm){const o=null===(e=this.dropinConfig.paymentMethodsConfiguration)||void 0===e?void 0:e.cards,s=Boolean(null==o?void 0:o.showStoreInstrumentCheckbox),r=Boolean(null==o?void 0:o.showCardHolderName),a=Boolean(null==o?void 0:o.alwaysStoreInstrument);this.cardForm=new Ao(this.collectContainer,{showStoreInstrumentCheckbox:s,showCardHolderName:r,alwaysStoreInstrument:a,translations:null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.cardForm,styles:Object.assign(Object.assign({},null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.cardForm),null===(n=this.dropinConfig.styles)||void 0===n?void 0:n.element),events:{onFocus:()=>{var e;null===(e=this.creditCard)||void 0===e||e.activate()},onChange:({isValid:e})=>{var t;null===(t=this.cardPaymentButton)||void 0===t||t.setDisabled(!e)},onSaveInstrumentCheckboxChanged:e=>{var t,i;null===(i=null===(t=this.dropinConfig.events)||void 0===t?void 0:t.onSaveInstrumentCheckboxChanged)||void 0===i||i.call(t,e)}}})}return this.cardPaymentButton&&this.cardPaymentButton.setCardForm(this.cardForm),this.cardForm}createApplePayButton(){var e,t,i,n;return this.applePay=new bo(this.sdkConfig,this.execution,Object.assign(Object.assign({events:{onAuthorizeSuccess:e=>{var t;if(e)if("authorizeSuccessful"===(null===(t=null==e?void 0:e.finalState)||void 0===t?void 0:t.code))this.onAuthorizeSuccess();else this.onAuthorizeFailed()},onAuthorizeFailed:this.onAuthorizeFailed.bind(this),onPaymentButtonClicked:null===(e=this.dropinConfig.events)||void 0===e?void 0:e.onPaymentButtonClicked}},null===(t=this.dropinConfig.paymentMethodsConfiguration)||void 0===t?void 0:t.applePay),{styles:Object.assign(Object.assign({},null===(i=this.dropinConfig.styles)||void 0===i?void 0:i.applePayButton),null===(n=this.dropinConfig.styles)||void 0===n?void 0:n.element)})),this.applePay}createCardPaymentButton(e){return this.cardPaymentButton||(this.cardPaymentButton=new R(this.sdkConfig,this.execution,{translations:e,events:Object.assign(Object.assign({},this.dropinConfig.events),{onAuthorizeSuccess:this.onAuthorizeSuccess.bind(this),onAuthorizeFailed:this.onAuthorizeFailed.bind(this)})},this.returnLinks)),this.cardForm&&this.cardPaymentButton.setCardForm(this.cardForm),this.cardPaymentButton}onAuthorizeSuccess(){var e,t,i,n;this.subElements.forEach((e=>e.unmount())),new So({translations:{label:null===(i=null===(t=null===(e=this.dropinConfig)||void 0===e?void 0:e.translations)||void 0===t?void 0:t.paymentResult)||void 0===i?void 0:i.success}}).mount(this.selector),(null===(n=this.dropinConfig.events)||void 0===n?void 0:n.onAuthorizeSuccess)&&this.dropinConfig.events.onAuthorizeSuccess()}onAuthorizeFailed(e){var t,i,n,o;new Do(null===(i=null===(t=this.dropinConfig.translations)||void 0===t?void 0:t.paymentResult)||void 0===i?void 0:i.fail).mount(this.selector),null===(o=null===(n=this.dropinConfig.events)||void 0===n?void 0:n.onAuthorizeFailed)||void 0===o||o.call(n,e)}isStoredInstrumentEnabled(e){var t,i,n,o,s,r;switch(e){case L.CARD:return!1!==(null===(i=null===(t=this.dropinConfig.paymentMethodsConfiguration)||void 0===t?void 0:t.cards)||void 0===i?void 0:i.showStoredInstruments)||!1!==(null===(o=null===(n=this.dropinConfig.paymentMethodsConfiguration)||void 0===n?void 0:n.cards)||void 0===o?void 0:o.showExistingCards);case L.PAYPAL:case L.GOOGLE_PAY:case L.APPLE_PAY:return!1!==(null===(r=null===(s=this.dropinConfig.paymentMethodsConfiguration)||void 0===s?void 0:s[e])||void 0===r?void 0:r.showStoredInstruments);default:return!1}}}const qo=()=>{[["https://js.skyflow.com/v1/elements/index.js","payrails-iframe-js-v1"],["https://js.skyflow.com/v1/elements/index.html","payrails-iframe-html-v1"]].forEach((([e,t])=>{if(!document.getElementById(t)){const i=document.createElement("link");i.id=t,i.rel="preload",i.as="script",i.href=e,document.head.appendChild(i)}}))},Jo={visa:/^4\d*/,mastercard:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,amex:/^3[47]\d*/,diners:/^(36|38|30[0-5])\d*/,discover:/^(6011|65|64[4-9]|622)\d*/,jcb:/^35\d*/,hipercard:/^606282\d*/,unionpay:/^62\d*/,maestro:/^(5018|5020|5038|5043|5[6-9]|6020|6304|6703|6759|676[1-3])\d*/};class Zo{constructor(e,t,i){this.sdkConfig=i,this.bin="",this.id="payrails-container-wrapper",this.containerType="COMPOSABLE",this.cardTableName=t.cardTableName||"cards",this.containerType=t.containerType||"COMPOSABLE",this.__container=e.container(this.containerType,t)}createCollectElement(e){const t={required:!!e.required,enableCardIcon:!1!==e.enableCardIcon},i=this.__container.create(Object.assign(Object.assign({table:this.cardTableName,labelStyles:{},errorTextStyles:{},column:this.elementToFieldMap.get(e.type)},e),{type:e.type===exports.ElementType.CARDHOLDER_NAME?"INPUT_FIELD":e.type}),e.format?Object.assign(Object.assign({},t),{format:e.format}):t);return this.attachCustomEventHandler(i)}mount(e){if("COLLECT"===this.containerType)throw new Error("Collect container cannot be mounted");this.element=document.createElement("span"),this.element.setAttribute("id",this.id);const t=document.querySelector(e);if(!t)throw new Error(`Element with selector ${e} does not exist`);t.appendChild(this.element),window.setTimeout((()=>{this.__container.mount(`#${this.id}`)}),50)}unmount(){this.element&&this.element.remove()}collect(){return e(this,void 0,void 0,(function*(){const{records:e}=yield this.__container.collect(),{skyflow_id:t,card_number:i,cardholder_name:n,expiry_month:o,expiry_year:s,security_code:r}=e[0].fields;return{instrumentId:t,card_number:i,cardholder_name:n,expiry_month:o,expiry_year:s,security_code:r}}))}tokenize(t){return e(this,void 0,void 0,(function*(){const e=yield this.collect(),{instrumentId:i,card_number:n,cardholder_name:o,expiry_month:s,expiry_year:r,security_code:l}=e,d=this.sdkConfig.vaultConfiguration.links.saveInstrument.href,E=this.sdkConfig.token,_=this.sdkConfig.holderReference;if(!d)throw new Error("Save instrument URL not available!");const I=yield(({url:e,token:t,instrumentId:i,holderReference:n,providerId:o,providerConfigId:s,meta:r,storeInstrument:l=!1,futureUsage:d="CardOnFile"})=>c({url:e,token:t,method:a.POST,body:{holderReference:n,storeInstrument:l,futureUsage:d,paymentMethod:"card",token:{providerId:o,providerConfigId:s,reference:i,type:"vault",meta:r}}}))({url:d,token:E,instrumentId:i,holderReference:_,providerId:this.sdkConfig.vaultConfiguration.providerId,providerConfigId:this.sdkConfig.vaultConfiguration.providerConfigId,meta:{skyflow_id:i,card_number:n,cardholder_name:o,expiry_month:s,expiry_year:r,security_code:l},storeInstrument:t.storeInstrument||!1,futureUsage:t.futureUsage||"CardOnFile"});return I.res}))}attachCustomEventHandler(e){return new Proxy(e,{get:(e,t)=>{if("on"!==t)return e[t];return((i,n)=>{e[t].call(e,i,(e=>{"CHANGE"===i?(e.elementType===exports.ElementType.CARD_NUMBER&&(e.network=function(e){for(const[t,i]of Object.entries(Jo))if(i.test(e))return t;return""}(e.value),e.bin=this.formatBin(e.value),this.bin=this.formatBin(e.value)),n(e)):n(e)}))}).bind(e)}})}formatBin(e){return e.replace(/-|X/g,"")}get elementToFieldMap(){return new Map([[exports.ElementType.CARD_NUMBER,"card_number"],[exports.ElementType.CARDHOLDER_NAME,"cardholder_name"],[exports.ElementType.CVV,"security_code"],[exports.ElementType.EXPIRATION_MONTH,"expiry_month"],[exports.ElementType.EXPIRATION_YEAR,"expiry_year"]])}}class Qo{constructor(e,t,i){this.pageId=e,this.sdkConfig=t,this.environment=i,this.guid=d().replace(/-/g,""),this.fnclsVal="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99",this.configId=d(),this.scriptId=d(),this.execution=new A(t.execution)}mount(){this.loadFraudnet(this.pageId)}unmount(){var e,t;null===(e=document.getElementById(this.configId))||void 0===e||e.remove(),null===(t=document.getElementById(this.scriptId))||void 0===t||t.remove()}loadFraudnet(e){this.unmount();const t=this.createFraudnetConfig(e);document.body.appendChild(t);const i=document.createElement("script");i.setAttribute("id",this.scriptId),i.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(i)}get payPalConfig(){return this.execution.paypalConfig}createFraudnetConfig(e){const t=document.createElement("script");return t.setAttribute("type","application/json"),t.setAttribute("fncls",this.fnclsVal),t.setAttribute("id",this.configId),t.innerText=JSON.stringify({f:this.guid,s:`${this.payPalConfig.merchantId}_${e}`,sandbox:"TEST"===this.environment}),t}}
21
21
  /* @copyright
22
22
  Copyright (c) 2023 Payrails (https://www.payrails.com/)
23
- */class Jo{static init(e,t){const i=JSON.parse(atob(e.data)),{vaultConfiguration:{vaultId:n,vaultUrl:o,token:s},execution:r}=i,a=ao.init({vaultID:n,vaultURL:o,getBearerToken:()=>Promise.resolve(s)}),l=new O(r);return l.isPaymentMethodAvailable(f.CARD)&&$o(),new Jo(i,a,l,t)}update(e){this.sdkConfiguration.amount=e}collectContainer(e){if("COMPOSABLE"===e.containerType&&!e.layout)throw new Error("Layout configuration is required");return this.__container=new zo(this.vaultClient,Object.assign(Object.assign({},e),{cardTableName:this.sdkConfiguration.vaultConfiguration.cardTableName}),this.sdkConfiguration),this.__container}googlePayButton(e){var t;if(!this.execution)throw new Error("SDK was not initialized with workflow execution");return new wo(this.sdkConfiguration,this.execution,Object.assign({environment:null===(t=this.options)||void 0===t?void 0:t.environment},e))}applePayButton(e){if(!this.execution)throw new Error("SDK was not initialized with workflow execution");return new _o(this.sdkConfiguration,this.execution,e)}cardList(e){return this.__cardList||(this.__cardList=new vo(this.execution,{onCardChange:t=>{this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=t,this.__cardPaymentButton.setDisabled(!1)),null==e||e.onCardChange(t)}})),this.__cardList}cardForm(e){var t,i;if(!this.__cardForm){const n=this.getContainerLayout(null==e?void 0:e.showCardHolderName);this.__container=this.collectContainer(Object.assign(Object.assign({layout:n,errorTextStyles:{base:{display:"none"}}},null===(t=null==e?void 0:e.styles)||void 0===t?void 0:t.errorTextStyles),{styles:{base:null===(i=null==e?void 0:e.styles)||void 0===i?void 0:i.base}})),this.__cardForm=new Oo(this.__container,Object.assign(Object.assign({},e),{events:Object.assign(Object.assign({},null==e?void 0:e.events),{onChange:t=>{var i;this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm&&this.__cardPaymentButton.setDisabled(!this.__cardForm.isValid)),(null===(i=null==e?void 0:e.events)||void 0===i?void 0:i.onChange)&&e.events.onChange(t)},onFocus:()=>{var t;this.__cardList&&this.__cardList.reset(),this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm&&this.__cardPaymentButton.setDisabled(!this.__cardForm.isValid)),(null===(t=null==e?void 0:e.events)||void 0===t?void 0:t.onFocus)&&e.events.onFocus()}})}))}return this.__cardPaymentButton&&this.__cardPaymentButton.setCardForm(this.__cardForm),this.__cardForm}dropin(e){var t,i,n;const o=this.getContainerLayout(null===(i=null===(t=e.paymentMethodsConfiguration)||void 0===t?void 0:t.cards)||void 0===i?void 0:i.showCardHolderName);return this.__container=this.collectContainer({layout:o,errorTextStyles:{base:{display:"none"}}}),new Wo(this.__container,e,this.execution,this.sdkConfiguration,(null===(n=this.options)||void 0===n?void 0:n.returnLinks)||{})}getSavedCreditCards(){return this.execution.savedCreditCards}paymentButton(e){var t;return this.__cardPaymentButton||(this.__cardPaymentButton=new v(this.sdkConfiguration,this.execution,e,(null===(t=this.options)||void 0===t?void 0:t.returnLinks)||{})),this.__cardPaymentButton.setDisabled(!0),this.__cardForm&&this.__cardPaymentButton.setCardForm(this.__cardForm),this.__cardPaymentButton}paypalButton(e){var t;return this.__paypalButton=new Bo(this.sdkConfiguration,this.execution,Object.assign(Object.assign({},e),{fraudNetGuid:(null==e?void 0:e.fraudNetGuid)||(null===(t=this.__fraudNet)||void 0===t?void 0:t.guid)})),this.__paypalButton}getSavedPaypalAccounts(){return this.execution.savedPaypalAccounts||[]}fraudNet(e){var t;return this.__fraudNet||(this.__fraudNet=new qo(e,this.sdkConfiguration,(null===(t=this.options)||void 0===t?void 0:t.environment)||"TEST")),this.__paypalButton&&(this.__paypalButton.fraudNetGuid=this.__fraudNet.guid),this.__fraudNet}constructor(e,t,i,n){var o;this.sdkConfiguration=e,this.vaultClient=t,this.execution=i,this.options=n,(null===(o=null==n?void 0:n.events)||void 0===o?void 0:o.onClientInitialized)&&n.events.onClientInitialized(this.execution)}getContainerLayout(e){return e?[1,1,3]:[1,3]}}Jo.preloadCardForm=$o,exports.Payrails=Jo}();
23
+ */class es{static init(e,t){const i=JSON.parse(atob(e.data)),{vaultConfiguration:{vaultId:n,vaultUrl:o,token:s},execution:r}=i,a=Eo.init({vaultID:n,vaultURL:o,getBearerToken:()=>Promise.resolve(s)}),l=new A(r);return l.isPaymentMethodAvailable(L.CARD)&&qo(),new es(i,a,l,t)}update(e){this.sdkConfiguration.amount=e}collectContainer(e){if("COMPOSABLE"===e.containerType&&!e.layout)throw new Error("Layout configuration is required");return this.__container=new Zo(this.vaultClient,Object.assign(Object.assign({},e),{cardTableName:this.sdkConfiguration.vaultConfiguration.cardTableName}),this.sdkConfiguration),this.__container}googlePayButton(e){var t;if(!this.execution)throw new Error("SDK was not initialized with workflow execution");return new Vo(this.sdkConfiguration,this.execution,Object.assign({environment:null===(t=this.options)||void 0===t?void 0:t.environment},e))}applePayButton(e){if(!this.execution)throw new Error("SDK was not initialized with workflow execution");return new uo(this.sdkConfiguration,this.execution,e)}cardList(e){return this.__cardList||(this.__cardList=new Ro(this.execution,{onCardChange:t=>{this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=t,this.__cardPaymentButton.setDisabled(!1)),null==e||e.onCardChange(t)}})),this.__cardList}cardForm(e){var t,i;if(!this.__cardForm){const n=this.getContainerLayout(null==e?void 0:e.showCardHolderName);this.__container=this.collectContainer(Object.assign(Object.assign({layout:n,errorTextStyles:{base:{display:"none"}}},null===(t=null==e?void 0:e.styles)||void 0===t?void 0:t.errorTextStyles),{styles:{base:null===(i=null==e?void 0:e.styles)||void 0===i?void 0:i.base}})),this.__cardForm=new Ao(this.__container,Object.assign(Object.assign({},e),{events:Object.assign(Object.assign({},null==e?void 0:e.events),{onChange:t=>{var i;this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm&&this.__cardPaymentButton.setDisabled(!this.__cardForm.isValid)),(null===(i=null==e?void 0:e.events)||void 0===i?void 0:i.onChange)&&e.events.onChange(t)},onFocus:()=>{var t;this.__cardList&&this.__cardList.reset(),this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm&&this.__cardPaymentButton.setDisabled(!this.__cardForm.isValid)),(null===(t=null==e?void 0:e.events)||void 0===t?void 0:t.onFocus)&&e.events.onFocus()}})}))}return this.__cardPaymentButton&&this.__cardPaymentButton.setCardForm(this.__cardForm),this.__cardForm}dropin(e){var t,i,n;const o=this.getContainerLayout(null===(i=null===(t=e.paymentMethodsConfiguration)||void 0===t?void 0:t.cards)||void 0===i?void 0:i.showCardHolderName);return this.__container=this.collectContainer({layout:o,errorTextStyles:{base:{display:"none"}}}),new zo(this.__container,e,this.execution,this.sdkConfiguration,(null===(n=this.options)||void 0===n?void 0:n.returnLinks)||{})}getSavedCreditCards(){return this.execution.savedCreditCards}paymentButton(e){var t;return this.__cardPaymentButton||(this.__cardPaymentButton=new R(this.sdkConfiguration,this.execution,e,(null===(t=this.options)||void 0===t?void 0:t.returnLinks)||{})),this.__cardPaymentButton.setDisabled(!0),this.__cardForm&&this.__cardPaymentButton.setCardForm(this.__cardForm),this.__cardPaymentButton}paypalButton(e){var t;return this.__paypalButton=new Xo(this.sdkConfiguration,this.execution,Object.assign(Object.assign({},e),{fraudNetGuid:(null==e?void 0:e.fraudNetGuid)||(null===(t=this.__fraudNet)||void 0===t?void 0:t.guid)})),this.__paypalButton}getSavedPaypalAccounts(){return this.execution.savedPaypalAccounts||[]}fraudNet(e){var t;return this.__fraudNet||(this.__fraudNet=new Qo(e,this.sdkConfiguration,(null===(t=this.options)||void 0===t?void 0:t.environment)||"TEST")),this.__paypalButton&&(this.__paypalButton.fraudNetGuid=this.__fraudNet.guid),this.__fraudNet}constructor(e,t,i,n){var o;this.sdkConfiguration=e,this.vaultClient=t,this.execution=i,this.options=n,(null===(o=null==n?void 0:n.events)||void 0===o?void 0:o.onClientInitialized)&&n.events.onClientInitialized(this.execution)}getContainerLayout(e){return e?[1,1,3]:[1,3]}}es.preloadCardForm=qo,exports.Payrails=es}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payrails/web-sdk",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
@@ -161,8 +161,10 @@
161
161
 
162
162
  #payrails-dropin-component {
163
163
  background: #ffffff;
164
- box-shadow: 0px 0px 1px rgba(66, 71, 76, 0.32),
165
- 0px 4px 8px rgba(66, 71, 76, 0.06), 0px 8px 48px #eeeeee;
164
+ box-shadow:
165
+ 0px 0px 1px rgba(66, 71, 76, 0.32),
166
+ 0px 4px 8px rgba(66, 71, 76, 0.06),
167
+ 0px 8px 48px #eeeeee;
166
168
  border-radius: 16px;
167
169
  border: 1px solid #eae8ee;
168
170
  width: 100%;
@@ -245,7 +247,8 @@
245
247
  stroke: #fff;
246
248
  stroke-miterlimit: 10;
247
249
  box-shadow: inset 0px 0px 0px #ff5a66;
248
- animation: strokeFill 0.4s ease-in-out 0.4s forwards,
250
+ animation:
251
+ strokeFill 0.4s ease-in-out 0.4s forwards,
249
252
  strokeScale 0.3s ease-in-out 0.9s both;
250
253
  }
251
254
 
@@ -316,7 +319,8 @@
316
319
  stroke-miterlimit: 10;
317
320
  margin: 10% auto;
318
321
  box-shadow: inset 0px 0px 0px #7ac142;
319
- animation: fillCheck 0.4s ease-in-out 0.4s forwards,
322
+ animation:
323
+ fillCheck 0.4s ease-in-out 0.4s forwards,
320
324
  scaleCheck 0.3s ease-in-out 0.9s both;
321
325
  }
322
326
  #payrails-authorization-success-msg .checkmark__check {