!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,c={},s=null,u=null;for(n in void 0!==r&&(s=""+r),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,n)&&!i.hasOwnProperty(n)&&(c[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===c[n]&&(c[n]=t[n]);return{$$typeof:o,type:e,key:s,ref:u,props:c,_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,c=window.wp.i18n,s=r(3373),u=r.n(s),p=r(1609),f=r.n(p);function _(){return _=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},_.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=n.cloneNode(!0),c={fill:"fill",stroke:"stroke",strokeWidth:"stroke-width",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeOpacity:"stroke-opacity",strokeMiterlimit:"stroke-miterlimit",fillOpacity:"fill-opacity",fillRule:"fill-rule"},s={},u={};Object.entries(r).forEach((e=>{let[t,r]=e;c[t]?s[c[t]]=r:u[t]=r})),Object.keys(s).length>0&&i.querySelectorAll("path, circle, rect, ellipse, line, polyline, polygon").forEach((e=>{Object.entries(s).forEach((t=>{let[r,n]=t;null!=n&&e.setAttribute(r,n)}))})),Object.entries(s).forEach((e=>{let[t,r]=e;null!=r&&i.setAttribute(t,r)})),Object.entries(u).forEach((e=>{let[t,r]=e;if(null!=r){const e="className"===t?"class":t;i.setAttribute(e,r)}}));const d={};for(const e of i.attributes)d["class"===e.name?"className":e.name]=e.value;return f().createElement("svg",_({},d,{dangerouslySetInnerHTML:{__html:i.innerHTML}}))}var b=window.wp.components,h=(window.wp.data,window.wp.element,window.wp.coreData,window.wp.htmlEntities,window.wp.compose),m=e=>{let{attributes:t,setAttributes:r}=e;const{button_type:n,width:o,icon_size:a}=t,l=(0,h.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}};return React.createElement(b.__experimentalToolsPanel,{label:(0,c.__)("Design","surecart"),resetAll:()=>r({button_type:"both",width:null,icon_size:15}),dropdownMenuProps:l},React.createElement(b.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,c.__)("Icon & Text","surecart"),onDeselect:()=>r({button_type:"both"}),isShownByDefault:!0},React.createElement(b.__experimentalToggleGroupControl,{label:(0,c.__)("Icon & Text","surecart"),value:n,onChange:e=>r({button_type:e}),help:(0,c.__)("A decorative way to show review add button of the product.","surecart"),isBlock:!0},React.createElement(b.__experimentalToggleGroupControlOption,{value:"icon",label:(0,c._x)("Icon","Button option for product review add button button.","surecart")}),React.createElement(b.__experimentalToggleGroupControlOption,{value:"text",label:(0,c._x)("Text","Button option for product review add button button.","surecart")}),React.createElement(b.__experimentalToggleGroupControlOption,{value:"both",label:(0,c._x)("Both","Button option for product review add button button.","surecart")}))),React.createElement(b.__experimentalToolsPanelItem,{label:(0,c.__)("Width","surecart"),isShownByDefault:!0,hasValue:()=>!!o,onDeselect:()=>r({width:void 0})},React.createElement(b.__experimentalToggleGroupControl,{label:(0,c.__)("Width","surecart"),help:(0,c.__)("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(b.__experimentalToggleGroupControlOption,{key:e,value:e,label:sprintf(/* translators: Percentage value. */ /* translators: Percentage value. */
(0,c.__)("%d%%","surecart"),e)}))))),React.createElement(b.__experimentalToolsPanelItem,{label:(0,c.__)("Icon Size","surecart"),hasValue:()=>15!==a,onDeselect:()=>r({icon_size:15}),isShownByDefault:!0},React.createElement(b.__experimentalNumberControl,{label:(0,c.__)("Icon Size","surecart"),help:(0,c.__)("Size of the icon in pixels.","surecart"),value:a,onChange:e=>r({icon_size:parseInt(e)||15}),min:10,max:100,step:1})))};const w=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 g=JSON.parse('{"UU":"surecart/product-review-add-button"}');(0,n.registerBlockType)(g.UU,{icon:l,edit:e=>{let{attributes:t,setAttributes:r}=e;const{icon:n,button_type:o,label:a,style:l,width:s,icon_position:p,icon_size:f}=t,_=(0,i.useBlockProps)({className:"wp-block-buttons",style:{gap:w(l?.spacing?.blockGap),justifyContent:l?.typography?.textAlign}});return React.createElement(React.Fragment,null,React.createElement(i.InspectorControls,null,React.createElement(m,{attributes:t,setAttributes:r})),React.createElement("div",{className:"wp-block-buttons"},React.createElement("div",{className:u()({"wp-block-button":!0,"sc-block-button":!0,[`has-custom-width wp-block-button__width-${s}`]:s,[`has-custom-width sc-block-button__width-${s}`]:s})},React.createElement("div",v({},_,{className:u()(_.className,{"wp-block-button__link":!0})}),(()=>{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:f,height:f}),t&&React.createElement(i.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,c.__)("Write a Review button"),placeholder:(0,c.__)("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:f,height:f}))})()))))}})},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,c=0;c<r.length;c++)(!1&a||l>=a)&&Object.keys(n.O).every((function(e){return n.O[e](r[c])}))?r.splice(c--,1):(i=!1,a<l&&(l=a));if(i){e.splice(u--,1);var s=o();void 0!==s&&(t=s)}}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],c=r[2],s=0;if(l.some((function(t){return 0!==e[t]}))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(c)var u=c(n)}for(t&&t(r);s<l.length;s++)a=l[s],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)}();