https://www.aeraforhome.com/cdn/shop/t/508/assets/bundle.widget-st…?v=110500830145208704681782241033
1"use strict";(self.webpackChunkaera_theme=self.webpackChunkaera_theme||[]).push([[602],{9976(t,e,r){var i,o=r(467),a=r(6096),n="[data-rating-stars-color]",s="[data-rating-score]",l="[data-rating-count]",d=r(5394),c=function(t,e,r,i){var o,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n},p=i=class extends a.ov{constructor(){var t;super(...arguments),t=this,this.hasInitialized=!1,this.isSampleProduct=!1,this.loadRatings=(0,o.A)(function*(){var e=t.productId;if(!0===t.isSampleProduct){var o,a=null===(o=t.sku)||void 0===o?void 0:o.trim();if(a){var n=a.split("-"),s=n.length>1?n.slice(1).join("-"):a,l="C2W1-".concat(s);try{var d,{getProductBySku:c}=yield r.e(279).then(r.bind(r,1279)),p=yield c(l),h=null==p||null===(d=p.product)||void 0===d?void 0:d.id;if(h&&"string"==typeof h){var u,v=null===(u=h.match(/Product\/(\d+)/))||void 0===u?void 0:u[1];v&&(e=v)}}catch(t){console.error("sku lookup error",t)}}}if(e){var g="https://api.yotpo.com/v1/widget/".concat(i.API_KEY,"/products/").concat(e,"/reviews.json");t.abortController=new AbortController;try{var y,f=yield fetch(g,{method:"GET",signal:t.abortController.signal,headers:{Accept:"application/json","Content-Type":"application/json"}});if(!f.ok)return void t.hideRatings("response not ok");var m=yield f.json(),S=null==m||null===(y=m.response)||void 0===y?void 0:y.bottomline;if(!S)return void t.hideRatings("no bottomline in response");var b=Number(S.total_review);if(!Number.isFinite(b)||b<=0)return void t.hideRatings("no reviews or invalid totalReviews");t.updateRatings({averageScore:Number(S.average_score),totalReviews:b})}catch(e){console.error("Yotpo error:",e),t.hideRatings("exception during fetch")}}})}connectedCallback(){super.connectedCallback(),this.hasInitialized||(this.hasInitialized=!0,this.applyTheme(),"loading"!==document.readyState?this.loadRatings():window.addEventListener("DOMContentLoaded",this.loadRatings,{once:!0}))}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=void 0}updateRatings(t){var{averageScore:e,totalReviews:r}=t;Number.isFinite(e)?(this.getRatingContainers().forEach(t=>{t.classList.add("loaded"),t.classList.remove("tw-hidden")}),this.updateStars(e),this.updateScoreText(e),this.updateReviewCount(r),this.applyTheme()):this.hideRatings("invalid averageScore")}updateStars(t){if(this.areStarsEnabled()){var e=Math.min(Math.max(t,0),5)/5*110;this.querySelectorAll(n).forEach(t=>{t.setAttribute("width",e.toString())})}}updateScoreText(t){if(!this.areStarsEnabled()){var e=t.toFixed(1);this.querySelectorAll(s).forEach(t=>{t.textContent=e})}}updateReviewCount(t){var e=this.isSlim()?"(".concat(t,")"):"".concat(t," Reviews");this.querySelectorAll(l).forEach(t=>{t.textContent=e})}hideRatings(t){console.error("[widget-star-rating] hideRatings reason: ",t),this.getRatingContainers().forEach(t=>{t.classList.remove("loaded"),t.classList.add("tw-hidden")})}getRatingContainers(){return Array.from(this.querySelectorAll("[data-rating-container]"))}applyTheme(){var t="on-dark"===this.getAppearance();this.getRatingContainers().forEach(e=>{e.classList.toggle("tw-text-white",t)}
1),this.querySelectorAll("".concat(s,", ").concat(l)).forEach(e=>{e.classList.toggle("tw-text-white",t)}),this.querySelectorAll("img.star").forEach(e=>{t?e.style.filter="brightness(0) invert(1)":e.style.removeProperty("filter")}),this.querySelectorAll(".stars-background").forEach(e=>{t?e.style.fill="rgba(255, 255, 255, 0.32)":e.style.removeProperty("fill")}),this.querySelectorAll(n).forEach(e=>{t?e.style.fill="var(--aera-gold)":e.style.removeProperty("fill")})}getAppearance(){return"on-dark"===this.appearance?"on-dark":"light"}areStarsEnabled(){return"true"===this.stars}isSlim(){var t=this.slim;return null==t||"false"!==t}};p.API_KEY="8qgpyjj1jpFknmtqkDyNeFtnDowBxITo26jZmKJ2",c([(0,d.MZ)({type:String,attribute:"product-id"})],p.prototype,"productId",void 0),c([(0,d.MZ)({type:String})],p.prototype,"appearance",void 0),c([(0,d.MZ)({type:String})],p.prototype,"location",void 0),c([(0,d.MZ)({type:String})],p.prototype,"stars",void 0),c([(0,d.MZ)({type:String})],p.prototype,"slim",void 0),c([(0,d.MZ)({type:String,attribute:"sku"})],p.prototype,"sku",void 0),c([(0,d.MZ)({type:String})],p.prototype,"linked",void 0),c([(0,d.MZ)({type:Boolean,attribute:"is-sample-product"})],p.prototype,"isSampleProduct",void 0),c([(0,d.MZ)({type:String})],p.prototype,"debug",void 0),p=i=c([(0,d.EM)("widget-star-rating")],p)}},t=>{t.O(0,[96,76],()=>t(t.s=9976)),t.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.