(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&defineproperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>call(e,t),r:e=>{"undefined"!=typeof Symbol&&tostringtag&&defineproperty(e,tostringtag,{value:"Module"}),defineproperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{__experimentalDeRegisterExpressPaymentMethod:()=>T,__experimentalDeRegisterPaymentMethod:()=>P,getExpressPaymentMethods:()=>E,getPaymentMethods:()=>C,getRegisteredBlockComponents:()=>I,getRegisteredInnerBlocks:()=>O,registerBlockComponent:()=>B,registerExpressPaymentMethod:()=>k,registerInnerBlock:()=>R,registerPaymentMethod:()=>w,registerPaymentMethodExtensionCallbacks:()=>M});const o=deprecated;var n=e.n(o);const r=data;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&constructor===Symbol&&e!==prototype?"symbol":typeof e},a(e)}function i(e,t,o){return(t=function(e){var t=function(e,t){if("object"!==a(e)||null===e)return e;var o=e[toprimitive];if(void 0!==o){var n=call(e,"string");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===a(t)?t:String(t)}(t))in e?defineproperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const s=react,l={},p=l,c=(e,t,o)=>{const n=((e,t)=>o=>((null==o?void 0:paymentrequirements)||[]).every((e=>includes(e)))&&e(o))(e,t);return values(p).some((e=>o in e))?((e,t,o)=>n=>{let r=e(n);if(r){const e={};entries(t).forEach((([t,n])=>{o in n&&"function"==typeof n[o]&&(e[t]=n[o])})),r=keys(e).every((t=>{try{return e[t](n)}catch(e){return error(`Error when executing callback for ${o} in ${t}`,e),!0}}))}return r})(n,p,o):n},d=element,m=(e,t)=>{if(null!==e&&!(0,isvalidelement)(e))throw new TypeError(`The ${t} property for the payment method must be a React element or null.`)},u=(e,t=[])=>{const o=reduce(((t,o)=>(hasownproperty(o)||push(o),t)),[]);if(length>0)throw new TypeError("The payment method configuration object is missing the following properties:"+join(", "))},h=()=>null;class y{constructor(e){var t,o,n,r;i(this,"name",void 0),i(this,"content",void 0),i(this,"edit",void 0),i(this,"paymentMethodId",void 0),i(this,"supports",void 0),i(this,"icons",void 0),i(this,"label",void 0),i(this,"ariaLabel",void 0),i(this,"placeOrderButtonLabel",void 0),i(this,"savedTokenComponent",void 0),i(this,"canMakePaymentFromConfig",void 0),assertvalidconfig(e),name=name,label=label,placeorderbuttonlabel=placeorderbuttonlabel,arialabel=arialabel,content=content,savedtokencomponent=savedtokencomponent,icons=icons||null,edit=edit,paymentmethodid=paymentmethodid||name,supports={showSavedCards:(null==e||null===(t=supports)||void 0===t?void 0:showsavedcards)||(null==e||null===(o=supports)||void 0===o?void 0:savepaymentinfo)||!1,showSaveOption:(null==e||null===(n=supports)||void 0===n?void 0:showsaveoption)||!1,features:(null==e||null===(r=supports)||void 0===r?void 0:features)||["products"]},canmakepaymentfromconfig=canmakepayment}get canMakePayment(){return c(canmakepaymentfromconfig,features,name)}}i(y,"assertValidConfig",(e=>{var t,o,r,a,i,l,p;if(savedtokencomponent=savedtokencomponent||(0,createelement)(h,null),u(e,["name","label","ariaLabel","content","edit","canMakePayment"]),"string"!=typeof name)throw new Error("The name property for the payment method must be a string");if(void 0!==icons&&!isarray(icons)&&null!==icons)throw new Error("The icons property for the payment method must be an array or null.");if("string"!=typeof paymentmethodid&&void 0!==paymentmethodid)throw new Error("The paymentMethodId property for the payment method must be a string or undefined (in which case it will be the value of the name property).");if("string"!=typeof placeorderbuttonlabel&&void 0!==placeorderbuttonlabel)throw new TypeError("The placeOrderButtonLabel property for the payment method must be a string");if(((e,t)=>{if(null!==e&&!(0,isvalidelement)(e)&&"string"!=typeof e)throw new TypeError("The label property for the payment method must be a React element, a string, or null.")})(label),m(content,"content"),m(edit,"edit"),m(savedtokencomponent,"savedTokenComponent"),"string"!=typeof arialabel)throw new TypeError("The ariaLabel property for the payment method must be a string");if("function"!=typeof canmakepayment)throw new TypeError("The canMakePayment property for the payment method must be a function.");if(void 0!==(null===(t=supports)||void 0===t?void 0:showsavedcards)&&"boolean"!=typeof(null===(o=supports)||void 0===o?void 0:showsavedcards))throw new TypeError("If the payment method includes the `showsavedcards` property, it must be a boolean");if(void 0!==(null===(r=supports)||void 0===r?void 0:savepaymentinfo)&&n()("Passing savePaymentInfo when registering a payment method.",{alternative:"Pass showSavedCards and showSaveOption",plugin:"woocommerce-gutenberg-products-block",link:"https://github/woocommerce/woocommerce-gutenberg-products-block/pull/3686"}),void 0!==(null===(a=supports)||void 0===a?void 0:features)&&!isarray(null===(i=supports)||void 0===i?void 0:features))throw new Error("The features property for the payment method must be an array or undefined.");if(void 0!==(null===(l=supports)||void 0===l?void 0:showsaveoption)&&"boolean"!=typeof(null===(p=supports)||void 0===p?void 0:showsaveoption))throw new TypeError("If the payment method includes the `showsaveoption` property, it must be a boolean")}));class f{constructor(e){var t;i(this,"name",void 0),i(this,"content",void 0),i(this,"edit",void 0),i(this,"paymentMethodId",void 0),i(this,"supports",void 0),i(this,"canMakePaymentFromConfig",void 0),assertvalidconfig(e),name=name,content=content,edit=edit,paymentmethodid=paymentmethodid||name,supports={features:(null==e||null===(t=supports)||void 0===t?void 0:features)||["products"]},canmakepaymentfromconfig=canmakepayment}get canMakePayment(){return c(canmakepaymentfromconfig,features,name)}}i(f,"assertValidConfig",(e=>{var t,o;if(u(e,["name","content","edit"]),"string"!=typeof name)throw new TypeError("The name property for the express payment method must be a string");if("string"!=typeof paymentmethodid&&void 0!==paymentmethodid)throw new Error("The paymentMethodId property for the payment method must be a string or undefined (in which case it will be the value of the name property).");if(void 0!==(null===(t=supports)||void 0===t?void 0:features)&&!isarray(null===(o=supports)||void 0===o?void 0:features))throw new Error("The features property for the payment method must be an array or undefined.");if(m(content,"content"),m(edit,"edit"),"function"!=typeof canmakepayment)throw new TypeError("The canMakePayment property for the express payment method must be a function.")}));const v="wc/store/payment",b={},g={},w=e=>{let t;"function"==typeof e?(t=e(y),n()("Passing a callback to registerPaymentMethod()",{alternative:"a config options object",plugin:"woocommerce-gutenberg-products-block",link:"https://github/woocommerce/woocommerce-gutenberg-products-block/pull/3404"})):t=new y(e),t instanceof y&&(b[name]=t)},k=e=>{let t;"function"==typeof e?(t=e(f),n()("Passing a callback to registerExpressPaymentMethod()",{alternative:"a config options object",plugin:"woocommerce-gutenberg-products-block",link:"https://github/woocommerce/woocommerce-gutenberg-products-block/pull/3404"})):t=new f(e),t instanceof f&&(g[name]=t)},M=(e,t)=>{l[e]?error(`The namespace provided to registerPaymentMethodExtensionCallbacks must be unique. Callbacks have already been registered for the ${e} namespace.`):(l[e]={},entries(t).forEach((([t,o])=>{"function"==typeof o?l[e][t]=o:error(`All callbacks provided to registerPaymentMethodExtensionCallbacks must be functions. The callback for the ${t} payment method in the ${e} namespace was not a function.`)})))},P=e=>{delete b[e];const{__internalRemoveAvailablePaymentMethod:t}=(0,dispatch)(v);t(e)},T=e=>{delete g[e];const{__internalRemoveAvailableExpressPaymentMethod:t}=(0,dispatch)(v);t(e)},C=()=>b,E=()=>g,S={};function I(e){return{..."object"==typeof S[e]&&keys(S[e]).length>0?S[e]:{},any}}function O(e){return n()("getRegisteredInnerBlocks",{version:"2.8.0",alternative:"getRegisteredBlockComponents",plugin:"WooCommerce Blocks"}),I(e)}const x=(e,t,o)=>{const n=typeof e[t];if(n!==o)throw new Error(`Incorrect value for the ${t} argument when registering a block component. It was a ${n}, but must be a ${o}.`)},j=(e,t)=>{if(e[t]){if("function"==typeof e[t])return;if(e[t].$$typeof&&e[t].$$typeof===for("lazy"))return}throw new Error(`Incorrect value for the ${t} argument when registering a block component. Component must be a valid React Element or Lazy callback.`)};function B(e){context||(context="any"),x(e,"context","string"),x(e,"blockName","string"),j(e,"component");const{context:t,blockName:o,component:n}=e;S[t]||(S[t]={}),S[t][o]=n}function R(e){n()("registerInnerBlock",{version:"2.8.0",alternative:"registerBlockComponent",plugin:"WooCommerce Blocks",hint:'"main" has been replaced with "context" and is now optional.'}),x(e,"main","string"),B({...e,context:main})}(wc=wc||{}).wcBlocksRegistry=t})();