@payrails/web-sdk 5.25.2 → 5.25.3-RC.0
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 +2 -2
- package/package.json +1 -1
- package/payrails.js +2 -2
package/payrails.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e){"use strict";function t(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}function i(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 n(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 o(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}e.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",e.EXPIRATION_DATE="EXPIRATION_DATE"}(e.ElementType||(e.ElementType={})),"function"==typeof SuppressedError&&SuppressedError;var s={};!function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=(e=>(e.PAYRAILS_CLIENT_CONFIG_MALFORMED="payrails:client:init.config_malformed",e.PAYRAILS_CLIENT_COLLECT_CONTAINER_MOUNT="payrails:client:collectContainer.unmountable",e.PAYRAILS_CLIENT_UI_ELEMENT_MISSING="payrails:client:mount.ui_element_missing",e.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING="payrails:client:mount.parent_element_missing",e.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR="payrails:client:mount.subelements_render_error",e.PAYRAILS_CLIENT_CARD_FORM_MISSING="payrails:client:pay.card_form_missing",e.PAYRAILS_CLIENT_GPAY_LOADING_ERROR="payrails:client:mount.gpay_loading_error",e.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING="payrails:client:init.gpay_config_missing",e.PAYRAILS_CLIENT_APPLEPAY_LOADING_ERROR="payrails:client:mount.applepay_loading_error",e.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING="payrails:client:init.applepay_config_missing",e.PAYRAILS_CLIENT_PAYPAL_LOADING_ERROR="payrails:client:init.paypal_loading_error",e.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING="payrails:client:init.paypal_config_missing",e.PAYRAILS_CLIENT_PAYPAL_ORDER_CREATION="payrails:client:init.paypal_order_creation",e.PAYRAILS_CLIENT_PAYPAL_BUTTON_MOUNT="payrails:client:mount.paypal_button_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR="payrails:client:payment_executor.pay_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR="payrails:client:payment_executor.3ds_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR="payrails:client:payment_executor.confirm_error",e.PAYRAILS_API_UNAUTHORIZED="payrails:api:unauthorized",e.PAYRAILS_API_TOO_MANY_REQUESTS="payrails:api:too_many_requests",e.PAYRAILS_API_UNSUCCESSFUL="payrails:api:unsuccessful",e.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED="payrails:api:authorization_not_requested",e.PAYRAILS_API_AUTHENTICATION_ERROR="payrails:api:request_authentication_error",e.PAYRAILS_API_AUTHORIZATION_ERROR="payrails:api:request_authorization_error",e.PAYRAILS_CLIENT_API_URL_NOT_FOUND="payrails:client:api_url_not_found",e.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND="payrails:client:workflow_execution_not_found",e.PAYRAILS_CARD_FORM_CREATION_FAILED="payrails:card_form:iframe_creation_failed",e.PAYRAILS_CARD_FORM_IFRAME_URL_MISSING="payrails:card_form:iframe_url_missing",e.PAYRAILS_CLIENT_UNKNOWN_ERROR="payrails:client:unknown",e.PAYRAILS_API_UNKNOWN_ERROR="payrails:api:unknown",e.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED="payrails:client:session_refresh_failed",e.PAYRAILS_CLIENT_CALLBACK_FAILED="payrails:client:callback_failed",e.PAYRAILS_API_BIN_LOOKUP_FAILED="payrails:api:bin_lookup_failed",e.PAYRAILS_CARD_FORM_ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE="payrails.card_form.element_not_mounted_in_element_match_rule",e.PAYRAILS_CARD_FORM_REQUIRED_PARAMS_NOT_PROVIDED="payrails.card_form.required_params_not_provided",e.PAYRAILS_CARD_FORM_CLIENT_CONNECTION="payrails.card_form.client_connection",e.PAYRAILS_CARD_FORM_IFRAME_NOT_FOUND="payrails.card_form.iframe_not_found",e.PAYRAILS_CARD_FORM_IFRAME_LOADING_ERROR="payrails.card_form.iframe_loading_error",e.PAYRAILS_CARD_FORM_CSP_ERROR="payrails.card_form.iframe_csp_error",e.PAYRAILS_CARD_FORM_COMPLETE_AND_VALID_INPUTS="payrails.card_form.complete_and_valid_inputs",e.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED="payrails.card_form.collect_element_not_mounted",e.PAYRAILS_CLIENT_GENERIC_REDIRECT_MISSING_REDIRECT_LINK="payrails:client:generic_redirect.missing.redirect_link",e.PAYRAILS_CLIENT_COLLECT_CREATION_FAILED="payrails:client:collect_container.creation.failed",e.PAYRAILS_CLIENT_COLLECT_EMPTY_CONTAINER_TYPE="payrails:client:collect_container.empty_container_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_CONTAINER_TYPE="payrails:client:collect_container.invalid_container_type",e.PAYRAILS_CLIENT_COLLECT_OPERATION_FAILED="payrails:client:collect_container.collect_operation_failed",e.PAYRAILS_CLIENT_VAULT_CONNECTION_ERROR="payrails:client:vault.connection_error",e.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR="payrails:client:vault.network.error",e.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME="payrails:client:collect_container.unique_element_name",e.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS="payrails:client:collect_container.invalid_tokens",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT="payrails:client:collect_container.empty_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER="payrails:client:collect_container.invalid_event_listener",e.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.missing_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.invalid_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_TYPE="payrails:client:collect_container.invalid_event_type",e.PAYRAILS_CLIENT_COLLECT_TABLE_NAME_MISSING="payrails:client:collect_container.table_name_missing",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE="payrails:client:collect_container.empty_table",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_NAME="payrails:client:collect_container.invalid_table_name",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN="payrails:client:collect_container.missing_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COLUMN="payrails:client:collect_container.empty_column",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN="payrails:client:collect_container.invalid_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID="payrails:client:collect_container.empty_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID="payrails:client:collect_container.invalid_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_MISMATCH_ELEMENT_COUNT_LAYOUT_SUM="payrails:client:collect_container.mismatch_element_count_layout_sum",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR="payrails:client:collect_container.invalid_element_selector",e.PAYRAILS_CLIENT_COLLECT_DUPLICATE_ELEMENT="payrails:client:collect_container.duplicate_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_TYPE="payrails:client:collect_container.invalid_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATIONS_TYPE="payrails:client:collect_container.invalid_validations_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_TYPE="payrails:client:collect_container.missing_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_TYPE="payrails:client:collect_container.invalid_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_PARAMS="payrails:client:collect_container.missing_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_PARAMS="payrails:client:collect_container.invalid_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_MISSING_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.missing_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE="payrails:client:collect_container.missing_min_and_max_in_length_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.missing_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.invalid_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.invalid_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS="payrails:client:collect_container.invalid_boolean_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_TYPE="payrails:client:collect_container.missing_element_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_TYPE="payrails:client:collect_container.empty_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_TYPE="payrails:client:collect_container.invalid_upsert_option_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_UPSERT_OPTIONS_ARRAY="payrails:client:collect_container.empty_upsert_options_array",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_OBJECT_TYPE="payrails:client:collect_container.invalid_upsert_option_object_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.missing_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.missing_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.missing_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.invalid_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_LAYOUT_KEY="payrails:client:collect_container.missing_composable_layout_key",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE="payrails:client:collect_container.invalid_composable_layout_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COMPOSABLE_LAYOUT_ARRAY="payrails:client:collect_container.empty_composable_layout_array",e.PAYRAILS_CLIENT_COLLECT_NEGATIVE_VALUES_COMPOSABLE_LAYOUT="payrails:client:collect_container.negative_values_composable_layout",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_FORMAT="payrails:client:collect_container.invalid_input_options_format",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_TRANSLATION="payrails:client:collect_container.invalid_input_options_translation",e.PAYRAILS_CLIENT_COLLECT_RECORDS_KEY_MISSING_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.records_key_missing_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_GET_BEARER_TOKEN_MISSING="payrails:client:collect_container.get_bearer_token_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_MISSING="payrails:client:composable_container_options_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_INVALID="payrails:client:composable_container_options_invalid",e))(t||{});const i={"payrails:client:init.config_malformed":{description:"The provided configuration string is invalid. Please ensure it matches the required format and structure as defined in the documentation",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:unknown":{description:"Unknown Client",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unauthorized":{description:"Unauthorized access to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:too_many_requests":{description:"Too many requests to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unsuccessful":{description:"Unsuccessful request to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collectContainer.unmountable":{description:"Collect container cannot be mounted",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.ui_element_missing":{description:"Collect container element does not exist",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:pay.card_form_missing":{description:"Trying to collect values from non-existent card form",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.gpay_loading_error":{description:"Google pay can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_loading_error":{description:"Paypal can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_order_creation":{description:"Paypal order creation failed",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.paypal_button_error":{description:"PaypalButtonError occurred",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.parent_element_missing":{description:"Parent element not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.subelements_render_error":{description:"Subelements could not be rendered. Please set id for the element first.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:api_url_not_found":{description:"API URL not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:workflow_execution_not_found":{description:"Workflow execution not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_config_missing":{description:"Paypal config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:authorization_not_requested":{description:"Authorization was not requested",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.gpay_config_missing":{description:"Google pay config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.applepay_loading_error":{description:"Apple pay can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.applepay_config_missing":{description:"Apple pay config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:card_form:iframe_creation_failed":{description:"Error occured while creating an iframe",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:card_form:iframe_url_missing":{description:"Iframe URL is missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:callback_failed":{description:"Callback passed threw an error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:session_refresh_failed":{description:"Error occured while refreshing the session",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:bin_lookup_failed":{description:"Error occured while looking up the BIN",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:request_authentication_error":{description:"Authentication error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unknown":{description:"Unknown API error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.pay_error":{description:"Error occured while executing a payment",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.confirm_error":{description:"Error occured while confirming a payment",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:request_authorization_error":{description:"Authorization error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.3ds_error":{description:"Authorization failed after 3DS challenge.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.element_not_mounted_in_element_match_rule":{description:"Interface: collect element - collect element is not mounted in ValidationRule params at index %s1 in validations array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.required_params_not_provided":{description:"Interface: collect element - Required params are not provided.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.client_connection":{description:"Interface: collect container - client connection not established. client info has not reached iframes",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_not_found":{description:"Interface: collect element - frame not found:",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.complete_and_valid_inputs":{description:"Interface: collect container - Provide complete and valid inputs",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.collect_element_not_mounted":{description:"Interface: composable collect - collect element is not mounted",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_loading_error":{description:"Interface: collect element - Error occured while loading iframe",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_csp_error":{description:"Interface: collect element - Content Security Policy error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:generic_redirect.missing.redirect_link":{description:"[Generic Redirect] Missing redirect link in response"},"payrails:client:collect_container.creation.failed":{description:"Collect container failed to initialize",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_container_type":{description:"client container - Invalid container type. Container object cannot be empty.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_container_type":{description:"client container - Invalid container type. Invalid container object",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:vault.connection_error":{description:"Vault connection error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:vault.network.error":{description:"Vault network error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.unique_element_name":{description:"client container - Element name must be unique",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_tokens":{description:"client container - Invalid tokens",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_element":{description:"client container - Element cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_listener":{description:"client container - Invalid event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_event_handler":{description:"client container - Missing handler in event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_handler":{description:"client container - Invalid handler in event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_type":{description:"client container - Invalid event type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.table_name_missing":{description:"client container - Table name missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_table":{description:"client container - Table cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_name":{description:"client container - Invalid table name",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_column":{description:"client container - Column missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_column":{description:"client container - Column cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_column":{description:"client container - Invalid column",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_skyflow_id":{description:"client container - Skyflow ID cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_skyflow_id":{description:"client container - Invalid Skyflow ID",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.mismatch_element_count_layout_sum":{description:"client container - Element count does not match layout sum",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_selector":{description:"client container - Invalid element selector",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.duplicate_element":{description:"client container - Duplicate element",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_type":{description:"client container - Invalid element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validations_type":{description:"client container - Invalid validations type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_validation_rule_type":{description:"client container - Missing validation rule type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validation_rule_type":{description:"client container - Invalid validation rule type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_validation_rule_params":{description:"client container - Missing validation rule params",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validation_rule_params":{description:"client container - Invalid validation rule params",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_regex_in_regex_match_rule":{description:"client container - Missing regex in regex match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_min_and_max_in_length_match_rule":{description:"client container - Missing min and max in length match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_element_in_element_match_rule":{description:"client container - Missing element in element match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_in_element_match_rule":{description:"client container - Invalid element in element match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_regex_in_regex_match_rule":{description:"client container - Invalid regex in regex match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_boolean_options":{description:"client container - Invalid boolean options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_element_type":{description:"client container - Missing element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_element_type":{description:"client container - EMPTY element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_upsert_option_type":{description:"client container - Invalid upsert option type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_upsert_options_array":{description:"client container - Empty upsert options array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_upsert_option_object_type":{description:"client container - Invalid upsert option object type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_table_in_upsert_option":{description:"client container - Missing table in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_in_upsert_option":{description:"client container - Invalid table in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_column_in_upsert_option":{description:"client container - Missing column in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_column_in_upsert_option":{description:"client container - Invalid column in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_composable_container_options":{description:"client container - Missing composable container options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_composable_container_options":{description:"client container - Invalid composable container options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_composable_layout_key":{description:"client container - Missing composable layout key",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_composable_layout_type":{description:"client container - Invalid composable layout type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_composable_layout_array":{description:"client container - Empty composable layout array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.negative_values_composable_layout":{description:"client container - Negative values in composable layout",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_input_options_format":{description:"client container - Invalid input options format",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_input_options_translation":{description:"client container - Invalid input options translation",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.records_key_missing_in_additional_fields":{description:"client container - Records key missing in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_records_in_additional_fields":{description:"client container - Invalid records in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_records_in_additional_fields":{description:"client container - Missing records in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_table_in_additional_fields":{description:"client container - Missing table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_table_in_additional_fields":{description:"client container - Empty table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_in_additional_fields":{description:"client container - Invalid table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_fields_in_additional_fields":{description:"client container - Missing fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_fields_in_additional_fields":{description:"client container - Empty fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_fields_in_additional_fields":{description:"client container - Invalid fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.get_bearer_token_missing":{description:"client container - Get bearer token missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:composable_container_options_missing":{description:"client container - Composable container options missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:composable_container_options_invalid":{description:"client container - Composable container options invalid",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.collect_operation_failed":{description:"client container - Collect operation failed",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"}};var n=(e=>(e.ERROR="payrails:error",e.INFO="payrails:info",e.DEBUG="payrails:debug",e.WARN="payrails:warn",e))(n||{});class o extends Error{constructor(e,t){var n;const{description:s,docUrl:r,cause:a}=null!=t?t:{},{description:l,docUrl:c}=i[e]||{},d=null!=(n=null!=s?s:l)?n:"An unknown error occurred",u=null!=r?r:c;super(d),this.name=e,this.docUrl=u,this.cause=a,this.message=d,Error.captureStackTrace&&Error.captureStackTrace(this,o)}toJSON(){return{name:this.name,message:this.message,docUrl:this.docUrl,stack:this.stack,cause:this.cause}}}e.ERROR_CODES=t,e.PAYRAILS_OBSERVABILITY_EVENTS=n,e.PayrailsError=o}(s);var r={};!function(e){var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,s=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,r=(e,t)=>{for(var r in t||(t={}))n.call(t,r)&&s(e,r,t[r]);if(i)for(var r of i(t))o.call(t,r)&&s(e,r,t[r]);return e};Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var a=(e=>(e.PAYRAILS_CLIENT_CONFIG_MALFORMED="payrails:client:init.config_malformed",e.PAYRAILS_CLIENT_COLLECT_CONTAINER_MOUNT="payrails:client:collectContainer.unmountable",e.PAYRAILS_CLIENT_UI_ELEMENT_MISSING="payrails:client:mount.ui_element_missing",e.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING="payrails:client:mount.parent_element_missing",e.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR="payrails:client:mount.subelements_render_error",e.PAYRAILS_CLIENT_CARD_FORM_MISSING="payrails:client:pay.card_form_missing",e.PAYRAILS_CLIENT_GPAY_LOADING_ERROR="payrails:client:mount.gpay_loading_error",e.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING="payrails:client:init.gpay_config_missing",e.PAYRAILS_CLIENT_APPLEPAY_LOADING_ERROR="payrails:client:mount.applepay_loading_error",e.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING="payrails:client:init.applepay_config_missing",e.PAYRAILS_CLIENT_PAYPAL_LOADING_ERROR="payrails:client:init.paypal_loading_error",e.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING="payrails:client:init.paypal_config_missing",e.PAYRAILS_CLIENT_PAYPAL_ORDER_CREATION="payrails:client:init.paypal_order_creation",e.PAYRAILS_CLIENT_PAYPAL_BUTTON_MOUNT="payrails:client:mount.paypal_button_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR="payrails:client:payment_executor.pay_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR="payrails:client:payment_executor.3ds_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR="payrails:client:payment_executor.confirm_error",e.PAYRAILS_API_UNAUTHORIZED="payrails:api:unauthorized",e.PAYRAILS_API_TOO_MANY_REQUESTS="payrails:api:too_many_requests",e.PAYRAILS_API_UNSUCCESSFUL="payrails:api:unsuccessful",e.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED="payrails:api:authorization_not_requested",e.PAYRAILS_API_AUTHENTICATION_ERROR="payrails:api:request_authentication_error",e.PAYRAILS_API_AUTHORIZATION_ERROR="payrails:api:request_authorization_error",e.PAYRAILS_CLIENT_API_URL_NOT_FOUND="payrails:client:api_url_not_found",e.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND="payrails:client:workflow_execution_not_found",e.PAYRAILS_CARD_FORM_CREATION_FAILED="payrails:card_form:iframe_creation_failed",e.PAYRAILS_CARD_FORM_IFRAME_URL_MISSING="payrails:card_form:iframe_url_missing",e.PAYRAILS_CLIENT_UNKNOWN_ERROR="payrails:client:unknown",e.PAYRAILS_API_UNKNOWN_ERROR="payrails:api:unknown",e.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED="payrails:client:session_refresh_failed",e.PAYRAILS_CLIENT_CALLBACK_FAILED="payrails:client:callback_failed",e.PAYRAILS_API_BIN_LOOKUP_FAILED="payrails:api:bin_lookup_failed",e.PAYRAILS_CARD_FORM_ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE="payrails.card_form.element_not_mounted_in_element_match_rule",e.PAYRAILS_CARD_FORM_REQUIRED_PARAMS_NOT_PROVIDED="payrails.card_form.required_params_not_provided",e.PAYRAILS_CARD_FORM_CLIENT_CONNECTION="payrails.card_form.client_connection",e.PAYRAILS_CARD_FORM_IFRAME_NOT_FOUND="payrails.card_form.iframe_not_found",e.PAYRAILS_CARD_FORM_IFRAME_LOADING_ERROR="payrails.card_form.iframe_loading_error",e.PAYRAILS_CARD_FORM_CSP_ERROR="payrails.card_form.iframe_csp_error",e.PAYRAILS_CARD_FORM_COMPLETE_AND_VALID_INPUTS="payrails.card_form.complete_and_valid_inputs",e.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED="payrails.card_form.collect_element_not_mounted",e.PAYRAILS_CLIENT_GENERIC_REDIRECT_MISSING_REDIRECT_LINK="payrails:client:generic_redirect.missing.redirect_link",e.PAYRAILS_CLIENT_COLLECT_CREATION_FAILED="payrails:client:collect_container.creation.failed",e.PAYRAILS_CLIENT_COLLECT_EMPTY_CONTAINER_TYPE="payrails:client:collect_container.empty_container_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_CONTAINER_TYPE="payrails:client:collect_container.invalid_container_type",e.PAYRAILS_CLIENT_COLLECT_OPERATION_FAILED="payrails:client:collect_container.collect_operation_failed",e.PAYRAILS_CLIENT_VAULT_CONNECTION_ERROR="payrails:client:vault.connection_error",e.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR="payrails:client:vault.network.error",e.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME="payrails:client:collect_container.unique_element_name",e.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS="payrails:client:collect_container.invalid_tokens",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT="payrails:client:collect_container.empty_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER="payrails:client:collect_container.invalid_event_listener",e.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.missing_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.invalid_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_TYPE="payrails:client:collect_container.invalid_event_type",e.PAYRAILS_CLIENT_COLLECT_TABLE_NAME_MISSING="payrails:client:collect_container.table_name_missing",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE="payrails:client:collect_container.empty_table",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_NAME="payrails:client:collect_container.invalid_table_name",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN="payrails:client:collect_container.missing_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COLUMN="payrails:client:collect_container.empty_column",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN="payrails:client:collect_container.invalid_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID="payrails:client:collect_container.empty_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID="payrails:client:collect_container.invalid_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_MISMATCH_ELEMENT_COUNT_LAYOUT_SUM="payrails:client:collect_container.mismatch_element_count_layout_sum",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR="payrails:client:collect_container.invalid_element_selector",e.PAYRAILS_CLIENT_COLLECT_DUPLICATE_ELEMENT="payrails:client:collect_container.duplicate_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_TYPE="payrails:client:collect_container.invalid_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATIONS_TYPE="payrails:client:collect_container.invalid_validations_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_TYPE="payrails:client:collect_container.missing_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_TYPE="payrails:client:collect_container.invalid_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_PARAMS="payrails:client:collect_container.missing_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_PARAMS="payrails:client:collect_container.invalid_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_MISSING_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.missing_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE="payrails:client:collect_container.missing_min_and_max_in_length_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.missing_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.invalid_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.invalid_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS="payrails:client:collect_container.invalid_boolean_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_TYPE="payrails:client:collect_container.missing_element_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_TYPE="payrails:client:collect_container.empty_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_TYPE="payrails:client:collect_container.invalid_upsert_option_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_UPSERT_OPTIONS_ARRAY="payrails:client:collect_container.empty_upsert_options_array",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_OBJECT_TYPE="payrails:client:collect_container.invalid_upsert_option_object_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.missing_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.missing_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.missing_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.invalid_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_LAYOUT_KEY="payrails:client:collect_container.missing_composable_layout_key",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE="payrails:client:collect_container.invalid_composable_layout_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COMPOSABLE_LAYOUT_ARRAY="payrails:client:collect_container.empty_composable_layout_array",e.PAYRAILS_CLIENT_COLLECT_NEGATIVE_VALUES_COMPOSABLE_LAYOUT="payrails:client:collect_container.negative_values_composable_layout",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_FORMAT="payrails:client:collect_container.invalid_input_options_format",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_TRANSLATION="payrails:client:collect_container.invalid_input_options_translation",e.PAYRAILS_CLIENT_COLLECT_RECORDS_KEY_MISSING_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.records_key_missing_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_GET_BEARER_TOKEN_MISSING="payrails:client:collect_container.get_bearer_token_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_MISSING="payrails:client:composable_container_options_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_INVALID="payrails:client:composable_container_options_invalid",e))(a||{}),l=(e=>(e.ERROR="payrails:error",e.INFO="payrails:info",e.DEBUG="payrails:debug",e.WARN="payrails:warn",e))(l||{});class c{log(e,t){console.group(`%c[${e}] : ${t.mssg}`,function(e){switch(e){case"error":return"color:red";case"info":return"color:blue";case"warn":return"color:orange";default:return"color:black"}}(e)),console.log(t.error),console.log("metadata",t.withMetada),console.log("extra",t.extra),console.groupEnd()}}function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u,_,p,E,h,I,v,m,y,L,A,f,O,R,T={},C={},g={},N={},S={},P={},b={},D={},M={},w={},k={},Y={},U={};function x(){if(A)return U;A=1,Object.defineProperty(U,"__esModule",{value:!0}),U.Framebus=void 0;var e=$(),t="undefined"!=typeof window&&window.Promise,i=function(){function i(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return i.setPromise=function(e){i.Promise=e},i.target=function(e){return new i(e)},i.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},i.prototype.include=function(t){return null!=t&&null!=t.Window&&t.constructor===t.Window&&(e.childWindows.push(t),!0)},i.prototype.target=function(e){return i.target(e)},i.prototype.emit=function(t,i,n){if(this.isDestroyed)return!1;var o=this.origin;if(t=this.namespaceEvent(t),(0,e.isntString)(t))return!1;if((0,e.isntString)(o))return!1;"function"==typeof i&&(n=i,i=void 0);var s=(0,e.packagePayload)(t,o,i,n);return!!s&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach((function(t){(0,e.sendMessage)(t,s,o)})):(0,e.broadcast)(s,{origin:o,frame:window.top||window.self}),!0)},i.prototype.emitAsPromise=function(e,t){var n=this;return new i.Promise((function(i,o){n.emit(e,t,(function(e){i(e)}))||o(new Error('Listener not added for "'.concat(e,'"')))}))},i.prototype.on=function(t,i){if(this.isDestroyed)return!1;var n=this,o=this.origin,s=i;return t=this.namespaceEvent(t),!(0,e.subscriptionArgsInvalid)(t,s,o)&&(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,e)}),this.listeners.push({eventName:t,handler:s,originalHandler:i}),e.subscribers[o]=e.subscribers[o]||{},e.subscribers[o][t]=e.subscribers[o][t]||[],e.subscribers[o][t].push(s),!0)},i.prototype.off=function(t,i){var n=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var o=0;o<this.listeners.length;o++){var s=this.listeners[o];s.originalHandler===i&&(n=s.handler)}t=this.namespaceEvent(t);var r=this.origin;if((0,e.subscriptionArgsInvalid)(t,n,r))return!1;var a=e.subscribers[r]&&e.subscribers[r][t];if(!a)return!1;for(o=0;o<a.length;o++)if(a[o]===n)return a.splice(o,1),!0;return!1},i.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},i.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},i.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map((function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e})).filter((function(e){return e})):[]},i.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find((function(t){return t===e}));return Boolean(t)},i.prototype.checkOrigin=function(e){var t,i=document.createElement("a");return i.href=location.href,t="https:"===i.protocol?i.host.replace(/:443$/,""):"http:"===i.protocol?i.host.replace(/:80$/,""):i.host,i.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},i.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},i.Promise=t,i}();return U.Framebus=i,U}function F(){if(R)return Y;R=1;var e=Y&&Y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Y,"__esModule",{value:!0}),Y.subscribeReplier=void 0;var t=x(),i=e((O||(O=1,f=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)}))}),f));return Y.subscribeReplier=function(e,n){var o=(0,i.default)();return t.Framebus.target({origin:n}).on(o,(function i(s,r){e(s,r),t.Framebus.target({origin:n}).off(o,i)})),o},Y}var B,j,V,G,X,z,H={},W={},q={};function $(){return G||(G=1,e=T,t=T&&T.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,o)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),i=T&&T.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||t(i,e,n)},Object.defineProperty(e,"__esModule",{value:!0}),i(function(){if(u)return C;u=1,Object.defineProperty(C,"__esModule",{value:!0}),C.detach=C.attach=void 0;var e=$(),t=!1;return C.attach=function(){t||"undefined"==typeof window||(t=!0,window.addEventListener("message",e.onMessage,!1))},C.detach=function(){t=!1,window.removeEventListener("message",e.onMessage,!1)},C}(),e),i(function(){if(_)return g;_=1,Object.defineProperty(g,"__esModule",{value:!0}),g.broadcastToChildWindows=void 0;var e=$();return g.broadcastToChildWindows=function(t,i,n){for(var o=e.childWindows.length-1;o>=0;o--){var s=e.childWindows[o];s.closed?e.childWindows.splice(o,1):n!==s&&(0,e.broadcast)(t,{origin:i,frame:s.top})}},g}(),e),i(function(){if(p)return N;p=1,Object.defineProperty(N,"__esModule",{value:!0}),N.broadcast=void 0;var e=$();return N.broadcast=function t(i,n){var o,s=0,r=n.origin,a=n.frame;try{for(a.postMessage(i,r),(0,e.hasOpener)(a)&&a.opener.top!==window.top&&t(i,{origin:r,frame:a.opener.top});o=a.frames[s];)t(i,{origin:r,frame:o}),s++}catch(e){}},N}(),e),i((E||(E=1,Object.defineProperty(S,"__esModule",{value:!0}),S.subscribers=S.childWindows=S.prefix=void 0,S.prefix="/*framebus*/",S.childWindows=[],S.subscribers={}),S),e),i(function(){if(h)return P;h=1,Object.defineProperty(P,"__esModule",{value:!0}),P.dispatch=void 0;var e=$();return P.dispatch=function(t,i,n,o,s){if(e.subscribers[t]&&e.subscribers[t][i]){var r=[];n&&r.push(n),o&&r.push(o);for(var a=0;a<e.subscribers[t][i].length;a++)e.subscribers[t][i][a].apply(s,r)}},P}(),e),i((I||(I=1,Object.defineProperty(b,"__esModule",{value:!0}),b.hasOpener=void 0,b.hasOpener=function(e){return e.top===e&&null!=e.opener&&e.opener!==e&&!0!==e.opener.closed}),b),e),i((v||(v=1,Object.defineProperty(D,"__esModule",{value:!0}),D.isntString=void 0,D.isntString=function(e){return"string"!=typeof e}),D),e),i(function(){if(m)return M;m=1,Object.defineProperty(M,"__esModule",{value:!0}),M.onMessage=void 0;var e=$();return M.onMessage=function(t){if(!(0,e.isntString)(t.data)){var i=(0,e.unpackPayload)(t);if(i){var n=i.eventData,o=i.reply;(0,e.dispatch)("*",i.event,n,o,t),(0,e.dispatch)(t.origin,i.event,n,o,t),(0,e.broadcastToChildWindows)(t.data,i.origin,t.source)}}},M}(),e),i(function(){if(y)return w;y=1,Object.defineProperty(w,"__esModule",{value:!0}),w.packagePayload=void 0;var e=$();return w.packagePayload=function(t,i,n,o){var s,r={event:t,origin:i};"function"==typeof o&&(r.reply=(0,e.subscribeReplier)(o,i)),r.eventData=n;try{s=e.prefix+JSON.stringify(r)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return s},w}(),e),i((L||(L=1,Object.defineProperty(k,"__esModule",{value:!0}),k.sendMessage=void 0,k.sendMessage=function(e,t,i){try{e.postMessage(t,i)}catch(e){}}),k),e),i(F(),e),i(function(){if(B)return H;B=1,Object.defineProperty(H,"__esModule",{value:!0}),H.subscriptionArgsInvalid=void 0;var e=$();return H.subscriptionArgsInvalid=function(t,i,n){return!!(0,e.isntString)(t)||"function"!=typeof i||(0,e.isntString)(n)},H}(),e),i((j||(j=1,Object.defineProperty(W,"__esModule",{value:!0})),W),e),i(function(){if(V)return q;V=1,Object.defineProperty(q,"__esModule",{value:!0}),q.unpackPayload=void 0;var e=$();return q.unpackPayload=function(t){var i;if(t.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{i=JSON.parse(t.data.slice(e.prefix.length))}catch(e){return!1}if(i.reply){var n=t.origin,o=t.source,s=i.reply;i.reply=function(t){if(o){var i=(0,e.packagePayload)(s,n,t);i&&o.postMessage(i,n)}}}return i},q}(),e)),T;var e,t,i}const K=d(function(){if(z)return X;z=1;var e=$(),t=x();return(0,e.attach)(),X=t.Framebus}());class J{constructor(e){this.origin=null,this.listeners=[],this.bus=new K(e)}static getInstance(){return J.instance||(J.instance=new J),J.instance}on(e,t){return this.bus.on(e,t)}off(e,t){return this.bus.off(e,t)}emit(e,t,i=void 0){return this.bus.emit(e,t,i)}target(e){return this.bus.target(e)}}class Z{constructor(){this.bus=J.getInstance()}log(e,t){this.bus.emit(l.ERROR,{level:e,event:t})}}var Q,ee;const te=d(function(){if(ee)return Q;ee=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var i=Object.prototype.toString.call(e);return"[object RegExp]"===i||"[object Date]"===i||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function n(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function s(e,t){try{return t in e}catch(e){return!1}}function r(e,t,n){var r={};return n.isMergeableObject(e)&&o(e).forEach((function(t){r[t]=i(e[t],n)})),o(t).forEach((function(o){(function(e,t){return s(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(s(e,o)&&n.isMergeableObject(t[o])?r[o]=function(e,t){if(!t.customMerge)return a;var i=t.customMerge(e);return"function"==typeof i?i:a}(o,n)(e[o],t[o],n):r[o]=i(t[o],n))})),r}function a(t,o,s){(s=s||{}).arrayMerge=s.arrayMerge||n,s.isMergeableObject=s.isMergeableObject||e,s.cloneUnlessOtherwiseSpecified=i;var a=Array.isArray(o);return a===Array.isArray(t)?a?s.arrayMerge(t,o,s):r(t,o,s):i(o,s)}return a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return a(e,i,t)}),{})},Q=a}());class ie{constructor(){this.state={}}static getInstance(){return ie.instance||(ie.instance=new ie),ie.instance}getState(e){return this.state[e]}setState(e){this.state=te(this.state,e)}}const ne=ie.getInstance(),oe=()=>window&&window.navigator,se=()=>window&&window.screen,re=()=>({resolution:`${se().width}x${se().height}`,user_agent:oe().userAgent,language:oe().language}),ae=[a.PAYRAILS_API_AUTHORIZATION_ERROR,a.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR];class le{constructor(e){this.adapter=[new Z],this.enabled=e.enabled||!0,this.initGlobalState(e),e.logLevel=e.logLevel||"error","debug"===e.logLevel&&this.addAdapter(new c)}static init(e){le.instance=new le(e)}static getLogger(){return le.instance}initGlobalState(e){ne.setState({payrails:e.payrails,sdk:e.sdk})}static setState(e){ne.setState(e)}log(e,t,i){var n;this.enabled&&-1===ae.indexOf(null==(n=null==i?void 0:i.error)?void 0:n.name)&&this.adapter.forEach((n=>{n.log(e,{mssg:t,error:null==i?void 0:i.error,withMetada:r(r({},this.constructMetadata()),null==i?void 0:i.withMetada),extra:null==i?void 0:i.extra})}))}constructMetadata(){return{device:re(),payrails:ne.getState("payrails"),sdk:ne.getState("sdk")}}addAdapter(e){this.adapter.push(e)}static log(e,t){this.getLogger().log("info",e,t)}static debug(e,t){this.getLogger().log("debug",e,t)}static info(e,t){this.getLogger().log("info",e,t)}static warn(e,t){this.getLogger().log("warning",e,t)}static error(e,t){this.getLogger().log("error",e,t)}static exception(e,t){this.error(e,t)}}e.PayrailsLogger=le,e.getDeviceInfo=re}(r);const a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));let l;const c=new Uint8Array(16);var d,u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _(e,t,i){if(u.randomUUID&&!t&&!e)return u.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!l){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");l=crypto.getRandomValues.bind(crypto)}return l(c)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase()}(n)}!function(e){e.GET="GET",e.POST="POST"}(d||(d={}));const p=e=>i(void 0,[e],void 0,(function*({url:e,method:t=d.GET,token:i="",body:n}){const o={method:t,headers:Object.assign(Object.assign(Object.assign({},y()),m(i)),L())};t===d.POST&&(o.body=JSON.stringify(n||{}));const s=yield fetch(e,o),r=yield s.json();if([401,403].includes(s.status))throw new E(e,t);if(429===s.status)throw new I(e,t);if(!s.ok)throw new h(e,t);return{ok:s.ok,req:Object.assign({url:e},o),res:r}}));class E extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_UNAUTHORIZED,{description:`[${t}] ${e} unauthorized`})}}let h=class extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_UNSUCCESSFUL,{description:`[${t}] ${e} unsuccessful`})}},I=class extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_TOO_MANY_REQUESTS,{description:`[${t}] ${e} too many requests`})}};class v extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_TOO_MANY_REQUESTS,{description:`[${t}] ${e} max poll attempts exceeded.`})}}const m=e=>({authorization:`Bearer ${e}`}),y=()=>({"x-idempotency-key":_()}),L=()=>{const e={version:"5.25.2",type:"web-sdk"};return{"x-client-version":e.version,"x-client-type":e.type}},A=(t,n)=>i(void 0,void 0,void 0,(function*(){var i,o;if(null==t?void 0:t.onPaymentButtonClicked)try{const o=yield t.onPaymentButtonClicked(n);if(!o){const n=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CALLBACK_FAILED,{description:"Callback passed to onPaymentButtonClicked resolved to false"});return null===(i=null==t?void 0:t.onAuthorizeFailed)||void 0===i||i.call(t,{code:e.AuthorizationFailureReasons.VALIDATION_FAILED,message:n.message}),o}}catch(i){const n=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CALLBACK_FAILED,{description:"Callback passed to onPaymentButtonClicked threw an error",cause:i});return null===(o=t.onAuthorizeFailed)||void 0===o||o.call(t,{code:e.AuthorizationFailureReasons.VALIDATION_FAILED,message:n.message}),!1}return!0}));var f,O,R,T;e.PAYMENT_METHOD_CODES=void 0,(f=e.PAYMENT_METHOD_CODES||(e.PAYMENT_METHOD_CODES={})).CARD="card",f.GOOGLE_PAY="googlePay",f.PAYPAL="payPal",f.APPLE_PAY="applePay",f.GENERIC_REDIRECT="genericRedirect",function(e){e.ENABLED="enabled",e.CREATED="created",e.DELETED="deleted",e.DISABLED="disabled",e.INVALID="invalid",e.TRANSIENT="transient"}(O||(O={}));class C{static get response(){if(!C._response){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND);throw r.PayrailsLogger.error(e.message,{error:e}),e}return C._response}static setResponse(e){return C._response=e,C}static get lookup(){return C.response.initialResults.find((({body:{name:e}})=>"lookup"===e))}static get holderReference(){return C.response.holderReference}static get savedCreditCards(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.CARD)}static get savedPaypalAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.PAYPAL).filter((({status:e})=>e===O.ENABLED))}static get savedGooglePayAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.GOOGLE_PAY).filter((({status:e})=>e===O.ENABLED))}static get savedApplePayAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.APPLE_PAY)}static get paypalConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.PAYPAL));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t.config||{}}static get googlePayConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.GOOGLE_PAY));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t?[t.config]:[]}static isPaymentMethodAvailable(e){return C.availablePaymentMethods.some((({paymentMethodCode:t})=>t===e))}static get applePayConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.APPLE_PAY));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t.config.parameters}static get url(){return C.response.links.self}static get meta(){return C.response.meta}static get availablePaymentMethods(){var e;return(null===(e=C.lookup)||void 0===e?void 0:e.body.data.paymentCompositionOptions)||[]}static get authorizeLink(){var e;return null===(e=C.lookup)||void 0===e?void 0:e.body.links.authorize.href}static get createSessionLink(){var e;return null===(e=C.response.links.startPaymentSession)||void 0===e?void 0:e.href}static get storedPaymentInstruments(){return C.availablePaymentMethods.flatMap((e=>e.paymentInstruments||[])).filter((({paymentMethod:t,status:i})=>i===O.ENABLED||![e.PAYMENT_METHOD_CODES.GOOGLE_PAY,e.PAYMENT_METHOD_CODES.PAYPAL].includes(t)))}static get storedDropinInstruments(){return C.storedPaymentInstruments.filter((({paymentMethod:t})=>![e.PAYMENT_METHOD_CODES.GOOGLE_PAY,e.PAYMENT_METHOD_CODES.APPLE_PAY].includes(t)))}static getFullPaymentMethodConfig(e){return C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e))}static isAddressSelectorEnabled(e){var t,i;return!!C._response&&(null===(i=null===(t=C.getFullPaymentMethodConfig(e))||void 0===t?void 0:t.clientConfig)||void 0===i?void 0:i.supportsBillingInfo)}static isPaymentInstallmentsEnabled(e){var t;if(C._response){const i=this.getFullPaymentMethodConfig(e);return i&&(null===(t=this.getPaymentMethodConfig(i).clientConfig)||void 0===t?void 0:t.supportsInstallments)}return!1}static getPaymentInstallmentOptions(e){var t;const i=this.getFullPaymentMethodConfig(e);return i&&(null===(t=this.getPaymentMethodConfig(i).clientConfig)||void 0===t?void 0:t.installments)||{}}static getStoredInstrumentForPaymentMethod(e){var t;return(null===(t=this.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e)))||void 0===t?void 0:t.paymentInstruments)||[]}static getPaymentMethodForStoredInstrument(e){const t=this.availablePaymentMethods.find((({paymentInstruments:t})=>null==t?void 0:t.some((({id:t})=>t===e.id))));return t&&this.getPaymentMethodConfig(t)}static getPaymentMethodConfig(e){return t(e,["paymentInstruments"])}}!function(e){e.REDIRECT="redirect",e.DIRECT="direct"}(R||(R={})),e.INTEGRATION_TYPE=void 0,(T=e.INTEGRATION_TYPE||(e.INTEGRATION_TYPE={})).API="api",T.HPP="hpp";class g{constructor(){this._config=void 0}static getInstance(){return g._instance||(g._instance=new g),g._instance}set config(e){try{g.getInstance()._config=e}catch(e){r.PayrailsLogger.error("Error parsing SDK Configuration",{error:e})}}get config(){return g.getInstance()._config||r.PayrailsLogger.error("SDK Configuration not set"),g.getInstance()._config||{}}}const N=()=>g.getInstance().config,S=e=>{try{const t=JSON.parse(function(e){const t=window.atob(e);return decodeURIComponent(Array.prototype.map.call(t,(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))}(e.data));g.getInstance().config=t,t.execution&&C.setResponse(t.execution)}catch(e){r.PayrailsLogger.error("Error parsing SDK Configuration",{error:e})}},P={success:"https://assets.payrails.io/html/payrails-success.html",error:"https://assets.payrails.io/html/payrails-error.html",cancel:"https://assets.payrails.io/html/payrails-cancel.html",pending:"https://assets.payrails.io/html/payrails-pending.html"};class b{static getInstance(){return this.instance||(this.instance=new b),this.instance}constructor(e=""){this.lastActionUpdateTime=e,b.instance=this}}class D{constructor(e=P,t=680,i=60,n=2e3,o=5,s=b.getInstance()){this.returnLinks=e,this.POLL_INTERVAL=t,this.MAX_POLL_ATTEMPTS=i,this.POLL_INITIAL_DELAY=n,this.POLL_ERROR_COUNT_MULTIPLIER=o,this.paymentStatus=s}pay(e){return i(this,void 0,void 0,(function*(){try{const t=(yield this.authorize(e)).res.links.execution;return yield this.pollForAuthorizationResult(t)}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR,{cause:e});throw r.PayrailsLogger.error(t.message,{error:t}),e}}))}confirm(e){return i(this,arguments,void 0,(function*(e,t={}){try{const i=yield p({url:e,method:d.POST,token:N().token,body:{data:t}}),n=yield this.pollForAuthorizationResult(i.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(i.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}}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR,{cause:e});throw r.PayrailsLogger.error(t.message,{error:t}),e}}))}getExecution(e,t){return i(this,arguments,void 0,(function*(e,t,i=0){if(i>this.MAX_POLL_ATTEMPTS)throw new v(e,d.GET);0===i&&t?yield this.wait(this.POLL_INITIAL_DELAY):yield this.wait(this.POLL_INTERVAL);try{const n=yield p({url:e,token:N().token});return t&&!n.res.status.find((({time:e})=>new Date(e)>new Date(t)))?(yield this.wait(this.POLL_INTERVAL),this.getExecution(e,t,i+1)):n}catch(n){if(n instanceof h)return yield this.wait(this.POLL_INTERVAL),this.getExecution(e,t,i+this.POLL_ERROR_COUNT_MULTIPLIER);if(n instanceof I)return yield this.wait(this.POLL_INTERVAL*i),this.getExecution(e,t,i+1);throw n}}))}createApplePaySession(e){return i(this,void 0,void 0,(function*(){return p({url:e.requestUrl,method:d.POST,token:N().token,body:{integrationType:"api",paymentMethodCode:"applePay",amount:N().amount,meta:{sessionURL:e.sessionUrl,clientContext:{host:e.clientDomain||window.location.host}}}})}))}authorize(e){return i(this,void 0,void 0,(function*(){if(!C.authorizeLink||!N().amount){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND,{description:"SDK was not initialized with workflow execution"});throw r.PayrailsLogger.error(e.message,{error:e}),e}const{success:t=P.success,error:i=P.error,cancel:n=P.cancel,pending:o=P.pending}=this.returnLinks,a=this.attachRiskIdToPaymentComposition({amount:N().amount,paymentComposition:e,returnInfo:{success:t,cancel:n,error:i,pending:o}});return p({url:C.authorizeLink,method:d.POST,token:N().token,body:a})}))}getFirstNonFraudNetId(e){const t=Object.keys(e||{}).find((e=>"fraudNet"!==e));return t?e[t]:null}attachRiskIdToPaymentComposition(t){var i,n,o,s,r;let a;return a=t.paymentComposition[0].paymentMethodCode===e.PAYMENT_METHOD_CODES.PAYPAL&&(null===(n=null===(i=window.PayrailsData)||void 0===i?void 0:i.riskIds)||void 0===n?void 0:n.fraudNet)?null===(s=null===(o=window.PayrailsData)||void 0===o?void 0:o.riskIds)||void 0===s?void 0:s.fraudNet:this.getFirstNonFraudNetId(null===(r=window.PayrailsData)||void 0===r?void 0:r.riskIds)||"",a?Object.assign(Object.assign({},t),{meta:{risk:{sessionId:a}}}):t}wait(e){return i(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}pollForAuthorizationResult(e){return i(this,arguments,void 0,(function*(e,t=0,i=["authorizePending","authorizeSuccessful","authorizeFailed"]){const n=(yield this.getExecution(e,this.paymentStatus.lastActionUpdateTime,t)).res,o=n.status,a=o.find((({code:e})=>"authorizeRequested"===e));if(!a&&t<10)return yield new Promise((e=>setTimeout(e,this.POLL_INTERVAL))),this.pollForAuthorizationResult(e,t+1);if(!a){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED);throw r.PayrailsLogger.error(e.message,{error:e}),e}const l=o.find((({code:e,time:t})=>"confirmRequested"===e&&new Date(t)>new Date(a.time))),c=l?l.time:a.time,d=o.filter((({code:e,time:t})=>i.includes(e)&&new Date(t)>new Date(c))).sort(((e,t)=>new Date(t.time).getTime()-new Date(e.time).getTime()))[0];return d?(this.paymentStatus.lastActionUpdateTime=d.time,{finalState:d,response:n}):this.pollForAuthorizationResult(e,t+1,i)}))}}class M{constructor(e,t,i,n=w.THREE_DS){this.link=e,this.paymentExecutor=t,this.options=i,this.type=n,this.THREE_DS_SIZES=[[250,400],[390,400],[500,600],[600,400]],this.internalPopupBackground=null,this.SCREEN_WIDTH=window.innerWidth,this.SCREEN_HEIGHT=window.innerHeight}get iframeSize(){return this.type===w.THREE_DS?this.THREE_DS_SIZES.reduce(((e,t)=>this.SCREEN_WIDTH>t[0]?t:e),[250,400]):[this.SCREEN_WIDTH-50,this.SCREEN_HEIGHT-50]}get popupBackground(){if(this.internalPopupBackground)return this.internalPopupBackground;{const e=document.createElement("div");e.setAttribute("id","payrails-popup-background"),e.appendChild(this.popup),this.internalPopupBackground=e}return this.internalPopupBackground}get popup(){const e=document.createElement("div");return e.setAttribute("id","payrails-popup"),e.setAttribute("width",this.iframeSize[0].toString()),e.setAttribute("height",this.iframeSize[1].toString()),e.appendChild(this.iframe),e.style.width=`${this.iframeSize[0]+4}px`,e.style.height=`${this.iframeSize[1]+4}px`,e}get iframe(){const e=document.createElement("iframe");return e.setAttribute("id","payrails-frame"),e.setAttribute("src",this.link),e.setAttribute("width",this.iframeSize[0].toString()),e.setAttribute("height",this.iframeSize[1].toString()),e}handleMessages(){const t=n=>i(this,void 0,void 0,(function*(){var i,o,s,r,a,l,c;if(n.data&&'{"type":"3DS-challenge-completed"}'===n.data){switch(window.removeEventListener("message",t),null===(i=(yield this.paymentExecutor.pollForAuthorizationResult(C.url)).finalState)||void 0===i?void 0:i.code){case"authorizeSuccessful":null===(s=null===(o=this.options.events)||void 0===o?void 0:o.onAuthorizeSuccess)||void 0===s||s.call(o);break;case"authorizePending":null===(a=null===(r=this.options.events)||void 0===r?void 0:r.onAuthorizePending)||void 0===a||a.call(r);break;default:null===(c=null===(l=this.options.events)||void 0===l?void 0:l.onAuthorizeFailed)||void 0===c||c.call(l,{code:e.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed after 3DS challenge."})}this.unmount()}}));window.addEventListener("message",t)}mount(){var e;this.popup.remove(),null===(e=document.querySelector("body"))||void 0===e||e.appendChild(this.popupBackground),this.handleMessages()}unmount(){this.popupBackground.remove(),this.internalPopupBackground=null}}var w;!function(e){e[e.THREE_DS=0]="THREE_DS",e[e.GENERIC_REDIRECT=1]="GENERIC_REDIRECT"}(w||(w={}));class k{constructor(e,t){this.options=e,this.paymentExecutor=t}handle3ds(e){var t,i,n;try{null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onThreeDSecureChallenge)||void 0===i||i.call(t)}catch(e){}const o=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.links["3ds"];o&&(this.options.redirectFor3DS?window.location.assign(o):new M(o,this.paymentExecutor,this.options).mount())}}var Y,U={};!function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var i,n,o,s,r,a,l,c,d,u,_,p,E,h,I={},v={},m={},y={},L={},A={},f={},O={},R={},T={},C={},g={},N={};function S(){if(_)return N;_=1,Object.defineProperty(N,"__esModule",{value:!0}),N.Framebus=void 0;var e=B(),t="undefined"!=typeof window&&window.Promise,i=function(){function i(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return i.setPromise=function(e){i.Promise=e},i.target=function(e){return new i(e)},i.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},i.prototype.include=function(t){return null!=t&&null!=t.Window&&t.constructor===t.Window&&(e.childWindows.push(t),!0)},i.prototype.target=function(e){return i.target(e)},i.prototype.emit=function(t,i,n){if(this.isDestroyed)return!1;var o=this.origin;if(t=this.namespaceEvent(t),(0,e.isntString)(t))return!1;if((0,e.isntString)(o))return!1;"function"==typeof i&&(n=i,i=void 0);var s=(0,e.packagePayload)(t,o,i,n);return!!s&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach((function(t){(0,e.sendMessage)(t,s,o)})):(0,e.broadcast)(s,{origin:o,frame:window.top||window.self}),!0)},i.prototype.emitAsPromise=function(e,t){var n=this;return new i.Promise((function(i,o){n.emit(e,t,(function(e){i(e)}))||o(new Error('Listener not added for "'.concat(e,'"')))}))},i.prototype.on=function(t,i){if(this.isDestroyed)return!1;var n=this,o=this.origin,s=i;return t=this.namespaceEvent(t),!(0,e.subscriptionArgsInvalid)(t,s,o)&&(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,e)}),this.listeners.push({eventName:t,handler:s,originalHandler:i}),e.subscribers[o]=e.subscribers[o]||{},e.subscribers[o][t]=e.subscribers[o][t]||[],e.subscribers[o][t].push(s),!0)},i.prototype.off=function(t,i){var n=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var o=0;o<this.listeners.length;o++){var s=this.listeners[o];s.originalHandler===i&&(n=s.handler)}t=this.namespaceEvent(t);var r=this.origin;if((0,e.subscriptionArgsInvalid)(t,n,r))return!1;var a=e.subscribers[r]&&e.subscribers[r][t];if(!a)return!1;for(o=0;o<a.length;o++)if(a[o]===n)return a.splice(o,1),!0;return!1},i.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},i.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},i.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map((function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e})).filter((function(e){return e})):[]},i.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find((function(t){return t===e}));return Boolean(t)},i.prototype.checkOrigin=function(e){var t,i=document.createElement("a");return i.href=location.href,t="https:"===i.protocol?i.host.replace(/:443$/,""):"http:"===i.protocol?i.host.replace(/:80$/,""):i.host,i.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},i.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},i.Promise=t,i}();return N.Framebus=i,N}function P(){if(h)return g;h=1;var e=g&&g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g,"__esModule",{value:!0}),g.subscribeReplier=void 0;var t=S(),i=e((E||(E=1,p=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)}))}),p));return g.subscribeReplier=function(e,n){var o=(0,i.default)();return t.Framebus.target({origin:n}).on(o,(function i(s,r){e(s,r),t.Framebus.target({origin:n}).off(o,i)})),o},g}var b,D,M,w,k,Y,U={},x={},F={};function B(){return w||(w=1,e=I,t=I&&I.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,o)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),_=I&&I.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||t(i,e,n)},Object.defineProperty(e,"__esModule",{value:!0}),_(function(){if(i)return v;i=1,Object.defineProperty(v,"__esModule",{value:!0}),v.detach=v.attach=void 0;var e=B(),t=!1;return v.attach=function(){t||"undefined"==typeof window||(t=!0,window.addEventListener("message",e.onMessage,!1))},v.detach=function(){t=!1,window.removeEventListener("message",e.onMessage,!1)},v}(),e),_(function(){if(n)return m;n=1,Object.defineProperty(m,"__esModule",{value:!0}),m.broadcastToChildWindows=void 0;var e=B();return m.broadcastToChildWindows=function(t,i,n){for(var o=e.childWindows.length-1;o>=0;o--){var s=e.childWindows[o];s.closed?e.childWindows.splice(o,1):n!==s&&(0,e.broadcast)(t,{origin:i,frame:s.top})}},m}(),e),_(function(){if(o)return y;o=1,Object.defineProperty(y,"__esModule",{value:!0}),y.broadcast=void 0;var e=B();return y.broadcast=function t(i,n){var o,s=0,r=n.origin,a=n.frame;try{for(a.postMessage(i,r),(0,e.hasOpener)(a)&&a.opener.top!==window.top&&t(i,{origin:r,frame:a.opener.top});o=a.frames[s];)t(i,{origin:r,frame:o}),s++}catch(e){}},y}(),e),_((s||(s=1,Object.defineProperty(L,"__esModule",{value:!0}),L.subscribers=L.childWindows=L.prefix=void 0,L.prefix="/*framebus*/",L.childWindows=[],L.subscribers={}),L),e),_(function(){if(r)return A;r=1,Object.defineProperty(A,"__esModule",{value:!0}),A.dispatch=void 0;var e=B();return A.dispatch=function(t,i,n,o,s){if(e.subscribers[t]&&e.subscribers[t][i]){var r=[];n&&r.push(n),o&&r.push(o);for(var a=0;a<e.subscribers[t][i].length;a++)e.subscribers[t][i][a].apply(s,r)}},A}(),e),_((a||(a=1,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}),f),e),_((l||(l=1,Object.defineProperty(O,"__esModule",{value:!0}),O.isntString=void 0,O.isntString=function(e){return"string"!=typeof e}),O),e),_(function(){if(c)return R;c=1,Object.defineProperty(R,"__esModule",{value:!0}),R.onMessage=void 0;var e=B();return R.onMessage=function(t){if(!(0,e.isntString)(t.data)){var i=(0,e.unpackPayload)(t);if(i){var n=i.eventData,o=i.reply;(0,e.dispatch)("*",i.event,n,o,t),(0,e.dispatch)(t.origin,i.event,n,o,t),(0,e.broadcastToChildWindows)(t.data,i.origin,t.source)}}},R}(),e),_(function(){if(d)return T;d=1,Object.defineProperty(T,"__esModule",{value:!0}),T.packagePayload=void 0;var e=B();return T.packagePayload=function(t,i,n,o){var s,r={event:t,origin:i};"function"==typeof o&&(r.reply=(0,e.subscribeReplier)(o,i)),r.eventData=n;try{s=e.prefix+JSON.stringify(r)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return s},T}(),e),_((u||(u=1,Object.defineProperty(C,"__esModule",{value:!0}),C.sendMessage=void 0,C.sendMessage=function(e,t,i){try{e.postMessage(t,i)}catch(e){}}),C),e),_(P(),e),_(function(){if(b)return U;b=1,Object.defineProperty(U,"__esModule",{value:!0}),U.subscriptionArgsInvalid=void 0;var e=B();return U.subscriptionArgsInvalid=function(t,i,n){return!!(0,e.isntString)(t)||"function"!=typeof i||(0,e.isntString)(n)},U}(),e),_((D||(D=1,Object.defineProperty(x,"__esModule",{value:!0})),x),e),_(function(){if(M)return F;M=1,Object.defineProperty(F,"__esModule",{value:!0}),F.unpackPayload=void 0;var e=B();return F.unpackPayload=function(t){var i;if(t.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{i=JSON.parse(t.data.slice(e.prefix.length))}catch(e){return!1}if(i.reply){var n=t.origin,o=t.source,s=i.reply;i.reply=function(t){if(o){var i=(0,e.packagePayload)(s,n,t);i&&o.postMessage(i,n)}}}return i},F}(),e)),I;var e,t,_}const j=t(function(){if(Y)return k;Y=1;var e=B(),t=S();return(0,e.attach)(),k=t.Framebus}());class V{constructor(e){this.origin=null,this.listeners=[],this.bus=new j(e)}static getInstance(){return V.instance||(V.instance=new V),V.instance}on(e,t){return this.bus.on(e,t)}off(e,t){return this.bus.off(e,t)}emit(e,t,i=void 0){return this.bus.emit(e,t,i)}target(e){return this.bus.target(e)}}e.IframeEventBus=V,e.getEventBus=()=>V.getInstance()}(U);class x{constructor(e,{id:t="",className:i=""}={}){this.subElements=[],this.eventBus=U.getEventBus();const n=document.createElement(e);t&&(this.id=t,n.setAttribute("id",t)),i&&(Array.isArray(i)?n.setAttribute("class",function(...e){return e.filter(Boolean).join(" ")}(...i)):n.setAttribute("class",i)),this.element=n}get parentElement(){return this.element.parentElement}get selector(){if(!this.id)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_UI_ELEMENT_MISSING);return`#${this.id}`}mount(e){const t=document.querySelector(e);if(!t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING,{description:`Element with selector "${e}" not found in in the DOM`});this.clean(),t.appendChild(this.element),this.subElements.forEach((e=>{if(!this.id)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR);e.mount(this.selector)}))}clean(){var e;null===(e=document.getElementById(this.element.id))||void 0===e||e.remove()}unmount(){var e;this.subElements.forEach((e=>e.unmount())),null===(e=this.parentElement)||void 0===e||e.removeChild(this.element)}}class F extends x{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){var i;super("button",{id:"payrails-card-payment-button"}),this.options=e,this.returnInfo=t,this.selectedInstrument=null,this.paymentInstallmentElement=null,this.disabledByDefault=!0,this.element.innerText=(null===(i=null==e?void 0:e.translations)||void 0===i?void 0:i.label)||"Pay",this.disabledByDefault="boolean"!=typeof e.disabledByDefault||e.disabledByDefault,this.setDisabled(this.disabledByDefault),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 D(this.returnInfo)}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}setPaymentInstallmentsDropdown(e){this.paymentInstallmentElement=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(){return i(this,void 0,void 0,(function*(){var t,i,n,o,a,l,c,d,u,_,p,h,I;let v;if(this.setDisabled(!0),this.triggerLoading(!0),!(null===(t=this.selectedInstrument)||void 0===t?void 0:t.id)&&(v=null===(n=yield null===(i=this.cardForm)||void 0===i?void 0:i.validate())||void 0===n?void 0:n.isValid,!v))return this.setDisabled(!1),void this.triggerLoading(!1);if(v=yield A(this.options.events,{bin:this.bin||""}),!v)return this.setDisabled(!1),void this.triggerLoading(!1);try{let t=[{paymentMethodCode:e.PAYMENT_METHOD_CODES.CARD,integrationType:"api",amount:N().amount,storeInstrument:!1}];if(null===(o=this.selectedInstrument)||void 0===o?void 0:o.id)t[0].paymentInstrumentId=null===(a=this.selectedInstrument)||void 0===a?void 0:a.id,t[0].paymentMethodCode=null===(l=this.selectedInstrument)||void 0===l?void 0:l.paymentMethod,this.paymentInstallmentElement&&(null===(c=this.paymentInstallmentElement)||void 0===c?void 0:c.selectedInstallmentValue)&&(t[0].installments={count:null===(d=this.paymentInstallmentElement)||void 0===d?void 0:d.selectedInstallmentValue});else{if(!this.cardForm){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CARD_FORM_MISSING);throw r.PayrailsLogger.error(e.message,{error:e}),e}t=yield this.constructEncryptedPayment(t)}const i=yield this.paymentExecutor.pay(t);this.handleAuthorizationResult(i)}catch(t){let i=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHENTICATION_ERROR,{cause:t});t instanceof E||[401,403].includes(null===(u=null==t?void 0:t.error)||void 0===u?void 0:u.code)?(null===(p=null===(_=this.options.events)||void 0===_?void 0:_.onPaymentSessionExpired)||void 0===p||p.call(_),i.message="API token is not valid or expired.",r.PayrailsLogger.error(i.message,{error:i}),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:i.message})):t.toString().includes("Invalid token")?(null===(I=null===(h=this.options.events)||void 0===h?void 0:h.onPaymentSessionExpired)||void 0===I||I.call(h),i.message="Vault token is not valid or expired.",r.PayrailsLogger.error(i.message,{error:i})):i=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_UNKNOWN_ERROR,{cause:t}),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:i.message})}}))}constructEncryptedPayment(e){return i(this,void 0,void 0,(function*(){if(!this.cardForm)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CARD_FORM_MISSING);const{cardData:t,storeInstrument:i,enrollInstrumentToNetworkOffers:n,selectedInstallment:o,billingInfo:r}=yield this.cardForm.collectValues();return e[0].paymentInstrumentData=Object.assign(Object.assign({},t),{billingAddress:r}),e[0].storeInstrument=i,e[0].enrollInstrumentToNetworkOffers=n,o&&(e[0].installments={count:o}),e}))}handleAuthorizationResult(t){var i,n,o,r,a,l,c;let d;switch(null===(i=null==t?void 0:t.finalState)||void 0===i?void 0:i.code){case"authorizeSuccessful":this.triggerLoading(!1),null===(o=null===(n=this.options.events)||void 0===n?void 0:n.onAuthorizeSuccess)||void 0===o||o.call(n);break;case"authorizePending":"3ds"===(null===(r=null==t?void 0:t.response)||void 0===r?void 0:r.actionRequired)?new k(Object.assign(Object.assign({},this.options),{events:Object.assign(Object.assign({},this.options.events),{onAuthorizeFailed:e=>{this.onAuthorizationFailed(e)}})}),this.paymentExecutor).handle3ds(t):(null===(a=null==t?void 0:t.response)||void 0===a?void 0:a.actionRequired)||(this.triggerLoading(!1),null===(c=null===(l=this.options.events)||void 0===l?void 0:l.onAuthorizePending)||void 0===c||c.call(l));break;default:d=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHORIZATION_ERROR),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:d.message})}}}e.AuthorizationFailureReasons=void 0,(Y=e.AuthorizationFailureReasons||(e.AuthorizationFailureReasons={})).VALIDATION_FAILED="VALIDATION_FAILED",Y.AUTHORIZATION_ERROR="AUTHORIZATION_ERROR",Y.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",Y.UNKNOWN_ERROR="UNKNOWN_ERROR";const B={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.",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.",CREATED_ELEMENT:"%s1 - Created %s2 element.",ELEMENT_MOUNTED:"%s1 - %s2 Element mounted.",COLLECT_SUBMIT_SUCCESS:"%s1 - Data has been collected successfully.",INSERT_DATA_SUCCESS:"%s1 - Data has been inserted 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",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."},j={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_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",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.",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.',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",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."},V={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."},G="collect_controller",X="element",z="ERROR",H={CHANGE:"CHANGE",READY:"READY",FOCUS:"FOCUS",BLUR:"BLUR",ESCAPE:"ESCAPE",CLICK:"CLICK",ERROR:"ERROR",SUCCESS:"SUCCESS",SUBMIT:"SUBMIT",CREATED:"CREATED",MOUNTED:"MOUNTED",HEIGHT:"HEIGHT"},W="FRAME_READY",q="TOKENIZATION_REQUEST",$="INPUT_EVENT",K="DESTROY FRAME",J="SET_VALUE",Z="GET_BEARER_TOKEN",Q="COLLECT_ELEMENT_SET_ERROR",ee="COMPOSABLE_UPDATE_OPTIONS",te="VALIDATE_ELEMENT",ie="COMPOSABLE_CONTAINER_MOUNTED",ne="COLLECT_CONTAINER_MOUNTED";var oe,se;!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"}(oe||(oe={})),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.CVV="CVV",e.EXPIRY="EXPIRY",e.ERROR="ERROR",e.UNKNOWN="UNKNOWN"}(se||(se={}));const re={[se.AMEX]:["XXXX XXXXXX XXXXX",{X:"[0-9]"}],[se.VISA]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[se.MASTERCARD]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[se.DISCOVER]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.DINERS_CLUB]:["XXXX XXXXXX XXXXXX",{X:"[0-9]"}],[se.JCB]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.MAESTRO]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.UNIONPAY]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.HIPERCARD]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.DEFAULT]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.UNKNOWN]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}]},ae={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},[oe.CARDHOLDER_NAME]:{name:"cardHolderName",attributes:{type:"text",autocomplete:"cc-name"},sensitive:!0,regex:/^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/},[oe.CARD_NUMBER]:{name:"CARD_NUMBER",attributes:{type:"text",autocomplete:"cc-number",inputmode:"numeric"},sensitive:!0,mask:re[se.DEFAULT],regex:/$|^[\s]*?([0-9]{2,6}[ -]?){3,5}[\s]*/},[oe.EXPIRATION_DATE]:{name:"EXPIRATION_DATE",attributes:{type:"text",autocomplete:"cc-exp",inputmode:"numeric"},sensitive:!0},[oe.EXPIRATION_MONTH]:{name:"EXPIRATION_MONTH",attributes:{maxLength:2,type:"text",inputmode:"numeric",autocomplete:"cc-exp-month"},sensitive:!0,mask:["XX",{X:"[0-9]"}]},[oe.EXPIRATION_YEAR]:{name:"EXPIRATION_YEAR",attributes:{type:"text",inputmode:"numeric",autocomplete:"cc-exp-year"},sensitive:!0},[oe.CVV]:{name:"CVV",attributes:{type:"text",inputmode:"numeric",maxLength:3},sensitive:!0,regex:/^$|^[0-9]{3,4}$/},[oe.INPUT_FIELD]:{name:"INPUT_FIELD",sensitive:!0,attributes:{type:"text"}},[oe.PIN]:{name:"PIN",attributes:{type:"text",inputmode:"numeric",maxLength:12,minLength:4},sensitive:!0,regex:/^$|^[0-9]{4,12}$/}},le="XXXX-XXXX-XXXX-XXXX",ce={height:"100%",width:"100%",margin:0,padding:0,border:0,position:"absolute",top:0,left:0,"user-select":"none"},de={position:"absolute",top:0,width:0,height:0,visibility:"hidden",left:"-99999999px","user-select":"none"},ue={width:"100%",height:"100%",border:"0",padding:"0",margin:"0",outline:"none"},_e={WEBPACKAUTOFILL:"-webkit-autofill",BASE:"base",FOCUS:"focus",COMPLETE:"complete",EMPTY:"empty",INVALID:"invalid",GLOBAL:"global",REQUIRED_ASTERISK:"requiredAsterisk"},pe={[se.VISA]:{regex:/^4\d*/,maxCardLength:19,cardLengthRange:[13,16]},[se.MASTERCARD]:{regex:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,maxCardLength:16,cardLengthRange:[16]},[se.AMEX]:{regex:/^3[47]\d*/,maxCardLength:15,cardLengthRange:[15]},[se.DINERS_CLUB]:{regex:/^(36|38|30[0-5])\d*/,maxCardLength:16,cardLengthRange:[14,15,16,17,18,19]},[se.DISCOVER]:{regex:/^(6011|65|64[4-9]|622)\d*/,maxCardLength:16,cardLengthRange:[16,17,18,19]},[se.JCB]:{regex:/^35\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[se.HIPERCARD]:{regex:/^606282\d*/,maxCardLength:19,cardLengthRange:[14,15,16,17,18,19]},[se.UNIONPAY]:{regex:/^62\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[se.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]}};se.DEFAULT,se.CVV,se.EXPIRY,se.ERROR,se.AMEX,se.DINERS_CLUB,se.DISCOVER,se.HIPERCARD,se.JCB,se.MAESTRO,se.MASTERCARD,se.UNIONPAY,se.VISA;const Ee="MM/YY",he=[Ee,"YYYY/MM","YY/MM","MM/YYYY"],Ie=["YY","YYYY"];var ve;!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"}(ve||(ve={})),oe.CARD_NUMBER,oe.EXPIRATION_DATE,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR,oe.CVV,oe.EXPIRATION_DATE,oe.CARD_NUMBER,oe.CARDHOLDER_NAME,oe.INPUT_FIELD,j.INVALID_COLLECT_VALUE,oe.PIN,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR,oe.CVV,oe.EXPIRATION_DATE,oe.CARD_NUMBER,oe.CARDHOLDER_NAME,oe.INPUT_FIELD,j.DEFAULT_REQUIRED_COLLECT_VALUE,oe.PIN,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR;const me=[oe.CARDHOLDER_NAME,oe.EXPIRATION_MONTH,oe.PIN,oe.CVV],ye={X:"[0-9]"};class Le{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(Le.prototype,{constructor:e})}}
|
|
1
|
+
!function(e){"use strict";function t(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}function i(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 n(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 o(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}e.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",e.EXPIRATION_DATE="EXPIRATION_DATE"}(e.ElementType||(e.ElementType={})),"function"==typeof SuppressedError&&SuppressedError;var s={};!function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=(e=>(e.PAYRAILS_CLIENT_CONFIG_MALFORMED="payrails:client:init.config_malformed",e.PAYRAILS_CLIENT_COLLECT_CONTAINER_MOUNT="payrails:client:collectContainer.unmountable",e.PAYRAILS_CLIENT_UI_ELEMENT_MISSING="payrails:client:mount.ui_element_missing",e.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING="payrails:client:mount.parent_element_missing",e.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR="payrails:client:mount.subelements_render_error",e.PAYRAILS_CLIENT_CARD_FORM_MISSING="payrails:client:pay.card_form_missing",e.PAYRAILS_CLIENT_GPAY_LOADING_ERROR="payrails:client:mount.gpay_loading_error",e.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING="payrails:client:init.gpay_config_missing",e.PAYRAILS_CLIENT_APPLEPAY_LOADING_ERROR="payrails:client:mount.applepay_loading_error",e.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING="payrails:client:init.applepay_config_missing",e.PAYRAILS_CLIENT_PAYPAL_LOADING_ERROR="payrails:client:init.paypal_loading_error",e.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING="payrails:client:init.paypal_config_missing",e.PAYRAILS_CLIENT_PAYPAL_ORDER_CREATION="payrails:client:init.paypal_order_creation",e.PAYRAILS_CLIENT_PAYPAL_BUTTON_MOUNT="payrails:client:mount.paypal_button_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR="payrails:client:payment_executor.pay_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR="payrails:client:payment_executor.3ds_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR="payrails:client:payment_executor.confirm_error",e.PAYRAILS_API_UNAUTHORIZED="payrails:api:unauthorized",e.PAYRAILS_API_TOO_MANY_REQUESTS="payrails:api:too_many_requests",e.PAYRAILS_API_UNSUCCESSFUL="payrails:api:unsuccessful",e.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED="payrails:api:authorization_not_requested",e.PAYRAILS_API_AUTHENTICATION_ERROR="payrails:api:request_authentication_error",e.PAYRAILS_API_AUTHORIZATION_ERROR="payrails:api:request_authorization_error",e.PAYRAILS_CLIENT_API_URL_NOT_FOUND="payrails:client:api_url_not_found",e.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND="payrails:client:workflow_execution_not_found",e.PAYRAILS_CARD_FORM_CREATION_FAILED="payrails:card_form:iframe_creation_failed",e.PAYRAILS_CARD_FORM_IFRAME_URL_MISSING="payrails:card_form:iframe_url_missing",e.PAYRAILS_CLIENT_UNKNOWN_ERROR="payrails:client:unknown",e.PAYRAILS_API_UNKNOWN_ERROR="payrails:api:unknown",e.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED="payrails:client:session_refresh_failed",e.PAYRAILS_CLIENT_CALLBACK_FAILED="payrails:client:callback_failed",e.PAYRAILS_API_BIN_LOOKUP_FAILED="payrails:api:bin_lookup_failed",e.PAYRAILS_CARD_FORM_ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE="payrails.card_form.element_not_mounted_in_element_match_rule",e.PAYRAILS_CARD_FORM_REQUIRED_PARAMS_NOT_PROVIDED="payrails.card_form.required_params_not_provided",e.PAYRAILS_CARD_FORM_CLIENT_CONNECTION="payrails.card_form.client_connection",e.PAYRAILS_CARD_FORM_IFRAME_NOT_FOUND="payrails.card_form.iframe_not_found",e.PAYRAILS_CARD_FORM_IFRAME_LOADING_ERROR="payrails.card_form.iframe_loading_error",e.PAYRAILS_CARD_FORM_CSP_ERROR="payrails.card_form.iframe_csp_error",e.PAYRAILS_CARD_FORM_COMPLETE_AND_VALID_INPUTS="payrails.card_form.complete_and_valid_inputs",e.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED="payrails.card_form.collect_element_not_mounted",e.PAYRAILS_CLIENT_GENERIC_REDIRECT_MISSING_REDIRECT_LINK="payrails:client:generic_redirect.missing.redirect_link",e.PAYRAILS_CLIENT_COLLECT_CREATION_FAILED="payrails:client:collect_container.creation.failed",e.PAYRAILS_CLIENT_COLLECT_EMPTY_CONTAINER_TYPE="payrails:client:collect_container.empty_container_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_CONTAINER_TYPE="payrails:client:collect_container.invalid_container_type",e.PAYRAILS_CLIENT_COLLECT_OPERATION_FAILED="payrails:client:collect_container.collect_operation_failed",e.PAYRAILS_CLIENT_VAULT_CONNECTION_ERROR="payrails:client:vault.connection_error",e.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR="payrails:client:vault.network.error",e.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME="payrails:client:collect_container.unique_element_name",e.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS="payrails:client:collect_container.invalid_tokens",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT="payrails:client:collect_container.empty_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER="payrails:client:collect_container.invalid_event_listener",e.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.missing_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.invalid_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_TYPE="payrails:client:collect_container.invalid_event_type",e.PAYRAILS_CLIENT_COLLECT_TABLE_NAME_MISSING="payrails:client:collect_container.table_name_missing",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE="payrails:client:collect_container.empty_table",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_NAME="payrails:client:collect_container.invalid_table_name",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN="payrails:client:collect_container.missing_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COLUMN="payrails:client:collect_container.empty_column",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN="payrails:client:collect_container.invalid_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID="payrails:client:collect_container.empty_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID="payrails:client:collect_container.invalid_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_MISMATCH_ELEMENT_COUNT_LAYOUT_SUM="payrails:client:collect_container.mismatch_element_count_layout_sum",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR="payrails:client:collect_container.invalid_element_selector",e.PAYRAILS_CLIENT_COLLECT_DUPLICATE_ELEMENT="payrails:client:collect_container.duplicate_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_TYPE="payrails:client:collect_container.invalid_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATIONS_TYPE="payrails:client:collect_container.invalid_validations_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_TYPE="payrails:client:collect_container.missing_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_TYPE="payrails:client:collect_container.invalid_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_PARAMS="payrails:client:collect_container.missing_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_PARAMS="payrails:client:collect_container.invalid_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_MISSING_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.missing_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE="payrails:client:collect_container.missing_min_and_max_in_length_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.missing_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.invalid_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.invalid_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS="payrails:client:collect_container.invalid_boolean_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_TYPE="payrails:client:collect_container.missing_element_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_TYPE="payrails:client:collect_container.empty_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_TYPE="payrails:client:collect_container.invalid_upsert_option_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_UPSERT_OPTIONS_ARRAY="payrails:client:collect_container.empty_upsert_options_array",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_OBJECT_TYPE="payrails:client:collect_container.invalid_upsert_option_object_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.missing_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.missing_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.missing_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.invalid_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_LAYOUT_KEY="payrails:client:collect_container.missing_composable_layout_key",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE="payrails:client:collect_container.invalid_composable_layout_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COMPOSABLE_LAYOUT_ARRAY="payrails:client:collect_container.empty_composable_layout_array",e.PAYRAILS_CLIENT_COLLECT_NEGATIVE_VALUES_COMPOSABLE_LAYOUT="payrails:client:collect_container.negative_values_composable_layout",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_FORMAT="payrails:client:collect_container.invalid_input_options_format",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_TRANSLATION="payrails:client:collect_container.invalid_input_options_translation",e.PAYRAILS_CLIENT_COLLECT_RECORDS_KEY_MISSING_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.records_key_missing_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_GET_BEARER_TOKEN_MISSING="payrails:client:collect_container.get_bearer_token_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_MISSING="payrails:client:composable_container_options_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_INVALID="payrails:client:composable_container_options_invalid",e))(t||{});const i={"payrails:client:init.config_malformed":{description:"The provided configuration string is invalid. Please ensure it matches the required format and structure as defined in the documentation",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:unknown":{description:"Unknown Client",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unauthorized":{description:"Unauthorized access to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:too_many_requests":{description:"Too many requests to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unsuccessful":{description:"Unsuccessful request to the Payrails API",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collectContainer.unmountable":{description:"Collect container cannot be mounted",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.ui_element_missing":{description:"Collect container element does not exist",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:pay.card_form_missing":{description:"Trying to collect values from non-existent card form",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.gpay_loading_error":{description:"Google pay can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_loading_error":{description:"Paypal can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_order_creation":{description:"Paypal order creation failed",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.paypal_button_error":{description:"PaypalButtonError occurred",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.parent_element_missing":{description:"Parent element not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.subelements_render_error":{description:"Subelements could not be rendered. Please set id for the element first.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:api_url_not_found":{description:"API URL not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:workflow_execution_not_found":{description:"Workflow execution not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.paypal_config_missing":{description:"Paypal config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:authorization_not_requested":{description:"Authorization was not requested",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.gpay_config_missing":{description:"Google pay config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:mount.applepay_loading_error":{description:"Apple pay can not be initialized",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:init.applepay_config_missing":{description:"Apple pay config not found",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:card_form:iframe_creation_failed":{description:"Error occured while creating an iframe",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:card_form:iframe_url_missing":{description:"Iframe URL is missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:callback_failed":{description:"Callback passed threw an error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:session_refresh_failed":{description:"Error occured while refreshing the session",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:bin_lookup_failed":{description:"Error occured while looking up the BIN",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:request_authentication_error":{description:"Authentication error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:unknown":{description:"Unknown API error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.pay_error":{description:"Error occured while executing a payment",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.confirm_error":{description:"Error occured while confirming a payment",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:api:request_authorization_error":{description:"Authorization error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:payment_executor.3ds_error":{description:"Authorization failed after 3DS challenge.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.element_not_mounted_in_element_match_rule":{description:"Interface: collect element - collect element is not mounted in ValidationRule params at index %s1 in validations array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.required_params_not_provided":{description:"Interface: collect element - Required params are not provided.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.client_connection":{description:"Interface: collect container - client connection not established. client info has not reached iframes",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_not_found":{description:"Interface: collect element - frame not found:",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.complete_and_valid_inputs":{description:"Interface: collect container - Provide complete and valid inputs",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.collect_element_not_mounted":{description:"Interface: composable collect - collect element is not mounted",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_loading_error":{description:"Interface: collect element - Error occured while loading iframe",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails.card_form.iframe_csp_error":{description:"Interface: collect element - Content Security Policy error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:generic_redirect.missing.redirect_link":{description:"[Generic Redirect] Missing redirect link in response"},"payrails:client:collect_container.creation.failed":{description:"Collect container failed to initialize",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_container_type":{description:"client container - Invalid container type. Container object cannot be empty.",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_container_type":{description:"client container - Invalid container type. Invalid container object",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:vault.connection_error":{description:"Vault connection error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:vault.network.error":{description:"Vault network error",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.unique_element_name":{description:"client container - Element name must be unique",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_tokens":{description:"client container - Invalid tokens",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_element":{description:"client container - Element cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_listener":{description:"client container - Invalid event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_event_handler":{description:"client container - Missing handler in event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_handler":{description:"client container - Invalid handler in event listener",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_event_type":{description:"client container - Invalid event type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.table_name_missing":{description:"client container - Table name missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_table":{description:"client container - Table cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_name":{description:"client container - Invalid table name",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_column":{description:"client container - Column missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_column":{description:"client container - Column cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_column":{description:"client container - Invalid column",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_skyflow_id":{description:"client container - Skyflow ID cannot be empty",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_skyflow_id":{description:"client container - Invalid Skyflow ID",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.mismatch_element_count_layout_sum":{description:"client container - Element count does not match layout sum",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_selector":{description:"client container - Invalid element selector",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.duplicate_element":{description:"client container - Duplicate element",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_type":{description:"client container - Invalid element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validations_type":{description:"client container - Invalid validations type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_validation_rule_type":{description:"client container - Missing validation rule type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validation_rule_type":{description:"client container - Invalid validation rule type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_validation_rule_params":{description:"client container - Missing validation rule params",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_validation_rule_params":{description:"client container - Invalid validation rule params",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_regex_in_regex_match_rule":{description:"client container - Missing regex in regex match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_min_and_max_in_length_match_rule":{description:"client container - Missing min and max in length match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_element_in_element_match_rule":{description:"client container - Missing element in element match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_element_in_element_match_rule":{description:"client container - Invalid element in element match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_regex_in_regex_match_rule":{description:"client container - Invalid regex in regex match rule",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_boolean_options":{description:"client container - Invalid boolean options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_element_type":{description:"client container - Missing element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_element_type":{description:"client container - EMPTY element type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_upsert_option_type":{description:"client container - Invalid upsert option type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_upsert_options_array":{description:"client container - Empty upsert options array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_upsert_option_object_type":{description:"client container - Invalid upsert option object type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_table_in_upsert_option":{description:"client container - Missing table in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_in_upsert_option":{description:"client container - Invalid table in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_column_in_upsert_option":{description:"client container - Missing column in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_column_in_upsert_option":{description:"client container - Invalid column in upsert option",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_composable_container_options":{description:"client container - Missing composable container options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_composable_container_options":{description:"client container - Invalid composable container options",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_composable_layout_key":{description:"client container - Missing composable layout key",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_composable_layout_type":{description:"client container - Invalid composable layout type",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_composable_layout_array":{description:"client container - Empty composable layout array",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.negative_values_composable_layout":{description:"client container - Negative values in composable layout",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_input_options_format":{description:"client container - Invalid input options format",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_input_options_translation":{description:"client container - Invalid input options translation",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.records_key_missing_in_additional_fields":{description:"client container - Records key missing in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_records_in_additional_fields":{description:"client container - Invalid records in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_records_in_additional_fields":{description:"client container - Missing records in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_table_in_additional_fields":{description:"client container - Missing table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_table_in_additional_fields":{description:"client container - Empty table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_table_in_additional_fields":{description:"client container - Invalid table in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.missing_fields_in_additional_fields":{description:"client container - Missing fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.empty_fields_in_additional_fields":{description:"client container - Empty fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.invalid_fields_in_additional_fields":{description:"client container - Invalid fields in additional fields",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.get_bearer_token_missing":{description:"client container - Get bearer token missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:composable_container_options_missing":{description:"client container - Composable container options missing",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:composable_container_options_invalid":{description:"client container - Composable container options invalid",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"},"payrails:client:collect_container.collect_operation_failed":{description:"client container - Collect operation failed",docUrl:"https://docs.payrails.com/docs/sdk#initializing-the-sdk"}};var n=(e=>(e.ERROR="payrails:error",e.INFO="payrails:info",e.DEBUG="payrails:debug",e.WARN="payrails:warn",e))(n||{});class o extends Error{constructor(e,t){var n;const{description:s,docUrl:r,cause:a}=null!=t?t:{},{description:l,docUrl:c}=i[e]||{},d=null!=(n=null!=s?s:l)?n:"An unknown error occurred",u=null!=r?r:c;super(d),this.name=e,this.docUrl=u,this.cause=a,this.message=d,Error.captureStackTrace&&Error.captureStackTrace(this,o)}toJSON(){return{name:this.name,message:this.message,docUrl:this.docUrl,stack:this.stack,cause:this.cause}}}e.ERROR_CODES=t,e.PAYRAILS_OBSERVABILITY_EVENTS=n,e.PayrailsError=o}(s);var r={};!function(e){var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,s=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,r=(e,t)=>{for(var r in t||(t={}))n.call(t,r)&&s(e,r,t[r]);if(i)for(var r of i(t))o.call(t,r)&&s(e,r,t[r]);return e};Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var a=(e=>(e.PAYRAILS_CLIENT_CONFIG_MALFORMED="payrails:client:init.config_malformed",e.PAYRAILS_CLIENT_COLLECT_CONTAINER_MOUNT="payrails:client:collectContainer.unmountable",e.PAYRAILS_CLIENT_UI_ELEMENT_MISSING="payrails:client:mount.ui_element_missing",e.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING="payrails:client:mount.parent_element_missing",e.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR="payrails:client:mount.subelements_render_error",e.PAYRAILS_CLIENT_CARD_FORM_MISSING="payrails:client:pay.card_form_missing",e.PAYRAILS_CLIENT_GPAY_LOADING_ERROR="payrails:client:mount.gpay_loading_error",e.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING="payrails:client:init.gpay_config_missing",e.PAYRAILS_CLIENT_APPLEPAY_LOADING_ERROR="payrails:client:mount.applepay_loading_error",e.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING="payrails:client:init.applepay_config_missing",e.PAYRAILS_CLIENT_PAYPAL_LOADING_ERROR="payrails:client:init.paypal_loading_error",e.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING="payrails:client:init.paypal_config_missing",e.PAYRAILS_CLIENT_PAYPAL_ORDER_CREATION="payrails:client:init.paypal_order_creation",e.PAYRAILS_CLIENT_PAYPAL_BUTTON_MOUNT="payrails:client:mount.paypal_button_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR="payrails:client:payment_executor.pay_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR="payrails:client:payment_executor.3ds_error",e.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR="payrails:client:payment_executor.confirm_error",e.PAYRAILS_API_UNAUTHORIZED="payrails:api:unauthorized",e.PAYRAILS_API_TOO_MANY_REQUESTS="payrails:api:too_many_requests",e.PAYRAILS_API_UNSUCCESSFUL="payrails:api:unsuccessful",e.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED="payrails:api:authorization_not_requested",e.PAYRAILS_API_AUTHENTICATION_ERROR="payrails:api:request_authentication_error",e.PAYRAILS_API_AUTHORIZATION_ERROR="payrails:api:request_authorization_error",e.PAYRAILS_CLIENT_API_URL_NOT_FOUND="payrails:client:api_url_not_found",e.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND="payrails:client:workflow_execution_not_found",e.PAYRAILS_CARD_FORM_CREATION_FAILED="payrails:card_form:iframe_creation_failed",e.PAYRAILS_CARD_FORM_IFRAME_URL_MISSING="payrails:card_form:iframe_url_missing",e.PAYRAILS_CLIENT_UNKNOWN_ERROR="payrails:client:unknown",e.PAYRAILS_API_UNKNOWN_ERROR="payrails:api:unknown",e.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED="payrails:client:session_refresh_failed",e.PAYRAILS_CLIENT_CALLBACK_FAILED="payrails:client:callback_failed",e.PAYRAILS_API_BIN_LOOKUP_FAILED="payrails:api:bin_lookup_failed",e.PAYRAILS_CARD_FORM_ELEMENT_NOT_MOUNTED_IN_ELEMENT_MATCH_RULE="payrails.card_form.element_not_mounted_in_element_match_rule",e.PAYRAILS_CARD_FORM_REQUIRED_PARAMS_NOT_PROVIDED="payrails.card_form.required_params_not_provided",e.PAYRAILS_CARD_FORM_CLIENT_CONNECTION="payrails.card_form.client_connection",e.PAYRAILS_CARD_FORM_IFRAME_NOT_FOUND="payrails.card_form.iframe_not_found",e.PAYRAILS_CARD_FORM_IFRAME_LOADING_ERROR="payrails.card_form.iframe_loading_error",e.PAYRAILS_CARD_FORM_CSP_ERROR="payrails.card_form.iframe_csp_error",e.PAYRAILS_CARD_FORM_COMPLETE_AND_VALID_INPUTS="payrails.card_form.complete_and_valid_inputs",e.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED="payrails.card_form.collect_element_not_mounted",e.PAYRAILS_CLIENT_GENERIC_REDIRECT_MISSING_REDIRECT_LINK="payrails:client:generic_redirect.missing.redirect_link",e.PAYRAILS_CLIENT_COLLECT_CREATION_FAILED="payrails:client:collect_container.creation.failed",e.PAYRAILS_CLIENT_COLLECT_EMPTY_CONTAINER_TYPE="payrails:client:collect_container.empty_container_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_CONTAINER_TYPE="payrails:client:collect_container.invalid_container_type",e.PAYRAILS_CLIENT_COLLECT_OPERATION_FAILED="payrails:client:collect_container.collect_operation_failed",e.PAYRAILS_CLIENT_VAULT_CONNECTION_ERROR="payrails:client:vault.connection_error",e.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR="payrails:client:vault.network.error",e.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME="payrails:client:collect_container.unique_element_name",e.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS="payrails:client:collect_container.invalid_tokens",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT="payrails:client:collect_container.empty_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER="payrails:client:collect_container.invalid_event_listener",e.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.missing_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER="payrails:client:collect_container.invalid_event_handler",e.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_TYPE="payrails:client:collect_container.invalid_event_type",e.PAYRAILS_CLIENT_COLLECT_TABLE_NAME_MISSING="payrails:client:collect_container.table_name_missing",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE="payrails:client:collect_container.empty_table",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_NAME="payrails:client:collect_container.invalid_table_name",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN="payrails:client:collect_container.missing_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COLUMN="payrails:client:collect_container.empty_column",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN="payrails:client:collect_container.invalid_column",e.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID="payrails:client:collect_container.empty_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID="payrails:client:collect_container.invalid_skyflow_id",e.PAYRAILS_CLIENT_COLLECT_MISMATCH_ELEMENT_COUNT_LAYOUT_SUM="payrails:client:collect_container.mismatch_element_count_layout_sum",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR="payrails:client:collect_container.invalid_element_selector",e.PAYRAILS_CLIENT_COLLECT_DUPLICATE_ELEMENT="payrails:client:collect_container.duplicate_element",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_TYPE="payrails:client:collect_container.invalid_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATIONS_TYPE="payrails:client:collect_container.invalid_validations_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_TYPE="payrails:client:collect_container.missing_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_TYPE="payrails:client:collect_container.invalid_validation_rule_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_PARAMS="payrails:client:collect_container.missing_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_PARAMS="payrails:client:collect_container.invalid_validation_rule_params",e.PAYRAILS_CLIENT_COLLECT_MISSING_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.missing_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE="payrails:client:collect_container.missing_min_and_max_in_length_match_rule",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.missing_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE="payrails:client:collect_container.invalid_element_in_element_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_REGEX_IN_REGEX_MATCH_RULE="payrails:client:collect_container.invalid_regex_in_regex_match_rule",e.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS="payrails:client:collect_container.invalid_boolean_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_TYPE="payrails:client:collect_container.missing_element_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_TYPE="payrails:client:collect_container.empty_element_type",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_TYPE="payrails:client:collect_container.invalid_upsert_option_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_UPSERT_OPTIONS_ARRAY="payrails:client:collect_container.empty_upsert_options_array",e.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_OBJECT_TYPE="payrails:client:collect_container.invalid_upsert_option_object_type",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.missing_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_table_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.missing_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN_IN_UPSERT_OPTION="payrails:client:collect_container.invalid_column_in_upsert_option",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.missing_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_CONTAINER_OPTIONS="payrails:client:collect_container.invalid_composable_container_options",e.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_LAYOUT_KEY="payrails:client:collect_container.missing_composable_layout_key",e.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE="payrails:client:collect_container.invalid_composable_layout_type",e.PAYRAILS_CLIENT_COLLECT_EMPTY_COMPOSABLE_LAYOUT_ARRAY="payrails:client:collect_container.empty_composable_layout_array",e.PAYRAILS_CLIENT_COLLECT_NEGATIVE_VALUES_COMPOSABLE_LAYOUT="payrails:client:collect_container.negative_values_composable_layout",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_FORMAT="payrails:client:collect_container.invalid_input_options_format",e.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_TRANSLATION="payrails:client:collect_container.invalid_input_options_translation",e.PAYRAILS_CLIENT_COLLECT_RECORDS_KEY_MISSING_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.records_key_missing_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_RECORDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_records_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_table_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_MISSING_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.missing_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_EMPTY_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.empty_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_INVALID_FIELDS_IN_ADDITIONAL_FIELDS="payrails:client:collect_container.invalid_fields_in_additional_fields",e.PAYRAILS_CLIENT_COLLECT_GET_BEARER_TOKEN_MISSING="payrails:client:collect_container.get_bearer_token_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_MISSING="payrails:client:composable_container_options_missing",e.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_INVALID="payrails:client:composable_container_options_invalid",e))(a||{}),l=(e=>(e.ERROR="payrails:error",e.INFO="payrails:info",e.DEBUG="payrails:debug",e.WARN="payrails:warn",e))(l||{});class c{log(e,t){console.group(`%c[${e}] : ${t.mssg}`,function(e){switch(e){case"error":return"color:red";case"info":return"color:blue";case"warn":return"color:orange";default:return"color:black"}}(e)),console.log(t.error),console.log("metadata",t.withMetada),console.log("extra",t.extra),console.groupEnd()}}function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u,_,p,E,h,I,v,m,y,L,A,f,O,R,T={},C={},g={},N={},S={},P={},b={},D={},M={},w={},k={},Y={},U={};function x(){if(A)return U;A=1,Object.defineProperty(U,"__esModule",{value:!0}),U.Framebus=void 0;var e=$(),t="undefined"!=typeof window&&window.Promise,i=function(){function i(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return i.setPromise=function(e){i.Promise=e},i.target=function(e){return new i(e)},i.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},i.prototype.include=function(t){return null!=t&&null!=t.Window&&t.constructor===t.Window&&(e.childWindows.push(t),!0)},i.prototype.target=function(e){return i.target(e)},i.prototype.emit=function(t,i,n){if(this.isDestroyed)return!1;var o=this.origin;if(t=this.namespaceEvent(t),(0,e.isntString)(t))return!1;if((0,e.isntString)(o))return!1;"function"==typeof i&&(n=i,i=void 0);var s=(0,e.packagePayload)(t,o,i,n);return!!s&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach((function(t){(0,e.sendMessage)(t,s,o)})):(0,e.broadcast)(s,{origin:o,frame:window.top||window.self}),!0)},i.prototype.emitAsPromise=function(e,t){var n=this;return new i.Promise((function(i,o){n.emit(e,t,(function(e){i(e)}))||o(new Error('Listener not added for "'.concat(e,'"')))}))},i.prototype.on=function(t,i){if(this.isDestroyed)return!1;var n=this,o=this.origin,s=i;return t=this.namespaceEvent(t),!(0,e.subscriptionArgsInvalid)(t,s,o)&&(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,e)}),this.listeners.push({eventName:t,handler:s,originalHandler:i}),e.subscribers[o]=e.subscribers[o]||{},e.subscribers[o][t]=e.subscribers[o][t]||[],e.subscribers[o][t].push(s),!0)},i.prototype.off=function(t,i){var n=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var o=0;o<this.listeners.length;o++){var s=this.listeners[o];s.originalHandler===i&&(n=s.handler)}t=this.namespaceEvent(t);var r=this.origin;if((0,e.subscriptionArgsInvalid)(t,n,r))return!1;var a=e.subscribers[r]&&e.subscribers[r][t];if(!a)return!1;for(o=0;o<a.length;o++)if(a[o]===n)return a.splice(o,1),!0;return!1},i.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},i.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},i.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map((function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e})).filter((function(e){return e})):[]},i.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find((function(t){return t===e}));return Boolean(t)},i.prototype.checkOrigin=function(e){var t,i=document.createElement("a");return i.href=location.href,t="https:"===i.protocol?i.host.replace(/:443$/,""):"http:"===i.protocol?i.host.replace(/:80$/,""):i.host,i.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},i.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},i.Promise=t,i}();return U.Framebus=i,U}function F(){if(R)return Y;R=1;var e=Y&&Y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Y,"__esModule",{value:!0}),Y.subscribeReplier=void 0;var t=x(),i=e((O||(O=1,f=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)}))}),f));return Y.subscribeReplier=function(e,n){var o=(0,i.default)();return t.Framebus.target({origin:n}).on(o,(function i(s,r){e(s,r),t.Framebus.target({origin:n}).off(o,i)})),o},Y}var B,j,V,G,X,z,H={},W={},q={};function $(){return G||(G=1,e=T,t=T&&T.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,o)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),i=T&&T.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||t(i,e,n)},Object.defineProperty(e,"__esModule",{value:!0}),i(function(){if(u)return C;u=1,Object.defineProperty(C,"__esModule",{value:!0}),C.detach=C.attach=void 0;var e=$(),t=!1;return C.attach=function(){t||"undefined"==typeof window||(t=!0,window.addEventListener("message",e.onMessage,!1))},C.detach=function(){t=!1,window.removeEventListener("message",e.onMessage,!1)},C}(),e),i(function(){if(_)return g;_=1,Object.defineProperty(g,"__esModule",{value:!0}),g.broadcastToChildWindows=void 0;var e=$();return g.broadcastToChildWindows=function(t,i,n){for(var o=e.childWindows.length-1;o>=0;o--){var s=e.childWindows[o];s.closed?e.childWindows.splice(o,1):n!==s&&(0,e.broadcast)(t,{origin:i,frame:s.top})}},g}(),e),i(function(){if(p)return N;p=1,Object.defineProperty(N,"__esModule",{value:!0}),N.broadcast=void 0;var e=$();return N.broadcast=function t(i,n){var o,s=0,r=n.origin,a=n.frame;try{for(a.postMessage(i,r),(0,e.hasOpener)(a)&&a.opener.top!==window.top&&t(i,{origin:r,frame:a.opener.top});o=a.frames[s];)t(i,{origin:r,frame:o}),s++}catch(e){}},N}(),e),i((E||(E=1,Object.defineProperty(S,"__esModule",{value:!0}),S.subscribers=S.childWindows=S.prefix=void 0,S.prefix="/*framebus*/",S.childWindows=[],S.subscribers={}),S),e),i(function(){if(h)return P;h=1,Object.defineProperty(P,"__esModule",{value:!0}),P.dispatch=void 0;var e=$();return P.dispatch=function(t,i,n,o,s){if(e.subscribers[t]&&e.subscribers[t][i]){var r=[];n&&r.push(n),o&&r.push(o);for(var a=0;a<e.subscribers[t][i].length;a++)e.subscribers[t][i][a].apply(s,r)}},P}(),e),i((I||(I=1,Object.defineProperty(b,"__esModule",{value:!0}),b.hasOpener=void 0,b.hasOpener=function(e){return e.top===e&&null!=e.opener&&e.opener!==e&&!0!==e.opener.closed}),b),e),i((v||(v=1,Object.defineProperty(D,"__esModule",{value:!0}),D.isntString=void 0,D.isntString=function(e){return"string"!=typeof e}),D),e),i(function(){if(m)return M;m=1,Object.defineProperty(M,"__esModule",{value:!0}),M.onMessage=void 0;var e=$();return M.onMessage=function(t){if(!(0,e.isntString)(t.data)){var i=(0,e.unpackPayload)(t);if(i){var n=i.eventData,o=i.reply;(0,e.dispatch)("*",i.event,n,o,t),(0,e.dispatch)(t.origin,i.event,n,o,t),(0,e.broadcastToChildWindows)(t.data,i.origin,t.source)}}},M}(),e),i(function(){if(y)return w;y=1,Object.defineProperty(w,"__esModule",{value:!0}),w.packagePayload=void 0;var e=$();return w.packagePayload=function(t,i,n,o){var s,r={event:t,origin:i};"function"==typeof o&&(r.reply=(0,e.subscribeReplier)(o,i)),r.eventData=n;try{s=e.prefix+JSON.stringify(r)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return s},w}(),e),i((L||(L=1,Object.defineProperty(k,"__esModule",{value:!0}),k.sendMessage=void 0,k.sendMessage=function(e,t,i){try{e.postMessage(t,i)}catch(e){}}),k),e),i(F(),e),i(function(){if(B)return H;B=1,Object.defineProperty(H,"__esModule",{value:!0}),H.subscriptionArgsInvalid=void 0;var e=$();return H.subscriptionArgsInvalid=function(t,i,n){return!!(0,e.isntString)(t)||"function"!=typeof i||(0,e.isntString)(n)},H}(),e),i((j||(j=1,Object.defineProperty(W,"__esModule",{value:!0})),W),e),i(function(){if(V)return q;V=1,Object.defineProperty(q,"__esModule",{value:!0}),q.unpackPayload=void 0;var e=$();return q.unpackPayload=function(t){var i;if(t.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{i=JSON.parse(t.data.slice(e.prefix.length))}catch(e){return!1}if(i.reply){var n=t.origin,o=t.source,s=i.reply;i.reply=function(t){if(o){var i=(0,e.packagePayload)(s,n,t);i&&o.postMessage(i,n)}}}return i},q}(),e)),T;var e,t,i}const K=d(function(){if(z)return X;z=1;var e=$(),t=x();return(0,e.attach)(),X=t.Framebus}());class J{constructor(e){this.origin=null,this.listeners=[],this.bus=new K(e)}static getInstance(){return J.instance||(J.instance=new J),J.instance}on(e,t){return this.bus.on(e,t)}off(e,t){return this.bus.off(e,t)}emit(e,t,i=void 0){return this.bus.emit(e,t,i)}target(e){return this.bus.target(e)}}class Z{constructor(){this.bus=J.getInstance()}log(e,t){this.bus.emit(l.ERROR,{level:e,event:t})}}var Q,ee;const te=d(function(){if(ee)return Q;ee=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var i=Object.prototype.toString.call(e);return"[object RegExp]"===i||"[object Date]"===i||function(e){return e.$$typeof===t}(e)}(e)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function n(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function s(e,t){try{return t in e}catch(e){return!1}}function r(e,t,n){var r={};return n.isMergeableObject(e)&&o(e).forEach((function(t){r[t]=i(e[t],n)})),o(t).forEach((function(o){(function(e,t){return s(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(s(e,o)&&n.isMergeableObject(t[o])?r[o]=function(e,t){if(!t.customMerge)return a;var i=t.customMerge(e);return"function"==typeof i?i:a}(o,n)(e[o],t[o],n):r[o]=i(t[o],n))})),r}function a(t,o,s){(s=s||{}).arrayMerge=s.arrayMerge||n,s.isMergeableObject=s.isMergeableObject||e,s.cloneUnlessOtherwiseSpecified=i;var a=Array.isArray(o);return a===Array.isArray(t)?a?s.arrayMerge(t,o,s):r(t,o,s):i(o,s)}return a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return a(e,i,t)}),{})},Q=a}());class ie{constructor(){this.state={}}static getInstance(){return ie.instance||(ie.instance=new ie),ie.instance}getState(e){return this.state[e]}setState(e){this.state=te(this.state,e)}}const ne=ie.getInstance(),oe=()=>window&&window.navigator,se=()=>window&&window.screen,re=()=>({resolution:`${se().width}x${se().height}`,user_agent:oe().userAgent,language:oe().language}),ae=[a.PAYRAILS_API_AUTHORIZATION_ERROR,a.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_3DS_ERROR];class le{constructor(e){this.adapter=[new Z],this.enabled=e.enabled||!0,this.initGlobalState(e),e.logLevel=e.logLevel||"error","debug"===e.logLevel&&this.addAdapter(new c)}static init(e){le.instance=new le(e)}static getLogger(){return le.instance}initGlobalState(e){ne.setState({payrails:e.payrails,sdk:e.sdk})}static setState(e){ne.setState(e)}log(e,t,i){var n;this.enabled&&-1===ae.indexOf(null==(n=null==i?void 0:i.error)?void 0:n.name)&&this.adapter.forEach((n=>{n.log(e,{mssg:t,error:null==i?void 0:i.error,withMetada:r(r({},this.constructMetadata()),null==i?void 0:i.withMetada),extra:null==i?void 0:i.extra})}))}constructMetadata(){return{device:re(),payrails:ne.getState("payrails"),sdk:ne.getState("sdk")}}addAdapter(e){this.adapter.push(e)}static log(e,t){this.getLogger().log("info",e,t)}static debug(e,t){this.getLogger().log("debug",e,t)}static info(e,t){this.getLogger().log("info",e,t)}static warn(e,t){this.getLogger().log("warning",e,t)}static error(e,t){this.getLogger().log("error",e,t)}static exception(e,t){this.error(e,t)}}e.PayrailsLogger=le,e.getDeviceInfo=re}(r);const a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));let l;const c=new Uint8Array(16);var d,u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _(e,t,i){if(u.randomUUID&&!t&&!e)return u.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!l){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");l=crypto.getRandomValues.bind(crypto)}return l(c)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase()}(n)}!function(e){e.GET="GET",e.POST="POST"}(d||(d={}));const p=e=>i(void 0,[e],void 0,(function*({url:e,method:t=d.GET,token:i="",body:n}){const o={method:t,headers:Object.assign(Object.assign(Object.assign({},y()),m(i)),L())};t===d.POST&&(o.body=JSON.stringify(n||{}));const s=yield fetch(e,o),r=yield s.json();if([401,403].includes(s.status))throw new E(e,t);if(429===s.status)throw new I(e,t);if(!s.ok)throw new h(e,t);return{ok:s.ok,req:Object.assign({url:e},o),res:r}}));class E extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_UNAUTHORIZED,{description:`[${t}] ${e} unauthorized`})}}let h=class extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_UNSUCCESSFUL,{description:`[${t}] ${e} unsuccessful`})}},I=class extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_TOO_MANY_REQUESTS,{description:`[${t}] ${e} too many requests`})}};class v extends s.PayrailsError{constructor(e,t){super(s.ERROR_CODES.PAYRAILS_API_TOO_MANY_REQUESTS,{description:`[${t}] ${e} max poll attempts exceeded.`})}}const m=e=>({authorization:`Bearer ${e}`}),y=()=>({"x-idempotency-key":_()}),L=()=>{const e={version:"5.25.3-RC.0",type:"web-sdk"};return{"x-client-version":e.version,"x-client-type":e.type}},A=(t,n)=>i(void 0,void 0,void 0,(function*(){var i,o;if(null==t?void 0:t.onPaymentButtonClicked)try{const o=yield t.onPaymentButtonClicked(n);if(!o){const n=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CALLBACK_FAILED,{description:"Callback passed to onPaymentButtonClicked resolved to false"});return null===(i=null==t?void 0:t.onAuthorizeFailed)||void 0===i||i.call(t,{code:e.AuthorizationFailureReasons.VALIDATION_FAILED,message:n.message}),o}}catch(i){const n=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CALLBACK_FAILED,{description:"Callback passed to onPaymentButtonClicked threw an error",cause:i});return null===(o=t.onAuthorizeFailed)||void 0===o||o.call(t,{code:e.AuthorizationFailureReasons.VALIDATION_FAILED,message:n.message}),!1}return!0}));var f,O,R,T;e.PAYMENT_METHOD_CODES=void 0,(f=e.PAYMENT_METHOD_CODES||(e.PAYMENT_METHOD_CODES={})).CARD="card",f.GOOGLE_PAY="googlePay",f.PAYPAL="payPal",f.APPLE_PAY="applePay",f.GENERIC_REDIRECT="genericRedirect",function(e){e.ENABLED="enabled",e.CREATED="created",e.DELETED="deleted",e.DISABLED="disabled",e.INVALID="invalid",e.TRANSIENT="transient"}(O||(O={}));class C{static get response(){if(!C._response){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND);throw r.PayrailsLogger.error(e.message,{error:e}),e}return C._response}static setResponse(e){return C._response=e,C}static get lookup(){return C.response.initialResults.find((({body:{name:e}})=>"lookup"===e))}static get holderReference(){return C.response.holderReference}static get savedCreditCards(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.CARD)}static get savedPaypalAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.PAYPAL).filter((({status:e})=>e===O.ENABLED))}static get savedGooglePayAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.GOOGLE_PAY).filter((({status:e})=>e===O.ENABLED))}static get savedApplePayAccounts(){return C.getStoredInstrumentForPaymentMethod(e.PAYMENT_METHOD_CODES.APPLE_PAY)}static get paypalConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.PAYPAL));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYPAL_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t.config||{}}static get googlePayConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.GOOGLE_PAY));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_GPAY_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t?[t.config]:[]}static isPaymentMethodAvailable(e){return C.availablePaymentMethods.some((({paymentMethodCode:t})=>t===e))}static get applePayConfig(){const t=C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e.PAYMENT_METHOD_CODES.APPLE_PAY));if(!t){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_APPLEPAY_CONFIG_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{availablePaymentMethods:C.availablePaymentMethods}}),e}return t.config.parameters}static get url(){return C.response.links.self}static get meta(){return C.response.meta}static get availablePaymentMethods(){var e;return(null===(e=C.lookup)||void 0===e?void 0:e.body.data.paymentCompositionOptions)||[]}static get authorizeLink(){var e;return null===(e=C.lookup)||void 0===e?void 0:e.body.links.authorize.href}static get createSessionLink(){var e;return null===(e=C.response.links.startPaymentSession)||void 0===e?void 0:e.href}static get storedPaymentInstruments(){return C.availablePaymentMethods.flatMap((e=>e.paymentInstruments||[])).filter((({paymentMethod:t,status:i})=>i===O.ENABLED||![e.PAYMENT_METHOD_CODES.GOOGLE_PAY,e.PAYMENT_METHOD_CODES.PAYPAL].includes(t)))}static get storedDropinInstruments(){return C.storedPaymentInstruments.filter((({paymentMethod:t})=>![e.PAYMENT_METHOD_CODES.GOOGLE_PAY,e.PAYMENT_METHOD_CODES.APPLE_PAY].includes(t)))}static getFullPaymentMethodConfig(e){return C.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e))}static isAddressSelectorEnabled(e){var t,i;return!!C._response&&(null===(i=null===(t=C.getFullPaymentMethodConfig(e))||void 0===t?void 0:t.clientConfig)||void 0===i?void 0:i.supportsBillingInfo)}static isPaymentInstallmentsEnabled(e){var t;if(C._response){const i=this.getFullPaymentMethodConfig(e);return i&&(null===(t=this.getPaymentMethodConfig(i).clientConfig)||void 0===t?void 0:t.supportsInstallments)}return!1}static getPaymentInstallmentOptions(e){var t;const i=this.getFullPaymentMethodConfig(e);return i&&(null===(t=this.getPaymentMethodConfig(i).clientConfig)||void 0===t?void 0:t.installments)||{}}static getStoredInstrumentForPaymentMethod(e){var t;return(null===(t=this.availablePaymentMethods.find((({paymentMethodCode:t})=>t===e)))||void 0===t?void 0:t.paymentInstruments)||[]}static getPaymentMethodForStoredInstrument(e){const t=this.availablePaymentMethods.find((({paymentInstruments:t})=>null==t?void 0:t.some((({id:t})=>t===e.id))));return t&&this.getPaymentMethodConfig(t)}static getPaymentMethodConfig(e){return t(e,["paymentInstruments"])}}!function(e){e.REDIRECT="redirect",e.DIRECT="direct"}(R||(R={})),e.INTEGRATION_TYPE=void 0,(T=e.INTEGRATION_TYPE||(e.INTEGRATION_TYPE={})).API="api",T.HPP="hpp";class g{constructor(){this._config=void 0}static getInstance(){return g._instance||(g._instance=new g),g._instance}set config(e){try{g.getInstance()._config=e}catch(e){r.PayrailsLogger.error("Error parsing SDK Configuration",{error:e})}}get config(){return g.getInstance()._config||r.PayrailsLogger.error("SDK Configuration not set"),g.getInstance()._config||{}}}const N=()=>g.getInstance().config,S=e=>{try{const t=JSON.parse(function(e){const t=window.atob(e);return decodeURIComponent(Array.prototype.map.call(t,(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))}(e.data));g.getInstance().config=t,t.execution&&C.setResponse(t.execution)}catch(e){r.PayrailsLogger.error("Error parsing SDK Configuration",{error:e})}},P={success:"https://assets.payrails.io/html/payrails-success.html",error:"https://assets.payrails.io/html/payrails-error.html",cancel:"https://assets.payrails.io/html/payrails-cancel.html",pending:"https://assets.payrails.io/html/payrails-pending.html"};class b{static getInstance(){return this.instance||(this.instance=new b),this.instance}constructor(e=""){this.lastActionUpdateTime=e,b.instance=this}}class D{constructor(e=P,t=680,i=60,n=2e3,o=5,s=b.getInstance()){this.returnLinks=e,this.POLL_INTERVAL=t,this.MAX_POLL_ATTEMPTS=i,this.POLL_INITIAL_DELAY=n,this.POLL_ERROR_COUNT_MULTIPLIER=o,this.paymentStatus=s}pay(e){return i(this,void 0,void 0,(function*(){try{const t=(yield this.authorize(e)).res.links.execution;return yield this.pollForAuthorizationResult(t)}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_PAY_ERROR,{cause:e});throw r.PayrailsLogger.error(t.message,{error:t}),e}}))}confirm(e){return i(this,arguments,void 0,(function*(e,t={}){try{const i=yield p({url:e,method:d.POST,token:N().token,body:{data:t}}),n=yield this.pollForAuthorizationResult(i.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(i.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}}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PAYMENT_EXECUTOR_CONFIRM_ERROR,{cause:e});throw r.PayrailsLogger.error(t.message,{error:t}),e}}))}getExecution(e,t){return i(this,arguments,void 0,(function*(e,t,i=0){if(i>this.MAX_POLL_ATTEMPTS)throw new v(e,d.GET);0===i&&t?yield this.wait(this.POLL_INITIAL_DELAY):yield this.wait(this.POLL_INTERVAL);try{const n=yield p({url:e,token:N().token});return t&&!n.res.status.find((({time:e})=>new Date(e)>new Date(t)))?(yield this.wait(this.POLL_INTERVAL),this.getExecution(e,t,i+1)):n}catch(n){if(n instanceof h)return yield this.wait(this.POLL_INTERVAL),this.getExecution(e,t,i+this.POLL_ERROR_COUNT_MULTIPLIER);if(n instanceof I)return yield this.wait(this.POLL_INTERVAL*i),this.getExecution(e,t,i+1);throw n}}))}createApplePaySession(e){return i(this,void 0,void 0,(function*(){return p({url:e.requestUrl,method:d.POST,token:N().token,body:{integrationType:"api",paymentMethodCode:"applePay",amount:N().amount,meta:{sessionURL:e.sessionUrl,clientContext:{host:e.clientDomain||window.location.host}}}})}))}authorize(e){return i(this,void 0,void 0,(function*(){if(!C.authorizeLink||!N().amount){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_WORKFLOW_EXECUTION_NOT_FOUND,{description:"SDK was not initialized with workflow execution"});throw r.PayrailsLogger.error(e.message,{error:e}),e}const{success:t=P.success,error:i=P.error,cancel:n=P.cancel,pending:o=P.pending}=this.returnLinks,a=this.attachRiskIdToPaymentComposition({amount:N().amount,paymentComposition:e,returnInfo:{success:t,cancel:n,error:i,pending:o}});return p({url:C.authorizeLink,method:d.POST,token:N().token,body:a})}))}getFirstNonFraudNetId(e){const t=Object.keys(e||{}).find((e=>"fraudNet"!==e));return t?e[t]:null}attachRiskIdToPaymentComposition(t){var i,n,o,s,r;let a;return a=t.paymentComposition[0].paymentMethodCode===e.PAYMENT_METHOD_CODES.PAYPAL&&(null===(n=null===(i=window.PayrailsData)||void 0===i?void 0:i.riskIds)||void 0===n?void 0:n.fraudNet)?null===(s=null===(o=window.PayrailsData)||void 0===o?void 0:o.riskIds)||void 0===s?void 0:s.fraudNet:this.getFirstNonFraudNetId(null===(r=window.PayrailsData)||void 0===r?void 0:r.riskIds)||"",a?Object.assign(Object.assign({},t),{meta:{risk:{sessionId:a}}}):t}wait(e){return i(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}pollForAuthorizationResult(e){return i(this,arguments,void 0,(function*(e,t=0,i=["authorizePending","authorizeSuccessful","authorizeFailed"]){const n=(yield this.getExecution(e,this.paymentStatus.lastActionUpdateTime,t)).res,o=n.status,a=o.find((({code:e})=>"authorizeRequested"===e));if(!a&&t<10)return yield new Promise((e=>setTimeout(e,this.POLL_INTERVAL))),this.pollForAuthorizationResult(e,t+1);if(!a){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHORIZATION_NOT_REQUESTED);throw r.PayrailsLogger.error(e.message,{error:e}),e}const l=o.find((({code:e,time:t})=>"confirmRequested"===e&&new Date(t)>new Date(a.time))),c=l?l.time:a.time,d=o.filter((({code:e,time:t})=>i.includes(e)&&new Date(t)>new Date(c))).sort(((e,t)=>new Date(t.time).getTime()-new Date(e.time).getTime()))[0];return d?(this.paymentStatus.lastActionUpdateTime=d.time,{finalState:d,response:n}):this.pollForAuthorizationResult(e,t+1,i)}))}}class M{constructor(e,t,i,n=w.THREE_DS){this.link=e,this.paymentExecutor=t,this.options=i,this.type=n,this.THREE_DS_SIZES=[[250,400],[390,400],[500,600],[600,400]],this.internalPopupBackground=null,this.SCREEN_WIDTH=window.innerWidth,this.SCREEN_HEIGHT=window.innerHeight}get iframeSize(){return this.type===w.THREE_DS?this.THREE_DS_SIZES.reduce(((e,t)=>this.SCREEN_WIDTH>t[0]?t:e),[250,400]):[this.SCREEN_WIDTH-50,this.SCREEN_HEIGHT-50]}get popupBackground(){if(this.internalPopupBackground)return this.internalPopupBackground;{const e=document.createElement("div");e.setAttribute("id","payrails-popup-background"),e.appendChild(this.popup),this.internalPopupBackground=e}return this.internalPopupBackground}get popup(){const e=document.createElement("div");return e.setAttribute("id","payrails-popup"),e.setAttribute("width",this.iframeSize[0].toString()),e.setAttribute("height",this.iframeSize[1].toString()),e.appendChild(this.iframe),e.style.width=`${this.iframeSize[0]+4}px`,e.style.height=`${this.iframeSize[1]+4}px`,e}get iframe(){const e=document.createElement("iframe");return e.setAttribute("id","payrails-frame"),e.setAttribute("src",this.link),e.setAttribute("width",this.iframeSize[0].toString()),e.setAttribute("height",this.iframeSize[1].toString()),e}handleMessages(){const t=n=>i(this,void 0,void 0,(function*(){var i,o,s,r,a,l,c;if(n.data&&'{"type":"3DS-challenge-completed"}'===n.data){switch(window.removeEventListener("message",t),null===(i=(yield this.paymentExecutor.pollForAuthorizationResult(C.url)).finalState)||void 0===i?void 0:i.code){case"authorizeSuccessful":null===(s=null===(o=this.options.events)||void 0===o?void 0:o.onAuthorizeSuccess)||void 0===s||s.call(o);break;case"authorizePending":null===(a=null===(r=this.options.events)||void 0===r?void 0:r.onAuthorizePending)||void 0===a||a.call(r);break;default:null===(c=null===(l=this.options.events)||void 0===l?void 0:l.onAuthorizeFailed)||void 0===c||c.call(l,{code:e.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:"Authorization failed after 3DS challenge."})}this.unmount()}}));window.addEventListener("message",t)}mount(){var e;this.popup.remove(),null===(e=document.querySelector("body"))||void 0===e||e.appendChild(this.popupBackground),this.handleMessages()}unmount(){this.popupBackground.remove(),this.internalPopupBackground=null}}var w;!function(e){e[e.THREE_DS=0]="THREE_DS",e[e.GENERIC_REDIRECT=1]="GENERIC_REDIRECT"}(w||(w={}));class k{constructor(e,t){this.options=e,this.paymentExecutor=t}handle3ds(e){var t,i,n;try{null===(i=null===(t=this.options.events)||void 0===t?void 0:t.onThreeDSecureChallenge)||void 0===i||i.call(t)}catch(e){}const o=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.links["3ds"];o&&(this.options.redirectFor3DS?window.location.assign(o):new M(o,this.paymentExecutor,this.options).mount())}}var Y,U={};!function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var i,n,o,s,r,a,l,c,d,u,_,p,E,h,I={},v={},m={},y={},L={},A={},f={},O={},R={},T={},C={},g={},N={};function S(){if(_)return N;_=1,Object.defineProperty(N,"__esModule",{value:!0}),N.Framebus=void 0;var e=B(),t="undefined"!=typeof window&&window.Promise,i=function(){function i(e){void 0===e&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=Boolean(e.targetFrames),this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=Boolean(this.verifyDomain||this.limitBroadcastToFramesArray)}return i.setPromise=function(e){i.Promise=e},i.target=function(e){return new i(e)},i.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},i.prototype.include=function(t){return null!=t&&null!=t.Window&&t.constructor===t.Window&&(e.childWindows.push(t),!0)},i.prototype.target=function(e){return i.target(e)},i.prototype.emit=function(t,i,n){if(this.isDestroyed)return!1;var o=this.origin;if(t=this.namespaceEvent(t),(0,e.isntString)(t))return!1;if((0,e.isntString)(o))return!1;"function"==typeof i&&(n=i,i=void 0);var s=(0,e.packagePayload)(t,o,i,n);return!!s&&(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach((function(t){(0,e.sendMessage)(t,s,o)})):(0,e.broadcast)(s,{origin:o,frame:window.top||window.self}),!0)},i.prototype.emitAsPromise=function(e,t){var n=this;return new i.Promise((function(i,o){n.emit(e,t,(function(e){i(e)}))||o(new Error('Listener not added for "'.concat(e,'"')))}))},i.prototype.on=function(t,i){if(this.isDestroyed)return!1;var n=this,o=this.origin,s=i;return t=this.namespaceEvent(t),!(0,e.subscriptionArgsInvalid)(t,s,o)&&(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.passesVerifyDomainCheck(this&&this.origin)&&n.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,e)}),this.listeners.push({eventName:t,handler:s,originalHandler:i}),e.subscribers[o]=e.subscribers[o]||{},e.subscribers[o][t]=e.subscribers[o][t]||[],e.subscribers[o][t].push(s),!0)},i.prototype.off=function(t,i){var n=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var o=0;o<this.listeners.length;o++){var s=this.listeners[o];s.originalHandler===i&&(n=s.handler)}t=this.namespaceEvent(t);var r=this.origin;if((0,e.subscriptionArgsInvalid)(t,n,r))return!1;var a=e.subscribers[r]&&e.subscribers[r][t];if(!a)return!1;for(o=0;o<a.length;o++)if(a[o]===n)return a.splice(o,1),!0;return!1},i.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var t=this.listeners[e];this.off(t.eventName,t.handler)}this.listeners.length=0}},i.prototype.passesVerifyDomainCheck=function(e){return!this.verifyDomain||this.checkOrigin(e)},i.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map((function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e})).filter((function(e){return e})):[]},i.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var t=this.targetFramesAsWindows().find((function(t){return t===e}));return Boolean(t)},i.prototype.checkOrigin=function(e){var t,i=document.createElement("a");return i.href=location.href,t="https:"===i.protocol?i.host.replace(/:443$/,""):"http:"===i.protocol?i.host.replace(/:80$/,""):i.host,i.protocol+"//"+t===e||!this.verifyDomain||this.verifyDomain(e)},i.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},i.Promise=t,i}();return N.Framebus=i,N}function P(){if(h)return g;h=1;var e=g&&g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g,"__esModule",{value:!0}),g.subscribeReplier=void 0;var t=S(),i=e((E||(E=1,p=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)}))}),p));return g.subscribeReplier=function(e,n){var o=(0,i.default)();return t.Framebus.target({origin:n}).on(o,(function i(s,r){e(s,r),t.Framebus.target({origin:n}).off(o,i)})),o},g}var b,D,M,w,k,Y,U={},x={},F={};function B(){return w||(w=1,e=I,t=I&&I.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,o)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),_=I&&I.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||t(i,e,n)},Object.defineProperty(e,"__esModule",{value:!0}),_(function(){if(i)return v;i=1,Object.defineProperty(v,"__esModule",{value:!0}),v.detach=v.attach=void 0;var e=B(),t=!1;return v.attach=function(){t||"undefined"==typeof window||(t=!0,window.addEventListener("message",e.onMessage,!1))},v.detach=function(){t=!1,window.removeEventListener("message",e.onMessage,!1)},v}(),e),_(function(){if(n)return m;n=1,Object.defineProperty(m,"__esModule",{value:!0}),m.broadcastToChildWindows=void 0;var e=B();return m.broadcastToChildWindows=function(t,i,n){for(var o=e.childWindows.length-1;o>=0;o--){var s=e.childWindows[o];s.closed?e.childWindows.splice(o,1):n!==s&&(0,e.broadcast)(t,{origin:i,frame:s.top})}},m}(),e),_(function(){if(o)return y;o=1,Object.defineProperty(y,"__esModule",{value:!0}),y.broadcast=void 0;var e=B();return y.broadcast=function t(i,n){var o,s=0,r=n.origin,a=n.frame;try{for(a.postMessage(i,r),(0,e.hasOpener)(a)&&a.opener.top!==window.top&&t(i,{origin:r,frame:a.opener.top});o=a.frames[s];)t(i,{origin:r,frame:o}),s++}catch(e){}},y}(),e),_((s||(s=1,Object.defineProperty(L,"__esModule",{value:!0}),L.subscribers=L.childWindows=L.prefix=void 0,L.prefix="/*framebus*/",L.childWindows=[],L.subscribers={}),L),e),_(function(){if(r)return A;r=1,Object.defineProperty(A,"__esModule",{value:!0}),A.dispatch=void 0;var e=B();return A.dispatch=function(t,i,n,o,s){if(e.subscribers[t]&&e.subscribers[t][i]){var r=[];n&&r.push(n),o&&r.push(o);for(var a=0;a<e.subscribers[t][i].length;a++)e.subscribers[t][i][a].apply(s,r)}},A}(),e),_((a||(a=1,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}),f),e),_((l||(l=1,Object.defineProperty(O,"__esModule",{value:!0}),O.isntString=void 0,O.isntString=function(e){return"string"!=typeof e}),O),e),_(function(){if(c)return R;c=1,Object.defineProperty(R,"__esModule",{value:!0}),R.onMessage=void 0;var e=B();return R.onMessage=function(t){if(!(0,e.isntString)(t.data)){var i=(0,e.unpackPayload)(t);if(i){var n=i.eventData,o=i.reply;(0,e.dispatch)("*",i.event,n,o,t),(0,e.dispatch)(t.origin,i.event,n,o,t),(0,e.broadcastToChildWindows)(t.data,i.origin,t.source)}}},R}(),e),_(function(){if(d)return T;d=1,Object.defineProperty(T,"__esModule",{value:!0}),T.packagePayload=void 0;var e=B();return T.packagePayload=function(t,i,n,o){var s,r={event:t,origin:i};"function"==typeof o&&(r.reply=(0,e.subscribeReplier)(o,i)),r.eventData=n;try{s=e.prefix+JSON.stringify(r)}catch(e){throw new Error("Could not stringify event: ".concat(e.message))}return s},T}(),e),_((u||(u=1,Object.defineProperty(C,"__esModule",{value:!0}),C.sendMessage=void 0,C.sendMessage=function(e,t,i){try{e.postMessage(t,i)}catch(e){}}),C),e),_(P(),e),_(function(){if(b)return U;b=1,Object.defineProperty(U,"__esModule",{value:!0}),U.subscriptionArgsInvalid=void 0;var e=B();return U.subscriptionArgsInvalid=function(t,i,n){return!!(0,e.isntString)(t)||"function"!=typeof i||(0,e.isntString)(n)},U}(),e),_((D||(D=1,Object.defineProperty(x,"__esModule",{value:!0})),x),e),_(function(){if(M)return F;M=1,Object.defineProperty(F,"__esModule",{value:!0}),F.unpackPayload=void 0;var e=B();return F.unpackPayload=function(t){var i;if(t.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{i=JSON.parse(t.data.slice(e.prefix.length))}catch(e){return!1}if(i.reply){var n=t.origin,o=t.source,s=i.reply;i.reply=function(t){if(o){var i=(0,e.packagePayload)(s,n,t);i&&o.postMessage(i,n)}}}return i},F}(),e)),I;var e,t,_}const j=t(function(){if(Y)return k;Y=1;var e=B(),t=S();return(0,e.attach)(),k=t.Framebus}());class V{constructor(e){this.origin=null,this.listeners=[],this.bus=new j(e)}static getInstance(){return V.instance||(V.instance=new V),V.instance}on(e,t){return this.bus.on(e,t)}off(e,t){return this.bus.off(e,t)}emit(e,t,i=void 0){return this.bus.emit(e,t,i)}target(e){return this.bus.target(e)}}e.IframeEventBus=V,e.getEventBus=()=>V.getInstance()}(U);class x{constructor(e,{id:t="",className:i=""}={}){this.subElements=[],this.eventBus=U.getEventBus();const n=document.createElement(e);t&&(this.id=t,n.setAttribute("id",t)),i&&(Array.isArray(i)?n.setAttribute("class",function(...e){return e.filter(Boolean).join(" ")}(...i)):n.setAttribute("class",i)),this.element=n}get parentElement(){return this.element.parentElement}get selector(){if(!this.id)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_UI_ELEMENT_MISSING);return`#${this.id}`}mount(e){const t=document.querySelector(e);if(!t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_PARENT_ELEMENT_MISSING,{description:`Element with selector "${e}" not found in in the DOM`});this.clean(),t.appendChild(this.element),this.subElements.forEach((e=>{if(!this.id)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_SUBELEMENTS_RENDER_ERROR);e.mount(this.selector)}))}clean(){var e;null===(e=document.getElementById(this.element.id))||void 0===e||e.remove()}unmount(){var e;this.subElements.forEach((e=>e.unmount())),null===(e=this.parentElement)||void 0===e||e.removeChild(this.element)}}class F extends x{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){var i;super("button",{id:"payrails-card-payment-button"}),this.options=e,this.returnInfo=t,this.selectedInstrument=null,this.paymentInstallmentElement=null,this.disabledByDefault=!0,this.element.innerText=(null===(i=null==e?void 0:e.translations)||void 0===i?void 0:i.label)||"Pay",this.disabledByDefault="boolean"!=typeof e.disabledByDefault||e.disabledByDefault,this.setDisabled(this.disabledByDefault),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 D(this.returnInfo)}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}setPaymentInstallmentsDropdown(e){this.paymentInstallmentElement=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(){return i(this,void 0,void 0,(function*(){var t,i,n,o,a,l,c,d,u,_,p,h,I;let v;if(this.setDisabled(!0),this.triggerLoading(!0),!(null===(t=this.selectedInstrument)||void 0===t?void 0:t.id)&&(v=null===(n=yield null===(i=this.cardForm)||void 0===i?void 0:i.validate())||void 0===n?void 0:n.isValid,!v))return this.setDisabled(!1),void this.triggerLoading(!1);if(v=yield A(this.options.events,{bin:this.bin||""}),!v)return this.setDisabled(!1),void this.triggerLoading(!1);try{let t=[{paymentMethodCode:e.PAYMENT_METHOD_CODES.CARD,integrationType:"api",amount:N().amount,storeInstrument:!1}];if(null===(o=this.selectedInstrument)||void 0===o?void 0:o.id)t[0].paymentInstrumentId=null===(a=this.selectedInstrument)||void 0===a?void 0:a.id,t[0].paymentMethodCode=null===(l=this.selectedInstrument)||void 0===l?void 0:l.paymentMethod,this.paymentInstallmentElement&&(null===(c=this.paymentInstallmentElement)||void 0===c?void 0:c.selectedInstallmentValue)&&(t[0].installments={count:null===(d=this.paymentInstallmentElement)||void 0===d?void 0:d.selectedInstallmentValue});else{if(!this.cardForm){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CARD_FORM_MISSING);throw r.PayrailsLogger.error(e.message,{error:e}),e}t=yield this.constructEncryptedPayment(t)}const i=yield this.paymentExecutor.pay(t);this.handleAuthorizationResult(i)}catch(t){let i=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHENTICATION_ERROR,{cause:t});t instanceof E||[401,403].includes(null===(u=null==t?void 0:t.error)||void 0===u?void 0:u.code)?(null===(p=null===(_=this.options.events)||void 0===_?void 0:_.onPaymentSessionExpired)||void 0===p||p.call(_),i.message="API token is not valid or expired.",r.PayrailsLogger.error(i.message,{error:i}),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:i.message})):t.toString().includes("Invalid token")?(null===(I=null===(h=this.options.events)||void 0===h?void 0:h.onPaymentSessionExpired)||void 0===I||I.call(h),i.message="Vault token is not valid or expired.",r.PayrailsLogger.error(i.message,{error:i})):i=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_UNKNOWN_ERROR,{cause:t}),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHENTICATION_ERROR,message:i.message})}}))}constructEncryptedPayment(e){return i(this,void 0,void 0,(function*(){if(!this.cardForm)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CARD_FORM_MISSING);const{cardData:t,storeInstrument:i,enrollInstrumentToNetworkOffers:n,selectedInstallment:o,billingInfo:r}=yield this.cardForm.collectValues();return e[0].paymentInstrumentData=Object.assign(Object.assign({},t),{billingAddress:r}),e[0].storeInstrument=i,e[0].enrollInstrumentToNetworkOffers=n,o&&(e[0].installments={count:o}),e}))}handleAuthorizationResult(t){var i,n,o,r,a,l,c;let d;switch(null===(i=null==t?void 0:t.finalState)||void 0===i?void 0:i.code){case"authorizeSuccessful":this.triggerLoading(!1),null===(o=null===(n=this.options.events)||void 0===n?void 0:n.onAuthorizeSuccess)||void 0===o||o.call(n);break;case"authorizePending":"3ds"===(null===(r=null==t?void 0:t.response)||void 0===r?void 0:r.actionRequired)?new k(Object.assign(Object.assign({},this.options),{events:Object.assign(Object.assign({},this.options.events),{onAuthorizeFailed:e=>{this.onAuthorizationFailed(e)}})}),this.paymentExecutor).handle3ds(t):(null===(a=null==t?void 0:t.response)||void 0===a?void 0:a.actionRequired)||(this.triggerLoading(!1),null===(c=null===(l=this.options.events)||void 0===l?void 0:l.onAuthorizePending)||void 0===c||c.call(l));break;default:d=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_API_AUTHORIZATION_ERROR),this.onAuthorizationFailed({code:e.AuthorizationFailureReasons.AUTHORIZATION_ERROR,message:d.message})}}}e.AuthorizationFailureReasons=void 0,(Y=e.AuthorizationFailureReasons||(e.AuthorizationFailureReasons={})).VALIDATION_FAILED="VALIDATION_FAILED",Y.AUTHORIZATION_ERROR="AUTHORIZATION_ERROR",Y.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",Y.UNKNOWN_ERROR="UNKNOWN_ERROR";const B={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.",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.",CREATED_ELEMENT:"%s1 - Created %s2 element.",ELEMENT_MOUNTED:"%s1 - %s2 Element mounted.",COLLECT_SUBMIT_SUCCESS:"%s1 - Data has been collected successfully.",INSERT_DATA_SUCCESS:"%s1 - Data has been inserted 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",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."},j={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_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",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.",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.',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",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."},V={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."},G="collect_controller",X="element",z="ERROR",H={CHANGE:"CHANGE",READY:"READY",FOCUS:"FOCUS",BLUR:"BLUR",ESCAPE:"ESCAPE",CLICK:"CLICK",ERROR:"ERROR",SUCCESS:"SUCCESS",SUBMIT:"SUBMIT",CREATED:"CREATED",MOUNTED:"MOUNTED",HEIGHT:"HEIGHT"},W="FRAME_READY",q="TOKENIZATION_REQUEST",$="INPUT_EVENT",K="DESTROY FRAME",J="SET_VALUE",Z="GET_BEARER_TOKEN",Q="COLLECT_ELEMENT_SET_ERROR",ee="COMPOSABLE_UPDATE_OPTIONS",te="VALIDATE_ELEMENT",ie="COMPOSABLE_CONTAINER_MOUNTED",ne="COLLECT_CONTAINER_MOUNTED";var oe,se;!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"}(oe||(oe={})),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.CVV="CVV",e.EXPIRY="EXPIRY",e.ERROR="ERROR",e.UNKNOWN="UNKNOWN"}(se||(se={}));const re={[se.AMEX]:["XXXX XXXXXX XXXXX",{X:"[0-9]"}],[se.VISA]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[se.MASTERCARD]:["XXXX XXXX XXXX XXXX",{X:"[0-9]"}],[se.DISCOVER]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.DINERS_CLUB]:["XXXX XXXXXX XXXXXX",{X:"[0-9]"}],[se.JCB]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.MAESTRO]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.UNIONPAY]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.HIPERCARD]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.DEFAULT]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}],[se.UNKNOWN]:["XXXX XXXX XXXX XXXX XXX",{X:"[0-9]"}]},ae={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},[oe.CARDHOLDER_NAME]:{name:"cardHolderName",attributes:{type:"text",autocomplete:"cc-name"},sensitive:!0,regex:/^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/},[oe.CARD_NUMBER]:{name:"CARD_NUMBER",attributes:{type:"text",autocomplete:"cc-number",inputmode:"numeric"},sensitive:!0,mask:re[se.DEFAULT],regex:/$|^[\s]*?([0-9]{2,6}[ -]?){3,5}[\s]*/},[oe.EXPIRATION_DATE]:{name:"EXPIRATION_DATE",attributes:{type:"text",autocomplete:"cc-exp",inputmode:"numeric"},sensitive:!0},[oe.EXPIRATION_MONTH]:{name:"EXPIRATION_MONTH",attributes:{maxLength:2,type:"text",inputmode:"numeric",autocomplete:"cc-exp-month"},sensitive:!0,mask:["XX",{X:"[0-9]"}]},[oe.EXPIRATION_YEAR]:{name:"EXPIRATION_YEAR",attributes:{type:"text",inputmode:"numeric",autocomplete:"cc-exp-year"},sensitive:!0},[oe.CVV]:{name:"CVV",attributes:{type:"text",inputmode:"numeric",maxLength:3},sensitive:!0,regex:/^$|^[0-9]{3,4}$/},[oe.INPUT_FIELD]:{name:"INPUT_FIELD",sensitive:!0,attributes:{type:"text"}},[oe.PIN]:{name:"PIN",attributes:{type:"text",inputmode:"numeric",maxLength:12,minLength:4},sensitive:!0,regex:/^$|^[0-9]{4,12}$/}},le="XXXX-XXXX-XXXX-XXXX",ce={height:"100%",width:"100%",margin:0,padding:0,border:0,position:"absolute",top:0,left:0,"user-select":"none"},de={position:"absolute",top:0,width:0,height:0,visibility:"hidden",left:"-99999999px","user-select":"none"},ue={width:"100%",height:"100%",border:"0",padding:"0",margin:"0",outline:"none"},_e={WEBPACKAUTOFILL:"-webkit-autofill",BASE:"base",FOCUS:"focus",COMPLETE:"complete",EMPTY:"empty",INVALID:"invalid",GLOBAL:"global",REQUIRED_ASTERISK:"requiredAsterisk"},pe={[se.VISA]:{regex:/^4\d*/,maxCardLength:19,cardLengthRange:[13,16]},[se.MASTERCARD]:{regex:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*/,maxCardLength:16,cardLengthRange:[16]},[se.AMEX]:{regex:/^3[47]\d*/,maxCardLength:15,cardLengthRange:[15]},[se.DINERS_CLUB]:{regex:/^(36|38|30[0-5])\d*/,maxCardLength:16,cardLengthRange:[14,15,16,17,18,19]},[se.DISCOVER]:{regex:/^(6011|65|64[4-9]|622)\d*/,maxCardLength:16,cardLengthRange:[16,17,18,19]},[se.JCB]:{regex:/^35\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[se.HIPERCARD]:{regex:/^606282\d*/,maxCardLength:19,cardLengthRange:[14,15,16,17,18,19]},[se.UNIONPAY]:{regex:/^62\d*/,maxCardLength:19,cardLengthRange:[16,17,18,19]},[se.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]}};se.DEFAULT,se.CVV,se.EXPIRY,se.ERROR,se.AMEX,se.DINERS_CLUB,se.DISCOVER,se.HIPERCARD,se.JCB,se.MAESTRO,se.MASTERCARD,se.UNIONPAY,se.VISA;const Ee="MM/YY",he=[Ee,"YYYY/MM","YY/MM","MM/YYYY"],Ie=["YY","YYYY"];var ve;!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"}(ve||(ve={})),oe.CARD_NUMBER,oe.EXPIRATION_DATE,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR,oe.CVV,oe.EXPIRATION_DATE,oe.CARD_NUMBER,oe.CARDHOLDER_NAME,oe.INPUT_FIELD,j.INVALID_COLLECT_VALUE,oe.PIN,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR,oe.CVV,oe.EXPIRATION_DATE,oe.CARD_NUMBER,oe.CARDHOLDER_NAME,oe.INPUT_FIELD,j.DEFAULT_REQUIRED_COLLECT_VALUE,oe.PIN,oe.EXPIRATION_MONTH,oe.EXPIRATION_YEAR;const me=[oe.CARDHOLDER_NAME,oe.EXPIRATION_MONTH,oe.PIN,oe.CVV],ye={X:"[0-9]"};class Le{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(Le.prototype,{constructor:e})}}
|
|
2
2
|
/* @copyright
|
|
3
3
|
Copyright (c) 2022 Skyflow, Inc.
|
|
4
4
|
*/const Ae={IFRAME_SECURE_SITE:"https://js.skyflow.com/v1/elements/index.html",IFRAME_SECURE_ORGIN:"https://js.skyflow.com"},fe={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no",style:"width: 100%;",allow:"clipboard-read; clipboard-write"},Oe=(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 Re=(e={})=>{const t=document.createElement("iframe"),i=Object.assign(Object.assign({},fe),e);return Object.assign(t.style,ce),Oe(t,i),t.getAttribute("id")||(t.id=t.name),t};const Te=()=>Ae.IFRAME_SECURE_SITE,Ce=(e,t)=>{Object.keys(t).forEach((i=>{Object.prototype.hasOwnProperty.call(t,i)&&(e.style[i]=t[i])}))};function ge(e){return JSON.parse(JSON.stringify(e))}var Ne,Se,Pe,be,De,Me,we;!function(e){e.DEFAULT="DEFAULT",e.PLAIN_TEXT="PLAIN_TEXT",e.MASKED="MASKED",e.REDACTED="REDACTED"}(Ne||(Ne={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(Se||(Se={})),function(e){e.CHANGE="CHANGE",e.READY="READY",e.FOCUS="FOCUS",e.BLUR="BLUR",e.SUBMIT="SUBMIT"}(Pe||(Pe={})),function(e){e.WARN="WARN",e.INFO="INFO",e.DEBUG="DEBUG",e.ERROR="ERROR"}(be||(be={})),function(e){e.DEV="DEV",e.PROD="PROD"}(De||(De={})),function(e){e.LOG="LOG",e.WARN="WARN",e.ERROR="ERROR"}(Me||(Me={})),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"}(we||(we={}));const ke={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}},Ye={PROD:{doesReturnValue:!1},DEV:{doesReturnValue:!0}},Ue="[Skyflow]",xe=(e,t,i)=>{if(i&&ke[i]){const{showDebugLogs:n,showInfoLogs:o,showWarnLogs:s,showErrorLogs:r}=ke[i];t===Me.LOG&&n?console.log(`${be.DEBUG}: ${Ue} ${e}`):t===Me.LOG&&o?console.log(`${be.INFO}: ${Ue} ${e}`):t===Me.WARN&&s?console.warn(`${be.WARN}: ${Ue} ${e}`):t===Me.ERROR&&r&&console.error(`${be.ERROR}: ${Ue} ${e}`)}},Fe=(...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]})):""},Be=(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},je=e=>{if(!e||!Object.prototype.hasOwnProperty.call(e,"records"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_RECORDS_KEY_MISSING_IN_ADDITIONAL_FIELDS);const{records:t}=e;if(!t||!Array.isArray(t))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_RECORDS_IN_ADDITIONAL_FIELDS);if(0===t.length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_RECORDS_IN_ADDITIONAL_FIELDS);t.forEach(((e,t)=>{var i,n,o,r;if(!e||!Object.prototype.hasOwnProperty.call(e,"table"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_ADDITIONAL_FIELDS);if(!e.table)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE_IN_ADDITIONAL_FIELDS);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 s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID);if(!("string"==typeof(null===(o=e.fields)||void 0===o?void 0:o.skyflowID)||(null===(r=e.fields)||void 0===r?void 0:r.skyflowID)instanceof String))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID)}if(!("string"==typeof e.table||e.table instanceof String))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_ADDITIONAL_FIELDS);if(!Object.prototype.hasOwnProperty.call(e,"fields"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_FIELDS_IN_ADDITIONAL_FIELDS);if(!e.fields)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_FIELDS_IN_ADDITIONAL_FIELDS);if("object"!=typeof e.fields||Array.isArray(e.fields))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_FIELDS_IN_ADDITIONAL_FIELDS)}))},Ve=e=>{let t=!0;try{new RegExp(e)}catch(e){t=!1}return t},Ge=e=>{if(!Object.prototype.hasOwnProperty.call(e,"getBearerToken"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_GET_BEARER_TOKEN_MISSING)},Xe=(e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_TYPE);if(!e.type)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_TYPE);if(Object.prototype.hasOwnProperty.call(e,"altText")&&xe(V.COLLECT_ALT_TEXT_DEPERECATED,Me.WARN,t),Object.prototype.hasOwnProperty.call(e,"skyflowID")&&"string"!=typeof e.skyflowID)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_SKYFLOW_ID)},ze=e=>{if(!e||!Array.isArray(e))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_TYPE);if(!e.length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_UPSERT_OPTIONS_ARRAY);e.forEach(((e,t)=>{if(!e||"object"!=typeof e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_UPSERT_OPTION_OBJECT_TYPE);if(!Object.prototype.hasOwnProperty.call(e,"table"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_TABLE_IN_UPSERT_OPTION);if(!e.table||"string"!=typeof e.table||!e.table.length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_IN_UPSERT_OPTION);if(!Object.prototype.hasOwnProperty.call(e,"column"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN_IN_UPSERT_OPTION);if(!e.column||"string"!=typeof e.column||!e.column.length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN_IN_UPSERT_OPTION)}))},He=e=>"boolean"==typeof e;function We(e){const t=e.split(":");return t.length>2?(t.pop(),t.pop(),t.join(":")):""}const qe=(e,t,i)=>{if("string"!=typeof e)return e;if(t===oe.CARD_NUMBER){if(e=e&&e.replace(/\s/g,""),!i){((e="")=>{const t=e.replace(/[\s-]/g,"");let i=se.DEFAULT;Object.entries(pe).forEach((([e,n])=>{n.regex.test(t)&&(i=e)}))})(e);const t=e.length<=15?6:8;return e.length>t?e.replace(new RegExp(`.(?=.{0,${(null==e?void 0:e.length)-t-1}}$)`,"g"),"X"):e}return e}return i?e:void 0};function $e(e){var t,i,n,o;if((null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.customElementsURL)&&(e=>{if(!e||"https"!==e.substring(0,5).toLowerCase())return!1;try{if(new URL(e))return!0}catch(e){return!1}return!0})(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,r=i.hostname;Ae.IFRAME_SECURE_ORGIN=`${s}//${r}`,Ae.IFRAME_SECURE_SITE=null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.customElementsURL}{const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CARD_FORM_IFRAME_URL_MISSING);throw r.PayrailsLogger.error(e.message,{error:e,extra:{IFRAME_SECURE_ORGIN:Ae.IFRAME_SECURE_ORGIN,IFRAME_SECURE_SITE:Ae.IFRAME_SECURE_SITE}}),e}}class Ke{constructor(e,t,i,n){this.setAttributess=e=>{Oe(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 s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR)}else{if(!(e instanceof HTMLElement))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_SELECTOR);this.container=e}}catch(e){console.error(e)}Oe(this.iframe,{src:Te()}),null===(t=this.container)||void 0===t||t.appendChild(this.iframe)},this.setIframeHeight=e=>{this.iframe.getAttribute("height")!==`${e}px`&&this.iframe.setAttribute("height",`${e}px`)},this.unmount=()=>{this.iframe.remove()},this.name=`${e}:${i}:${n}`,this.metadata=t,this.iframe=Re({name:this.name})}}class Je{}var Ze,Qe,et,tt,it,nt,ot,st,rt,at,lt,ct,dt,ut,_t,pt,Et,ht,It,vt;const mt="Element";class yt extends Je{constructor(e,i,r,a,l=!1,c,d,u,_){var p;super(),this.type=gi.COLLECT,Ze.set(this,void 0),Qe.set(this,!1),et.set(this,void 0),tt.set(this,void 0),it.set(this,{isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:void 0,isRequired:!1}),nt.set(this,void 0),ot.set(this,new Le),st.set(this,void 0),rt.set(this,U.getEventBus()),at.set(this,void 0),lt.set(this,[]),ct.set(this,!1),dt.set(this,void 0),ut.set(this,void 0),_t.set(this,!1),this.getID=()=>n(this,Ze,"f"),this.mount=e=>{var i;if(!e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT);const r=(e,i)=>{if(e.name===n(this,at,"f").name){i(n(this,nt,"f")),n(this,vt,"f").call(this);const e=t(n(this,et,"f")[0],["name"]);n(this,tt,"f").length>1?n(this,tt,"f").forEach(((e,t)=>{n(this,st,"f")&&n(this,st,"f")._emit(`${H.READY}:${e.elementName}`,Object.assign(Object.assign({},n(this,et,"f")[t]),{elementType:e.elementType}))})):n(this,ot,"f")._emit(H.READY,Object.assign({},e)),n(this,rt,"f").off(W+this.containerId,r),xe(`${Fe(B.ELEMENT_MOUNTED,mt,Be(n(this,at,"f").name))} `,Me.LOG,n(this,dt,"f").logLevel),n(this,lt,"f").forEach((e=>e())),o(this,lt,[],"f")}};if(n(this,tt,"f").length>1)n(this,at,"f").mount(e),n(this,rt,"f").on(W+this.containerId,r);else{if(n(this,_t,"f"))return n(this,at,"f").mount(e),void n(this,rt,"f").on(W+this.containerId,r);null===(i=n(this,st,"f"))||void 0===i||i.on(ne,(t=>{(null==t?void 0:t.containerId)===this.containerId&&(n(this,at,"f").mount(e),n(this,rt,"f").on(W+this.containerId,r))}))}},this.unmount=()=>{n(this,at,"f").unmount()},this.update=e=>{let t=ge(e);const i=()=>{n(this,Qe,"f")&&(t={rows:[{elements:[Object.assign({},t)]}]}),o(this,nt,At(n(this,nt,"f"),t),"f"),o(this,tt,ft(n(this,nt,"f")),"f"),n(this,Qe,"f")?n(this,rt,"f").emit(J,{name:n(this,at,"f").name,options:n(this,tt,"f")[0],isSingleElementAPI:!0}):(n(this,tt,"f").forEach((e=>{n(this,rt,"f").emit(J,{name:e.elementName,options:e,isSingleElementAPI:!0})})),n(this,rt,"f").emit(J,{name:n(this,at,"f").name,options:n(this,nt,"f"),isSingleElementAPI:!1})),n(this,vt,"f").call(this)};n(this,ct,"f")?i():n(this,lt,"f").push(i)},pt.set(this,(e=>{n(this,Qe,"f")||n(this,ot,"f").on(J,(()=>{e(n(this,tt,"f"))}),!0)})),this.updateElement=e=>{n(this,rt,"f").emit(J,{name:e.elementName,options:e,isSingleElementAPI:!0})},Et.set(this,(()=>{n(this,et,"f").forEach(((e,t)=>{if(0===t){n(this,it,"f").isEmpty=e.isEmpty,n(this,it,"f").isComplete=e.isComplete,n(this,it,"f").isValid=e.isValid,n(this,it,"f").isFocused=e.isFocused,n(this,it,"f").isRequired=e.isRequired,n(this,it,"f").value={};const i=n(this,tt,"f")[t].elementName,o=e.value&&qe(e.value,e.elementType,n(this,ut,"f"));n(this,Qe,"f")?n(this,it,"f").value=o:n(this,it,"f").value[i]=o}else n(this,it,"f").isEmpty=n(this,it,"f").isEmpty||e.isEmpty,n(this,it,"f").isComplete=n(this,it,"f").isComplete&&e.isComplete,n(this,it,"f").isValid=n(this,it,"f").isValid&&e.isValid,n(this,it,"f").isFocused=n(this,it,"f").isFocused||e.isFocused,n(this,it,"f").isRequired=n(this,it,"f").isRequired||e.isRequired,n(this,it,"f").value||(n(this,it,"f").value={}),n(this,tt,"f")[t].sensitive||(n(this,it,"f").value[n(this,tt,"f")[t].elementName]=e.value||"")}))})),this.getState=()=>({isEmpty:n(this,it,"f").isEmpty,isComplete:n(this,it,"f").isComplete,isValid:n(this,it,"f").isValid,isFocused:n(this,it,"f").isFocused,value:n(this,it,"f").value,required:n(this,it,"f").isRequired}),this.getOptions=()=>{let e=ge(n(this,nt,"f"));return n(this,Qe,"f")?e=e.rows[0].elements[0]:e.rows.forEach((e=>{e.elements.forEach((e=>{delete e.elementName}))})),delete e.elementName,e},ht.set(this,(e=>{n(this,ot,"f").on(K,(()=>{const t=n(this,tt,"f").map((e=>e.elementName));n(this,Qe,"f")||t.push(n(this,at,"f").name),e(t)}),!0)})),It.set(this,(()=>{n(this,rt,"f").on($,(e=>{if(n(this,Qe,"f")&&e.event===H.READY&&e.name===n(this,at,"f").name)n(this,ot,"f")._emit(H.READY);else{const t=n(this,tt,"f").length>1;n(this,tt,"f").forEach(((i,o)=>{var r;if(e.name===i.elementName){let a="";switch(e.event){case H.FOCUS:a=H.FOCUS;break;case H.BLUR:a=H.BLUR;break;case H.CHANGE:a=H.CHANGE;break;case H.READY:a=H.READY;break;case H.SUBMIT:return void(null===(r=n(this,st,"f"))||void 0===r||r._emit(H.SUBMIT));default:throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_TYPE)}n(this,et,"f")[o].isEmpty=e.value.isEmpty,n(this,et,"f")[o].isValid=e.value.isValid,n(this,et,"f")[o].isComplete=e.value.isComplete,n(this,et,"f")[o].isFocused=e.value.isFocused,n(this,et,"f")[o].isRequired=e.value.isRequired,Object.prototype.hasOwnProperty.call(e.value,"value")?n(this,et,"f")[o].value=e.value.value:n(this,et,"f")[o].value=void 0,a=t?`${a}:${e.name}`:a,n(this,rt,"f").emit(H.HEIGHT+n(this,at,"f").name,{},(e=>{n(this,at,"f").setIframeHeight(e.height)})),n(this,Et,"f").call(this);const l=Object.assign(Object.assign({},n(this,et,"f")[o]),{elementType:i.elementType});t&&n(this,st,"f")?n(this,st,"f")._emit(a,l):n(this,ot,"f")._emit(a,l)}}))}}))})),vt.set(this,(()=>{const{rows:e}=n(this,nt,"f");e.forEach((e=>{e.elements.forEach((e=>{e.elementType!==ae.radio.name&&e.elementType!==ae.checkbox.name&&(e.value=void 0)}))})),o(this,tt,ft(n(this,nt,"f")),"f")})),this.containerId=a.containerId,o(this,Ze,e,"f"),o(this,dt,u,"f"),o(this,nt,At(i),"f"),o(this,tt,ft(i),"f"),o(this,Qe,l,"f"),_&&o(this,st,_,"f"),o(this,ut,Ye[n(this,dt,"f").env].doesReturnValue,"f"),this.elementType=n(this,Qe,"f")?n(this,tt,"f")[0].elementType:"group",o(this,et,[],"f"),n(this,tt,"f").forEach((e=>{n(this,et,"f").push({isEmpty:!0,isComplete:!1,isValid:!1,isFocused:!1,value:n(this,ut,"f")?"":void 0,elementType:e.elementType,name:e.elementName,isRequired:!1})})),o(this,at,new Ke(n(this,nt,"f").elementName,r,this.containerId,n(this,dt,"f").logLevel),"f"),n(this,It,"f").call(this),n(this,ht,"f").call(this,c),n(this,pt,"f").call(this,d),xe(Fe(B.CREATED_ELEMENT,mt,Be(n(this,at,"f").name)),Me.LOG,n(this,dt,"f").logLevel),o(this,_t,a.isMounted,"f"),null===(p=n(this,st,"f"))||void 0===p||p.on(ne,(e=>{(null==e?void 0:e.containerId)===this.containerId&&o(this,_t,!0,"f")}));const E=e=>{e.height&&e.height>0&&n(this,at,"f").setIframeHeight(e.height)};n(this,rt,"f").on(H.MOUNTED,(e=>{a.type===gi.COMPOSABLE?n(this,tt,"f").forEach((t=>{e.name===t.elementName&&(t.isMounted=!0,o(this,ct,!0,"f"))})):e.name===n(this,tt,"f")[0].elementName&&(n(this,tt,"f")[0].isMounted=!0,o(this,ct,!0,"f")),n(this,rt,"f").emit(H.HEIGHT+n(this,at,"f").name,{},E)}))}on(e,t){if(!Object.values(H).includes(e))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER);if(!t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER);if("function"!=typeof t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER);n(this,ot,"f").on(e,(e=>{void 0===e.value&&(e.value=""),delete e.isComplete,delete e.name,t(e)}))}iframeName(){return n(this,at,"f").name}isMounted(){return n(this,ct,"f")}isValidElement(){for(let e=0;e<n(this,tt,"f").length;e+=1){if(!Object.prototype.hasOwnProperty.call(n(this,tt,"f")[e],"table"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_TABLE_NAME_MISSING);if(!n(this,tt,"f")[e].table)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_TABLE);if(!("string"==typeof n(this,tt,"f")[e].table||n(this,tt,"f")[e].table instanceof String))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_TABLE_NAME);if(!Object.prototype.hasOwnProperty.call(n(this,tt,"f")[e],"column"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_COLUMN);if(!n(this,tt,"f")[e].column)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_COLUMN);if(!("string"==typeof n(this,tt,"f")[e].column||n(this,tt,"f")[e].column instanceof String))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_COLUMN);if(void 0!==n(this,tt,"f")[e].skyflowID&&!n(this,tt,"f")[e].skyflowID)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_SKYFLOW_ID)}return!0}setError(e){n(this,rt,"f").emit(Q,{name:We(n(this,at,"f").name),isTriggerError:!0,clientErrorText:e})}resetError(){n(this,rt,"f").emit(Q,{name:We(n(this,at,"f").name),isTriggerError:!1})}setValue(e){n(this,dt,"f").env!==De.PROD?n(this,Qe,"f")&&n(this,rt,"f").emit(J,{name:n(this,at,"f").name,options:Object.assign(Object.assign({},n(this,tt,"f")[0]),{value:e}),isSingleElementAPI:!0}):xe(Fe(V.UNABLE_TO_SET_VALUE_IN_PROD_ENV,n(this,tt,"f")[0].elementType),Me.WARN,n(this,dt,"f").logLevel)}clearValue(){n(this,dt,"f").env!==De.PROD?n(this,Qe,"f")&&n(this,rt,"f").emit(J,{name:n(this,at,"f").name,options:Object.assign(Object.assign({},n(this,tt,"f")[0]),{value:""}),isSingleElementAPI:!0}):xe(Fe(V.UNABLE_TO_CLEAR_VALUE_IN_PROD_ENV,n(this,tt,"f")[0].elementType),Me.WARN,n(this,dt,"f").logLevel)}}function Lt(e,t,i={}){if("group"!==e&&!Object.prototype.hasOwnProperty.call(ae,e))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_TYPE);if(Object.prototype.hasOwnProperty.call(t,"validations")){if(!Array.isArray(t.validations))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATIONS_TYPE);t.validations.forEach(((e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,"type"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_TYPE);if(!Object.values(we).includes(e.type))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_TYPE);if(!Object.prototype.hasOwnProperty.call(e,"params"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_VALIDATION_RULE_PARAMS);if("object"!=typeof e.params||Array.isArray(e.params)||null===e.params)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_VALIDATION_RULE_PARAMS);if(e.type===we.REGEX_MATCH_RULE){if(!Object.prototype.hasOwnProperty.call(e.params,"regex"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_REGEX_IN_REGEX_MATCH_RULE)}else if(e.type===we.LENGTH_MATCH_RULE&&!Object.prototype.hasOwnProperty.call(e.params,"min")&&!Object.prototype.hasOwnProperty.call(e.params,"max"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_MIN_AND_MAX_IN_LENGTH_MATCH_RULE)}))}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}=ae[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===ae.radio.name||e===ae.checkbox.name)&&!i.value)throw new Error("Elements radio and checkbox requires value attribute");if(!(e!==ae.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 At(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(j.CANNOT_CHANGE_ELEMENT);Lt(a.elementType,a,l),s.elements[t]=Object.assign(Object.assign(Object.assign({},a),l),{elementName:a.elementName});const c=l.classes||{},d=l.styles||{};d.base=Object.assign(Object.assign({},ue),d.base),l.classes=c,l.styles=d;const u=(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(_e).forEach((i=>{if(e[i]||t[i])switch(i){case _e.BASE:t[i]=Object.assign({},t[i]);break;case _e.FOCUS:t[_e.BASE]=Object.assign(Object.assign({},t[_e.BASE]),{":focus":Object.assign({},t[_e.BASE]&&t[_e.BASE][":focus"])});break;case _e.WEBPACKAUTOFILL:t[_e.BASE]=Object.assign(Object.assign({},t[_e.BASE]),{":-webkit-autofill":Object.assign({},t[_e.BASE]&&t[_e.BASE][":-webkit-autofill"])});break;default:t[i]=Object.assign(Object.assign({},t[_e.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`)}))}))}(u,_),l.labelStyles={labelClasses:u},l.labelStyles.styles=_}))})),t}Ze=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,it=new WeakMap,nt=new WeakMap,ot=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,_t=new WeakMap,pt=new WeakMap,Et=new WeakMap,ht=new WeakMap,It=new WeakMap,vt=new WeakMap;const ft=e=>{const{rows:t}=e,i=[];return t.forEach((e=>{e.elements.forEach((e=>{i.push(e)}))})),i},Ot=e=>{const t=e.validations;return t&&Array.isArray(t)&&t.length>0&&t.forEach(((e,t)=>{if(e&&e.type===we.ELEMENT_VALUE_MATCH_RULE){if(e.params&&!Object.prototype.hasOwnProperty.call(e.params,"element"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_ELEMENT_IN_ELEMENT_MATCH_RULE);if(e.params&&(null==e.params.element||!(e.params.element instanceof yt)))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_ELEMENT_IN_ELEMENT_MATCH_RULE);e.params&&e.params.element&&e.params.element instanceof yt&&(e.params.element=e.params.element.iframeName())}else if(e&&e.type===we.REGEX_MATCH_RULE){if(e.params&&e.params.regex&&!Ve(e.params.regex))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_REGEX_IN_REGEX_MATCH_RULE);e.params&&e.params.regex&&Ve(e.params.regex)&&(e.params.regex=e.params.regex.toString())}})),t},Rt=(e,t,i)=>{let n=Object.assign({required:!1},t);if((Object.prototype.hasOwnProperty.call(n,"format")||Object.prototype.hasOwnProperty.call(n,"translation"))&&(me.includes(e)?(xe(Fe(V.INPUT_FORMATTING_NOT_SUPPROTED,e),Me.WARN,i),null==n||delete n.format,null==n||delete n.translation):e===ae.INPUT_FIELD.name&&((e=>{if(e){if(Object.prototype.hasOwnProperty.call(e,"format")&&"string"!=typeof e.format)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_FORMAT);if(Object.prototype.hasOwnProperty.call(e,"translation")&&("object"!=typeof e.translation||"[object Object]"!==Object.prototype.toString.call(e.translation)))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_INPUT_OPTIONS_TRANSLATION)}})(t),n=Object.assign(Object.assign({},n),{mask:[n.format,n.translation?n.translation:ye]}),null==n||delete n.format,null==n||delete n.translation)),e===ae.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)===le&&(e="-"),n=Object.assign(Object.assign({},n),{cardSeperator:e}),null==n||delete n.format,null==n||delete n.translation}else if(e===ae.EXPIRATION_DATE.name){let e=!1;n.format&&(e=!!(o=n.format.toUpperCase())&&he.includes(o),e||xe(Fe(V.INVALID_EXPIRATION_DATE_FORMAT,he.toString()),Me.WARN,i)),n=Object.assign(Object.assign({},n),{format:e?n.format.toUpperCase():Ee}),null==n||delete n.translation}else if(e===ae.EXPIRATION_YEAR.name){let e=!1;n.format&&(e=(e=>!!e&&Ie.includes(e))(n.format.toUpperCase()),e||xe(Fe(V.INVALID_EXPIRATION_YEAR_FORMAT,Ie.toString()),Me.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")&&!He(n.enableCardIcon))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS,{description:"Interface: container create - Invaild enableCardIcon in options, enableCardIcon of type boolean is required."});if(Object.prototype.hasOwnProperty.call(n,"required")&&!He(n.required))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_BOOLEAN_OPTIONS,{description:"Interface: container create - Invaild required in options, required of type boolean is required."});return n};function Tt(){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 Ct{}var gt,Nt,St,Pt,bt,Dt,Mt,wt,kt,Yt,Ut,xt;const Ft="CollectContainer";class Bt extends Ct{constructor(e,t,i,r){super(),gt.set(this,void 0),Nt.set(this,{}),St.set(this,void 0),Pt.set(this,void 0),bt.set(this,void 0),this.type=gi.COLLECT,Dt.set(this,void 0),Mt.set(this,!1),this.create=(e,t={required:!1})=>{Xe(e,n(this,Pt,"f").logLevel);const i=Ot(e),o=Rt(e.type,t,n(this,Pt,"f").logLevel),s={rows:[{elements:[Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column,accept:t.allowedFileType},e),o),{validations:i})]}]};return n(this,wt,"f").call(this,s,!0)},wt.set(this,((e,t=!1)=>{const i=[],o=ge(e);if(o.rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:n}=t;Lt(n,t),t.sensitive=t.sensitive||ae[n].sensitive,t.replacePattern=t.replacePattern||ae[n].replacePattern,t.mask=t.mask||ae[n].mask,t.isMounted=!1,t.elementType!==ae.radio.name&&t.elementType!==ae.checkbox.name||(t.elementName=`${t.elementName}:${btoa(t.value)}`),t.elementName=`${X}:${t.elementType}:${btoa(Tt())}`,t.label=e.label,t.skyflowID=e.skyflowID,i.push(t)}))})),o.elementName=t?i[0].elementName:`${X}:group:${btoa(o.name)}`,t&&!n(this,Nt,"f")[i[0].elementName]&&n(this,xt,"f").call(this,i[0].name))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME);let r=n(this,Nt,"f")[o.elementName];if(r)t?r.update(i[0]):r.update(o);else{const e=Tt();r=new yt(e,o,n(this,St,"f"),{containerId:n(this,gt,"f"),isMounted:n(this,Mt,"f"),type:this.type},t,n(this,Yt,"f"),n(this,Ut,"f"),n(this,Pt,"f"),n(this,Dt,"f")),n(this,Nt,"f")[o.elementName]=r,n(this,bt,"f")[e]=r}return t||i.forEach((e=>{const t=e.elementName;n(this,Nt,"f")[t]?n(this,Nt,"f")[t].update(e):n(this,Nt,"f")[t]=this.create(e.elementType,r)})),r})),kt.set(this,(e=>{Object.keys(n(this,Nt,"f")).forEach((t=>{t===e&&delete n(this,Nt,"f")[t]}))})),Yt.set(this,(e=>{e.forEach((e=>{n(this,kt,"f").call(this,e)}))})),Ut.set(this,(e=>{e.forEach((e=>{n(this,Nt,"f")[e.elementName]&&n(this,Nt,"f")[e.elementName].update(e)}))})),xt.set(this,(e=>{const t=Object.keys(n(this,Nt,"f"));for(let i=0;i<t.length;i+=1)if(atob(t[i].split(":")[2])===e)return!0;return!1})),this.validate=()=>new Promise(((e,t)=>{Object.values(n(this,Nt,"f")).forEach((e=>{if(!e.isMounted())throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED);e.isValidElement()})),this.bus.emit(te+n(this,gt,"f"),{},(t=>{e(t)}))})),this.collect=(e={tokens:!0})=>new Promise(((t,i)=>{try{if(Ge(n(this,St,"f").clientJSON.config),Object.values(n(this,Nt,"f")).forEach((e=>{if(!e.isMounted())throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED);e.isValidElement()})),Object.prototype.hasOwnProperty.call(e,"tokens")&&!He(e.tokens))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS);(null==e?void 0:e.additionalFields)&&je(e.additionalFields),(null==e?void 0:e.upsert)&&ze(null==e?void 0:e.upsert),this.bus.emit(q+n(this,gt,"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)?(xe(`${JSON.stringify(null==e?void 0:e.error)}`,Me.ERROR,n(this,Pt,"f").logLevel),i(null==e?void 0:e.error)):(xe(Fe(B.COLLECT_SUBMIT_SUCCESS,Ft),Me.LOG,n(this,Pt,"f").logLevel),t(e))})),xe(Fe(B.EMIT_EVENT,Ft,q),Me.LOG,n(this,Pt,"f").logLevel)}catch(e){xe(`${e.message}`,Me.ERROR,n(this,Pt,"f").logLevel),i(e)}})),this.unmount=()=>{this.iframe.remove()},this.bus=U.getEventBus(),o(this,gt,Tt(),"f"),o(this,St,t,"f"),o(this,bt,i,"f"),o(this,Pt,r,"f"),o(this,Dt,new Le,"f"),this.iframe=Re({name:`${G}:${n(this,gt,"f")}:${n(this,Pt,"f").logLevel}`}),Oe(this.iframe,{src:Te()}),Ce(this.iframe,Object.assign({},de)),xe(Fe(B.CREATE_COLLECT_CONTAINER,Ft),Me.LOG,n(this,Pt,"f").logLevel);const a=(e,i)=>{e.name===G+n(this,gt,"f")&&(i(Object.assign(Object.assign({},t),{clientJSON:Object.assign(Object.assign({},t.clientJSON),{config:Object.assign({},t.clientJSON.config)}),context:r})),o(this,Mt,!0,"f"),n(this,Dt,"f")._emit(ne,{containerId:n(this,gt,"f")}),this.bus.target({origin:Ae.IFRAME_SECURE_ORGIN}).off(W+n(this,gt,"f"),a))};this.bus.target({origin:Ae.IFRAME_SECURE_ORGIN}).on(W+n(this,gt,"f"),a),document.body.append(this.iframe)}}var jt,Vt,Gt,Xt,zt,Ht,Wt,qt,$t,Kt,Jt,Zt,Qt,ei,ti,ii,ni,oi,si,ri,ai,li,ci;gt=new WeakMap,Nt=new WeakMap,St=new WeakMap,Pt=new WeakMap,bt=new WeakMap,Dt=new WeakMap,Mt=new WeakMap,wt=new WeakMap,kt=new WeakMap,Yt=new WeakMap,Ut=new WeakMap,xt=new WeakMap;class di{constructor(e,t){jt.set(this,void 0),Vt.set(this,void 0),this.type=gi.COMPOSABLE,Gt.set(this,!1),Xt.set(this,!1),this.update=e=>{o(this,Xt,!0,"f"),n(this,Gt,"f")?(n(this,Vt,"f")._emit(ee,{elementName:n(this,jt,"f"),elementOptions:e}),o(this,Xt,!1,"f")):n(this,Xt,"f")&&n(this,Vt,"f").on(`${Pe.READY}:${n(this,jt,"f")}`,(()=>{n(this,Vt,"f")._emit(ee,{elementName:n(this,jt,"f"),elementOptions:e}),o(this,Gt,!0,"f"),o(this,Xt,!1,"f")}))},o(this,jt,e,"f"),o(this,Vt,t,"f"),n(this,Vt,"f").on(`${Pe.READY}:${n(this,jt,"f")}`,(()=>{o(this,Gt,!0,"f")}))}on(e,t){if(!Object.values(H).includes(e))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER);if(!t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER);if("function"!=typeof t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER);n(this,Vt,"f").on(`${e}:${n(this,jt,"f")}`,(e=>{if(void 0===e.value&&(e.value=""),"CARD_NUMBER"===e.elementType&&e.value){const{value:t}=e;e.value=t.slice(0,8)}delete e.isComplete,delete e.name,t(e)}))}}jt=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,Xt=new WeakMap;const ui="CollectContainer";class _i extends Ct{constructor(e,t,i,a){super(),zt.set(this,void 0),Ht.set(this,{}),Wt.set(this,void 0),qt.set(this,{rows:[]}),$t.set(this,[]),Kt.set(this,void 0),Jt.set(this,void 0),Zt.set(this,void 0),Qt.set(this,!1),ei.set(this,void 0),ti.set(this,void 0),this.type=gi.COMPOSABLE,ii.set(this,!1),ni.set(this,{}),this.create=(e,t={required:!1})=>{Xe(e,n(this,Kt,"f").logLevel);const i=Ot(e),o=Rt(e.type,t,n(this,Kt,"f").logLevel),s=`${X}:${e.type}:${btoa(Tt())}`;return n(this,$t,"f").push(Object.assign(Object.assign(Object.assign({elementType:e.type,name:e.column},e),o),{validations:i,elementName:s})),new di(s,n(this,Zt,"f"))},oi.set(this,((e,t=!1)=>{const i=[];if(o(this,ni,ge(e),"f"),n(this,ni,"f").rows.forEach((e=>{e.elements.forEach((e=>{const t=e,{elementType:n}=t;Lt(n,t),t.sensitive=t.sensitive||ae[n].sensitive,t.replacePattern=t.replacePattern||ae[n].replacePattern,t.mask=t.mask||ae[n].mask,t.isMounted=!1,t.label=e.label,t.skyflowID=e.skyflowID,i.push(t)}))})),n(this,ni,"f").elementName=t?i[0].elementName:`${X}:group:${btoa(n(this,ni,"f").name)}`,t&&!n(this,Ht,"f")[i[0].elementName]&&n(this,li,"f").call(this,i[0].name))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_UNIQUE_ELEMENT_NAME);let r=n(this,Ht,"f")[n(this,ni,"f").elementName];if(r)t?r.update(i[0]):r.update(n(this,ni,"f"));else{const e=Tt();r=new yt(e,n(this,ni,"f"),n(this,Wt,"f"),{containerId:n(this,zt,"f"),isMounted:n(this,ii,"f"),type:this.type},!0,n(this,ri,"f"),n(this,ai,"f"),n(this,Kt,"f"),n(this,Zt,"f")),n(this,Ht,"f")[n(this,ni,"f").elementName]=r,n(this,Jt,"f")[e]=r}return r})),si.set(this,(e=>{Object.keys(n(this,Ht,"f")).forEach((t=>{t===e&&delete n(this,Ht,"f")[t]}))})),ri.set(this,(e=>{e.forEach((e=>{n(this,si,"f").call(this,e)}))})),ai.set(this,(e=>{e.forEach((e=>{n(this,Ht,"f")[e.elementName]&&n(this,Ht,"f")[e.elementName].update(e)}))})),li.set(this,(e=>{const t=Object.keys(n(this,Ht,"f"));for(let i=0;i<t.length;i+=1)if(atob(t[i].split(":")[2])===e)return!0;return!1})),this.on=(e,t)=>{if(!Object.values(H).includes(e))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_EVENT_LISTENER);if(!t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_HANDLER_IN_EVENT_LISTENER);if("function"!=typeof t)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_HANDLER_IN_EVENT_LISTENER);n(this,Zt,"f").on(H.SUBMIT,(()=>{t()}))},this.mount=e=>{if(!e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_ELEMENT_IN_MOUNT);const{layout:t}=n(this,ei,"f");if((t||[]).reduce(((e,t)=>e+(i?i(t):t)),0)!==n(this,$t,"f").length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISMATCH_ELEMENT_COUNT_LAYOUT_SUM);var i;let r=0;if(t.forEach(((e,t)=>{n(this,qt,"f").rows=[...n(this,qt,"f").rows,{elements:[]}];for(let i=0;i<e;i++)n(this,qt,"f").rows[t].elements.push(n(this,$t,"f")[r]),r++})),n(this,ei,"f").styles&&(n(this,qt,"f").styles=Object.assign({},n(this,ei,"f").styles)),n(this,ei,"f").errorTextStyles&&(n(this,qt,"f").errorTextStyles=Object.assign({},n(this,ei,"f").errorTextStyles)),n(this,ii,"f"))return o(this,ti,n(this,oi,"f").call(this,n(this,qt,"f"),!1),"f"),n(this,ti,"f").mount(e),void o(this,Qt,!0,"f");n(this,Zt,"f").on(ie+n(this,zt,"f"),(()=>{o(this,ti,n(this,oi,"f").call(this,n(this,qt,"f"),!1),"f"),n(this,ti,"f").mount(e),o(this,Qt,!0,"f")}))},this.unmount=()=>{var e;null===(e=n(this,ti,"f"))||void 0===e||e.unmount(),this.iframe.remove()},this.validate=()=>new Promise(((e,t)=>{Object.values(n(this,Ht,"f")).forEach((e=>{if(!e.isMounted())throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED);e.isValidElement()})),this.bus.emit(te+n(this,zt,"f"),{},(t=>{e(t)}))})),this.collect=(e={tokens:!0})=>new Promise(((t,i)=>{try{if(Ge(n(this,Wt,"f").clientJSON.config),!n(this,Qt,"f")){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CARD_FORM_COLLECT_ELEMENT_NOT_MOUNTED);throw r.PayrailsLogger.error(e.message,{error:e}),e}if(ft(n(this,ni,"f")).forEach((e=>{if(!(null==e?void 0:e.isMounted))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_UI_ELEMENT_MISSING)})),Object.values(n(this,Ht,"f")).forEach((e=>{e.isValidElement()})),e&&e.tokens&&"boolean"!=typeof e.tokens)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_TOKENS);(null==e?void 0:e.additionalFields)&&je(e.additionalFields),(null==e?void 0:e.upsert)&&ze(null==e?void 0:e.upsert),this.bus.emit(q+n(this,zt,"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)?(xe(`${JSON.stringify(null==e?void 0:e.error)}`,Me.ERROR,n(this,Kt,"f").logLevel),i(null==e?void 0:e.error)):(xe(Fe(B.COLLECT_SUBMIT_SUCCESS,ui),Me.LOG,n(this,Kt,"f").logLevel),t(e))})),xe(Fe(B.EMIT_EVENT,ui,q),Me.LOG,n(this,Kt,"f").logLevel)}catch(e){xe(`${e.message}`,Me.ERROR,n(this,Kt,"f").logLevel),i(e)}})),ci.set(this,(()=>{n(this,Zt,"f").on(ee,(e=>{let t;const i=n(this,$t,"f").map(((i,n)=>i.elementName===e.elementName?(t=n,Object.assign({elementName:i.elementName},e.elementOptions)):i));n(this,ti,"f")&&n(this,ti,"f").updateElement(Object.assign({},i[t]))}))})),this.bus=U.getEventBus(),o(this,zt,Tt(),"f"),o(this,Wt,t,"f"),o(this,Jt,i,"f"),o(this,Kt,a,"f"),o(this,ei,e,"f"),o(this,Zt,new Le,"f"),this.iframe=Re({name:`${G}:${n(this,zt,"f")}:${n(this,Kt,"f").logLevel}`}),Oe(this.iframe,{src:Te()}),Ce(this.iframe,Object.assign({},de)),xe(Fe(B.CREATE_COLLECT_CONTAINER,ui),Me.LOG,n(this,Kt,"f").logLevel);const l=(e,i)=>{e.name===G+n(this,zt,"f")&&(i(Object.assign(Object.assign({},t),{clientJSON:Object.assign(Object.assign({},t.clientJSON),{config:Object.assign({},t.clientJSON.config)}),context:a})),o(this,ii,!0,"f"),n(this,Zt,"f")._emit(ie+n(this,zt,"f"),{containerId:n(this,zt,"f")}),this.bus.target({origin:Ae.IFRAME_SECURE_ORGIN}).off(W+n(this,zt,"f"),l))};this.bus.target({origin:Ae.IFRAME_SECURE_ORGIN}).on(W+n(this,zt,"f"),l),document.body.append(this.iframe),n(this,ci,"f").call(this)}}function pi(e){this.message=e}zt=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,qt=new WeakMap,$t=new WeakMap,Kt=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,ci=new WeakMap,pi.prototype=new Error,pi.prototype.name="InvalidCharacterError";var Ei="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new pi("'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 hi(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(Ei(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 Ei(t)}}function Ii(e){this.message=e}Ii.prototype=new Error,Ii.prototype.name="InvalidTokenError";const vi=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 Ii("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse(hi(e.split(".")[i]))}catch(e){throw new Ii("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 mi,yi,Li,Ai,fi,Oi,Ri,Ti,Ci,gi,Ni={name:"skyflow-js",preferGlobal:!0,analyze:!1,version:"1.30.1",author:"Skyflow",description:"Skyflow JavaScript SDK"};class Si{constructor(e,t){mi.set(this,void 0),this.request=e=>new Promise(((t,i)=>{var o,r,a,l;const c=new XMLHttpRequest;if(c){if(c.open(e.requestMethod,e.url),e.headers){const t=function(e,t,i){var n,o,s,r,a;const l={sdkName:e.name,sdkVersion:e.version},c=function(e,t){return""!==e?`${e}`:`${t.sdkName}@${t.sdkVersion}`}(t.sdkVersion,l),d=function(e){var t,i,n,o,s,r,a,l,c,d,u,_;let p=null,E=null;return/Windows/.test(e)?(p="Windows",E=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)?(p="Android",E=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)?(p="iOS",E=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)?(p="Mac OS X",E=null!==(d=null===(c=null===(l=/Mac OS X (\d+([._]\d+)*)/.exec(e))||void 0===l?void 0:l[1])||void 0===c?void 0:c.replace(/_/g,"."))&&void 0!==d?d:null):/Linux/.test(e)&&(p="Linux",E=null!==(_=null===(u=/Linux( \w+)*?\/([\w.]+)/.exec(e))||void 0===u?void 0:u[2])&&void 0!==_?_:null),{os:p,version:E}}(i.userAgent),u=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:c,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=d.os)&&void 0!==o?o:""} ${null!==(s=d.version)&&void 0!==s?s:""}`,sdk_runtime_details:`${null!==(r=u.browserName)&&void 0!==r?r:""} ${null!==(a=u.browserVersion)&&void 0!==a?a:""}`}}(Ni,n(this,mi,"f"),navigator);e.headers["sky-metadata"]=JSON.stringify(t);const{headers:i}=e;Object.keys(e.headers).forEach((e=>{"content-type"===e&&i[e]&&i[e].includes(ve.FORMDATA)||c.setRequestHeader(e,i[e])}))}(null===(r=null===(o=e.headers)||void 0===o?void 0:o["content-type"])||void 0===r?void 0:r.includes(ve.FORMURLENCODED))||(null===(l=null===(a=e.headers)||void 0===a?void 0:a["content-type"])||void 0===l?void 0:l.includes(ve.FORMDATA))?c.send(e.body):c.send(JSON.stringify(Object.assign({},e.body))),c.onload=()=>{var e,n,o;const r=c.getAllResponseHeaders().trim().split(/[\r\n]+/),a={};r.forEach((e=>{const t=e.split(": "),i=t.shift()||"",n=t.join(": ");a[i]=n}));const l=a["content-type"],d=a["x-request-id"];if(c.status<200||c.status>=400)if(l&&l.includes("application/json")){let t=JSON.parse(c.response);(null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.message)&&(t=d?`${null===(n=null==t?void 0:t.error)||void 0===n?void 0:n.message} - requestId: ${d}`:null===(o=null==t?void 0:t.error)||void 0===o?void 0:o.message),i(new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR,{description:t}))}else l&&l.includes("text/plain")?i(new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR,{description:d?`${c.response} - requestId: ${d}`:c.response})):i(new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR,{description:d?`${j.ERROR_OCCURED} - requestId: ${d}`:j.ERROR_OCCURED}));l&&l.includes("application/json")&&t(JSON.parse(c.response)),t(c.response)},c.onerror=()=>{i(new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_VAULT_NETWORK_ERROR))}}else i(new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_VAULT_CONNECTION_ERROR))})),this.config=e,o(this,mi,t,"f")}toJSON(){return{config:this.config,metaData:n(this,mi,"f")}}static fromJSON(e){return new Si(e.config,e.metaData)}}mi=new WeakMap,function(e){e.COLLECT="COLLECT",e.COMPOSABLE="COMPOSABLE"}(gi||(gi={}));const Pi="Skyflow";class bi{constructor(e){var t,i;yi.set(this,void 0),Li.set(this,Tt()),Ai.set(this,{uuid:n(this,Li,"f"),clientDomain:window.location.origin}),fi.set(this,""),Oi.set(this,void 0),Ri.set(this,void 0),Ti.set(this,void 0),Ci.set(this,void 0),this.bus=U.getEventBus();const a=localStorage.getItem("sdk_version")||"";n(this,Ai,"f").sdkVersion=a,o(this,yi,new Si(Object.assign({},e),n(this,Ai,"f")),"f"),o(this,Ri,(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.logLevel)||be.ERROR,"f"),o(this,Ti,(null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.env)||De.PROD,"f"),o(this,Ci,{},"f"),this.bus.on(z,(e=>{if(e&&e.errorCode){const t=new s.PayrailsError(e.errorCode,{cause:null==e?void 0:e.originalError});r.PayrailsLogger.error(t.message,{error:t})}})),this.bus.target({origin:Ae.IFRAME_SECURE_ORGIN}).on(Z+n(this,Li,"f"),((e,t)=>{xe(Fe(B.CAPTURED_BEARER_TOKEN_EVENT,Pi),Me.LOG,n(this,Ri,"f")),!n(this,yi,"f").config.getBearerToken||n(this,fi,"f")&&vi(n(this,fi,"f"))?(xe(Fe(B.REUSE_BEARER_TOKEN,Pi),Me.LOG,n(this,Ri,"f")),t({authToken:n(this,fi,"f")})):n(this,yi,"f").config.getBearerToken().then((e=>{vi(e)?(xe(Fe(B.BEARER_TOKEN_RESOLVED,Pi),Me.LOG,n(this,Ri,"f")),o(this,fi,e,"f"),t({authToken:n(this,fi,"f")})):(xe(j.INVALID_BEARER_TOKEN,Me.ERROR,n(this,Ri,"f")),t({error:j.INVALID_BEARER_TOKEN}))})).catch((e=>{xe(j.BEARER_TOKEN_REJECTED,Me.ERROR,n(this,Ri,"f")),t({error:e})}))})),xe(Fe(B.BEARER_TOKEN_LISTENER,Pi),Me.LOG,n(this,Ri,"f")),xe(Fe(B.CURRENT_ENV,Pi,n(this,Ti,"f")),Me.LOG,n(this,Ri,"f")),xe(Fe(B.CURRENT_LOG_LEVEL,Pi,n(this,Ri,"f")),Me.LOG,n(this,Ri,"f"))}static init(e){var t;const i=(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.logLevel)||be.ERROR;$e(e),xe(Fe(B.INITIALIZE_CLIENT,Pi),Me.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 bi(n);return xe(Fe(B.CLIENT_INITIALIZED,Pi),Me.LOG,i),s}container(e,t){switch(e){case gi.COLLECT:{const i=new Bt(t,Object.assign(Object.assign({},n(this,Ai,"f")),{clientJSON:n(this,yi,"f").toJSON(),containerType:e}),n(this,Ci,"f"),{logLevel:n(this,Ri,"f"),env:n(this,Ti,"f")});return xe(Fe(B.COLLECT_CONTAINER_CREATED,Pi),Me.LOG,n(this,Ri,"f")),i}case gi.COMPOSABLE:{(e=>{if(!e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_CONTAINER_OPTIONS);if("object"!=typeof e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COMPOSABLE_CONTAINER_OPTIONS_INVALID);if(!Object.prototype.hasOwnProperty.call(e,"layout"))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_MISSING_COMPOSABLE_LAYOUT_KEY);if(!e.layout)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE);if(!Array.isArray(e.layout))throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE);if(0===e.layout.length)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_COMPOSABLE_LAYOUT_ARRAY);e.layout.forEach((e=>{if("number"!=typeof e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_COMPOSABLE_LAYOUT_TYPE);if(e<0)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_NEGATIVE_VALUES_COMPOSABLE_LAYOUT)}))})(t);const i=new _i(t,Object.assign(Object.assign({},n(this,Ai,"f")),{clientJSON:n(this,yi,"f").toJSON(),containerType:e}),n(this,Ci,"f"),{logLevel:n(this,Ri,"f"),env:n(this,Ti,"f")});return xe(Fe(B.COLLECT_CONTAINER_CREATED,Pi),Me.LOG,n(this,Ri,"f")),i}default:if(!e)throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_EMPTY_CONTAINER_TYPE);throw new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_INVALID_CONTAINER_TYPE)}}static get ContainerType(){return gi}static get ElementType(){return oe}static get RedactionType(){return Ne}static get RequestMethod(){return Se}static get LogLevel(){return be}static get EventName(){return Pe}static get Env(){return De}static get ValidationRuleType(){return we}}function Di(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,n,o=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:{}}),s=o.queryParams,r=o.dataAttributes;return{url:"".concat(t,"?").concat((i=s,n="",Object.keys(i).forEach((function(e){0!==n.length&&(n+="&"),n+=e+"="+i[e]})),n)),dataAttributes:r}}function Mi(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 wi(e,t){if(void 0===t&&(t=ki()),Ui(e,t),"undefined"==typeof window)return t.resolve(null);var i=Di(e),n=i.url,o=i.dataAttributes,s=o["data-namespace"]||"paypal",r=Yi(s);
|
|
@@ -22,4 +22,4 @@ return function(e,t){var i=document.querySelector('script[src="'.concat(e,'"]'))
|
|
|
22
22
|
/* @copyright
|
|
23
23
|
Copyright (c) 2023 Payrails (https://www.payrails.com/)
|
|
24
24
|
*/
|
|
25
|
-
class Hn{static init(t,i){var n,o,a,l,c,d,u,_,p,E,h,I;try{const s="5.25.
|
|
25
|
+
class Hn{static init(t,i){var n,o,a,l,c,d,u,_,p,E,h,I;try{const s="5.25.3-RC.0",v="web-sdk";zn({version:s,packageName:v}),r.PayrailsLogger.init({enabled:(null===(n=null==i?void 0:i.telemetry)||void 0===n?void 0:n.enabled)||!0,logLevel:(null===(o=null==i?void 0:i.telemetry)||void 0===o?void 0:o.logLevel)||"error",environment:(null==i?void 0:i.environment)||"TEST",sdk:{name:v,version:s}}),S(t);const m=N();r.PayrailsLogger.setState({payrails:{execution_id:null===(a=null==m?void 0:m.execution)||void 0===a?void 0:a.id,holder_reference:null==m?void 0:m.holderReference,vault_provider:null===(l=null==m?void 0:m.vaultConfiguration)||void 0===l?void 0:l.vaultType,merchant_reference:null===(c=null==m?void 0:m.execution)||void 0===c?void 0:c.merchantReference,workflow:{code:(null===(u=null===(d=null==m?void 0:m.execution)||void 0===d?void 0:d.workflow)||void 0===u?void 0:u.code)||"",version:(null===(p=null===(_=null==m?void 0:m.execution)||void 0===_?void 0:_.workflow)||void 0===p?void 0:p.version)||0}}});const{vaultConfiguration:{vaultId:y,vaultUrl:L,token:A},execution:f}=m;null===(E=m.vaultConfiguration)||void 0===E||E.vaultId;const O=bi.init({vaultID:y,vaultURL:L,getBearerToken:()=>A?Promise.resolve(A):Promise.resolve(""),options:{initResponse:t,deserializedData:Object.assign({},m),logLevel:(null===(I=null===(h=null==i?void 0:i.telemetry)||void 0===h?void 0:h.logLevel)||void 0===I?void 0:I.toUpperCase())||"ERROR"}});return f&&(C.setResponse(f),C.isPaymentMethodAvailable(e.PAYMENT_METHOD_CODES.CARD)&&xi.preloadCardForm()),new Hn(O,i)}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_CONFIG_MALFORMED,{cause:e});throw r.PayrailsLogger.error(t.message,{error:t}),t}}update(e){N().amount=e}collectContainer(e){var t;if("COMPOSABLE"===e.containerType&&!e.layout){const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_COLLECT_CONTAINER_MOUNT);throw r.PayrailsLogger.error(e.message,{error:e}),e}return this.__container=Xn.init(this.vaultClient,Object.assign(Object.assign({},e),{cardTableName:null===(t=N().vaultConfiguration)||void 0===t?void 0:t.cardTableName})),this.__container}googlePayButton(e){var t;return this.logIntegrationMode("elements"),new Yn(Object.assign({environment:null===(t=this.options)||void 0===t?void 0:t.environment},e))}isGooglePayAvailable(e){var t;return Yn.isGooglePayAvailable(C.googlePayConfig,null===(t=this.options)||void 0===t?void 0:t.environment,e)}applePayButton(e){return this.logIntegrationMode("elements"),new Vi(e)}isApplePayAvailable(){return Vi.isApplePayAvailable()}cardList(e){return this.logIntegrationMode("elements"),this.__cardList||(this.__cardList=new vn({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.logIntegrationMode("elements"),!this.__cardForm){const n=this.getContainerLayout(null==e?void 0:e.showCardHolderName,null==e?void 0:e.showSingleExpiryDateField,null==e?void 0:e.layout);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 dn(this.__container,Object.assign(Object.assign({},e),{events:Object.assign(Object.assign({},null==e?void 0:e.events),{onChange:t=>{var i;if(this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm)){const e=!!this.__cardPaymentButton.disabledByDefault&&!this.__cardForm.isValid;this.__cardPaymentButton.setDisabled(e)}(null===(i=null==e?void 0:e.events)||void 0===i?void 0:i.onChange)&&e.events.onChange(t)},onFocus:()=>{var t;if(this.__cardList&&this.__cardList.reset(),this.__cardPaymentButton&&(this.__cardPaymentButton.selectedInstrument=null,this.__cardForm)){const e=!!this.__cardPaymentButton.disabledByDefault&&!this.__cardForm.isValid;this.__cardPaymentButton.setDisabled(e)}(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,o,s,r;this.logIntegrationMode("dropin");const a=this.getContainerLayout(null===(i=null===(t=e.paymentMethodsConfiguration)||void 0===t?void 0:t.cards)||void 0===i?void 0:i.showCardHolderName,null===(o=null===(n=e.paymentMethodsConfiguration)||void 0===n?void 0:n.cards)||void 0===o?void 0:o.showSingleExpiryDateField,null===(r=null===(s=e.paymentMethodsConfiguration)||void 0===s?void 0:s.cards)||void 0===r?void 0:r.layout);return this.__container=this.collectContainer({layout:a,errorTextStyles:{base:{display:"none"}}}),this.__dropin=new Vn(this.__container,Object.assign({},this.options||{}),e),this.__dropin}getSavedCreditCards(){return this.logIntegrationMode("elements"),C.savedCreditCards}getSavedGooglePayAccounts(){return this.logIntegrationMode("elements"),C.savedGooglePayAccounts}getSavedApplePayAccounts(){return this.logIntegrationMode("elements"),C.savedApplePayAccounts}getStoredInstruments(){return this.logIntegrationMode("elements"),C.storedPaymentInstruments}getAvailablePaymentMethods(){return this.logIntegrationMode("elements"),C.availablePaymentMethods.map((({paymentMethodCode:e})=>e)).filter((e=>!!e))}paymentButton(e){var t;return this.logIntegrationMode("elements"),this.__cardPaymentButton||(this.__cardPaymentButton=new F(e,(null===(t=this.options)||void 0===t?void 0:t.returnInfo)||{})),this.__cardPaymentButton.setDisabled(!!e.disabledByDefault),this.__cardForm&&this.__cardPaymentButton.setCardForm(this.__cardForm),this.__cardPaymentButton}paypalButton(e){return this.logIntegrationMode("elements"),this.__paypalButton=new xn(Object.assign({},e)),this.__paypalButton}genericRedirectButton(e){return this.logIntegrationMode("elements"),this.__genericRedirectButton=new Dn(e),this.__genericRedirectButton}getSavedPaypalAccounts(){return this.logIntegrationMode("elements"),C.savedPaypalAccounts||[]}logIntegrationMode(e){r.PayrailsLogger.setState({sdk:{integration_mode:e}})}constructor(e,t){var n;this.vaultClient=e,this.options=t,(null===(n=null==t?void 0:t.events)||void 0===n?void 0:n.onClientInitialized)&&t.events.onClientInitialized(C),U.getEventBus().on("PAYRAILS_CLIENT_SESSION_EXPIRED",(()=>i(this,void 0,void 0,(function*(){var e,n,o;(null===(e=null==t?void 0:t.events)||void 0===e?void 0:e.onSessionExpired)&&(yield(o=null===(n=this.options)||void 0===n?void 0:n.events,i(void 0,void 0,void 0,(function*(){if(null==o?void 0:o.onSessionExpired)try{const e=yield o.onSessionExpired();if(e)S(e),(null==o?void 0:o.onClientInitialized)&&o.onClientInitialized(C);else{const e=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED,{description:"Session refresh failed with no result returned"});r.PayrailsLogger.error(e.message,{error:e})}}catch(e){const t=new s.PayrailsError(s.ERROR_CODES.PAYRAILS_CLIENT_SESSION_REFRESH_FAILED,{description:"Callback passed to onSessionExpired threw an error",cause:e});r.PayrailsLogger.error(t.message,{error:t})}}))))}))))}getContainerLayout(e,t,i){const n=[];return i?i.forEach((e=>{n.push(e.length)})):(n.push(1),e&&n.push(1),t?n.push(2):n.push(3)),n}binLookup(){return i(this,void 0,void 0,(function*(){var e,t;if(!this.__dropin&&!this.__cardForm&&!this.__container)return void console.warn("No container found");let i;return this.__dropin?i=yield this.__dropin.fetchBinLookup():this.__cardForm?i=yield null===(e=this.__cardForm)||void 0===e?void 0:e.fetchBinLookup():this.__container&&(i=yield null===(t=this.__container)||void 0===t?void 0:t.fetchBinLookup(this.__container.bin)),i}))}}var Wn;Hn.preloadCardForm=xi.preloadCardForm,e.PayrailsEnvironment=void 0,(Wn=e.PayrailsEnvironment||(e.PayrailsEnvironment={})).TEST="TEST",Wn.PRODUCTION="PRODUCTION",e.Payrails=Hn,window.Payrails=Hn}({});
|