(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[39],{361:function(t,e,n){"use strict";n.r(e),n.d(e,"Block",(function(){return m}));var s=n(0),a=n(1),r=n(4),c=n.n(r),o=n(24),i=n(86),l=n(48),u=n(84);n(394);const b=t=>({width:t/5*100+"%"}),p=({parentClassName:t})=>{const e=b(0);return Object(s.createElement)("div",{className:c()("wc-block-components-product-rating-stars__norating-container",`${t}-product-rating-stars__norating-container`)},Object(s.createElement)("div",{className:"wc-block-components-product-rating-stars__norating",role:"img"},Object(s.createElement)("span",{style:e})),Object(s.createElement)("span",null,Object(a.__)("No Reviews","woocommerce")))},d=t=>{const{rating:e,reviews:n,parentClassName:r}=t,o=b(e),i=Object(a.sprintf)(/* translators: %f is referring to the average rating value */
Object(a.__)("Rated %f out of 5","woocommerce"),e),l={__html:Object(a.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
Object(a._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",n,"woocommerce"),Object(a.sprintf)('<strong class="rating">%f</strong>',e),Object(a.sprintf)('<span class="rating">%d</span>',n))};return Object(s.createElement)("div",{className:c()("wc-block-components-product-rating-stars__stars",`${r}__product-rating-stars__stars`),role:"img","aria-label":i},Object(s.createElement)("span",{style:o,dangerouslySetInnerHTML:l}))},m=t=>{const{textAlign:e,shouldDisplayMockedReviewsWhenProductHasNoReviews:n}=t,a=Object(i.a)(t),{parentClassName:r}=Object(o.useInnerBlockLayoutContext)(),{product:l}=Object(o.useProductDataContext)(),b=(t=>{const e=parseFloat(t.average_rating);return Number.isFinite(e)&&e>0?e:0})(l),m=(t=>{const e=Object(u.a)(t.review_count)?t.review_count:parseInt(t.review_count,10);return Number.isFinite(e)&&e>0?e:0})(l),g=c()(a.className,"wc-block-components-product-rating-stars",{[`${r}__product-rating`]:r,[`has-text-align-${e}`]:e}),_=n?Object(s.createElement)(p,{parentClassName:r}):null,w=m?Object(s.createElement)(d,{rating:b,reviews:m,parentClassName:r}):_;return Object(s.createElement)("div",{className:g,style:a.style},Object(s.createElement)("div",{className:"wc-block-components-product-rating-stars__container"},w))};e.default=Object(l.withProductDataContext)(m)},394:function(t,e){}}]);