(self.webpackChunkwebpackWcBlocksFrontendJsonp=self.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[462],{9325:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>c,default:()=>i});var n=s(1609),o=s(2796),r=s(4487),a=s(1616),l=s(4786);s(7067);const c=e=>{const{textAlign:t="",isDescendentOfSingleProductBlock:s,shouldDisplayMockedReviewsWhenProductHasNoReviews:a}=e,c=(0,r.p)(e),{parentClassName:i}=(0,o.useInnerBlockLayoutContext)(),{product:u}=(0,o.useProductDataContext)(),m=(0,l.p3)(u),d=(0,l.Nm)(u);if(d||a)return(0,n.createElement)(l.fb,{className:"wc-block-components-product-rating",showReviewCount:s,showMockedReviews:a,styleProps:c,parentClassName:i,reviews:d,rating:m,textAlign:t})},i=(0,a.withProductDataContext)(c)},4487:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var n=s(851),o=s(3993),r=s(1194),a=s(9786);function l(e={}){const t={};return(0,a.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function c(e,t){return e&&t?`has-${(0,r.c)(t)}-${e}`:""}const i=e=>{const t=(e=>{const t=(0,o.isObject)(e)?e:{style:{}};let s=t.style;return(0,o.isString)(s)&&(s=JSON.parse(s)||{}),(0,o.isObject)(s)||(s={}),{...t,style:s}})(e),s=function(e){var t,s,r,a,i,u;const{backgroundColor:m,textColor:d,gradient:v,style:p}=e,g=c("background-color",m),f=c("color",d),y=function(e){if(e)return`has-${e}-gradient-background`}(v),N=y||(null==p||null===(t=p.color)||void 0===t?void 0:t.gradient);return{className:(0,n.A)(f,y,{[g]:!N&&!!g,"has-text-color":d||(null==p||null===(s=p.color)||void 0===s?void 0:s.text),"has-background":m||(null==p||null===(r=p.color)||void 0===r?void 0:r.background)||v||(null==p||null===(a=p.color)||void 0===a?void 0:a.gradient),"has-link-color":(0,o.isObject)(null==p||null===(i=p.elements)||void 0===i?void 0:i.link)?null==p||null===(u=p.elements)||void 0===u||null===(u=u.link)||void 0===u?void 0:u.color:void 0}),style:l({color:(null==p?void 0:p.color)||{}})}}(t),r=function(e){var t;const s=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:s,style:o}=e,r=s?c("border-color",s):"";return(0,n.A)({"has-border-color":!!s||!(null==o||null===(t=o.border)||void 0===t||!t.color),[r]:!!r})}(e),style:l({border:s})}}(t),a=function(e){var t;return{className:void 0,style:l({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}(t),i=(e=>{const t=(0,o.isObject)(e.style.typography)?e.style.typography:{},s=(0,o.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:s,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,n.A)(i.className,s.className,r.className,a.className),style:{...i.style,...s.style,...r.style,...a.style}}}},4786:(e,t,s)=>{"use strict";s.d(t,{Nm:()=>c,fb:()=>v,p3:()=>l});var n=s(1609),o=s(7723),r=s(851),a=s(3993);const l=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},c=e=>{const t=(0,a.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0},i=e=>({width:e/5*100+"%"}),u=({className:e,parentClassName:t})=>{const s=i(0);return(0,n.createElement)("div",{className:(0,r.A)(`${e}__norating-container`,`${t}-product-rating__norating-container`)},(0,n.createElement)("div",{className:`${e}__norating`,role:"img"},(0,n.createElement)("span",{style:s})),(0,n.createElement)("span",null,(0,o.__)("No Reviews","woocommerce")))},m=e=>{const{className:t,rating:s,reviews:a,parentClassName:l}=e,c=i(s),u=(0,o.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,o.__)("Rated %f out of 5","woocommerce"),s),m={__html:(0,o.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */ /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
(0,o._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",a,"woocommerce"),(0,o.sprintf)('<strong class="rating">%f</strong>',s),(0,o.sprintf)('<span class="rating">%d</span>',a))};return(0,n.createElement)("div",{className:(0,r.A)(`${t}__stars`,`${l}__product-rating__stars`),role:"img","aria-label":u},(0,n.createElement)("span",{style:c,dangerouslySetInnerHTML:m}))},d=e=>{const{className:t,reviews:s}=e,r=(0,o.sprintf)(/* translators: %s is referring to the total of reviews for a product */ /* translators: %s is referring to the total of reviews for a product */
(0,o._n)("(%s customer review)","(%s customer reviews)",s,"woocommerce"),s);return(0,n.createElement)("span",{className:`${t}__reviews_count`},r)},v=e=>{const{className:t="wc-block-components-product-rating",showReviewCount:s,showMockedReviews:o,parentClassName:a="",rating:l,reviews:c,styleProps:i,textAlign:v}=e,p=(0,r.A)(i.className,t,{[`${a}__product-rating`]:a,[`has-text-align-${v}`]:v}),g=o&&(0,n.createElement)(u,{className:t,parentClassName:a}),f=c?(0,n.createElement)(m,{className:t,rating:l,reviews:c,parentClassName:a}):g,y=c&&s;return(0,n.createElement)("div",{className:p,style:i.style},(0,n.createElement)("div",{className:`${t}__container`},f,y?(0,n.createElement)(d,{className:t,reviews:c}):null))}},7067:()=>{}}]);