!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),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={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)&&!l.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:i.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),i=(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"})}),l=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",i=/^[a-zA-Z0-9_-]+$/.test(t);if((0,p.useEffect)((()=>{i&&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,i]),!n)return null;const l={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"},c={};for(const e of n.attributes)c[l[e.name]||e.name]=e.value;return f().createElement("svg",_({},c,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,i=(0,w.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}};return React.createElement(m.__experimentalToolsPanel,{label:(0,c.__)("Design","surecart"),resetAll:()=>r({button_type:"both",width:null,icon_size:15}),dropdownMenuProps:i},React.createElement(m.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,c.__)("Icon & Text","surecart"),onDeselect:()=>r({button_type:"both"}),isShownByDefault:!0},React.createElement(m.__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(m.__experimentalToggleGroupControlOption,{value:"icon",label:(0,c._x)("Icon","Button option for product review add button button.","surecart")}),React.createElement(m.__experimentalToggleGroupControlOption,{value:"text",label:(0,c._x)("Text","Button option for product review add button button.","surecart")}),React.createElement(m.__experimentalToggleGroupControlOption,{value:"both",label:(0,c._x)("Both","Button option for product review add button button.","surecart")}))),React.createElement(m.__experimentalToolsPanelItem,{label:(0,c.__)("Width","surecart"),isShownByDefault:!0,hasValue:()=>!!o,onDeselect:()=>r({width:void 0})},React.createElement(m.__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(m.__experimentalToggleGroupControlOption,{key:e,value:e,label:sprintf(/* translators: Percentage value. */ /* translators: Percentage value. */
(0,c.__)("%d%%","surecart"),e)}))))),React.createElement(m.__experimentalToolsPanelItem,{label:(0,c.__)("Icon Size","surecart"),hasValue:()=>15!==a,onDeselect:()=>r({icon_size:15}),isShownByDefault:!0},React.createElement(m.__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 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 g=JSON.parse('{"UU":"surecart/product-review-add-button"}');(0,n.registerBlockType)(g.UU,{icon:i,edit:e=>{let{attributes:t,setAttributes:r}=e;const{icon:n,button_type:o,label:a,style:i,width:s,icon_position:p,icon_size:f}=t,_=(0,l.useBlockProps)({className:"wp-block-buttons",style:{gap:h(i?.spacing?.blockGap),justifyContent:i?.typography?.textAlign}});return React.createElement(React.Fragment,null,React.createElement(l.InspectorControls,null,React.createElement(b,{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(l.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=i(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=i(t,r));return t}function i(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 i=1/0;for(u=0;u<e.length;u++){r=e[u][0],o=e[u][1],a=e[u][2];for(var l=!0,c=0;c<r.length;c++)(!1&a||i>=a)&&Object.keys(n.O).every((function(e){return n.O[e](r[c])}))?r.splice(c--,1):(l=!1,a<i&&(i=a));if(l){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,i=r[0],l=r[1],c=r[2],s=0;if(i.some((function(t){return 0!==e[t]}))){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)var u=c(n)}for(t&&t(r);s<i.length;s++)a=i[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)}();