!function(){var e,t={7005:function(e,t,r){"use strict";var n=r(1609),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var n,s={},c=null,u=null;for(n in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,n)&&!i.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:o,type:e,key:c,ref:u,props:s,_owner:l.current}}},9255:function(e,t,r){"use strict";e.exports=r(7005)},552:function(e,t,r){"use strict";var n=window.wp.blocks,o=window.wp.primitives,a=r(9255),l=(0,a.jsx)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(o.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})}),i=window.wp.blockEditor,s=window.wp.i18n,c=r(3373),u=r.n(c),p=r(1609),_=r.n(p);function f(){return f=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},f.apply(null,arguments)}function d(e){let{name:t,...r}=e;const[n,o]=(0,p.useState)(null),a=window?.scData?.plugin_url+"/dist/icon-assets",l=/^[a-zA-Z0-9_-]+$/.test(t);if((0,p.useEffect)((()=>{l&&fetch(`${a}/${t}.svg`).then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"image/svg+xml"),r=t?.documentElement;"svg"===r?.tagName?.toLowerCase()&&o(r)})).catch(console.error)}),[t,l]),!n)return null;const i={class:"className","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation-filters":"colorInterpolationFilters","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-opacity":"floodOpacity","font-size":"fontSize","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth"},s={};for(const e of n.attributes)s[i[e.name]||e.name]=e.value;return _().createElement("svg",f({},s,r,{dangerouslySetInnerHTML:{__html:n.innerHTML}}))}var m=window.wp.components,w=(window.wp.data,window.wp.element,window.wp.coreData,window.wp.htmlEntities,window.wp.compose),b=e=>{let{attributes:t,setAttributes:r}=e;const{button_type:n,width:o,icon_size:a}=t,l=(0,w.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}};return React.createElement(m.__experimentalToolsPanel,{label:(0,s.__)("Design","surecart"),resetAll:()=>r({button_type:"both",width:null,icon_size:15}),dropdownMenuProps:l},React.createElement(m.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,s.__)("Icon & Text","surecart"),onDeselect:()=>r({button_type:"both"}),isShownByDefault:!0},React.createElement(m.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,label:(0,s.__)("Icon & Text","surecart"),value:n,onChange:e=>r({button_type:e}),help:(0,s.__)("A decorative way to show review add button of the product.","surecart"),isBlock:!0},React.createElement(m.__experimentalToggleGroupControlOption,{value:"icon",label:(0,s._x)("Icon","Button option for product review add button button.","surecart")}),React.createElement(m.__experimentalToggleGroupControlOption,{value:"text",label:(0,s._x)("Text","Button option for product review add button button.","surecart")}),React.createElement(m.__experimentalToggleGroupControlOption,{value:"both",label:(0,s._x)("Both","Button option for product review add button button.","surecart")}))),React.createElement(m.__experimentalToolsPanelItem,{label:(0,s.__)("Width","surecart"),isShownByDefault:!0,hasValue:()=>!!o,onDeselect:()=>r({width:void 0})},React.createElement(m.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,label:(0,s.__)("Width","surecart"),help:(0,s.__)("The width of the button in its container.","surecart"),value:o,onChange:e=>r({width:e}),isBlock:!0},[25,50,75,100].map((e=>React.createElement(m.__experimentalToggleGroupControlOption,{key:e,value:e,label:sprintf(/* translators: Percentage value. */ /* translators: Percentage value. */
(0,s.__)("%d%%","surecart"),e)}))))),React.createElement(m.__experimentalToolsPanelItem,{label:(0,s.__)("Icon Size","surecart"),hasValue:()=>15!==a,onDeselect:()=>r({icon_size:15}),isShownByDefault:!0},React.createElement(m.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,s.__)("Icon Size","surecart"),help:(0,s.__)("Size of the icon in pixels.","surecart"),value:a,onChange:e=>r({icon_size:parseInt(e)||15}),min:10,max:100,step:1})))};const h=e=>{if(!e)return;const t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e};function v(){return v=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},v.apply(null,arguments)}var y=JSON.parse('{"UU":"surecart/product-review-add-button"}');(0,n.registerBlockType)(y.UU,{icon:l,edit:e=>{let{attributes:t,setAttributes:r}=e;const{icon:n,button_type:o,label:a,style:l,width:c,icon_position:p,icon_size:_}=t,f=(0,i.__experimentalUseBorderProps)(t),m=(0,i.__experimentalUseColorProps)(t),w=(0,i.__experimentalGetSpacingClassesAndStyles)(t),y=(0,i.__experimentalGetShadowClassesAndStyles)(t),g=(0,i.useBlockProps)();return React.createElement(React.Fragment,null,React.createElement(i.InspectorControls,null,React.createElement(b,{attributes:t,setAttributes:r})),React.createElement("div",{className:"wp-block-buttons"},React.createElement("div",v({},g,{className:u()(g.className,{"wp-block-button":!0,"sc-block-button":!0,[`has-custom-width wp-block-button__width-${c}`]:c,[`has-custom-width sc-block-button__width-${c}`]:c})}),React.createElement("div",{className:u()("wp-block-button__link","wp-element-button","sc-button__link",m.className,f.className,w.className,y.className),style:{...f.style,...w.style,...y.style,...m.style,gap:h(l?.spacing?.blockGap),justifyContent:l?.typography?.textAlign}},(()=>{const e=["icon","both"].includes(o),t=["text","both"].includes(o);return React.createElement(React.Fragment,null,e&&"before"===p&&React.createElement(d,{className:"wp-block-surecart-product-review-add-button__icon",name:n??"edit-2",width:_,height:_}),t&&React.createElement(i.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,s.__)("Write a Review button"),placeholder:(0,s.__)("Write a Review"),value:a,onChange:e=>r({label:e})}),e&&"after"===p&&React.createElement(d,{className:"wp-block-surecart-product-review-add-button__icon",name:n??"edit-2",width:_,height:_}))})()))))}})},1609:function(e){"use strict";e.exports=window.React},3373:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=l(e,a(r)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.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?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,e=[],n.O=function(t,r,o,a){if(!r){var l=1/0;for(u=0;u<e.length;u++){r=e[u][0],o=e[u][1],a=e[u][2];for(var i=!0,s=0;s<r.length;s++)(!1&a||l>=a)&&Object.keys(n.O).every((function(e){return n.O[e](r[s])}))?r.splice(s--,1):(i=!1,a<l&&(l=a));if(i){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[r,o,a]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={9808:0,1752:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,a,l=r[0],i=r[1],s=r[2],c=0;if(l.some((function(t){return 0!==e[t]}))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var u=s(n)}for(t&&t(r);c<l.length;c++)a=l[c],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(u)},r=self.webpackChunk_surecart_blocks_next=self.webpackChunk_surecart_blocks_next||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}();var o=n.O(void 0,[1752],(function(){return n(552)}));o=n.O(o)}();