File: //proc/thread-self/cwd/wp-content/plugins/woocommerce-payments/dist/multi-currency.js
/*! For license information please see multi-currency.js.LICENSE.txt */
(()=>{var e={5955:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-checkmark",i,!1,!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},9387:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-cross-circle",i,!1,!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M19.1 4.9C15.2 1 8.8 1 4.9 4.9S1 15.2 4.9 19.1s10.2 3.9 14.1 0 4-10.3.1-14.2zm-4.3 11.3L12 13.4l-2.8 2.8-1.4-1.4 2.8-2.8-2.8-2.8 1.4-1.4 2.8 2.8 2.8-2.8 1.4 1.4-2.8 2.8 2.8 2.8-1.4 1.4z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},4275:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-info-outline",i,!!function(e){return 0==e%18}(r)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},9031:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-notice-outline",i,!!function(e){return 0==e%18}(r)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},5338:(e,t,r)=>{"use strict";var o=r(5795);t.H=o.createRoot,o.hydrateRoot},1020:(e,t,r)=>{"use strict";var o=r(1609),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var o,a={},d=null,u=null;for(o in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,o)&&!c.hasOwnProperty(o)&&(a[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===a[o]&&(a[o]=t[o]);return{$$typeof:n,type:e,key:d,ref:u,props:a,_owner:i.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},4848:(e,t,r)=>{"use strict";e.exports=r(1020)},1609:e=>{"use strict";e.exports=window.React},5795:e=>{"use strict";e.exports=window.ReactDOM}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var n=o.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=o[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.p=window.wcpayAssets.url,(()=>{"use strict";var e={};r.r(e),r.d(e,{getAllDepositsOverviews:()=>Re,getAllDepositsOverviewsError:()=>be,getDeposit:()=>Te,getDepositQueryError:()=>Ae,getDeposits:()=>Oe,getDepositsCount:()=>Ie,getDepositsSummary:()=>Ce,getDepositsSummaryError:()=>xe,getInstantDeposit:()=>Pe});var t={};r.r(t),r.d(t,{submitInstantDeposit:()=>Ge,updateAllDepositsOverviews:()=>ze,updateDeposit:()=>Le,updateDeposits:()=>Be,updateDepositsCount:()=>Ye,updateDepositsSummary:()=>Ve,updateErrorForAllDepositsOverviews:()=>$e,updateErrorForDepositQuery:()=>qe,updateErrorForDepositsSummary:()=>He,updateInstantDeposit:()=>We});var o={};r.r(o),r.d(o,{getAllDepositsOverviews:()=>Ze,getDeposit:()=>Qe,getDeposits:()=>et,getDepositsSummary:()=>tt,getPayoutsCSVRequestURL:()=>Xe,payoutsDownloadEndpoint:()=>Ke});var n={};r.r(n),r.d(n,{getFraudOutcomeTransactions:()=>mt,getFraudOutcomeTransactionsError:()=>pt,getFraudOutcomeTransactionsSummary:()=>yt,getFraudOutcomeTransactionsSummaryError:()=>ht,getTransactions:()=>st,getTransactionsError:()=>it,getTransactionsSummary:()=>dt,getTransactionsSummaryError:()=>ut});var a={};r.r(a),r.d(a,{updateErrorForFraudOutcomeTransactions:()=>Tt,updateErrorForFraudOutcomeTransactionsSummary:()=>bt,updateErrorForTransactions:()=>gt,updateErrorForTransactionsSummary:()=>ft,updateFraudOutcomeTransactions:()=>wt,updateFraudOutcomeTransactionsSummary:()=>Rt,updateTransactions:()=>St,updateTransactionsSummary:()=>Et});var s={};r.r(s),r.d(s,{formatQueryFilters:()=>vt,getFraudOutcomeTransactions:()=>Ct,getFraudOutcomeTransactionsExport:()=>Pt,getFraudOutcomeTransactionsSummary:()=>xt,getTransactions:()=>Ot,getTransactionsCSVRequestURL:()=>At,getTransactionsSummary:()=>Nt,transactionsDownloadEndpoint:()=>It});var i={};r.r(i),r.d(i,{getCharge:()=>Dt,getChargeError:()=>Mt,getChargeFromOrder:()=>Ft,getChargeFromOrderError:()=>Ut});var c={};r.r(c),r.d(c,{updateCharge:()=>kt,updateErrorForCharge:()=>Lt});var d={};r.r(d),r.d(d,{getCharge:()=>zt,getChargeFromOrder:()=>$t});var u={};r.r(u),r.d(u,{getTimeline:()=>Yt,getTimelineError:()=>qt});var l={};r.r(l),r.d(l,{updateErrorForTimeline:()=>Ht,updateTimeline:()=>Vt});var m={};r.r(m),r.d(m,{getTimeline:()=>Wt});var p={};r.r(p),r.d(p,{getCachedDispute:()=>Xt,getDispute:()=>Jt,getDisputeError:()=>Kt,getDisputes:()=>er,getDisputesSummary:()=>tr});var _={};r.r(_),r.d(_,{refundCharge:()=>sr,updateErrorForPaymentIntent:()=>ar,updatePaymentIntent:()=>nr});var y={};r.r(y),r.d(y,{getPaymentIntent:()=>ir});var h={};r.r(h),r.d(h,{acceptDispute:()=>mr,updateDispute:()=>cr,updateDisputes:()=>ur,updateDisputesSummary:()=>lr,updateErrorForDispute:()=>dr});var S={};r.r(S),r.d(S,{disputesDownloadEndpoint:()=>Er,getDispute:()=>wr,getDisputes:()=>Tr,getDisputesCSVRequestURL:()=>fr,getDisputesSummary:()=>Rr});var g={};r.r(g),r.d(g,{getAccountBusinessSupportEmail:()=>zr,getAccountBusinessSupportPhone:()=>$r,getAccountCommunicationsEmail:()=>Io,getAccountDomesticCurrency:()=>Br,getAccountStatementDescriptor:()=>Ur,getAccountStatementDescriptorKana:()=>Lr,getAccountStatementDescriptorKanji:()=>kr,getAdvancedFraudProtectionSettings:()=>wo,getAvailablePaymentMethodIds:()=>jr,getCompletedWaitingPeriod:()=>Wr,getCurrentProtectionLevel:()=>fo,getDepositDelayDays:()=>Hr,getDepositRestrictions:()=>Qr,getDepositScheduleInterval:()=>Yr,getDepositScheduleMonthlyAnchor:()=>Vr,getDepositScheduleWeeklyAnchor:()=>qr,getDepositStatus:()=>Gr,getDuplicatedPaymentMethodIds:()=>Cr,getEnabledPaymentMethodIds:()=>Pr,getExpressCheckoutCartMethods:()=>No,getExpressCheckoutCheckoutMethods:()=>Co,getExpressCheckoutProductMethods:()=>Ao,getIsAmazonPayEnabled:()=>ho,getIsAppleGooglePayInPaymentMethodsOptionsEnabled:()=>to,getIsCardPresentEligible:()=>lo,getIsDebugLogEnabled:()=>ro,getIsDevModeEnabled:()=>Xr,getIsManualCaptureEnabled:()=>Zr,getIsMultiCurrencyEnabled:()=>oo,getIsPaymentRequestEnabled:()=>eo,getIsSavedCardsEnabled:()=>co,getIsStripeBillingEnabled:()=>Ro,getIsStripeBillingMigrationInProgress:()=>bo,getIsSubscriptionsPluginActive:()=>_o,getIsTestModeEnabled:()=>Jr,getIsTestModeOnboarding:()=>Kr,getIsWCPayEnabled:()=>xr,getIsWCPaySubscriptionsEligible:()=>po,getIsWCPaySubscriptionsEnabled:()=>mo,getIsWooPayEnabled:()=>yo,getIsWooPayGlobalThemeSupportEnabled:()=>So,getPaymentMethodStatuses:()=>Dr,getPaymentRequestButtonBorderRadius:()=>io,getPaymentRequestButtonSize:()=>ao,getPaymentRequestButtonTheme:()=>so,getPaymentRequestButtonType:()=>no,getSavingError:()=>uo,getSettings:()=>Nr,getShowWooPayIncompatibilityNotice:()=>To,getStripeBillingMigratedCount:()=>Oo,getStripeBillingSubscriptionCount:()=>vo,getWooPayCustomMessage:()=>go,getWooPayStoreLogo:()=>Eo,isDirty:()=>Fr,isSavingSettings:()=>Mr});var E={};r.r(E),r.d(E,{saveOption:()=>Tn,saveSettings:()=>cn,submitStripeBillingSubscriptionMigration:()=>wn,updateAccountBusinessSupportEmail:()=>rn,updateAccountBusinessSupportPhone:()=>on,updateAccountCommunicationsEmail:()=>Sn,updateAccountStatementDescriptor:()=>Xo,updateAccountStatementDescriptorKana:()=>tn,updateAccountStatementDescriptorKanji:()=>en,updateAdvancedFraudProtectionSettings:()=>yn,updateDepositScheduleInterval:()=>nn,updateDepositScheduleMonthlyAnchor:()=>sn,updateDepositScheduleWeeklyAnchor:()=>an,updateEnabledPaymentMethodIds:()=>qo,updateExpressCheckoutCartMethods:()=>En,updateExpressCheckoutCheckoutMethods:()=>fn,updateExpressCheckoutProductMethods:()=>gn,updateIsAmazonPayEnabled:()=>un,updateIsAppleGooglePayInPaymentMethodsOptionsEnabled:()=>Yo,updateIsCardPresentEligible:()=>Mo,updateIsDebugLogEnabled:()=>Zo,updateIsManualCaptureEnabled:()=>Go,updateIsMultiCurrencyEnabled:()=>Jo,updateIsPaymentRequestEnabled:()=>Bo,updateIsSavedCardsEnabled:()=>Do,updateIsSavingSettings:()=>Vo,updateIsStripeBillingEnabled:()=>hn,updateIsTestModeEnabled:()=>Qo,updateIsWCPayEnabled:()=>$o,updateIsWCPaySubscriptionsEnabled:()=>Ko,updateIsWooPayEnabled:()=>dn,updateIsWooPayGlobalThemeSupportEnabled:()=>ln,updatePaymentRequestButtonBorderRadius:()=>Lo,updatePaymentRequestButtonSize:()=>Uo,updatePaymentRequestButtonTheme:()=>ko,updatePaymentRequestButtonType:()=>Fo,updateProtectionLevel:()=>_n,updateSelectedPaymentMethod:()=>Ho,updateSettings:()=>zo,updateUnselectedPaymentMethod:()=>Wo,updateWooPayCustomMessage:()=>mn,updateWooPayStoreLogo:()=>pn});var f={};r.r(f),r.d(f,{getSettings:()=>Rn});var w={};r.r(w),r.d(w,{getCardReaderStats:()=>On,getCardReaderStatsError:()=>In,getCardReaders:()=>An});var T={};r.r(T),r.d(T,{updateCardReaderStats:()=>Nn,updateCardReaders:()=>Cn,updateErrorForCardReaderStats:()=>xn,updateErrorForCardReaders:()=>Pn});var R={};r.r(R),r.d(R,{getCardReaderStats:()=>jn,getCardReaders:()=>Dn});var b={};r.r(b),r.d(b,{getActiveLoanSummary:()=>Ln,getActiveLoanSummaryError:()=>zn,getLoans:()=>$n,getLoansError:()=>Bn});var v={};r.r(v),r.d(v,{updateActiveLoanSummary:()=>Yn,updateErrorForActiveLoanSummary:()=>qn,updateErrorForLoans:()=>Hn,updateLoans:()=>Vn});var O={};r.r(O),r.d(O,{getActiveLoanSummary:()=>Wn,getLoans:()=>Gn});var I={};r.r(I),r.d(I,{getDocuments:()=>Xn,getDocumentsError:()=>ea,getDocumentsSummary:()=>ra,getDocumentsSummaryError:()=>oa});var A={};r.r(A),r.d(A,{updateDocuments:()=>na,updateDocumentsSummary:()=>sa,updateErrorForDocuments:()=>aa,updateErrorForDocumentsSummary:()=>ia});var N={};r.r(N),r.d(N,{formatQueryFilters:()=>ca,getDocuments:()=>da,getDocumentsSummary:()=>ua});var C={};r.r(C),r.d(C,{getPaymentIntent:()=>ma,getPaymentIntentError:()=>pa});var x={};r.r(x),r.d(x,{getAuthorization:()=>Ea,getAuthorizations:()=>ga,getAuthorizationsError:()=>fa,getAuthorizationsSummary:()=>Ta,getAuthorizationsSummaryError:()=>Ra,getIsRequesting:()=>ba});var P={};r.r(P),r.d(P,{setIsRequestingAuthorization:()=>Ca,submitCancelAuthorization:()=>Pa,submitCaptureAuthorization:()=>xa,updateAuthorization:()=>Aa,updateAuthorizations:()=>Oa,updateAuthorizationsSummary:()=>Na,updateErrorForAuthorizations:()=>Ia,updateErrorForAuthorizationsSummary:()=>ja});var j={};r.r(j),r.d(j,{getAuthorization:()=>Ma,getAuthorizations:()=>Da,getAuthorizationsSummary:()=>Fa});var D={};r.r(D),r.d(D,{getFile:()=>za,getFileError:()=>$a});var M={};r.r(M),r.d(M,{updateErrorForFiles:()=>Ya,updateFiles:()=>Ba});var F={};r.r(F),r.d(F,{getFile:()=>qa});var U={};r.r(U),r.d(U,{getPmPromotions:()=>Wa,getPmPromotionsError:()=>Ga});var k={};r.r(k),r.d(k,{activatePmPromotion:()=>Ka,dismissPmPromotion:()=>Xa,updateErrorForPmPromotions:()=>Ja,updatePmPromotions:()=>Za});var L={};r.r(L),r.d(L,{getPmPromotions:()=>ts});var z={};r.r(z),r.d(z,{getAvailableCurrencies:()=>cs,getCurrencies:()=>is,getCurrencySettings:()=>ls,getDefaultCurrency:()=>us,getEnabledCurrencies:()=>ds,getStoreSettings:()=>ms});var $={};r.r($),r.d($,{saveOption:()=>Ts,submitCurrencySettings:()=>fs,submitEnabledCurrenciesUpdate:()=>Es,submitStoreSettingsUpdate:()=>ws,updateAvailableCurrencies:()=>_s,updateCurrencies:()=>ps,updateCurrencySettings:()=>Ss,updateDefaultCurrency:()=>hs,updateEnabledCurrencies:()=>ys,updateStoreSettings:()=>gs});var B={};r.r(B),r.d(B,{getCurrencies:()=>Rs,getCurrencySettings:()=>bs,getStoreSettings:()=>vs});var Y=r(1609),q=r.n(Y),V=r(5338);(0,Y.createContext)({isActive:!1,setActive:()=>null,isCompleted:!1,setCompleted:()=>null,taskId:""}),(0,Y.createContext)({activeTask:"",setActiveTask:()=>null,completedTasks:{},setCompletedTasks:()=>null});var H=r(4848);const W=window.wp.components;function G(e){var t,r,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=G(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}const Q=function(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=G(e))&&(o&&(o+=" "),o+=t);return o},Z=window.wp.primitives;const J=e=>{var{children:t,actions:r,className:o}=e,n=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(e,["children","actions","className"]);return q().createElement(W.Modal,Object.assign({className:Q("wcpay-confirmation-modal",o)},n),t,q().createElement(Z.HorizontalRule,{className:"wcpay-confirmation-modal__separator"}),q().createElement("div",{className:"wcpay-confirmation-modal__footer"},r))},K=window.wp.i18n;r(5955),r(9031),r(4275),Y.Component;const X=({isLoading:e,display:t,placeholder:r,value:o,children:n})=>e?q().createElement("span",{className:t?`is-loadable-placeholder is-${t}`:"is-loadable-placeholder","aria-busy":"true"},void 0===r?n||o:r):q().createElement(q().Fragment,null,n||o),ee=e=>{const t=q().createElement("p",{style:{lineHeight:e.numLines}},"Block placeholder");return q().createElement(X,Object.assign({},e,{placeholder:t,display:"block"}))},te=({Icon:e,label:t})=>e?(0,H.jsxs)("span",{className:Q("woocommerce-payments__payment-method-icon"),children:[(0,H.jsx)(e,{}),t&&(0,H.jsx)("span",{className:"woocommerce-payments__payment-method-icon__label",children:t})]}):null,re=({children:e})=>(0,H.jsx)("div",{className:"wcpay-settings-layout",children:e}),oe=({description:e=()=>null,children:t,className:r,id:o})=>q().createElement("div",{className:Q("settings-section",r),id:o},q().createElement("div",{className:"settings-section__details"},q().createElement(e,null)),q().createElement("div",{className:"settings-section__controls"},t)),ne=window.wp.domReady;var ae=r.n(ne);const se=(e,t={})=>{var r;if(window.wcpaySettings){Object.assign(t,{is_test_mode:wcpaySettings.testMode,jetpack_connected:wcpaySettings.isJetpackConnected,wcpay_version:wcpaySettings.version,woo_country_code:wcpaySettings.connect.country,hosting_provider:null===(r=wcpaySettings.trackingInfo)||void 0===r?void 0:r.hosting_provider});for(const e in t)void 0===t[e]&&delete t[e]}ae()((()=>{var r,o;(null!==(o=null===(r=null===wc||void 0===wc?void 0:wc.tracks)||void 0===r?void 0:r.recordEvent)&&void 0!==o?o:wcTracks.recordEvent)(e,t)}))},ie=((0,Y.createContext)(window.wcpaySettings),window.wc.currency);var ce=r.n(ie);const de=window.lodash,ue=((0,K.__)("Australian dollar","woocommerce-payments"),(0,K.__)("Canadian dollar","woocommerce-payments"),(0,K.__)("Swiss franc","woocommerce-payments"),(0,K.__)("Danish krone","woocommerce-payments"),(0,K.__)("Euro","woocommerce-payments"),(0,K.__)("Pound sterling","woocommerce-payments"),(0,K.__)("Norwegian krone","woocommerce-payments"),(0,K.__)("New Zealand dollar","woocommerce-payments"),(0,K.__)("Swedish krona","woocommerce-payments"),(0,K.__)("United States (US) dollar","woocommerce-payments"),e=>wcpaySettings.zeroDecimalCurrencies.includes(e.toLowerCase())),le=(e,t="USD",r=null,o=!1)=>{const n=ue(t);n||(e/=100);const a=e<0,s=a?-1*e:e,i=a?"-":"",c=o?(e=>{const t=e.toUpperCase(),{currencyData:r,connect:{country:o="US"}}=wcpaySettings;if(r[o]?.code===t)return ce()(r[o]);const n=(0,de.find)(r,{code:t});if(n){const{defaultLocale:e={}}=n;return e.hasOwnProperty("decimalSeparator")&&e.hasOwnProperty("thousandSeparator")&&e.hasOwnProperty("symbolPosition")&&(n.decimalSeparator=e.decimalSeparator,n.thousandSeparator=e.thousandSeparator,n.symbolPosition=e.symbolPosition),ce()(n)}return null})(t):((e,t=null)=>{const{currencyData:r,connect:{country:o="US"}}=wcpaySettings,n=(0,de.find)(r,{code:e.toUpperCase()});if(n){if(null!==t&&t.toUpperCase()!==e.toUpperCase()||r[o]){const e=t?(0,de.find)(r,{code:t.toUpperCase()}):r[o];e&&(n.decimalSeparator=e.decimalSeparator,n.thousandSeparator=e.thousandSeparator,n.symbolPosition=e.symbolPosition)}return ce()(n)}return null})(t,r);if(null===c)return i+me(s,t,n);try{return i+("function"==typeof c.formatAmount?pe(c.formatAmount(s)):pe(c.formatCurrency(s)))}catch(e){return i+pe(me(s,t,n))}};function me(e,t,r){try{return e.toLocaleString(void 0,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",dummy:r})}catch(o){return(0,K.sprintf)(r?"%s %i":"%s %.2f",t.toUpperCase(),e)}}function pe(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}const _e=window.wp.data,ye=window.wp.dataControls,he="/wc/v3/payments",Se="wc/payments",ge={SET_DEPOSIT:"SET_DEPOSIT",SET_DEPOSITS:"SET_DEPOSITS",SET_DEPOSITS_COUNT:"SET_DEPOSITS_COUNT",SET_ERROR_FOR_DEPOSIT_QUERY:"SET_ERROR_FOR_DEPOSIT_QUERY",SET_DEPOSITS_SUMMARY:"SET_DEPOSITS_SUMMARY",SET_ERROR_FOR_DEPOSITS_SUMMARY:"SET_ERROR_FOR_DEPOSITS_SUMMARY",SET_INSTANT_DEPOSIT:"SET_INSTANT_DEPOSIT",SET_ALL_DEPOSITS_OVERVIEWS:"SET_ALL_DEPOSITS_OVERVIEWS",SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS:"SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS"},Ee=e=>JSON.stringify(e,Object.keys(e).sort()),fe={byId:{},queries:{},count:0,instant:{}},we=e=>e&&e.deposits||{},Te=(e,t)=>(we(e).byId||{})[t],Re=e=>{const t=we(e).overviews||{};if(!t.data)return{account:null,currencies:[]};const{deposit:r,balance:o,account:n}=t.data,a={lastPaid:r.last_paid,pending:o.pending,available:o.available,instant:o.instant},s={};for(const[e,t]of Object.entries(a))t?.forEach((t=>{const{currency:r}=t;s[r]||(s[r]={currency:r,lastPaid:void 0,pending:void 0,available:void 0,instant:void 0}),s[r][e]=t}));const i=Object.values(s);return{account:n,currencies:[...i.filter((e=>n.default_currency===e.currency)),...i.filter((e=>n.default_currency!==e.currency))]}},be=e=>(we(e).overviews||{}).error,ve=(e,t)=>{const r=Ee(t);return(we(e).queries||{})[r]||{}},Oe=(e,t)=>(ve(e,t).data||[]).map(Te.bind(void 0,e)),Ie=e=>we(e).count,Ae=(e,t)=>ve(e,t).error||{},Ne=(e,t)=>{const r=Ee(t);return(we(e).summary||{})[r]||{}},Ce=(e,t)=>Ne(e,t).data||{},xe=(e,t)=>Ne(e,t).error||{},Pe=e=>(we(e).instant||{}).data,je=window.wp.url,De=window.moment;var Me=r.n(De);const Fe=window.wp.date,Ue=(window.wc.number,e=>(0,je.addQueryArgs)("admin.php",e)),ke=(e,t=!1)=>{const r=t?Me()(e).endOf("day").utc().toISOString():Me()(e).startOf("day").utc().toISOString();return e&&(0,Fe.dateI18n)("Y-m-d H:i:s",r,!0)};function Le(e){return{type:ge.SET_DEPOSIT,data:e}}function ze(e){return{type:ge.SET_ALL_DEPOSITS_OVERVIEWS,data:e}}function $e(e,t){return{type:ge.SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS,error:t}}function Be(e,t){return{type:ge.SET_DEPOSITS,query:e,data:t}}function Ye(e){return{type:ge.SET_DEPOSITS_COUNT,data:e}}function qe(e,t,r){return{type:ge.SET_ERROR_FOR_DEPOSIT_QUERY,query:e,data:t,error:r}}function Ve(e,t){return{type:ge.SET_DEPOSITS_SUMMARY,query:e,data:t}}function He(e,t,r){return{type:ge.SET_ERROR_FOR_DEPOSITS_SUMMARY,query:e,data:t,error:r}}function We(e){return{type:ge.SET_INSTANT_DEPOSIT,data:e}}function*Ge(e){try{yield(0,_e.dispatch)(Se).startResolution("getInstantDeposit",[e]);const t=yield(0,ye.apiFetch)({path:"/wc/v3/payments/deposits",method:"POST",data:{type:"instant",currency:e}});yield We(t),yield(0,_e.dispatch)(Se).invalidateResolutionForStoreSelector("getDeposits"),yield(0,_e.dispatch)(Se).invalidateResolutionForStoreSelector("getAllDepositsOverviews"),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,K.sprintf)((0,K.__)("Instant payout for %s in transit.","woocommerce-payments"),le(t.amount)),{actions:[{label:(0,K.__)("View details","woocommerce-payments"),url:Ue({page:"wc-admin",path:"/payments/payouts/details",id:t.id})}]})}catch{yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error creating instant payout.","woocommerce-payments"))}finally{yield(0,_e.dispatch)(Se).finishResolution("getInstantDeposit",[e])}}function*Qe(e){if(/\W/.test(e))return;const t=(0,je.addQueryArgs)(`${he}/deposits/${e}`);try{const e=yield(0,ye.apiFetch)({path:t});yield Le(e)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving payout.","woocommerce-payments"))}}function*Ze(){const e=(0,je.addQueryArgs)(`${he}/deposits/overview-all`);try{const t=yield(0,ye.apiFetch)({path:e});yield ze(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving all payouts' overviews.","woocommerce-payments")),yield $e()}}const Je=e=>({user_email:e.userEmail,match:e.match,store_currency_is:e.storeCurrencyIs,date_before:ke(e.dateBefore,!0),date_after:ke(e.dateAfter),date_between:e.dateBetween&&[ke(e.dateBetween[0]),ke(e.dateBetween[1],!0)],status_is:e.statusIs,status_is_not:e.statusIsNot,locale:e.locale}),Ke=`${he}/deposits/download`;function Xe(e){return(0,je.addQueryArgs)(Ke,Je(e))}function*et(e){const t=(0,je.addQueryArgs)(`${he}/deposits`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...Je(e)});try{const r=yield(0,ye.apiFetch)({path:t})||{};yield Be(e,r.data),yield Ye(r.total_count);for(const e in r.data)yield _e.controls.dispatch(Se,"finishResolution","getDeposit",[r.data[e].id])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving payouts.","woocommerce-payments")),yield qe(e,null,t)}}function*tt(e){const t=(0,je.addQueryArgs)(`${he}/deposits/summary`,Je(e));try{const r=yield(0,ye.apiFetch)({path:t});yield Ve(e,r)}catch(t){yield He(e,null,t)}}const rt={SET_TRANSACTIONS:"SET_TRANSACTIONS",SET_ERROR_FOR_TRANSACTIONS:"SET_ERROR_FOR_TRANSACTIONS",SET_TRANSACTIONS_SUMMARY:"SET_TRANSACTIONS_SUMMARY",SET_ERROR_FOR_TRANSACTIONS_SUMMARY:"SET_ERROR_FOR_TRANSACTIONS_SUMMARY",SET_FRAUD_OUTCOME_TRANSACTIONS:"SET_FRAUD_OUTCOME_TRANSACTIONS",SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS:"SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS",SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:"SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY",SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:"SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY"},ot={summary:{},fraudProtection:{review:{summary:{}},block:{summary:{}}}},nt=e=>e&&e.transactions||{},at=(e,t)=>{const r=Ee(t);return nt(e)[r]||{}},st=(e,t)=>at(e,t).data||[],it=(e,t)=>at(e,t).error||{},ct=(e,t)=>{const r=Ee(t);return nt(e).summary[r]||{}},dt=(e,t)=>ct(e,t).data||{},ut=(e,t)=>ct(e,t).error||{},lt=(e,t,r)=>{const o=Ee(r);return nt(e).fraudProtection?.[t]?.[o]||{}},mt=(e,t,r)=>lt(e,t,r).data||[],pt=(e,t,r)=>lt(e,t,r).error||{},_t=(e,t,r)=>{const o=Ee(r);return nt(e).fraudProtection?.[t]?.summary[o]||{}},yt=(e,t,r)=>_t(e,t,r).data||{},ht=(e,t,r)=>_t(e,t,r).error||{};function St(e,t){return{type:rt.SET_TRANSACTIONS,query:e,data:t}}function gt(e,t,r){return{type:rt.SET_ERROR_FOR_TRANSACTIONS,query:e,data:t,error:r}}function Et(e,t){return{type:rt.SET_TRANSACTIONS_SUMMARY,query:e,data:t}}function ft(e,t,r){return{type:rt.SET_ERROR_FOR_TRANSACTIONS_SUMMARY,query:e,data:t,error:r}}function wt(e,t,r){return{type:rt.SET_FRAUD_OUTCOME_TRANSACTIONS,status:e,query:t,data:r}}function Tt(e,t,r){return{type:rt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS,status:e,query:t,data:null,error:r}}function Rt(e,t,r){return{type:rt.SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY,status:e,query:t,data:r}}function bt(e,t,r){return{type:rt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY,status:e,query:t,data:null,error:r}}const vt=e=>({user_email:e.userEmail,match:e.match,date_before:ke(e.dateBefore,!0),date_after:ke(e.dateAfter),date_between:e.dateBetween&&[ke(e.dateBetween[0]),ke(e.dateBetween[1],!0)],type_is:e.typeIs,type_is_not:e.typeIsNot,type_is_in:e.typeIsIn,source_device_is:e.sourceDeviceIs,source_device_is_not:e.sourceDeviceIsNot,channel_is:e.channelIs,channel_is_not:e.channelIsNot,customer_country_is:e.customerCountryIs,customer_country_is_not:e.customerCountryIsNot,risk_level_is:e.riskLevelIs,risk_level_is_not:e.riskLevelIsNot,store_currency_is:e.storeCurrencyIs,loan_id_is:e.loanIdIs,deposit_id:e.depositId,customer_currency_is:e.customerCurrencyIs,customer_currency_is_not:e.customerCurrencyIsNot,source_is:e.sourceIs,source_is_not:e.sourceIsNot,search:e.search,user_timezone:Me()(new Date).format("Z"),locale:e.locale});function*Ot(e){const t=(0,je.addQueryArgs)(`${he}/transactions`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...vt(e)});try{const r=yield(0,ye.apiFetch)({path:t});yield St(e,r.data||[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving transactions.","woocommerce-payments")),yield gt(e,null,t)}}const It=`${he}/transactions/download`;function At(e){return(0,je.addQueryArgs)(It,vt(e))}function*Nt(e){const t=(0,je.addQueryArgs)(`${he}/transactions/summary`,vt(e));try{const r=yield(0,ye.apiFetch)({path:t});yield Et(e,r)}catch(t){yield ft(e,null,t)}}function*Ct(e,t){const r=(0,je.addQueryArgs)(`${he}/transactions/fraud-outcomes`,{status:e,page:t.paged,sort:t.orderby,pagesize:t.perPage,direction:t.order,additional_status:t.additionalStatus,...vt(t)});try{const o=yield(0,ye.apiFetch)({path:r});yield wt(e,t,o.data||[])}catch(r){if("wcpay_fraud_outcome_not_found"===r.code)return void(yield wt(e,t,[]));yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving transactions.","woocommerce-payments")),yield Tt(e,t,r)}}function*xt(e,t){const r=(0,je.addQueryArgs)(`${he}/transactions/fraud-outcomes/summary`,{status:e,additional_status:t.additionalStatus}),o={count:0,total:0};try{const n=yield(0,ye.apiFetch)({path:r});yield Rt(e,t,n||o)}catch(r){if("wcpay_fraud_outcome_not_found"===r.code)return void(yield Rt(e,t,o));yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving on review transactions.","woocommerce-payments")),yield bt(e,t,r)}}function Pt(e,t){return(0,je.addQueryArgs)(`${he}/transactions/fraud-outcomes/download`,{status:e,sort:t.orderby,direction:t.order,additional_status:t.additionalStatus,...vt(t)})}const jt={SET_CHARGE:"SET_CHARGE",SET_ERROR_FOR_CHARGE:"SET_ERROR_FOR_CHARGE"},Dt=(e,t)=>e.charges[t]&&e.charges[t].data?e.charges[t].data:{},Mt=(e,t)=>e.charges[t]&&e.charges[t].error?e.charges[t].error:{},Ft=(e,t)=>Dt(e,t),Ut=(e,t)=>Mt(e,t);function kt(e,t){return{type:jt.SET_CHARGE,id:e,data:t}}function Lt(e,t,r){return{type:jt.SET_ERROR_FOR_CHARGE,id:e,data:t,error:r}}function*zt(e){try{const t=yield(0,ye.apiFetch)({path:`${he}/charges/${e}`});yield kt(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving transaction.","woocommerce-payments")),yield Lt(e,null,t)}}function*$t(e){try{const t=yield(0,ye.apiFetch)({path:`${he}/charges/order/${e}`});yield kt(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving transaction.","woocommerce-payments")),yield Lt(e,null,t)}}const Bt={SET_TIMELINE:"SET_TIMELINE",SET_ERROR_FOR_TIMELINE:"SET_ERROR_FOR_TIMELINE"},Yt=(e,t)=>e.timeline&&e.timeline[t]&&e.timeline[t].data?e.timeline[t].data:{},qt=(e,t)=>e.timeline&&e.timeline[t]&&e.timeline[t].error?e.timeline[t].error:{};function Vt(e,t){return{id:e,type:Bt.SET_TIMELINE,data:t}}function Ht(e,t){return{id:e,type:Bt.SET_ERROR_FOR_TIMELINE,error:t}}function*Wt(e){try{const t=yield(0,ye.apiFetch)({path:`${he}/timeline/${e}`});yield Vt(e,t.data)}catch(t){yield Ht(e,t)}}const Gt={SET_DISPUTE:"SET_DISPUTE",SET_ERROR_FOR_DISPUTE:"SET_ERROR_FOR_DISPUTE",SET_DISPUTES:"SET_DISPUTES",SET_DISPUTES_SUMMARY:"SET_DISPUTES_SUMMARY"},Qt={byId:{},queries:{},summary:{},cached:{}},Zt=e=>e&&e.disputes||{},Jt=(e,t)=>(Zt(e).byId||{})[t],Kt=(e,t)=>{const r=Zt(e).byId||{};return r[t]?.error},Xt=(e,t)=>(Zt(e).cached||{})[t],er=(e,t)=>{const r=((e,t)=>{const r=Ee(t);return(Zt(e).queries||{})[r]||{}})(e,t).data||[];return r.map(Xt.bind(void 0,e))},tr=(e,t)=>((e,t)=>{const r=Ee(t);return(Zt(e).summary||{})[r]||{}})(e,t).data||{};var rr;!function(e){e.SET_PAYMENT_INTENT="SET_PAYMENT_INTENT",e.SET_ERROR_FOR_PAYMENT_INTENT="SET_ERROR_FOR_PAYMENT_INTENT"}(rr||(rr={}));const or=rr;function nr(e,t){return{type:or.SET_PAYMENT_INTENT,id:e,data:t}}function ar(e,t){return{type:or.SET_ERROR_FOR_PAYMENT_INTENT,id:e,error:t}}function*sr(e,t){var r;const o=e.payment_intent;try{yield(0,ye.apiFetch)({path:"/wc/v3/payments/refund/",method:"post",data:{charge_id:e.id,amount:e.amount,reason:t,order_id:null===(r=null==e?void 0:e.order)||void 0===r?void 0:r.id}}),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,K.sprintf)((0,K.__)("Refunded payment #%s.","woocommerce-payments"),o))}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.sprintf)((0,K.__)("There has been an error refunding the payment #%s. Please try again later.","woocommerce-payments"),o))}}function*ir(e){try{const t=yield(0,ye.apiFetch)({path:`${he}/payment_intents/${e}`});yield nr(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving transaction.","woocommerce-payments")),yield ar(e,t)}}function cr(e){return{type:Gt.SET_DISPUTE,data:e}}function dr(e,t,r){return{type:Gt.SET_ERROR_FOR_DISPUTE,id:e,data:t,error:r}}function ur(e,t){return{type:Gt.SET_DISPUTES,query:e,data:t}}function lr(e,t){return{type:Gt.SET_DISPUTES_SUMMARY,query:e,data:t}}function*mr(e){const{id:t,payment_intent:r}=e;try{yield _e.controls.dispatch(Se,"startResolution","getDispute",[t]);const e=yield(0,ye.apiFetch)({path:`${he}/disputes/${t}/close`,method:"post"});yield cr(e),yield ir(r),yield _e.controls.dispatch(Se,"finishResolution","getDispute",[t]);const o=e.order?(0,K.sprintf)((0,K.__)("You have accepted the dispute for order #%s.","woocommerce-payments"),e.order.number):(0,K.__)("You have accepted the dispute.","woocommerce-payments");yield _e.controls.dispatch("core/notices","createSuccessNotice",o)}catch(e){const r=(0,K.__)("There has been an error accepting the dispute. Please try again later.","woocommerce-payments");yield _e.controls.dispatch("core/notices","createErrorNotice",r),yield _e.controls.dispatch(Se,"finishResolution","getDispute",[t])}}const pr=window.wc.wcSettings,_r=((0,K.__)("Bank cannot process","woocommerce-payments"),(0,K.__)("Check returned","woocommerce-payments"),(0,K.__)("Credit not processed","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If your customer was not refunded appropriately, you will need to accept the dispute, or resolve the issue with your customer. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The customer claims that the purchased product was returned or the transaction was otherwise canceled, but you have not yet provided a refund or credit.","woocommerce-payments"),(0,K.__)("Demonstrate that you have refunded your customer through other means or that your customer is not entitled to a refund. You cannot issue a refund while a payment is being disputed. If you believe that your customer was entitled a refund that you did not provide, you can accept the dispute.","woocommerce-payments"),(0,K.__)("You should first get in touch with your customer. If you understand what their complaint is, there is a chance for you to explain the misunderstanding or to make it right. If you’re able to resolve the issue with your customer, you can ask that they withdraw the dispute.","woocommerce-payments"),(0,K.__)("If the cardholder agrees to withdraw the dispute, you should still submit evidence for the dispute using the forms on the next screen. In addition to the following evidence, your submission should include correspondence with the cardholder saying they would withdraw the dispute and a written statement from their card issuer confirming that the dispute has been withdrawn.","woocommerce-payments"),(0,K.__)("The cardholder claims a credit was not processed.","woocommerce-payments"),(0,K.__)("Customer initiated","woocommerce-payments"),(0,K.__)("Debit not authorized","woocommerce-payments"),(0,K.__)("Duplicate","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If there were duplicate payments, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The customer claims they were charged multiple times for the same product or service.","woocommerce-payments"),(0,K.__)("Demonstrate that each payment was for a separate product or service.","woocommerce-payments"),(0,K.__)("Determine if your customer was incorrectly charged multiple times.","woocommerce-payments"),(0,K.__)("If they were not, collect any and all information documenting that each payment was made separately, such as copies of receipts. If the receipts don’t include the items purchased, be sure to include an itemized list. Each receipt should clearly indicate that the payments are for separate purchases of items or services. If you’ve been able to get in touch with the customer you should be sure to address any concerns they had in your evidence.","woocommerce-payments"),(0,K.__)("If there have been two or more separate payments, you should get in touch with your customer. If you understand what their complaint is, there is a chance for you to explain the misunderstanding or to make it right. If you’re able to resolve the issue with your customer, you can ask that they withdraw the dispute.","woocommerce-payments"),(0,K.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,K.__)("The cardholder claims this is a duplicate transaction.","woocommerce-payments"),(0,K.__)("Transaction unauthorized","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If you believe the payment was actually made using a stolen credit card, you will need to accept the dispute. The credit card networks place liability for accepting unauthorized transactions with you, the business.","woocommerce-payments"),(0,K.__)("This is the most common reason for a dispute, and happens when a cardholder claims that they didn’t authorize the payment. This can happen if the card was lost or stolen and used to make an unauthorized transaction. It can also happen if the cardholder doesn’t recognize the payment as it appears on the billing statement from their card issuer.","woocommerce-payments"),(0,K.__)("Provide adequate payment and order details so that a legitimate customer recognizes it, or proves to the card issuer that their cardholder authorized the transaction.","woocommerce-payments"),(0,K.__)("Try to get in touch with your customer. Sometimes people forget about payments they make or don’t recognize the way they appear on their card statement. If this is the case, ask them to contact their card issuer and let them know they no longer dispute the transaction.","woocommerce-payments"),(0,K.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,K.__)("It may be more efficient—and provide a better customer experience—to accept an accidental dispute and charge the customer again, if appropriate. Even when a dispute is withdrawn, it usually takes approximately 75 days to be finalized. Remember, it doesn’t matter to the card networks whether you win or lose a dispute; what matters is how many disputes a business receives, regardless of how many disputes are won.","woocommerce-payments"),(0,K.__)("The cardholder claims this is an unauthorized transaction.","woocommerce-payments"),(0,K.__)("General","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("This is an uncategorized dispute, so you should contact the customer for additional details to find out why the payment was disputed.","woocommerce-payments"),(0,K.__)("Incorrect account details","woocommerce-payments"),(0,K.__)("Insufficient funds","woocommerce-payments"),(0,K.__)("Product not received","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If you can not prove the customer received their product or service, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The customer claims they did not receive the products or services purchased.","woocommerce-payments"),(0,K.__)("Prove that the customer received a physical product or offline service, or made use of a digital product or online service. This must have occurred prior to the date the dispute was initiated.","woocommerce-payments"),(0,K.__)("First, get in touch with your customer. Understanding why they filed the dispute will be important for helping make sure your customer gets the product and will give you critical information to prevent this from happening to others.","woocommerce-payments"),(0,K.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,K.__)("The cardholder claims they did not receive the product.","woocommerce-payments"),(0,K.__)("Product unacceptable","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If you can not prove the customer received their product or service as described, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The product or service was received but was defective, damaged, or not as described.","woocommerce-payments"),(0,K.__)("Demonstrate that the product or service was delivered as described at the time of purchase.","woocommerce-payments"),(0,K.__)("If the product or service is as described, provide specific information (invoice, contract, etc.) to refute the cardholder’s claims. Quality disputes are where the customer does not agree with the condition of merchandise or service received (e.g., a car repair situation or quality of a hotel room). There may be instances where you will need to obtain a neutral third-party opinion to help corroborate your claim against the cardholder. Provide as much specific information and documentation as possible to refute the cardholder’s claims. It is recommended that you address each point that the cardholder has made.","woocommerce-payments"),(0,K.__)("If the customer has not yet returned the product or canceled the service, provide specific information to that effect. You should double-check your incoming shipping records to verify that you have not received a return before you respond. If you have processed a credit or reversal for this transaction, provide evidence of this which includes the amount and date processed.","woocommerce-payments"),(0,K.__)("For products that have been repaired or replaced, provide evidence that the cardholder agreed to a repair or replacement, it has been received by the customer, and the repair or replacement has not since been disputed.","woocommerce-payments"),(0,K.__)("If your customer made no attempt to return the product or cancel the service, or if you provided a replacement product or service, make sure to note that as well.","woocommerce-payments"),(0,K.__)("If the customer withdraws their dispute you should still submit evidence using the forms on the next screen. Be sure to provide a letter or email from the cardholder stating that they are no longer in dispute.","woocommerce-payments"),(0,K.__)("The cardholder claims the product was unacceptable.","woocommerce-payments"),(0,K.__)("Subscription canceled","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If you can not prove the customer’s subscription was canceled, and or they did not follow your cancellation policy, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The customer claims that you continued to charge them after a subscription was canceled.","woocommerce-payments"),(0,K.__)("Prove that the subscription was still active and that the customer was aware of, and did not follow, your cancellation procedure.","woocommerce-payments"),(0,K.__)("First, get in touch with your customer. If you understand what they believe happened, there is a chance for you to explain the misunderstanding or to make it right. ","woocommerce-payments"),(0,K.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,K.__)("Otherwise, use the forms on the next screen to submit evidence that the subscription was still active and that the customer was aware of, and did not follow, your cancellation procedure.","woocommerce-payments"),(0,K.__)("The cardholder claims a subscription was canceled.","woocommerce-payments"),(0,K.__)("Unrecognized","woocommerce-payments"),(0,K.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,K.__)("If you can not prove the customer’s subscription was canceled, and or they did not follow your cancellation policy, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,K.__)("The customer doesn’t recognize the payment appearing on their card statement.","woocommerce-payments"),(0,K.__)("Get your customer to withdraw the dispute by helping them identify the payment. Otherwise, challenge the dispute with appropriate evidence that proves the purchase was legitimate. ","woocommerce-payments"),(0,K.__)("First, try to get in touch with your customer. Sometimes people forget about payments they make or don’t recognize the way they appear on their card statement. If this is the case, ask them to contact their card issuer and let them know they no longer dispute the transaction. Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,K.__)("It may be more efficient—and provide a better customer experience—to accept an accidental dispute and charge the customer again, if appropriate. Even when a dispute is withdrawn, it usually takes approximately 75 days to be finalized. Remember, it doesn’t matter to the card networks whether you win or lose a dispute; what matters is how many disputes a business receives, regardless of how many disputes are won.","woocommerce-payments"),(0,K.__)("Non-compliant","woocommerce-payments"),(0,K.__)("Your customer’s bank claims this payment violates Visa’s rules.","woocommerce-payments"),(0,K.__)("This transaction is being reviewed under Visa’s network compliance rules.","woocommerce-payments"),{warning_needs_response:(0,K.__)("Inquiry: Response needed","woocommerce-payments"),warning_under_review:(0,K.__)("Inquiry: Under review","woocommerce-payments"),warning_closed:(0,K.__)("Inquiry: Closed","woocommerce-payments"),needs_response:(0,K.__)("Response needed","woocommerce-payments"),under_review:(0,K.__)("Under review","woocommerce-payments"),charge_refunded:(0,K.__)("Charge refunded","woocommerce-payments"),won:(0,K.__)("Won","woocommerce-payments"),lost:(0,K.__)("Lost","woocommerce-payments")}),yr=(Object.entries(_r).map((([e,t])=>({label:t,value:e}))).filter((function(e){return null!=e})),["needs_response","warning_needs_response"]),hr=((0,K.__)("Dispute currency","woocommerce-payments"),(0,K.__)("All currencies","woocommerce-payments"),(0,K.__)("Show","woocommerce-payments"),(0,K.__)("Needs response","woocommerce-payments"),(0,K.__)("All disputes","woocommerce-payments"),(0,K.__)("Advanced filters","woocommerce-payments"),(0,pr.getSetting)("wcVersion")),Sr=parseFloat(hr),gr=(Sr<7.8?(0,K.__)("Disputes match {{select /}} filters","woocommerce-payments"):(0,K.__)("Disputes match <select /> filters","woocommerce-payments"),(0,K.__)("Disputed on date","woocommerce-payments"),(0,K.__)("Remove dispute date filter","woocommerce-payments"),(0,K.__)("Select a dispute date filter match","woocommerce-payments"),Sr<7.8?(0,K.__)("{{title}}Date{{/title}} {{rule /}} {{filter /}}","woocommerce-payments"):(0,K.__)("<title>Date</title> <rule /> <filter />","woocommerce-payments"),(0,K.__)("Select a dispute date","woocommerce-payments"),(0,K.__)("Before","woocommerce-payments"),(0,K.__)("After","woocommerce-payments"),(0,K.__)("Between","woocommerce-payments"),(0,K.__)("Status","woocommerce-payments"),(0,K.__)("Remove dispute status filter","woocommerce-payments"),(0,K.__)("Select a dispute status filter match","woocommerce-payments"),Sr<7.8?(0,K.__)("{{title}}Status{{/title}} {{rule /}} {{filter /}}","woocommerce-payments"):(0,K.__)("<title>Status</title> <rule /> <filter />","woocommerce-payments"),(0,K.__)("Select a dispute status","woocommerce-payments"),(0,K._x)("Is","dispute status","woocommerce-payments"),(0,K._x)("Is not","dispute status","woocommerce-payments"),e=>({user_email:e.userEmail,match:e.match,store_currency_is:e.storeCurrencyIs,date_before:ke(e.dateBefore,!0),date_after:ke(e.dateAfter),date_between:e.dateBetween&&[ke(e.dateBetween[0]),ke(e.dateBetween[1],!0)],search:"awaiting_response"===e.filter?yr:e.search,status_is:e.statusIs,status_is_not:e.statusIsNot,locale:e.locale})),Er=`${he}/disputes/download`;function fr(e){return(0,je.addQueryArgs)(Er,gr(e))}function*wr(e){const t=(0,je.addQueryArgs)(`${he}/disputes/${e}`);try{const e=yield(0,ye.apiFetch)({path:t});yield cr(e)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving dispute.","woocommerce-payments")),yield dr(e,void 0,t)}}function*Tr(e){const t=(0,je.addQueryArgs)(`${he}/disputes`,{page:e.paged,pagesize:e.perPage,sort:(0,de.snakeCase)(e.orderBy),direction:e.order,...gr(e)});try{const r=yield(0,ye.apiFetch)({path:t})||{};yield ur(e,r.data)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving disputes.","woocommerce-payments"))}}function*Rr(e){const t=(0,je.addQueryArgs)(`${he}/disputes/summary`,{page:e.paged,pagesize:e.perPage,...gr(e)});try{const r=yield(0,ye.apiFetch)({path:t});yield lr(e,r)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving the summary of disputes.","woocommerce-payments"))}}const br={SET_SETTINGS:"SET_SETTINGS",SET_SETTINGS_VALUES:"SET_SETTINGS_VALUES",SET_IS_SAVING_SETTINGS:"SET_IS_SAVING_SETTINGS",SET_SELECTED_PAYMENT_METHOD:"SET_SELECTED_PAYMENT_METHOD",SET_UNSELECTED_PAYMENT_METHOD:"SET_UNSELECTED_PAYMENT_METHOD"},vr={isDirty:!1,isSaving:!1,savingError:null,data:{}},Or={},Ir=[],Ar=e=>e&&e.settings||Or,Nr=e=>Ar(e).data||Or,Cr=e=>Nr(e).duplicated_payment_method_ids||Or,xr=e=>Nr(e).is_wcpay_enabled||!1,Pr=e=>Nr(e).enabled_payment_method_ids||Ir,jr=e=>Nr(e).available_payment_method_ids||Ir,Dr=e=>Nr(e).payment_method_statuses||Or,Mr=e=>Ar(e).isSaving||!1,Fr=e=>Ar(e).isDirty||!1,Ur=e=>Nr(e).account_statement_descriptor||"",kr=e=>Nr(e).account_statement_descriptor_kanji||"",Lr=e=>Nr(e).account_statement_descriptor_kana||"",zr=e=>Nr(e).account_business_support_email||"",$r=e=>Nr(e).account_business_support_phone||"",Br=e=>Nr(e).account_domestic_currency||"",Yr=e=>Nr(e).deposit_schedule_interval||"",qr=e=>Nr(e).deposit_schedule_weekly_anchor||"",Vr=e=>Nr(e).deposit_schedule_monthly_anchor||"",Hr=e=>Nr(e).deposit_delay_days||"7",Wr=e=>Nr(e).deposit_completed_waiting_period||!1,Gr=e=>Nr(e).deposit_status||"",Qr=e=>Nr(e).deposit_restrictions||"",Zr=e=>Nr(e).is_manual_capture_enabled||!1,Jr=e=>Nr(e).is_test_mode_enabled||!1,Kr=e=>Nr(e).is_test_mode_onboarding||!1,Xr=e=>Nr(e).is_dev_mode_enabled||!1,eo=e=>Nr(e).is_payment_request_enabled||!1,to=e=>Nr(e).is_apple_google_pay_in_payment_methods_options_enabled||!1,ro=e=>Nr(e).is_debug_log_enabled||!1,oo=e=>Nr(e).is_multi_currency_enabled||!1,no=e=>Nr(e).payment_request_button_type||"",ao=e=>Nr(e).payment_request_button_size||"",so=e=>Nr(e).payment_request_button_theme||"",io=e=>{const t=Nr(e)?.payment_request_button_border_radius;return 0===t||"0"===t||t?t:"undefined"==typeof wcpaySettings?4:parseInt(window?.wcpaySettings?.defaultExpressCheckoutBorderRadius||4,10)},co=e=>Nr(e).is_saved_cards_enabled||!1,uo=e=>Ar(e).savingError,lo=e=>Nr(e).is_card_present_eligible||!1,mo=e=>Nr(e).is_wcpay_subscriptions_enabled||!1,po=e=>Nr(e).is_wcpay_subscriptions_eligible||!1,_o=e=>Nr(e).is_subscriptions_plugin_active||!1,yo=e=>Nr(e).is_woopay_enabled||!1,ho=e=>Nr(e).is_amazon_pay_enabled||!1,So=e=>Nr(e).is_woopay_global_theme_support_enabled||!1,go=e=>Nr(e).woopay_custom_message||"",Eo=e=>Nr(e).woopay_store_logo||"",fo=e=>Nr(e).current_protection_level||"basic",wo=e=>Nr(e).advanced_fraud_protection_settings||Ir,To=e=>Nr(e).show_woopay_incompatibility_notice||!1,Ro=e=>Nr(e).is_stripe_billing_enabled||!1,bo=e=>Nr(e).is_migrating_stripe_billing||!1,vo=e=>Nr(e).stripe_billing_subscription_count||0,Oo=e=>Nr(e).stripe_billing_migrated_count||0,Io=e=>Nr(e).account_communications_email||"",Ao=e=>Nr(e).express_checkout_product_methods||Ir,No=e=>Nr(e).express_checkout_cart_methods||Ir,Co=e=>Nr(e).express_checkout_checkout_methods||Ir,xo=window.wp.apiFetch;var Po=r.n(xo);function jo(e){return{type:br.SET_SETTINGS_VALUES,payload:e}}function Do(e){return jo({is_saved_cards_enabled:e})}function Mo(e){return jo({is_card_present_eligible:e})}function Fo(e){return jo({payment_request_button_type:e})}function Uo(e){return jo({payment_request_button_size:e})}function ko(e){return jo({payment_request_button_theme:e})}function Lo(e){return jo({payment_request_button_border_radius:e})}function zo(e){return{type:br.SET_SETTINGS,data:e}}function $o(e){return jo({is_wcpay_enabled:e})}function Bo(e){return jo({is_payment_request_enabled:e})}function Yo(e){return jo({is_apple_google_pay_in_payment_methods_options_enabled:e})}function qo(e){return jo({enabled_payment_method_ids:[...e]})}function Vo(e,t){return{type:br.SET_IS_SAVING_SETTINGS,isSaving:e,error:t}}function Ho(e){return{type:br.SET_SELECTED_PAYMENT_METHOD,id:e}}function Wo(e){return{type:br.SET_UNSELECTED_PAYMENT_METHOD,id:e}}function Go(e){return jo({is_manual_capture_enabled:e})}function Qo(e){return jo({is_test_mode_enabled:e})}function Zo(e){return jo({is_debug_log_enabled:e})}function Jo(e){return jo({is_multi_currency_enabled:e})}function Ko(e){return jo({is_wcpay_subscriptions_enabled:e})}function Xo(e){return jo({account_statement_descriptor:e})}function en(e){return jo({account_statement_descriptor_kanji:e})}function tn(e){return jo({account_statement_descriptor_kana:e})}function rn(e){return jo({account_business_support_email:e})}function on(e){return jo({account_business_support_phone:e})}function nn(e){return jo({deposit_schedule_interval:e})}function an(e){return jo({deposit_schedule_weekly_anchor:e})}function sn(e){return jo({deposit_schedule_monthly_anchor:""===e?null:parseInt(e,10)})}function*cn(){let e=null;try{const e=(0,_e.select)(Se).getSettings();yield Vo(!0,null);const t=yield(0,ye.apiFetch)({path:`${he}/settings`,method:"post",data:e});yield jo({payment_method_statuses:t.data.payment_method_statuses}),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,K.__)("Settings saved.","woocommerce-payments"))}catch(t){e=t,yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error saving settings.","woocommerce-payments")),e.server_error&&(yield(0,_e.dispatch)("core/notices").createErrorNotice(e.server_error))}finally{yield Vo(!1,e)}return null===e}function dn(e){return jo({is_woopay_enabled:e})}function un(e){return jo({is_amazon_pay_enabled:e})}function ln(e){return jo({is_woopay_global_theme_support_enabled:e})}function mn(e){return jo({woopay_custom_message:e})}function pn(e){return jo({woopay_store_logo:e})}function _n(e){return jo({current_protection_level:e})}function yn(e){return jo({advanced_fraud_protection_settings:e})}function hn(e){return jo({is_stripe_billing_enabled:e})}function Sn(e){return jo({account_communications_email:e})}function gn(e){return jo({express_checkout_product_methods:[...e]})}function En(e){return jo({express_checkout_cart_methods:[...e]})}function fn(e){return jo({express_checkout_checkout_methods:[...e]})}function*wn(){try{yield(0,_e.dispatch)(Se).startResolution("scheduleStripeBillingMigration"),yield(0,ye.apiFetch)({path:`${he}/settings/schedule-stripe-billing-migration`,method:"post"})}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error starting the Stripe Billing migration.","woocommerce-payments"))}yield(0,_e.dispatch)(Se).finishResolution("scheduleStripeBillingMigration")}function Tn(e,t){return Po()({path:`${he}/settings/${e}`,method:"post",data:{value:t}}).catch((()=>{(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error saving option","woocommerce-payments"))}))}function*Rn(){const e=`${he}/settings`;try{const t=yield(0,ye.apiFetch)({path:e});yield zo(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error retrieving settings.","woocommerce-payments"))}}const bn=e=>()=>{const{updateExpressCheckoutProductMethods:t,updateExpressCheckoutCartMethods:r,updateExpressCheckoutCheckoutMethods:o}=(0,_e.useDispatch)(Se),n=(0,_e.useSelect)((e=>e(Se).getExpressCheckoutProductMethods())),a=(0,_e.useSelect)((e=>e(Se).getExpressCheckoutCartMethods())),s=(0,_e.useSelect)((e=>e(Se).getExpressCheckoutCheckoutMethods())),i={product:n,cart:a,checkout:s},c={product:t,cart:r,checkout:o};return[[n.includes(e)&&"product",a.includes(e)&&"cart",s.includes(e)&&"checkout"].filter(Boolean),(t,r)=>{c[t](r?[...i[t],e]:i[t].filter((t=>t!==e)))}]},vn=(bn("payment_request"),bn("woopay"),bn("amazon_pay"),{SET_CARD_READER_STATS:"SET_CARD_READER_STATS",SET_ERROR_FOR_CARD_READER_STATS:"SET_ERROR_FOR_CARD_READER_STATS",SET_READERS:"SET_READERS",SET_ERROR_FOR_CARD_READERS:"SET_ERROR_FOR_CARD_READERS"}),On=(e,t)=>e.readers[t]&&e.readers[t].data?e.readers[t].data:{},In=(e,t)=>e.readers[t]&&e.readers[t].error?e.readers[t].error:{},An=e=>e.readers&&e.readers.list?e.readers.list:{};function Nn(e,t){return{type:vn.SET_CARD_READER_STATS,id:e,data:t}}function Cn(e,t){return{type:vn.SET_READERS,query:e,data:t}}function xn(e,t,r){return{type:vn.SET_CARD_ERROR_FOR_READER_STATS,id:e,data:t,error:r}}function Pn(e,t){return{type:vn.SET_CARD_ERROR_FOR_READERS,data:e,error:t}}function*jn(e,t){try{const r=yield(0,ye.apiFetch)({path:`${he}/readers/charges/${t}`});yield Nn(e,r)}catch(t){yield xn(e,null,t)}}function*Dn(e){const t=(0,je.addQueryArgs)(`${he}/readers`,{limit:e.limit});try{const r=yield(0,ye.apiFetch)({path:t})||{};yield Cn(e,r)}catch(e){yield Pn(null,e)}}var Mn;!function(e){e.SET_ACTIVE_LOAN_SUMMARY="SET_ACTIVE_LOAN_SUMMARY",e.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY="SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY",e.SET_LOANS="SET_LOANS",e.SET_ERROR_FOR_LOANS="SET_ERROR_FOR_LOANS"}(Mn||(Mn={}));const Fn=Mn,Un={},kn=e=>e&&e.capital||{},Ln=e=>kn(e).summary,zn=e=>kn(e).summaryError,$n=e=>kn(e).loans||[],Bn=e=>kn(e).loansError;function Yn(e){return{type:Fn.SET_ACTIVE_LOAN_SUMMARY,data:e}}function qn(e){return{type:Fn.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY,error:e}}function Vn(e){return{type:Fn.SET_LOANS,data:e.data}}function Hn(e){return{type:Fn.SET_ERROR_FOR_LOANS,error:e}}function*Wn(){const e=`${he}/capital/active_loan_summary`;try{const t=yield(0,ye.apiFetch)({path:e});yield Yn(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving the active loan summary.","woocommerce-payments")),yield qn(e)}}function*Gn(){const e=`${he}/capital/loans`;try{const t=yield(0,ye.apiFetch)({path:e});yield Vn(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving the active loan summary.","woocommerce-payments")),yield Hn(e)}}const Qn={SET_DOCUMENTS:"SET_DOCUMENTS",SET_ERROR_FOR_DOCUMENTS:"SET_ERROR_FOR_DOCUMENTS",SET_DOCUMENTS_SUMMARY:"SET_DOCUMENTS_SUMMARY",SET_ERROR_FOR_DOCUMENTS_SUMMARY:"SET_ERROR_FOR_DOCUMENTS_SUMMARY"},Zn={summary:{}},Jn=e=>e&&e.documents||{},Kn=(e,t)=>{const r=Ee(t);return Jn(e)[r]||{}},Xn=(e,t)=>Kn(e,t).data||[],ea=(e,t)=>Kn(e,t).error||{},ta=(e,t)=>{const r=Ee(t);return Jn(e).summary[r]||{}},ra=(e,t)=>ta(e,t).data||{},oa=(e,t)=>ta(e,t).error||{};function na(e,t){return{type:Qn.SET_DOCUMENTS,query:e,data:t}}function aa(e,t,r){return{type:Qn.SET_ERROR_FOR_DOCUMENTS,query:e,data:t,error:r}}function sa(e,t){return{type:Qn.SET_DOCUMENTS_SUMMARY,query:e,data:t}}function ia(e,t,r){return{type:Qn.SET_ERROR_FOR_DOCUMENTS_SUMMARY,query:e,data:t,error:r}}const ca=e=>({user_email:e.userEmail,match:e.match,date_before:ke(e.dateBefore,!0),date_after:ke(e.dateAfter),date_between:e.dateBetween&&[ke(e.dateBetween[0]),ke(e.dateBetween[1],!0)],type_is:e.typeIs,type_is_not:e.typeIsNot});function*da(e){const t=(0,je.addQueryArgs)(`${he}/documents`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...ca(e)});try{const r=yield(0,ye.apiFetch)({path:t});yield na(e,r.data||[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving documents.","woocommerce-payments")),yield aa(e,null,t)}}function*ua(e){const t=(0,je.addQueryArgs)(`${he}/documents/summary`,ca(e));try{const r=yield(0,ye.apiFetch)({path:t});yield sa(e,r)}catch(t){yield ia(e,null,t)}}const la={},ma=({paymentIntents:e},t)=>{const r=null==e?void 0:e[t];return(null==r?void 0:r.data)||{}},pa=({paymentIntents:e},t)=>{const r=null==e?void 0:e[t];return(null==r?void 0:r.error)||{}},_a={SET_AUTHORIZATIONS:"SET_AUTHORIZATIONS",SET_AUTHORIZATION:"SET_AUTHORIZATION",SET_ERROR_FOR_AUTHORIZATIONS:"SET_ERROR_FOR_AUTHORIZATIONS",SET_AUTHORIZATIONS_SUMMARY:"SET_AUTHORIZATIONS_SUMMARY",SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY:"SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY",SET_IS_REQUESTING_AUTHORIZATION:"SET_IS_REQUESTING_AUTHORIZATION"},ya={summary:{},byId:{},isRequesting:!1},ha=e=>e&&e.authorizations||{},Sa=(e,t)=>{const r=Ee(t);return ha(e)[r]||{}},ga=(e,t)=>Sa(e,t).data||[],Ea=(e,t)=>(ha(e).byId||{})[t],fa=(e,t)=>Sa(e,t).error||{},wa=(e,t)=>{const r=Ee(t);return ha(e).summary[r]||{}},Ta=(e,t)=>wa(e,t).data||{},Ra=(e,t)=>wa(e,t).error||{},ba=e=>ha(e).isRequesting,va=e=>{var t;const r={wcpay_missing_order:(0,K.__)("The order could not be found.","woocommerce-payments"),wcpay_refunded_order_uncapturable:(0,K.__)("Payment cannot be processed for partially or fully refunded orders.","woocommerce-payments"),wcpay_intent_order_mismatch:(0,K.__)("The payment cannot be processed due to a mismatch with order details.","woocommerce-payments"),wcpay_payment_uncapturable:(0,K.__)("This payment cannot be processed in its current state.","woocommerce-payments"),wcpay_capture_error:e=>{var t;return"amount_too_small"===(null===(t=e.data)||void 0===t?void 0:t.error_type)?(e=>{var t,r,o,n;if(!(null===(r=null===(t=e.data)||void 0===t?void 0:t.extra_details)||void 0===r?void 0:r.minimum_amount)||!(null===(n=null===(o=e.data)||void 0===o?void 0:o.extra_details)||void 0===n?void 0:n.minimum_amount_currency))return(0,K.__)("The payment amount is too small to be processed.","woocommerce-payments");const a=e.data.extra_details.minimum_amount_currency,s=le(e.data.extra_details.minimum_amount,a);return(0,K.sprintf)((0,K.__)("The minimum amount that can be processed is %1$s %2$s.","woocommerce-payments"),s,a.toUpperCase())})(e):(0,K.__)("The payment capture failed to complete.","woocommerce-payments")},wcpay_cancel_error:(0,K.__)("The payment cancellation failed to complete.","woocommerce-payments"),wcpay_server_error:(0,K.__)("An unexpected error occurred. Please try again later.","woocommerce-payments")},o=r[null!==(t=e.code)&&void 0!==t?t:""];return"function"==typeof o?o(e):null!=o?o:(0,K.__)("Unable to process the payment. Please try again later.","woocommerce-payments")};function Oa(e,t){return{type:_a.SET_AUTHORIZATIONS,data:t,query:e}}function Ia(e,t){return{type:_a.SET_ERROR_FOR_AUTHORIZATIONS,query:e,error:t}}function Aa(e){return{type:_a.SET_AUTHORIZATION,data:e}}function Na(e,t){return{type:_a.SET_AUTHORIZATIONS_SUMMARY,data:t,query:e}}function Ca(e){return{type:_a.SET_IS_REQUESTING_AUTHORIZATION,data:e}}function*xa(e,t){try{yield _e.controls.dispatch(Se,"startResolution","getAuthorization",[e]),yield _e.controls.dispatch(Se,"setIsRequestingAuthorization",!0);const r=yield(0,ye.apiFetch)({path:`/wc/v3/payments/orders/${t}/capture_authorization`,method:"post",data:{payment_intent_id:e}}),o={payment_intent_id:r.id,captured:"succeeded"===r.status};yield Aa(o),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getAuthorizations"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getAuthorizationsSummary"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactions"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactionsSummary"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getTransactions"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,K.sprintf)((0,K.__)("Payment for order #%s captured successfully.","woocommerce-payments"),t))}catch(e){const r=(0,K.sprintf)((0,K.__)("There has been an error capturing the payment for order #%s.","woocommerce-payments"),t),o=va(e);yield _e.controls.dispatch("core/notices","createErrorNotice",`${r} ${o}`)}finally{yield _e.controls.dispatch(Se,"finishResolution","getAuthorization",[e]),yield _e.controls.dispatch(Se,"setIsRequestingAuthorization",!1)}}function*Pa(e,t){try{yield _e.controls.dispatch(Se,"startResolution","getAuthorization",[e]),yield _e.controls.dispatch(Se,"setIsRequestingAuthorization",!0);const r=yield(0,ye.apiFetch)({path:`/wc/v3/payments/orders/${t}/cancel_authorization`,method:"post",data:{payment_intent_id:e}}),o={payment_intent_id:r.id,captured:"succeeded"===r.status};yield Aa(o),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getAuthorizations"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getAuthorizationsSummary"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactions"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactionsSummary"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(Se,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,K.sprintf)((0,K.__)("Payment for order #%s canceled successfully.","woocommerce-payments"),t))}catch(e){const r=(0,K.sprintf)((0,K.__)("There has been an error canceling the payment for order #%s.","woocommerce-payments"),t),o=va(e);yield _e.controls.dispatch("core/notices","createErrorNotice",`${r} ${o}`)}finally{yield _e.controls.dispatch(Se,"finishResolution","getAuthorization",[e]),yield _e.controls.dispatch(Se,"setIsRequestingAuthorization",!1)}}function ja(e,t){return{type:_a.SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY,query:e,error:t}}function*Da(e){var t;let{paged:r=1,per_page:o=25,orderby:n="created",order:a="asc"}=e;"capture_by"===n&&(n="created");const s=(0,je.addQueryArgs)(`${he}/authorizations`,{page:r,pagesize:o,sort:n,direction:a});try{const r=yield(0,ye.apiFetch)({path:s});yield Oa(e,null!==(t=r.data)&&void 0!==t?t:[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving uncaptured transactions.","woocommerce-payments")),yield Ia(e,t)}}function*Ma(e){try{if(e){const t=yield(0,ye.apiFetch)({path:`${he}/authorizations/${e}`}),{is_captured:r,payment_intent_id:o,created:n}=t;yield Aa({payment_intent_id:o,captured:r,created:n})}}catch(e){"authorization_missing"!==e.code&&(yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving authorization.","woocommerce-payments")))}}function*Fa(e){const t=(0,je.addQueryArgs)(`${he}/authorizations/summary`,{pagesize:e.per_page,sort:e.orderby,direction:e.order,page:e.paged});try{const r=yield(0,ye.apiFetch)({path:t});yield Na(e,null!=r?r:[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving uncaptured transactions.","woocommerce-payments")),yield ja(e,t)}}var Ua;!function(e){e.SET_FILE="SET_FILE",e.SET_ERROR_FOR_FILES="SET_ERROR_FOR_FILES"}(Ua||(Ua={}));const ka=Ua,La={},za=({files:e},t)=>{const r=null==e?void 0:e[t];return(null==r?void 0:r.data)||{}},$a=({files:e},t)=>{const r=null==e?void 0:e[t];return(null==r?void 0:r.error)||{}};function Ba(e,t){return{type:ka.SET_FILE,id:e,data:t}}function Ya(e,t){return{type:ka.SET_ERROR_FOR_FILES,id:e,error:t}}function*qa(e){try{const t=yield(0,ye.apiFetch)({path:`${he}/file/${e}/details`});yield Ba(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving file.","woocommerce-payments")),yield Ya(e,t)}}var Va;!function(e){e.SET_PM_PROMOTIONS="SET_PM_PROMOTIONS",e.SET_ERROR_FOR_PM_PROMOTIONS="SET_ERROR_FOR_PM_PROMOTIONS"}(Va||(Va={}));const Ha={pmPromotions:void 0,pmPromotionsError:void 0},Wa=e=>{var t,r;return null!==(r=null===(t=e.pmPromotions)||void 0===t?void 0:t.pmPromotions)&&void 0!==r?r:[]},Ga=e=>{var t;return null===(t=e.pmPromotions)||void 0===t?void 0:t.pmPromotionsError};function Qa(e){return function(e){return"object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code}(e)?e:{code:"unknown_error"}}function Za(e){return{type:Va.SET_PM_PROMOTIONS,data:e}}function Ja(e){return{type:Va.SET_ERROR_FOR_PM_PROMOTIONS,error:e}}function*Ka(e){const t=`${he}/pm-promotions/${e}/activate`;try{yield(0,ye.apiFetch)({path:t,method:"POST"}),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,K.__)("Promotion activated successfully!","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","invalidateResolution","getPmPromotions",[])}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error activating promotion. Please try again.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",Qa(e))}}function*Xa(e){const t=`${he}/pm-promotions/${e}/dismiss`;try{yield(0,ye.apiFetch)({path:t,method:"POST"}),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,K.__)("Promotion dismissed.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","invalidateResolution","getPmPromotions",[])}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error dismissing promotion. Please try again.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",Qa(e))}}function es(e){if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.promo_id&&"string"==typeof t.payment_method&&"string"==typeof t.payment_method_title&&"string"==typeof t.type&&("spotlight"===t.type||"badge"===t.type)&&"string"==typeof t.title&&"string"==typeof t.description&&"string"==typeof t.cta_label&&"string"==typeof t.tc_url&&"string"==typeof t.tc_label}function*ts(){const e=`${he}/pm-promotions`;try{const t=yield(0,ye.apiFetch)({path:e});if(r=t,!Array.isArray(r)||!r.every(es))throw new Error("Invalid promotions data received from API");yield _e.controls.dispatch("wc/payments","updatePmPromotions",t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,K.__)("Error retrieving promotions. Please try again later.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",(t=e,function(e){return"object"==typeof e&&null!==e&&"code"in e}(t)?t:{code:"unknown_error"}))}var t,r}(0,_e.registerStore)(Se,{reducer:(0,_e.combineReducers)({deposits:(e=fe,{type:t,query:r={},data:o=[],error:n})=>{const a=Ee(r);switch(t){case ge.SET_DEPOSIT:return{...e,byId:{...e.byId,[o.id]:o}};case ge.SET_ALL_DEPOSITS_OVERVIEWS:return{...e,overviews:{...e.overviews,data:o}};case ge.SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS:return{...e,overviews:{...e.overviews,error:n}};case ge.SET_DEPOSITS:return{...e,byId:{...e.byId,...(0,de.keyBy)(o,"id")},queries:{...e.queries,[a]:{data:(0,de.map)(o,"id")}}};case ge.SET_DEPOSITS_COUNT:return{...e,count:o};case ge.SET_ERROR_FOR_DEPOSIT_QUERY:return{...e,queries:{...e.queries,[a]:{error:n}}};case ge.SET_DEPOSITS_SUMMARY:return{...e,summary:{...e.summary,[a]:{data:o}}};case ge.SET_ERROR_FOR_DEPOSITS_SUMMARY:return{...e,summary:{...e.summary,[a]:{error:n}}};case ge.SET_INSTANT_DEPOSIT:return{...e,instant:{...e.instant,data:o}}}return e},transactions:(e=ot,{type:t,query:r={},data:o=[],error:n,status:a})=>{const s=Ee(r);switch(t){case rt.SET_TRANSACTIONS:return{...e,[s]:{data:o}};case rt.SET_ERROR_FOR_TRANSACTIONS:return{...e,[s]:{error:n}};case rt.SET_TRANSACTIONS_SUMMARY:return{...e,summary:{...e.summary,[s]:{data:o}}};case rt.SET_ERROR_FOR_TRANSACTIONS_SUMMARY:return{...e,summary:{...e.summary,[s]:{error:n}}};case rt.SET_FRAUD_OUTCOME_TRANSACTIONS:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},[s]:{data:o}}}};case rt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},[s]:{error:n}}}};case rt.SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},summary:{...e.fraudProtection?.[a]?.summary||{},[s]:{data:o}}}}};case rt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},summary:{...e.fraudProtection?.[a]?.summary||{},[s]:{error:n}}}}}}return e},charges:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case jt.SET_CHARGE:e={...e,[r]:{...e[r],data:o}};break;case jt.SET_ERROR_FOR_CHARGE:e={...e,[r]:{...e[r],error:n}}}return e},timeline:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case Bt.SET_TIMELINE:e={...e,[r]:{data:o}};break;case Bt.SET_ERROR_FOR_TIMELINE:e={...e,[r]:{...e[r],error:n}}}return e},disputes:(e=Qt,{type:t,query:r={},data:o=[],id:n,error:a})=>{const s=Ee(r);switch(t){case Gt.SET_DISPUTE:return{...e,byId:{...e.byId,[o.id]:o}};case Gt.SET_ERROR_FOR_DISPUTE:e={...e,byId:{...e.byId,[n]:{error:a}}};break;case Gt.SET_DISPUTES:return{...e,cached:{...e.cached,...(0,de.keyBy)(o,"dispute_id")},queries:{...e.queries,[s]:{data:(0,de.map)(o,"dispute_id")}}};case Gt.SET_DISPUTES_SUMMARY:return{...e,summary:{...e.summary,[s]:{data:o}}}}return e},settings:(e=vr,{type:t,...r})=>{switch(t){case br.SET_SETTINGS:return{...e,data:r.data,isDirty:!1};case br.SET_SETTINGS_VALUES:return{...e,savingError:null,isDirty:!0,data:{...e.data,...r.payload}};case br.SET_IS_SAVING_SETTINGS:return{...e,isDirty:!(!r.isSaving&&!r.error)&&e.isDirty,isSaving:r.isSaving,savingError:r.error};case br.SET_SELECTED_PAYMENT_METHOD:return{...e,isDirty:!0,data:{...e.data,enabled_payment_method_ids:e.data.enabled_payment_method_ids.concat(r.id)}};case br.SET_UNSELECTED_PAYMENT_METHOD:return{...e,isDirty:!0,data:{...e.data,enabled_payment_method_ids:e.data.enabled_payment_method_ids.filter((e=>e!==r.id))}}}return e},readers:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case vn.SET_CARD_READER_STATS:e={...e,[r]:{...e[r],data:o}};break;case vn.SET_ERROR_FOR_CARD_READER_STATS:e={...e,[r]:{...e[r],error:n}};break;case vn.SET_READERS:e={...e,list:o}}return e},capital:(e=Un,t)=>{switch(t.type){case Fn.SET_ACTIVE_LOAN_SUMMARY:return Object.assign(Object.assign({},e),{summary:t.data,summaryError:void 0});case Fn.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY:return Object.assign(Object.assign({},e),{summary:void 0,summaryError:t.error});case Fn.SET_LOANS:return Object.assign(Object.assign({},e),{loans:t.data,loansError:void 0});case Fn.SET_ERROR_FOR_LOANS:return Object.assign(Object.assign({},e),{loans:void 0,loansError:t.error})}return e},documents:(e=Zn,{type:t,query:r={},data:o=[],error:n})=>{const a=Ee(r);switch(t){case Qn.SET_DOCUMENTS:return{...e,[a]:{data:o}};case Qn.SET_ERROR_FOR_DOCUMENTS:return{...e,[a]:{error:n}};case Qn.SET_DOCUMENTS_SUMMARY:return{...e,summary:{...e.summary,[a]:{data:o}}};case Qn.SET_ERROR_FOR_DOCUMENTS_SUMMARY:return{...e,summary:{...e.summary,[a]:{error:n}}}}return e},paymentIntents:(e=la,t)=>{const{type:r,id:o}=t;switch(r){case or.SET_PAYMENT_INTENT:return Object.assign(Object.assign({},e),{[o]:Object.assign(Object.assign({},e[o]),{data:t.data})});case or.SET_ERROR_FOR_PAYMENT_INTENT:return Object.assign(Object.assign({},e),{[o]:Object.assign(Object.assign({},e[o]),{error:t.error})});default:return e}},authorizations:(e=ya,t)=>{switch(t.type){case _a.SET_AUTHORIZATION:{const{data:r}=t;return Object.assign(Object.assign({},e),{byId:Object.assign(Object.assign({},e.byId),{[r.payment_intent_id]:Object.assign(Object.assign({},e.byId[r.payment_intent_id]),r)})})}case _a.SET_AUTHORIZATIONS:{const{data:r,query:o}=t;return Object.assign(Object.assign({},e),{[Ee(o)]:{data:r}})}case _a.SET_ERROR_FOR_AUTHORIZATIONS:{const{error:r,query:o}=t;return Object.assign(Object.assign({},e),{[Ee(o)]:{error:r}})}case _a.SET_AUTHORIZATIONS_SUMMARY:{const{data:r,query:o}=t;return Object.assign(Object.assign({},e),{summary:Object.assign(Object.assign({},e.summary),{[Ee(o)]:{data:r||{}}})})}case _a.SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY:{const{query:r,error:o}=t;return Object.assign(Object.assign({},e),{summary:Object.assign(Object.assign({},e.summary),{[Ee(r)]:{error:o||""}})})}case _a.SET_IS_REQUESTING_AUTHORIZATION:{const{data:r}=t;return Object.assign(Object.assign({},e),{isRequesting:r})}}return e},files:(e=La,t)=>{const{type:r,id:o}=t;switch(r){case ka.SET_FILE:return Object.assign(Object.assign({},e),{[o]:Object.assign(Object.assign({},e[o]),{data:t.data})});case ka.SET_ERROR_FOR_FILES:return Object.assign(Object.assign({},e),{[o]:Object.assign(Object.assign({},e[o]),{error:t.error})});default:return e}},pmPromotions:(e=Ha,t)=>{switch(t.type){case Va.SET_PM_PROMOTIONS:return Object.assign(Object.assign({},e),{pmPromotions:t.data,pmPromotionsError:void 0});case Va.SET_ERROR_FOR_PM_PROMOTIONS:return Object.assign(Object.assign({},e),{pmPromotions:void 0,pmPromotionsError:t.error})}return e}}),actions:{...t,...a,...c,...l,...h,...E,...T,...v,...A,..._,...P,...M,...k},controls:ye.controls,selectors:{...e,...n,...i,...u,...p,...g,...w,...b,...I,...C,...x,...D,...U},resolvers:{...o,...s,...d,...m,...S,...f,...R,...O,...N,...y,...j,...F,...L}});const rs="/wc/v3/payments",os="wc/payments/multi-currency",ns={SET_CURRENCIES:"SET_CURRENCIES",SET_AVAILABLE_CURRENCIES:"SET_AVAILABLE_CURRENCIES",SET_ENABLED_CURRENCIES:"SET_ENABLED_CURRENCIES",SET_DEFAULT_CURRENCY:"SET_DEFAULT_CURRENCY",SET_CURRENCY_SETTINGS:"SET_CURRENCY_SETTINGS",SET_STORE_SETTINGS:"SET_STORE_SETTINGS"},as={},ss=e=>e&&e||{},is=e=>ss(e).currencies||{},cs=e=>is(e).available||{},ds=e=>is(e).enabled||{},us=e=>is(e).default||{},ls=e=>ss(e).currency_settings||{},ms=e=>ss(e).settings||{};function ps(e){return{type:ns.SET_CURRENCIES,data:e}}function _s(e){return{type:ns.SET_AVAILABLE_CURRENCIES,data:e}}function ys(e){return{type:ns.SET_ENABLED_CURRENCIES,data:e}}function hs(e){return{type:ns.SET_DEFAULT_CURRENCY,data:e}}function Ss(e,t){return{type:ns.SET_CURRENCY_SETTINGS,data:{code:e,data:t}}}function gs(e){return{type:ns.SET_STORE_SETTINGS,data:e}}function*Es(e){const t=Object.keys((0,_e.select)(os).getEnabledCurrencies()),r=e.filter((e=>!t.includes(e))),o=t.filter((t=>!e.includes(t)));try{const t=yield(0,ye.apiFetch)({path:`${rs}/multi-currency/update-enabled-currencies`,method:"POST",data:{enabled:e}});yield ps(t),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,K.__)("Enabled currencies updated.","woocommerce-payments")),se("wcpay_multi_currency_enabled_currencies_updated",{added_currencies:r,removed_currencies:o})}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error updating enabled currencies.","woocommerce-payments"))}}function*fs(e,t){try{const r=yield(0,ye.apiFetch)({path:`${rs}/multi-currency/currencies/${e}`,method:"POST",data:t});yield Ss(e,r),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,K.__)("Currency settings updated.","woocommerce-payments"))}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error updating currency settings.","woocommerce-payments"))}}function*ws(e,t,r=!1){try{const o=yield(0,ye.apiFetch)({path:`${rs}/multi-currency/update-settings`,method:"POST",data:{wcpay_multi_currency_enable_auto_currency:e?"yes":"no",wcpay_multi_currency_enable_storefront_switcher:t?"yes":"no"}});if(yield gs(o),r)return;yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,K.__)("Store settings saved.","woocommerce-payments"))}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error saving store settings.","woocommerce-payments"))}}function Ts(e,t){Po()({path:`${rs}/settings/${e}`,method:"post",data:{value:t}}).catch((()=>{(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error saving option","woocommerce-payments"))}))}function*Rs(){const e=`${rs}/multi-currency/currencies`;try{const t=yield(0,ye.apiFetch)({path:e});yield ps(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error retrieving currencies.","woocommerce-payments"))}}function*bs(e){const t=`${rs}/multi-currency/currencies/${e}`;try{const r=yield(0,ye.apiFetch)({path:t});yield Ss(e,r)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error retrieving single currency settings.","woocommerce-payments"))}}function*vs(){const e=`${rs}/multi-currency/get-settings`;try{const t=yield(0,ye.apiFetch)({path:e});yield gs(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,K.__)("Error retrieving store settings.","woocommerce-payments"))}}const Os=()=>(0,_e.useSelect)((e=>{const{getCurrencies:t,isResolving:r}=e(os);return{currencies:t(),isLoading:r("getCurrencies",[])}}),[]),Is=()=>{const e=(0,_e.useSelect)((e=>{const{getEnabledCurrencies:t}=e(os);return t()})),{submitEnabledCurrenciesUpdate:t}=(0,_e.useDispatch)(os);return{enabledCurrencies:e,submitEnabledCurrenciesUpdate:t}},As=()=>{const{storeSettings:e,isLoading:t}=(0,_e.useSelect)((e=>{const{getStoreSettings:t,isResolving:r}=e(os);return{storeSettings:t(),isLoading:r("getStoreSettings",[])}})),{submitStoreSettingsUpdate:r}=(0,_e.useDispatch)(os);return{storeSettings:e,isLoading:t,submitStoreSettingsUpdate:r}},Ns=()=>(0,_e.useSelect)((e=>{const{getDefaultCurrency:t}=e(os);return t()}));(0,_e.registerStore)(os,{reducer:(e=as,{type:t,data:r=[]})=>{switch(t){case ns.SET_CURRENCIES:return{...e,currencies:r,available:r.available,enabled:r.enabled,default:r.default};case ns.SET_AVAILABLE_CURRENCIES:return{...e,currencies:{...e,available:r.available},available:r.available};case ns.SET_ENABLED_CURRENCIES:return{...e,currencies:{...e,enabled:r.enabled},enabled:r.enabled};case ns.SET_DEFAULT_CURRENCY:return{...e,currencies:{...e,default:r.default},default:r.default};case ns.SET_CURRENCY_SETTINGS:return{...e,currency_settings:{...e.currency_settings,[r.code]:r.data}};case ns.SET_STORE_SETTINGS:return{...e,settings:{enable_auto_currency:r.wcpay_multi_currency_enable_auto_currency,enable_storefront_switcher:r.wcpay_multi_currency_enable_storefront_switcher,site_theme:r.site_theme,date_format:r.date_format,time_format:r.time_format,store_url:r.store_url}}}return e},actions:{...$},controls:ye.controls,selectors:{...z},resolvers:{...B}});const Cs=({isPreviewModalOpen:e,setPreviewModalOpen:t,isStorefrontSwitcherEnabledValue:r,isAutomaticSwitchEnabledValue:o})=>{const{storeSettings:n}=As();return e&&(0,H.jsx)(W.Modal,{title:(0,K.__)("Preview","woocommerce-payments"),isDismissible:!0,className:"multi-currency-store-settings-preview-modal",shouldCloseOnClickOutside:!1,onRequestClose:()=>{t(!1)},children:(0,H.jsx)("iframe",{title:(0,K.__)("Preview","woocommerce-payments"),className:"multi-currency-store-settings-preview-iframe",src:"/"+n.store_url+"?is_mc_onboarding_simulation=1&enable_storefront_switcher="+r+"&enable_auto_currency="+o})})},xs=window.wp.element,Ps=({children:e})=>(0,H.jsx)("ul",{children:e});function js(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function Ds(e,t){let r,o,n=[];for(let a=0;a<e.length;a++){const s=e[a];if("string"!==s.type){if(void 0===t[s.value])throw new Error(`Invalid interpolation, missing component node: \`${s.value}\``);if("object"!=typeof t[s.value])throw new Error(`Invalid interpolation, component node must be a ReactElement or null: \`${s.value}\``);if("componentClose"===s.type)throw new Error(`Missing opening component token: \`${s.value}\``);if("componentOpen"===s.type){r=t[s.value],o=a;break}n.push(t[s.value])}else n.push(s.value)}if(r){const a=function(e,t){const r=t[e];let o=0;for(let n=e+1;n<t.length;n++){const e=t[n];if(e.value===r.value){if("componentOpen"===e.type){o++;continue}if("componentClose"===e.type){if(0===o)return n;o--}}}throw new Error("Missing closing component token `"+r.value+"`")}(o,e),s=Ds(e.slice(o+1,a),t),i=(0,Y.cloneElement)(r,{},s);if(n.push(i),a<e.length-1){const r=Ds(e.slice(a+1),t);n=n.concat(r)}}return n=n.filter(Boolean),0===n.length?null:1===n.length?n[0]:(0,Y.createElement)(Y.Fragment,null,...n)}function Ms(e){const{mixedString:t,components:r,throwErrors:o}=e;if(!r)return t;if("object"!=typeof r){if(o)throw new Error(`Interpolation Error: unable to process \`${t}\` because components is not an object`);return t}const n=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(js)}(t);try{return Ds(n,r)}catch(e){if(o)throw new Error(`Interpolation Error: unable to process \`${t}\` because of error \`${e.message}\``);return t}}const Fs=({onChange:e,checked:t=!1,currency:{flag:r,symbol:o,code:n,name:a},testId:s=null})=>{const i=(0,xs.useCallback)((t=>{e(n,t)}),[n,e]);return(0,H.jsx)("li",{className:"enabled-currency-checkbox","data-testid":s,children:(0,H.jsx)(W.CheckboxControl,{code:n,checked:t,onChange:i,label:Ms({mixedString:"{{flag /}} {{name /}} {{code /}}",components:{flag:(0,H.jsx)("span",{className:"enabled-currency-checkbox__flag",children:""!==r?r:(0,H.jsx)("div",{className:"enabled-currency-checkbox__flag-text",children:(0,H.jsx)("span",{children:n})})}),name:(0,H.jsx)("span",{children:a}),code:(0,H.jsxs)("span",{className:"enabled-currency-checkbox__code",children:["(",o,o!==n&&" "+n,")"]})}}),__nextHasNoMarginBottom:!0})})},Us=((0,K.__)("any","woocommerce-payments"),(0,K.__)("one","woocommerce-payments"),(0,K.__)("two","woocommerce-payments"),(0,K.__)("three","woocommerce-payments"),(0,K.__)("four","woocommerce-payments"),(0,K.__)("five","woocommerce-payments"),(0,K.__)("six","woocommerce-payments"),(0,K.__)("seven","woocommerce-payments"),(0,K.__)("eight","woocommerce-payments"),(0,K.__)("nine","woocommerce-payments"),({className:e,children:t})=>(0,H.jsx)("ul",{className:e,children:t}));var ks=r(9387);const Ls=({symbol:e})=>(0,H.jsx)("div",{className:"currency-delete-illustration__wrapper",children:(0,H.jsxs)("div",{className:"currency-delete-illustration__illustrations",children:[e,(0,H.jsx)(ks.A,{className:"currency-delete-illustration__currency-cross-icon"})]})}),zs=r.p+"../assets/images/payment-methods/jcb.svg?ver=3351f2584f4a62ad094d",$s=r.p+"../assets/images/cards/visa.svg?ver=f10d76e13a47cb867cca",Bs=r.p+"../assets/images/cards/mastercard.svg?ver=d21057587f14a719da45",Ys=r.p+"../assets/images/cards/amex.svg?ver=9035aad80e3ae7ac653c",qs=r.p+"../assets/images/payment-methods/woo.svg?ver=86a2411c2b2a56f57bc5",Vs=r.p+"../assets/images/payment-methods/woo-short.svg?ver=e7eb126add68e8fde2b6",Hs=r.p+"../assets/images/cards/diners.svg?ver=62451ea54fcf12af5e0d",Ws=r.p+"../assets/images/cards/discover.svg?ver=a19341de516c258e11fe",Gs=r.p+"../assets/images/cards/cb.svg?ver=375fa3d816484fa4b53c",Qs=r.p+"../assets/images/cards/unionpay.svg?ver=e60ed9d9db08315ff5c9";const Zs=(e,t,r=!0)=>o=>{var{className:n}=o,a=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["className"]);return q().createElement("img",Object.assign({className:Q("payment-method__icon",r?"":"no-border",n),src:e,alt:t},a))},Js=(Zs(Ys,(0,K.__)("American Express","woocommerce-payments")),Zs(Gs,(0,K.__)("Cartes Bancaires","woocommerce-payments")),Zs(Hs,(0,K.__)("Diners Club","woocommerce-payments")),Zs(Ws,(0,K.__)("Discover","woocommerce-payments")),Zs(zs,(0,K.__)("JCB","woocommerce-payments")));if(Zs(Bs,(0,K.__)("Mastercard","woocommerce-payments")),Zs(Qs,(0,K.__)("UnionPay","woocommerce-payments")),Zs($s,(0,K.__)("Visa","woocommerce-payments")),Zs(qs,(0,K.__)("WooPay","woocommerce-payments"),!1),Zs(Vs,(0,K.__)("WooPay","woocommerce-payments"),!1),"undefined"==typeof wooPaymentsPaymentMethodDefinitions)throw new Error("wooPaymentsPaymentMethodDefinitions is undefined");const Ks=Object.keys(wooPaymentsPaymentMethodDefinitions).reduce(((e,t)=>(e[t]=Object.assign(Object.assign({},wooPaymentsPaymentMethodDefinitions[t]),{icon:({className:e})=>q().createElement("img",{src:wooPaymentsPaymentMethodDefinitions[t].settings_icon_url,alt:wooPaymentsPaymentMethodDefinitions[t].label,className:Q("payment-method__icon",e)})}),e)),{jcb:{id:"jcb",label:(0,K.__)("JCB","woocommerce-payments"),description:(0,K.__)("Let your customers pay with JCB, the only international payment brand based in Japan.","woocommerce-payments"),icon:Js,currencies:["JPY"],stripe_key:"jcb_payments",allows_manual_capture:!1,allows_pay_later:!1,accepts_only_domestic_payment:!1,settings_icon_url:""}}),Xs=({code:e,label:t,symbol:r,onClick:o,className:n})=>{const[a,s]=(0,xs.useState)(!1),i=window.multiCurrencyPaymentMethodsMap,c=i&&i[e]&&Object.keys(i[e]).length>0,d=c?Object.keys(i[e]):[],u=(0,xs.useCallback)((()=>{c?s(!0):o(e)}),[s,c,o,e]),l=(0,xs.useCallback)((()=>{s(!1),o(e)}),[o,s,e]),m=(0,xs.useCallback)((()=>{s(!1)}),[s]);return(0,H.jsxs)(H.Fragment,{children:[a&&(0,H.jsxs)(J,{title:(0,K.sprintf)((0,K.__)("Remove %1$s","woocommerce-payments"),t),onRequestClose:m,className:"enabled-currency-delete-modal",actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(W.Button,{onClick:l,isPrimary:!0,isDestructive:!0,children:(0,K.__)("Remove","woocommerce-payments")}),(0,H.jsx)(W.Button,{onClick:m,isSecondary:!0,children:(0,K.__)("Cancel","woocommerce-payments")})]}),children:[(0,H.jsx)(Ls,{symbol:r}),(0,H.jsx)("p",{children:Ms({mixedString:(0,K.sprintf)((0,K.__)("Are you sure you want to remove {{strong}}%s (%s){{/strong}}? Your customers will no longer be able to pay in this currency and use payment methods listed below.","woocommerce-payments"),t,e===r?e:[e,r].join(" ")),components:{strong:(0,H.jsx)("strong",{})}})}),(0,H.jsx)("ul",{children:d.map((e=>(0,H.jsx)("li",{children:(0,H.jsx)(te,{Icon:Ks[e].icon,label:Ks[e].label})},e)))}),(0,H.jsx)("p",{children:(0,K.sprintf)((0,K.__)("You can add %s (%s) again at any time in Multi-Currency settings.","woocommerce-payments"),t,e===r?e:[e,r].join(" "))})]}),(0,H.jsx)(W.Button,{isLink:!0,"aria-label":(0,K.sprintf)((0,K.__)("Remove %1$s as an enabled currency","woocommerce-payments"),t),className:n,onClick:u,__next40pxDefaultSize:!0,children:(0,H.jsx)(W.Icon,{icon:"trash"})})]})},ei=(0,Y.createContext)(),ti=({currency:{code:e,flag:t,id:r,is_default:o,name:n,symbol:a,rate:s},onDeleteClick:i})=>{const{code:c,is_zero_decimal:d}=Ns(),{setCurrencyCodeToShowSettingsFor:u}=(0,Y.useContext)(ei);return(0,H.jsxs)("li",{className:Q("enabled-currency",r),children:[(0,H.jsxs)("div",{className:"enabled-currency__container",children:[(0,H.jsx)("div",{className:"enabled-currency__flag",children:""!==t?t:(0,H.jsx)("div",{className:"enabled-currency__flag-text",children:(0,H.jsx)("span",{children:e})})}),(0,H.jsx)("div",{className:"enabled-currency__label",children:n}),(0,H.jsxs)("div",{className:"enabled-currency__code",children:["(",a+(a===e?"":` ${e}`),")"]})]}),(0,H.jsx)("div",{className:"enabled-currency__rate",children:(()=>{const t=d?Number.parseFloat(1e3*s).toFixed(2):Number.parseFloat(s).toFixed(2);return o?(0,K.__)("Default currency","woocommerce-payments"):d?`1,000 ${c} → ${t} ${e}`:`1 ${c} → ${t} ${e}`})()}),(0,H.jsxs)("div",{className:"enabled-currency__actions",children:[!o&&(0,H.jsx)(W.Button,{isLink:!0,onClick:()=>{u(e)},"aria-label":(0,K.sprintf)((0,K.__)("Edit %1$s","woocommerce-payments"),n),className:"enabled-currency__action edit",__next40pxDefaultSize:!0,children:(0,K.__)("manage","woocommerce-payments")}),i&&(0,H.jsx)(Xs,{className:"enabled-currency__action delete",onClick:i,label:n,code:e,symbol:a})]})]})},ri=({isLoading:e})=>(0,H.jsxs)("li",{className:Q("enabled-currency-placeholder","enabled-currency"),children:[(0,H.jsxs)("div",{className:"enabled-currency__container",children:[(0,H.jsx)("div",{className:"enabled-currency__flag",children:(0,H.jsx)(ee,{isLoading:e,numLines:1,children:(0,H.jsx)("div",{className:"enabled-currency__flag-text"})})}),(0,H.jsx)("div",{className:"enabled-currency__label",children:(0,H.jsx)(ee,{isLoading:e,numLines:1})}),(0,H.jsx)("div",{className:"enabled-currency__code",children:(0,H.jsx)(ee,{isLoading:e,numLines:1})})]}),(0,H.jsx)("div",{className:"enabled-currency__rate",children:(0,H.jsx)(ee,{isLoading:e,numLines:1})}),(0,H.jsx)("div",{className:"enabled-currency__actions",children:(0,H.jsx)(ee,{isLoading:e,numLines:1})})]}),oi=({className:e})=>{const t=(0,_e.useSelect)((e=>{const{getAvailableCurrencies:t}=e(os);return t()})),r=Object.keys(t),o=(0,xs.useRef)(null),{enabledCurrencies:n,submitEnabledCurrenciesUpdate:a}=Is(),s=Object.keys(n),i=Ns().code;r.splice(r.indexOf(i),1);const[c,d]=(0,xs.useState)(""),[u,l]=(0,xs.useState)({}),m=c?r.filter((e=>{const{symbol:r,name:o}=t[e];return`${r} ${e} ${o}`.toLocaleLowerCase().indexOf(c.toLocaleLowerCase())>-1})):r,p=(0,xs.useCallback)((()=>{l(r.reduce(((e,t)=>(e[t]=s.includes(t),e)),{}))}),[s,r]);(0,xs.useEffect)((()=>{p()}),[JSON.stringify(r),JSON.stringify(s)]);const _=(e,t)=>{l((r=>({...r,[e]:t})))},[y,h]=(0,xs.useState)(!1),[S,g]=(0,xs.useState)(!1),E=(0,xs.useCallback)((()=>{h(!0)}),[h]),f=(0,xs.useCallback)((()=>{h(!1),g(!1),d(""),p()}),[h,p]);return(0,xs.useEffect)((()=>{y&&o&&!1===S&&g(o.current.offsetWidth)}),[JSON.stringify(m),y]),(0,H.jsxs)(H.Fragment,{children:[y&&(0,H.jsxs)(J,{title:(0,K.__)("Add enabled currencies","woocommerce-payments"),onRequestClose:f,className:"add-enabled-currencies-modal",actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(W.Button,{isSecondary:!0,onClick:f,__next40pxDefaultSize:!0,children:(0,K.__)("Cancel","woocommerce-payments")}),(0,H.jsx)(W.Button,{isPrimary:!0,onClick:()=>{h(!1),g(!1),d("");const e=Object.entries(u).filter((([,e])=>e)).map((([e])=>e));e.push(i),e.sort(),a(e)},__next40pxDefaultSize:!0,children:(0,K.__)("Update selected","woocommerce-payments")})]}),children:[(0,H.jsx)("div",{className:"add-enabled-currencies-modal__search",children:(0,H.jsx)(W.SearchControl,{__nextHasNoMarginBottom:!0,value:c,onChange:d,placeholder:(0,K.__)("Search currencies","woocommerce-payments")})}),(0,H.jsx)("h3",{children:c?(0,K.sprintf)((0,K.__)("Search results (%1$d currencies)","woocommerce-payments"),m.length):(0,K.__)("All currencies","woocommerce-payments")}),(0,H.jsx)("div",{className:"add-enabled-currencies-modal__content",ref:o,style:{width:S||"auto"},children:(0,H.jsx)(Ps,{children:m.map((e=>(0,H.jsx)(Fs,{checked:u[e],onChange:_,currency:t[e]},t[e].id)))})})]}),(0,H.jsx)(W.Button,{variant:"secondary",className:e,onClick:E,"data-testid":"enabled-currencies-add-button",__next40pxDefaultSize:!0,children:(0,K.__)("Add/remove currencies","woocommerce-payments")})]})},ni=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("h2",{children:(0,K.__)("Enabled currencies","woocommerce-payments")}),(0,H.jsx)("p",{children:(0,xs.createInterpolateElement)((0,K.__)("Accept payments in multiple currencies. Prices are converted based on exchange rates and rounding rules. <learnMoreLink>Learn more</learnMoreLink>","woocommerce-payments"),{learnMoreLink:(0,H.jsx)(W.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#enabled-currencies"})})})]}),ai=()=>{const{isLoading:e}=Os(),{enabledCurrencies:t,submitEnabledCurrenciesUpdate:r}=Is(),o="wcpay-multi-currency",n=e=>{const o=Object.keys(t);o.splice(o.indexOf(e),1),r(o)},a=t?Object.keys(t):[];return(0,H.jsx)(oe,{description:ni,className:"multi-currency-settings-enabled-currencies-section",children:(0,H.jsxs)(W.Card,{className:`${o}__enabled-currencies`,children:[(0,H.jsxs)(W.CardBody,{className:`${o}__enabled-currencies-header`,children:[(0,H.jsx)("div",{children:(0,K.__)("Name","woocommerce-payments")}),(0,H.jsx)("div",{children:(0,K.__)("Exchange rate","woocommerce-payments")}),(0,H.jsx)("div",{})]}),(0,H.jsx)(W.CardDivider,{}),(0,H.jsx)(W.CardBody,{size:null,children:(0,H.jsxs)(Us,{className:"enabled-currencies-list",children:[!e&&t&&a.map((e=>(0,H.jsx)(ti,{currency:t[e],onDeleteClick:t[e].is_default?void 0:n},t[e].id))),e&&[1,2,3,4,5].map((e=>(0,H.jsx)(ri,{isLoading:1},"loadable-placeholder-"+e)))]})}),(0,H.jsx)(W.CardDivider,{}),(0,H.jsx)(W.CardBody,{className:`${o}__available-currencies-container`,children:t&&(0,H.jsx)(oi,{className:`${o}__available-currencies-modal`})})]})})},si=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("h2",{children:(0,K.__)("Store settings","woocommerce-payments")}),(0,H.jsx)("p",{children:(0,xs.createInterpolateElement)((0,K.__)("Store settings allow your customers to choose which currency they would like to use when shopping at your store. <learnMoreLink>Learn more</learnMoreLink>","woocommerce-payments"),{learnMoreLink:(0,H.jsx)(W.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#store-settings"})})})]}),ii=()=>{const{storeSettings:e,isLoading:t,submitStoreSettingsUpdate:r}=As(),[o,n]=(0,Y.useState)(!1),[a,s]=(0,Y.useState)(!1),[i,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(!1),[l,m]=(0,Y.useState)(!1);return(0,Y.useEffect)((()=>{Object.keys(e).length&&(c(e.enable_storefront_switcher),s(e.enable_auto_currency))}),[s,c,e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(oe,{description:si,className:"multi-currency-settings-store-settings-section",children:(0,H.jsx)(ee,{isLoading:t,numLines:10,children:(0,H.jsxs)(W.Card,{className:"multi-currency-settings__wrapper",children:[(0,H.jsxs)(W.CardBody,{className:"wcpay-card-body",children:[(0,H.jsx)(W.CheckboxControl,{checked:a,onChange:e=>{s(e),m(!0)},"data-testid":"enable_auto_currency",label:(0,K.__)("Automatically switch customers to their local currency if it has been enabled","woocommerce-payments"),help:(0,xs.createInterpolateElement)((0,K.__)("Customers will be notified via store alert banner. <previewLink>Preview</previewLink>","woocommerce-payments"),{previewLink:(0,H.jsx)(W.Button,{isLink:!0,onClick:()=>{u(!0)},__next40pxDefaultSize:!0})}),__nextHasNoMarginBottom:!0}),"Storefront"===e.site_theme?(0,H.jsx)(W.CheckboxControl,{checked:i,onChange:e=>{c(e),m(!0)},"data-testid":"enable_storefront_switcher",label:(0,K.__)("Add a currency switcher to the Storefront theme on breadcrumb section.","woocommerce-payments"),help:(0,xs.createInterpolateElement)((0,K.sprintf)((0,K.__)("A currency switcher is also available in your widgets. <linkToWidgets>Configure now</linkToWidgets>","woocommerce-payments"),"widgets.php"),{linkToWidgets:(0,H.jsx)("a",{href:"widgets.php"})}),__nextHasNoMarginBottom:!0}):null]}),(0,H.jsx)(Cs,{isPreviewModalOpen:d,setPreviewModalOpen:u,isStorefrontSwitcherEnabledValue:!1,isAutomaticSwitchEnabledValue:!0})]})})}),(0,H.jsx)(oe,{className:"multi-currency-settings-save-settings-section",children:(0,H.jsx)(W.Button,{isPrimary:!0,isBusy:o,disabled:o||!l,onClick:()=>{n(!0),r(a,i),n(!1),m(!1)},__next40pxDefaultSize:!0,children:(0,K.__)("Save changes","woocommerce-payments")})})]})},ci=()=>(0,H.jsx)("div",{className:"multi-currency-settings",children:(0,H.jsxs)(re,{children:[(0,H.jsx)(ai,{}),(0,H.jsx)(ii,{})]})}),di=window.wc.components,ui=({storeCurrency:e,targetCurrency:t,currencyRate:r=null,roundingValue:o,charmValue:n})=>{const[a,s]=(0,Y.useState)(20),i=(0,Y.useMemo)((()=>{const e=parseFloat(a.toString().replace(/,/g,"."))*parseFloat(r||t.rate),s=(parseFloat(o)?Math.ceil(e/parseFloat(o))*parseFloat(o):e)+parseFloat(n);return isNaN(s)?(0,K.__)("Please enter a valid number","woocommerce-payments"):le(ue(t.code)?s:100*s,t.code,null,!0)}),[a,n,r,o,t]);return(0,H.jsx)(W.Card,{className:"single-currency-settings-preview-wrapper",children:(0,H.jsxs)(W.CardBody,{className:"wcpay-card-body",children:[(0,H.jsx)("div",{children:"left"===e.symbol_position?(0,H.jsx)(di.TextControlWithAffixes,{label:e.name,prefix:e.symbol,"data-testid":"store_currency_value",value:a.toString(),onChange:s}):(0,H.jsx)(di.TextControlWithAffixes,{label:e.name,suffix:e.symbol,"data-testid":"store_currency_value",value:a.toString(),onChange:s})}),(0,H.jsx)("div",{children:(0,H.jsx)(di.TextControlWithAffixes,{"data-testid":"calculated_value",label:t&&t.name,value:i,onChange:()=>null,disabled:!0})})]})})},li={0:(0,K.__)("None","woocommerce-payments"),.25:"0.25","0.50":"0.50","1.00":"1.00 (recommended)","5.00":"5.00","10.00":"10.00"},mi={1:"1",10:"10",25:"25",50:"50",100:"100 (recommended)",500:"500",1e3:"1000"},pi={"0.00":(0,K.__)("None","woocommerce-payments"),"-0.01":"-0.01","-0.05":"-0.05"},_i={"0.00":(0,K.__)("None","woocommerce-payments"),"-1":"-1","-5":"-5","-10":"-10","-20":"-20","-25":"-25","-50":"-50","-100":"-100"},yi=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("h2",{children:(0,K.__)("Currency settings","woocommerce-payments")}),(0,H.jsx)("p",{children:(0,K.__)("Choose between automatic or manual exchange rates and modify formatting rules to refine the display of your prices.","woocommerce-payments")})]}),hi=()=>{var e,t;const{currencyCodeToShowSettingsFor:r,setCurrencyCodeToShowSettingsFor:o}=(0,Y.useContext)(ei),[n,a]=(0,Y.useState)(!1),{currencies:s}=Os(),{enabledCurrencies:i}=Is(),{storeSettings:c}=As(),{currencySettings:d,isLoading:u,submitCurrencySettings:l}=(e=>{const{currencySettings:t,isLoading:r}=(0,_e.useSelect)((t=>{const{getCurrencySettings:r,isResolving:o}=t(os);return{currencySettings:r(e),isLoading:o("getCurrencySettings",[e])}})),{submitCurrencySettings:o}=(0,_e.dispatch)(os);return{currencySettings:t,isLoading:r,submitCurrencySettings:o}})(r),m=s.default?s.default:{},p=s.available?s.available[r]:{},_=p.is_zero_decimal?mi:li,y=p.is_zero_decimal?_i:pi,h="automatic",S=p?.is_zero_decimal?"100":"1.00",g="0.00",[E,f]=(0,Y.useState)(h),[w,T]=(0,Y.useState)(0),[R,b]=(0,Y.useState)(S),[v,O]=(0,Y.useState)(g),[I,A]=(0,Y.useState)(!1);(0,Y.useEffect)((()=>{var e;d[r]&&(f(d[r].exchange_rate_type||h),T(d[r].manual_rate||0),b(null!==(e=d[r].price_rounding)&&void 0!==e?e:S),O(d[r].price_charm||g))}),[d,r,S]);const N=null!==(e=c.date_format)&&void 0!==e?e:"M j, Y",C=null!==(t=c.time_format)&&void 0!==t?t:"g:iA",x=p?(0,Fe.dateI18n)(`${N} ${C}`,Me().unix(p.last_updated).toISOString()):"";return(0,H.jsx)("div",{className:"single-currency-settings",children:(0,H.jsxs)(re,{children:[(0,H.jsxs)("h2",{className:"single-currency-settings-breadcrumb",children:[(0,H.jsx)(W.Button,{isLink:!0,onClick:()=>o(null),__next40pxDefaultSize:!0,children:(0,K.__)("Enabled currencies","woocommerce-payments")})," ","> ",p.name," (",p.code,")"," ",p.flag]}),(0,H.jsx)(oe,{description:yi,children:(0,H.jsx)(ee,{isLoading:u,numLines:33,children:(0,H.jsx)(W.Card,{className:"single-currency-settings-currency-settings",children:(0,H.jsxs)(W.CardBody,{className:"wcpay-card-body",children:[(0,H.jsx)("h4",{children:(0,K.__)("Exchange rate","woocommerce-payments")}),(0,H.jsx)("fieldset",{children:(0,H.jsxs)("ul",{children:[(0,H.jsx)("li",{children:(0,H.jsx)(W.RadioControl,{onChange:e=>{f(e),a(!0),"manual"===e&&T(w||p.rate)},options:[{description:p.last_updated?(0,K.sprintf)((0,K.__)("Current rate: 1 %s = %s %s (Last updated: %s)","woocommerce-payments"),m.code,p.rate,p.code,x):(0,K.__)("Error - Unable to fetch automatic rate for this currency","woocommerce-payments"),label:(0,K.__)("Fetch rates automatically","woocommerce-payments"),value:"automatic"},{description:(0,K.__)("Enter your fixed rate of exchange","woocommerce-payments"),label:(0,K.__)("Manual","woocommerce-payments"),value:"manual"}],selected:E})}),"manual"===E&&(0,H.jsx)("li",{children:(0,H.jsx)(W.TextControl,{"data-testid":"manual_rate_input",label:(0,K.__)("Manual Rate","woocommerce-payments"),help:(0,K.__)("Enter the manual rate you would like to use. Must be a positive number.","woocommerce-payments"),value:w||p.rate,onChange:e=>{T(e.replace(/,/g,".")),a(!0)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})})]})}),(0,H.jsx)("h4",{children:(0,K.__)("Formatting rules","woocommerce-payments")}),(0,H.jsx)("fieldset",{children:(0,H.jsxs)("ul",{children:[(0,H.jsx)("li",{children:(0,H.jsx)(W.SelectControl,{"data-testid":"price_rounding",label:(0,K.__)("Price rounding","woocommerce-payments"),help:Ms({mixedString:(0,K.sprintf)((0,K.__)("Make your %s prices consistent by rounding them up after they're converted. {{learnMoreLink}}Learn more{{/learnMoreLink}}","woocommerce-payments"),p.code),components:{learnMoreLink:(0,H.jsx)(W.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#price-rounding"})}}),value:parseFloat(R),onChange:e=>{b(e),a(!0)},options:Object.keys(_).map((e=>({value:parseFloat(e),label:_[e]}))),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})}),(0,H.jsx)("li",{children:(0,H.jsx)(W.SelectControl,{"data-testid":"price_charm",label:(0,K.__)("Charm pricing","woocommerce-payments"),help:Ms({mixedString:(0,K.sprintf)((0,K.__)("Reduce the converted price for a specific amount. {{learnMoreLink}}Learn more{{/learnMoreLink}}","woocommerce-payments"),p.code),components:{learnMoreLink:(0,H.jsx)(W.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#charm-pricing"})}}),value:parseFloat(v),onChange:e=>{O(e),a(!0)},options:Object.keys(y).map((e=>({value:parseFloat(e),label:y[e]}))),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})})]})})]})})})}),(0,H.jsx)(oe,{description:()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("h2",{children:(0,K.__)("Preview","woocommerce-payments")}),(0,H.jsx)("p",{children:u?"":(0,K.sprintf)((0,K.__)("Enter a price in your default currency (%s) to see it converted to %s using the exchange rate and formatting rules above.","woocommerce-payments"),m.name,p.name)})]}),children:(0,H.jsx)(ee,{isLoading:u,numLines:8,children:(0,H.jsx)(ui,{className:"single-currency-settings-currency-preview",storeCurrency:m,targetCurrency:p,currencyRate:"manual"===E?w:null,roundingValue:R,charmValue:v})})}),(0,H.jsx)(oe,{className:"single-currency-settings-save-settings-section",children:(0,H.jsx)(W.Button,{isPrimary:!0,isBusy:I,disabled:I||!n,onClick:()=>{A(!0),l(p.code,{exchange_rate_type:E,manual_rate:w,price_rounding:R,price_charm:v}),isNaN(w)||(i[p.code].rate=Number(w)),A(!1),a(!1)},__next40pxDefaultSize:!0,children:(0,K.__)("Save changes","woocommerce-payments")})})]})})},Si=()=>{const[e,t]=(0,Y.useState)(null);return(0,H.jsx)(ei.Provider,{value:{currencyCodeToShowSettingsFor:e,setCurrencyCodeToShowSettingsFor:t},children:e?(0,H.jsx)(hi,{}):(0,H.jsx)(ci,{})})},gi=document.querySelector("#wcpay_multi_currency_settings_container");(0,V.H)(gi).render((0,H.jsx)(Si,{}))})()})();