!function(){var e={3373:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=l(e,o(r)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=l(t,r));return t}function l(e,t){return t?e?e+" "+t:e+t:e}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks,t=r(3373),n=r.n(t),a=window.wp.i18n,o=window.wp.element,l=window.wp.components,s=window.wp.blockEditor,i=window.wp.keycodes,c=e=>{let{selectedWidth:t,setAttributes:r,ariaLabel:n}=e;return React.createElement(l.PanelBody,{title:(0,a.__)("Width settings")},React.createElement(l.ButtonGroup,{"aria-label":n},[25,50,75,100].map((e=>React.createElement(l.Button,{key:e,isSmall:!0,variant:e===t?"primary":void 0,onClick:()=>{var n;r({width:t===(n=e)?void 0:n})}},e,"%")))))};function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(null,arguments)}var d=JSON.parse('{"UU":"surecart/product-buy-button"}');(0,e.registerBlockType)(d.UU,{edit:e=>{const{attributes:t,setAttributes:r,className:d}=e,{style:p,text:b,width:f,out_of_stock_text:m,unavailable_text:_}=t,y=(0,s.__experimentalUseBorderProps)(t),w=(0,s.__experimentalUseColorProps)(t),v=(0,s.__experimentalGetSpacingClassesAndStyles)(t),x=(0,s.__experimentalGetShadowClassesAndStyles)(t),h=(0,o.useRef)(),g=(0,o.useRef)(),k=(0,s.useBlockProps)({ref:h,onKeyDown:function(e){i.isKeyboardEvent.primary(e,"k")?startEditing(e):i.isKeyboardEvent.primaryShift(e,"k")&&(unlink(),g.current?.focus())}});return React.createElement(React.Fragment,null,React.createElement(s.InspectorControls,null,React.createElement(l.PanelBody,{title:(0,a.__)("Text settings","surecart")},React.createElement(l.PanelRow,null,React.createElement(l.TextControl,{label:(0,a.__)("Out of stock label","surecart"),value:m,onChange:e=>r({out_of_stock_text:e})})),React.createElement(l.PanelRow,null,React.createElement(l.TextControl,{label:(0,a.__)("Unavailable label","surecart"),value:_,onChange:e=>r({unavailable_text:e})}))),React.createElement(c,{selectedWidth:f,setAttributes:r,ariaLabel:(0,a.__)("Button width")})),React.createElement("div",u({},k,{className:n()(k.className,{"wp-block-button":!0,"sc-block-button":!0,[`has-custom-width sc-block-button__width-${f}`]:f,"has-custom-font-size":k.style.fontSize})}),React.createElement(s.RichText,{"aria-label":(0,a.__)("Button text","surecart"),placeholder:(0,a.__)("Add text…","surecart"),ref:g,className:n()(d,"wp-block-button__link","sc-block-button__link",w.className,y.className,v.className,x.className,{"no-border-radius":0===p?.border?.radius},(0,s.__experimentalGetElementClassName)("button")),style:{...y.style,...v.style,...x.style,...w.style},value:b,onChange:e=>r({text:e}),withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic"]})))}})}()}();