1import{i as m,n as o,a as S,t as b}from"./vendor-lit-reactive-element-Cjcwuima.js";import{x as c}from"./vendor-lit-html-nFsY_NSA.js";import{r as v}from"./vendor-lit-element-CtcYdrtK.js";import{reviewsDataStore as d}from"./reviews-data.store-CQyUfp3R.js";var g=Object.freeze,h=Object.defineProperty,y=Object.getOwnPropertyDescriptor,n=(t,e,s,a)=>{for(var i=a>1?void 0:a?y(e,s):e,u=t.length-1,p;u>=0;u--)(p=t[u])&&(i=(a?p(e,s,i):p(i))||i);return a&&i&&h(e,s,i),i},f=(t,e)=>g(h(t,"raw",{value:g(t.slice())})),l;let r=class extends v{constructor(){super(...arguments),this.productName="",this.productUrl="",this.productImage="",this.productBrand="",this.productSku="",this.dataState=d.getState()}connectedCallback(){super.connectedCallback(),this.unsubscribe=d.subscribe(t=>{this.dataState=t,this.requestUpdate()})}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.unsubscribe)==null||t.call(this)}generateSchema(){const t=this.dataState.originalAverageRating||this.dataState.averageRating,e=this.dataState.originalReviewCount||this.dataState.reviewCount||this.dataState.resultsCount;if(!t||!e||parseInt(e)===0)return null;const s=parseFloat(t),a=parseInt(e);return isNaN(s)||isNaN(a)||a===0?null:{"@context":"https://schema.org","@type":"Product",name:this.productName,...this.productUrl&&{url:this.productUrl},...this.productImage&&{image:this.productImage},...this.productBrand&&{brand:{"@type":"Brand",name:this.productBrand}},...this.productSku&&{sku:this.productSku},aggregateRating:{"@type":"AggregateRating",ratingValue:s.toString(),reviewCount:a.toString(),bestRating:"5",worstRating:"1"}}}render(){const t=this.generateSchema();return t?c(l||(l=f([` 2 <script type="application/ld+json"> 3 `,` 4 <\/script> 5 `])),JSON.stringify(t,null,2)):c``}};r.styles=m` 6 :host { 7 display: none; 8 } 9 `;n([o({type:String,attribute:"product-name"})],r.prototype,"productName",2);n([o({type:String,attribute:"product-url"})],r.prototype,"productUrl",2);n([o({type:String,attribute:"product-image"})],r.prototype,"productImage",2);n([o({type:String,attribute:"product-brand"})],r.prototype,"productBrand",2);n([o({type:String,attribute:"product-sku"})],r.prototype,"productSku",2);n([S()],r.prototype,"dataState",2);r=n([b("product-review-schema")],r);export{r as ProductReviewSchema};
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.