(self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[]).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(2150),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)},2150:(e,t,s)=>{"use strict";s.d(t,{p:()=>l});var n=s(851),o=s(3993),r=s(3924),a=s(104);const l=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=(0,a.BK)(t),l=(0,a.aR)(t),c=(0,a.fo)(t),i=(0,r.x)(t);return{className:(0,n.A)(i.className,s.className,l.className,c.className),style:{...i.style,...s.style,...l.style,...c.style}}}},3924:(e,t,s)=>{"use strict";s.d(t,{x:()=>o});var n=s(3993);const o=e=>{const t=(0,n.isObject)(e.style.typography)?e.style.typography:{},s=(0,n.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}}}},104:(e,t,s)=>{"use strict";s.d(t,{BK:()=>i,aR:()=>u,fo:()=>m});var n=s(851),o=s(1194),r=s(9786),a=s(3993);function l(e={}){const t={};return(0,r.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function c(e,t){return e&&t?`has-${(0,o.c)(t)}-${e}`:""}function i(e){var t,s,o,r,i,u,m;const{backgroundColor:d,textColor:v,gradient:p,style:g}=e,f=c("background-color",d),y=c("color",v),N=function(e){if(e)return`has-${e}-gradient-background`}(p),w=N||(null==g||null===(t=g.color)||void 0===t?void 0:t.gradient);return{className:(0,n.A)(y,N,{[f]:!w&&!!f,"has-text-color":v||(null==g||null===(s=g.color)||void 0===s?void 0:s.text),"has-background":d||(null==g||null===(o=g.color)||void 0===o?void 0:o.background)||p||(null==g||null===(r=g.color)||void 0===r?void 0:r.gradient),"has-link-color":(0,a.isObject)(null==g||null===(i=g.elements)||void 0===i?void 0:i.link)?null==g||null===(u=g.elements)||void 0===u||null===(m=u.link)||void 0===m?void 0:m.color:void 0}),style:l({color:(null==g?void 0:g.color)||{}})}}function u(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})}}function m(e){var t;return{className:void 0,style:l({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}},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:()=>{}}]);