1const TOKENIZATION_SECURE_FIELDS=["cardNumber","expirationDate","securityCode"],TOKENIZATION_MESSAGE_SECURITY_FIELDS="invalid_security_fields",TOKENIZATION_MESSAGE_CARDHOLDER_FIELDS="invalid_cardholder_fields",TOKENIZATION_FIELD_BY_NON_PCI_CODE={221:"cardholderName",316:"cardholderName",212:"document",322:"document",214:"document",324:"document"};function normalizeTokenizationField(e){return"expirationMonth"===e||"expirationYear"===e?"expirationDate":e}function tokenizationFieldOf(e){return e?.field&&e?.details?.reason?normalizeTokenizationField(e.field):e?.code&&TOKENIZATION_FIELD_BY_NON_PCI_CODE[e.code]||null}function dedupeJoin(e){return[...new Set(e.filter(Boolean))].join(",")}function classifyTokenizationError(e){const n=[],i=[],o=[],t=[];if(e.forEach((e=>{const r=tokenizationFieldOf(e);r&&TOKENIZATION_SECURE_FIELDS.includes(r)?n.includes(r)||n.push(r):"cardholderName"===r?i.push(e?.message):"document"===r?o.push(e?.message):e?.message&&t.push(e.message)})),n.length){return{message:"invalid_security_fields",reason:TOKENIZATION_SECURE_FIELDS.filter((e=>n.includes(e))).join(",")}}const r=dedupeJoin([...i,...o,...t]);return i.length||o.length?{message:"invalid_cardholder_fields",reason:r}:{message:null,reason:r||"unknown"}}async function callSdkWithMetrics(e,n){try{return await e()}catch(e){const i=String(e?.status??0),o="undefined"!=typeof document&&"custom"===document.querySelector("#mp_checkout_type")?.value&&"createCardToken"===n&&Array.isArray(e)&&e.some((e=>e?.details?.reason||e?.code))?classifyTokenizationError(e):null,t=o&&o.message||("string"==typeof e?e:null)||e?.message||e?.cause?.[0]?.description||"Unknown SDK error";if("function"==typeof window.sendMetric){const e={api_route:n};o&&(e.reason=o.reason),window.sendMetric(i,t,"mp_api_error",e)}throw e}}window.callSdkWithMetrics=callSdkWithMetrics;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.