1(()=>{"use strict";var e,t={838(e,t,r){r.r(t),r.d(t,{DEFAULT_BILLING_ADDRESS:()=>le,DEFAULT_SHIPPING_ADDRESS:()=>ce,StripeError:()=>C,canMakePayment:()=>H,deleteFromCache:()=>X,ensureErrorResponse:()=>w,ensureSuccessResponse:()=>S,filterEmptyValues:()=>L,formatPaymentMethod:()=>ie,formatPrice:()=>$,getBillingDetailsFromAddress:()=>P,getCreditCardForm:()=>_,getDefaultSourceArgs:()=>V,getDisplayItems:()=>B,getErrorMessage:()=>b,getFromCache:()=>Q,getIntermediateAddress:()=>U,getLocalPaymentMethods:()=>K,getLocaleFields:()=>A,getPage:()=>Z,getPaymentElementTerms:()=>ae,getRoute:()=>f,getSelectedShippingOption:()=>x,getSettings:()=>v,getShippingOptionId:()=>F,getShippingOptions:()=>T,handleCardAction:()=>R,handleNextAction:()=>D,hasShippingRates:()=>q,initStripe:()=>y,isAddressValid:()=>E,isCartPage:()=>ee,isCheckoutPage:()=>te,isEmpty:()=>I,isFieldRequired:()=>k,isKlarnaAvailable:()=>ne,isNextActionRequired:()=>re,isTestMode:()=>W,isUserLoggedIn:()=>j,mapLineItems:()=>N,registerCreditCardForm:()=>h,registerLocalPaymentMethod:()=>J,removeNumberPrecision:()=>O,storeInCache:()=>z,toCartAddress:()=>M,ucfirst:()=>oe});var n=r(37);const s=window.wc.wcSettings,a=(window.wp.apiFetch,window.wc.priceFormat),{publishableKey:i,stripeParams:o}=(0,s.getSetting)("stripeGeneralData"),c=(0,s.getSetting)("stripeErrorMessages"),l=(0,s.getSetting)("countryLocale",{}),p=/^([\w]+)\:(.+)$/,u=(0,s.getSetting)("stripeGeneralData").routes,d={},m=[],g={recipient:(e,t)=>(e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e),payerName:(e,t)=>(e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e),name:(e,t)=>(e.first_name=t.split(" ").slice(0,-1).join(" "),e.last_name=t.split(" ").pop(),e),country:"country",addressLine:(e,t)=>(t[0]&&(e.address_1=t[0]),t[1]&&(e.address_2=t[1]),e),line1:"address_1",line2:"address_2",city:"city",region:"state",state:"state",postalCode:"postcode",postal_code:"postcode",payerEmail:"email",payerPhone:"phone"},y=new Promise((e,t)=>{(0,n.c)(i,o).then(t=>{e(t)}).catch(t=>{e({error:t})})}),h=({id:e,...t})=>{d[e]=t},_=e=>d.hasOwnProperty(e)?d[e]:{},f=e=>u?.[e]?u[e]:console.log(`${e} is not a valid route`),S=(e,t={})=>({type:e.SUCCESS,...t}),w=(e,t,r={})=>({type:e.ERROR,message:b(t),...r}),b=e=>"string"==typeof e?e:e?.code&&c?.[e.code]?c[e.code]:e?.statusCode?c?.[e.statusCode]?c[e.statusCode]:e.statusMessage:e.message,P=e=>{let t={name:`${e.first_name} ${e.last_name}`,address:{city:e.city||null,country:e.country||null,line1:e.address_1||null,line2:e.address_2||null,postal_code:e.postcode||null,state:e.state||null}};return e?.phone&&(t.phone=e.phone),e?.email&&(t.email=e.email),t},v=e=>t=>t?(0,s.getSetting)(e)[t]:(0,s.getSetting)(e);class C extends Error{constructor(e){super(e.message),this.error=e}}const I=e=>"string"==typeof e?0==e.length||""==e:Array.isArray(e)?0==array.length:"object"!=typeof e||0==Object.keys(e).length,O=(e,t)=>e/10**t,E=(e,t=[])=>{const r=A(e.country);for(const[n,s]of Object.entries(e))if(!t.includes(n)&&r?.[n]&&r[n].required&&I(s))return!1;return!0},A=e=>{let t={...l.default};return e&&l?.[e]&&(t=Object.entries(l[e]).reduce((e,[t,r])=>(e[t]={...e[t],...r},e),t),["phone","shipping-phone","email"].forEach(e=>{let r=document.getElementById(e);r&&(t[e]={required:r.required})}
1)),t},k=(e,t=!1)=>{const r=(0,s.getSetting)("defaultFields");return r&&r.hasOwnProperty(e)?!!r[e]?.required:t},x=e=>{const t=e.match(p);if(t){const{1:e,2:r}=t;return[r,e]}return[]},q=e=>e.map(e=>e.shipping_rates.length>0).filter(Boolean).length>0,j=e=>e>0,R=async({args:e,stripe:t,redirectUrl:r,emitResponse:n})=>{try{let{type:r,status:s,return_url:a,client_secret:i}=e;if(["requires_action","requires_payment_method","requires_confirmation"].includes(s)){let e;if(e="payment_intent"===r?await t.confirmCardPayment(i):await t.confirmCardSetup(i),e.error)throw e.error;const s=new URL(a);return s.searchParams.append("payment_intent",e.paymentIntent.id),s.searchParams.append("payment_intent_client_secret",e.paymentIntent.client_secret),S(n.responseTypes,{redirectUrl:s.toString()})}return S(n.responseTypes)}catch(e){return console.log(e),w(n.responseTypes,e,{messageContext:n.noticeContexts.PAYMENTS})}},D=async({args:e,stripe:t,elements:r=null,billingAddress:n})=>{let{type:s,client_secret:a,status:i,return_url:o=null,confirmation_args:c=null}=e;if(["requires_action","requires_payment_method","requires_confirmation"].includes(i)){let e;if(e="payment_intent"===s?await t.confirmPayment({...r&&{elements:r},clientSecret:a,redirect:"if_required",confirmParams:{return_url:o,payment_method_data:{billing_details:P(n)},expand:["payment_method"],...c&&c}}):await t.confirmSetup({clientSecret:a,redirect:"if_required",confirmParams:{return_url:o,payment_method_data:{billing_details:P(n)},expand:["payment_method"]}}),e.error)throw e.error;if("payment_intent"===s){const t=e.paymentIntent?.status,r=e.paymentIntent?.next_action?.type;if("requires_action"===t&&"verify_with_microdeposits"!==r&&!r?.endsWith("_display_details"))throw{code:"payment_cancelled"};if("requires_payment_method"===t)throw{code:e.paymentIntent?.last_payment_error?.code,message:e.paymentIntent?.last_payment_error?.message}}else{const t=e.setupIntent?.status;if("requires_action"===t)throw{code:"payment_cancelled"};if("requires_payment_method"===t)throw{code:e.setupIntent?.last_setup_error?.code,message:e.setupIntent?.last_setup_error?.message}}const i=new URL(o);return"payment_intent"===s?(i.searchParams.append("payment_intent",e.paymentIntent.id),i.searchParams.append("payment_intent_client_secret",e.paymentIntent.client_secret)):(i.searchParams.append("setup_intent",e.setupIntent.id),i.searchParams.append("setup_intent_client_secret",e.setupIntent.client_secret)),{redirectUrl:i.toString()}}},M=(e=g)=>(t,r={})=>{const n={};t={...t,...L(r)};for(let[r,s]of Object.entries(e))t?.[r]&&("function"==typeof s?s(n,t[r]):n[s]=t[r]);return n},U=(e,t=["city","postcode","state","country"])=>{const r={};for(let n of t)r[n]=e[n];return r},L=e=>Object.keys(e).filter(t=>Boolean(e[t])).reduce((t,r)=>({...t,[r]:e[r]}),{}),$=(e,t)=>{const{prefix:r,suffix:n,decimalSeparator:s,minorUnit:i,thousandSeparator:o}=(0,a.getCurrency)(t);if(""==e||void 0===e)return e;e="string"==typeof e?parseInt(e,10):e;let c="";const l=(e=(e/=10**i).toString().replace(".",s)).indexOf(s);l<0?i>0&&(e+=`${s}${new Array(i+1).join("0")}`):(c=e.substr(l+1),c.length<i&&(e+=new Array(i-c.length+1).join("0")));const p=e.match(new RegExp(`(\\d+)\\${s}(\\d+)`));return p&&({1:e,2:c}=p),e=e.replace(new RegExp("\\B(?=(\\d{3})+(?!\\d))","g"),`${o}`),r+(e=c?.length>0?e+s+c:e)+n},T=(e,t={label:"label"})=>{let r=[];const n=[];return e.forEach((e,s)=>{[...e.shipping_rates].sort((e,t)=>(!0===t.selected)-(!0===e.selected)).forEach(e=>{const a=F(s,e.rate_id);!0===e.selected&&n.push(a);const i=document.createElement("textarea");i.innerHTML=e.name,r.push({id:a,[t.label]:i.value,amount:parseInt(e.price,10)})})}),r.length>9&&(r=[...r.filter(e=>n.includes(e.id)),...r.filter(e=>!n.includes(e.id))].slice(0,9)),r},F=(e,t)=>`${e}:${t}`,B=(e,{minorUnit:t})=>{let r=[];const n=["total_tax","total_shipping"];return e.forEach(e=>{(0<e.value||e.key&&n.includes(e.key))&&r.push({label:e.label,pending:!1,amount:e.value})}),r},N=e=>e.map(e=>({name:e.label,amount:e.amountCents})),G={},H=({country:e,currency:t,total:r},n)=>new Promise((s,a)=>{const i=[e,t,r.amount].reduce((e,t)=>
1`${e}-${t}`);return t?i in G?s(G[i]):y.then(o=>{if(o.error)return a(o.error);o.paymentRequest({country:e,currency:t,total:r}).canMakePayment().then(e=>(G[i]=n(e),s(G[i])))}).catch(a):s(!1)}),J=e=>{m.push(e)},K=()=>m,V=({type:e,amount:t,billingAddress:r,currency:n,returnUrl:s})=>({type:e,amount:t,currency:n,owner:P(r),redirect:{return_url:s}}),W=()=>"test"===(0,s.getSetting)("stripeGeneralData").mode,Y=e=>`stripe:${e}`,z=(e,t)=>{const r=Math.floor((new Date).getTime()/1e3)+900;"sessionStorage"in window&&sessionStorage.setItem(Y(e),JSON.stringify({value:t,exp:r}))},Q=e=>{if("sessionStorage"in window)try{const t=JSON.parse(sessionStorage.getItem(Y(e)));if(t){const{value:r,exp:n}=t;if(!(Math.floor((new Date).getTime()/1e3)>n))return r;X(Y(e))}}catch(e){}return null},X=e=>{"sessionStorage"in window&&sessionStorage.removeItem(Y(e))},Z=()=>(0,s.getSetting)("stripeGeneralData").page,ee=()=>"cart"===Z()&&!(0,s.getSetting)("isCheckoutBlock"),te=()=>"checkout"===Z()||!!(0,s.getSetting)("isCheckoutBlock"),re=e=>{let t=e.match(/#response=(.+)/),r=null;return t&&(r=JSON.parse(window.atob(decodeURIComponent(t[1])))),r},ne=({eea_countries:e,accountCountry:t,requiredParams:r,currency:n,country:s=null})=>{let a=!1;if(!s)return n in r;const i=[...e,"GB","CH"];return i.includes(t)?i.includes(s)&&(a=n in r&&r[n].includes(s)):a=n in r&&r[n].includes(s),a},se=["applePay","auBecsDebit","bancontact","card","cashapp","googlePay","ideal","paypal","sepaDebit","sofort","usBankAccount"],ae=e=>se.reduce((t,r)=>(t[r]=e,t),{}),ie=(e,t)=>{const r={};Object.keys(t).forEach(e=>{r[`{${e}}`]=t[e]});let n=e;return Object.keys(r).forEach(e=>{for(;n.includes(e);)n=n.replace(e,r[e])}),n},oe=e=>e.charAt(0).toUpperCase()+e.slice(1),ce={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},le={...ce,email:""}}},r={};function n(e){var s=r[e];if(void 0!==s)return s.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,e=[],n.O=(t,r,s,a)=>{if(!r){var i=1/0;for(p=0;p<e.length;p++){for(var[r,s,a]=e[p],o=!0,c=0;c<r.length;c++)(!1&a||i>=a)&&Object.keys(n.O).every(e=>n.O[e](r[c]))?r.splice(c--,1):(o=!1,a<i&&(i=a));if(o){e.splice(p--,1);var l=s();void 0!==l&&(t=l)}}return t}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[r,s,a]},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={508:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var s,a,[i,o,c]=r,l=0;if(i.some(t=>0!==e[t])){for(s in o)n.o(o,s)&&(n.m[s]=o[s]);if(c)var p=c(n)}for(t&&t(r);l<i.length;l++)a=i[l],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(p)},r=self.webpackChunkwcStripe=self.webpackChunkwcStripe||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var s=n.O(void 0,[910],()=>n(838));s=n.O(s),(this.wcStripe=this.wcStripe||{}).blocksUtils=s})(); 2//# sourceMappingURL=blocks-utils.js.map
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.