(()=>{var e={184:(e,t)=>{var l;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var l=arguments[t];if(l){var n=typeof l;if("string"===n||"number"===n)e.push(l);else if(Array.isArray(l)){if(l.length){var a=s.apply(null,l);a&&e.push(a)}}else if("object"===n){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){e.push(l.toString());continue}for(var o in l)r.call(l,o)&&l[o]&&e.push(o)}}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(l=function(){return s}.apply(t,[]))||(e.exports=l)}()}},t={};function l(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,l),n.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e},t.apply(this,arguments)}const r=window.wp.element;var s=l(184),n=l.n(s);const a=window.wp.i18n,o=window.wp.blockEditor,i=window.wp.components,c=window.wp.data,p=JSON.parse('{"u2":"pmpro/checkout-button"}');(0,e.registerBlockType)(p.u2,{icon:{background:"#FFFFFF",foreground:"#1A688B",src:"button"},edit:function(e){const l=[{value:0,label:(0,a.__)("Choose a level","paid-memberships-pro")}].concat(pmpro.all_level_values_and_labels),{attributes:s,setAttributes:p,className:m}=e,{textAlign:u,placeholder:d,style:b,text:_,level:v,css_class:h,selected_membership_level:g}=s;if(v&&v.length>0&&(p({selected_membership_level:v}),delete s.level),h&&h.length>0){const e=h.replace(/\bpmpro_btn\b/g,"").trim(),t=n()(m,e);p({className:t}),delete s.css_class}const y=(0,c.useSelect)((t=>{const{getBlockParents:l,getBlockName:r}=t("core/block-editor");return l(e.clientId).map((e=>r(e))).includes("pmpro/single-level")}),[e.clientId]),w=(0,o.__experimentalUseBorderProps)(s),x=(0,o.__experimentalUseColorProps)(s),f=(0,o.__experimentalGetSpacingClassesAndStyles)(s),k=(0,o.useBlockProps)(),N=n()("wp-block-buttons",{[`has-text-align-${u}`]:u}),C=n()("wp-block-button");return[(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:N},(0,r.createElement)("div",{className:C},!y&&(0,r.createElement)(o.InspectorControls,null,(0,r.createElement)(i.PanelBody,{title:(0,a.__)("Checkout Button Settings","paid-memberships-pro"),initialOpen:!0},(0,r.createElement)(i.SelectControl,{label:(0,a.__)("Choose a Level","paid-memberships-pro"),value:g,options:l,onChange:e=>p({selected_membership_level:e})}))),(0,r.createElement)(o.BlockControls,null,(0,r.createElement)(o.AlignmentControl,{value:u,onChange:e=>{p({textAlign:e})}})),(0,r.createElement)(o.RichText,t({},k,{allowedFormats:[],"aria-label":(0,a.__)("Button text","paid-memberships-pro"),placeholder:d||(0,a.__)("Buy Now","paid-memberships-pro"),value:_,onChange:e=>{p({text:e})},withoutInteractiveFormatting:!0,className:n()(m,"wp-block-button__link",k.className,x.className,w.className,{"no-border-radius":0===b?.border?.radius},(0,o.__experimentalGetElementClassName)("button")),style:{...k.style,...w.style,...x.style,...f.style,textAlign:u},identifier:"text"})))))]},save:function({attributes:e,className:l}){const{textAlign:s,style:a,text:i}=e,c=o.useBlockProps.save(),p=(0,o.__experimentalGetBorderClassesAndStyles)(e),m=(0,o.__experimentalGetColorClassesAndStyles)(e),u=(0,o.__experimentalGetSpacingClassesAndStyles)(e),d=n()("wp-block-button__link",c.className,m.className,p.className,{[`has-text-align-${s}`]:s,"no-border-radius":0===a?.border?.radius},(0,o.__experimentalGetElementClassName)("button")),b={...c.style,...p.style,...m.style,...u.style},_=n()("wp-block-buttons",{[`has-text-align-${s}`]:s}),v=n()("wp-block-button");return(0,r.createElement)("div",{className:_},(0,r.createElement)("div",{className:v},(0,r.createElement)(o.RichText.Content,t({},c,{tagName:"a",className:d,href:(h=e.selected_membership_level,pmpro.checkout_url+"?pmpro_level="+h),style:b,value:i}))));var h}})})()})();