(self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[8578],{53:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>c,default:()=>i});var n=s(1609),r=s(2796),o=s(2150),a=s(1616),l=s(4786);s(7195);const c=e=>{const{textAlign:t="",shouldDisplayMockedReviewsWhenProductHasNoReviews:s}=e,a=(0,o.p)(e),{parentClassName:c}=(0,r.useInnerBlockLayoutContext)(),{product:i}=(0,r.useProductDataContext)(),u=(0,l.p3)(i),m=(0,l.Nm)(i);return(0,n.createElement)(l.fb,{className:"wc-block-components-product-rating-stars",showMockedReviews:s,styleProps:a,parentClassName:c,reviews:m,rating:u,textAlign:t})},i=(0,a.withProductDataContext)(c)},2150:(e,t,s)=>{"use strict";s.d(t,{p:()=>l});var n=s(851),r=s(3993),o=s(3924),a=s(104);const l=e=>{const t=(e=>{const t=(0,r.isObject)(e)?e:{style:{}};let s=t.style;return(0,r.isString)(s)&&(s=JSON.parse(s)||{}),(0,r.isObject)(s)||(s={}),{...t,style:s}})(e),s=(0,a.BK)(t),l=(0,a.aR)(t),c=(0,a.fo)(t),i=(0,o.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:()=>r});var n=s(3993);const r=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),r=s(1194),o=s(9786),a=s(3993);function l(e={}){const t={};return(0,o.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function c(e,t){return e&&t?`has-${(0,r.c)(t)}-${e}`:""}function i(e){var t,s,r,o,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===(r=g.color)||void 0===r?void 0:r.background)||p||(null==g||null===(o=g.color)||void 0===o?void 0:o.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:r}=e,o=s?c("border-color",s):"";return(0,n.A)({"has-border-color":!!s||!(null==r||null===(t=r.border)||void 0===t||!t.color),[o]:!!o})}(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),r=s(7723),o=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,o.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,r.__)("No Reviews","woocommerce")))},m=e=>{const{className:t,rating:s,reviews:a,parentClassName:l}=e,c=i(s),u=(0,r.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,r.__)("Rated %f out of 5","woocommerce"),s),m={__html:(0,r.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,r._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,r.sprintf)('<strong class="rating">%f</strong>',s),(0,r.sprintf)('<span class="rating">%d</span>',a))};return(0,n.createElement)("div",{className:(0,o.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,o=(0,r.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,r._n)("(%s customer review)","(%s customer reviews)",s,"woocommerce"),s);return(0,n.createElement)("span",{className:`${t}__reviews_count`},o)},v=e=>{const{className:t="wc-block-components-product-rating",showReviewCount:s,showMockedReviews:r,parentClassName:a="",rating:l,reviews:c,styleProps:i,textAlign:v}=e,p=(0,o.A)(i.className,t,{[`${a}__product-rating`]:a,[`has-text-align-${v}`]:v}),g=r&&(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))}},7195:()=>{}}]);