PageSourceSearch

https://horze.eu/cdn/shop/t/676/assets/stars-reviews.element-CrVv3X2A.js

js horze.eu collected 2026-09-24 11:36:30 UTC 7,874 bytes, 120 lines download raw bytes

1import{i as g,a as p,t as c}from"./vendor-lit-reactive-element-Cjcwuima.js";import{x as l}from"./vendor-lit-html-nFsY_NSA.js";import{r as f}from"./vendor-lit-element-CtcYdrtK.js";import{reviewsDataStore as h}from"./reviews-data.store-CQyUfp3R.js";var u=Object.defineProperty,C=Object.getOwnPropertyDescriptor,d=(e,t,a,r)=>{for(var i=r>1?void 0:r?C(t,a):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(i=(r?o(t,a,i):o(i))||i);return r&&i&&u(t,a,i),i};let s=class extends f{constructor(){super(...arguments),this.dataState=h.getState()}connectedCallback(){super.connectedCallback(),this.unsubscribe=h.subscribe(e=>{this.dataState=e,this.requestUpdate()}),this.requestUpdate(),!this.hasRatingData()&&!this.dataState.loading&&setTimeout(()=>{this.hasRatingData()||this.requestUpdate()},100)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.unsubscribe)==null||e.call(this)}renderFullStar(){return l`
2            <svg
3                xmlns="http://www.w3.org/2000/svg"
4                width="20"
5                height="21"
6                viewBox="0 0 20 21"
7                fill="none"
8            >
9                <path
10                    fill-rule="evenodd"
11                    clip-rule="evenodd"
12                    d="M10.4552 1.34685C10.3119 0.884382 9.68806 0.884382 9.54477 1.34685L7.63027 7.52616C7.56619 7.73298 7.38241 7.87301 7.17504 7.87301H0.979572C0.515888 7.87301 0.323098 8.49527 0.698226 8.78109L5.71047 12.6001C5.87823 12.7279 5.94843 12.9545 5.88435 13.1613L3.96984 19.3406C3.82656 19.8031 4.33129 20.1877 4.70642 19.9019L9.71865 16.0828C9.88642 15.955 10.1136 15.955 10.2813 16.0828L15.2936 19.9019C15.6687 20.1877 16.1734 19.8031 16.0302 19.3406L14.1157 13.1613C14.0516 12.9545 14.1218 12.7279 14.2895 12.6001L19.3018 8.78109C19.6769 8.49527 19.4841 7.87301 19.0204 7.87301H12.825C12.6176 7.87301 12.4338 7.73298 12.3697 7.52616L10.4552 1.34685Z"
13                    fill="currentColor"
14                />
15            </svg>
16        `}renderHalfStar(){return l`
17            <svg
18                xmlns="http://www.w3.org/2000/svg"
19                width="20"
20                height="21"
21                viewBox="0 0 20 21"
22                fill="none"
23            >
24                <defs>
25                    <clipPath id="left-clip">
26                        <rect
27                            x="0"
28                            y="0"
29                            width="10.5"
30                            height="21"
31                        />
32                    </clipPath>
33                    <clipPath id="right-clip">
34                        <rect
35                            x="9.5"
36                            y="0"
37                            width="10.5"
38                            height="21"
39                        />
40                    </clipPath>
41                </defs>
42
43                <!-- Left half with original color -->
44                <g clip-path="url(#left-clip)">
45                    <path
46                        fill-rule="evenodd"
47                        clip-rule="evenodd"
48                        d="M10.4552 1.34685C10.3119 0.884382 9.68806 0.884382 9.54477 1.34685L7.63027 7.52616C7.56619 7.73298 7.38241 7.87301 7.17504 7.87301H0.979572C0.515888 7.87301 0.323098 8.49527 0.698226 8.78109L5.71047 12.6001C5.87823 12.7279 5.94843 12.9545 5.88435 13.1613L3.96984 19.3406C3.82656 19.8031 4.33129 20.1877 4.70642 19.9019L9.71865 16.0828C9.88642 15.955 10.1136 15.955 10.2813 16.0828L15.2936 19.9019C15.6687 20.1877 16.1734 19.8031 16.0302 19.3406L14.1157 13.1613C14.0516 12.9545 14.1218 12.7279 14.2895 12.6001L19.3018 8.78109C19.6769 8.49527 19.4841 7.87301 19.0204 7.87301H12.825C12.6176 7.87301 12.4338 7.73298 12.3697 7.52616L10.4552 1.34685Z"
49                        fill="currentColor"
50                    />
51                </g>
52
53                <!-- Right half with light gray -->
54                <g clip-path="url(#right-clip)">
55                    <path
56                        fill-rule="evenodd"
57                        clip-rule="evenodd"
58                        d="M10.4552 1.34685C10.3119 0.884382 9.68806 0.884382 9.54477 1.34685L7.63027 7.52616C7.56619 7.73298 7.38241 7.87301 7.17504 7.87301H0.979572C0.515888 7.87301 0.323098 8.49527 0.698226 8.78109L5.71047 12.6001C5.87823 12.7279 5.94843 12.9545 5.88435 13.1613L3.96984 19.3406C3.82656 19.8031 4.33129 20.1877 4.70642 19.9019L9.71865 16.0828C9.88642 15.955 10.1136 15.955 10.2813 16.0828L15.2936 19.9019C15.6687 20.1877 16.1734 19.8031 16.0302 19.3406L14.1157 13.1613C14.0516 12.9545 14.1218 12.7279 14.2895 12.6001L19.3018 8.78109C19.6769 8.49527 19.4841 7.87301 19.0204 7.87301H12.825C12.6176 7.87301 12.4338 7.73298 12.3697 7.52616L10.4552 1.34685Z"
59                        fill="#D1D5DB"
60                    />
61                </g>
62            </svg>
63        `}renderEmptyStar(){return l`
64            <svg
65                xmlns="http://www.w3.org/2000/svg"
66                width="20"
67                height="21"
68                viewBox="0 0 20 21"
69                fill="none"
70            >
71                <path
72                    fill-rule="evenodd"
73                    clip-rule="evenodd"
74                    d="M10.4552 1.34685C10.3119 0.884382 9.68806 0.884382 9.54477 1.34685L7.63027 7.52616C7.56619 7.73298 7.38241 7.87301 7.17504 7.87301H0.979572C0.515888 7.87301 0.323098 8.49527 0.698226 8.78109L5.71047 12.6001C5.87823 12.7279 5.94843 12.9545 5.88435 13.1613L3.96984 19.3406C3.82656 19.8031 4.33129 20.1877 4.70642 19.9019L9.71865 16.0828C9.88642 15.955 10.1136 15.955 10.2813 16.0828L15.2936 19.9019C15.6687 20.1877 16.1734 19.8031 16.0302 19.3406L14.1157 13.1613C14.0516 12.9545 14.1218 12.7279 14.2895 12.6001L19.3018 8.78109C19.6769 8.49527 19.4841 7.87301 19.0204 7.87301H12.825C12.6176 7.87301 12.4338 7.73298 12.3697 7.52616L10.4552 1.34685Z"
75                    fill="#D1D5DB"
76                />
77            </svg>
78        `}renderStar(e){const t=this.dataState.originalSyndicatedStats;let a=0;t!=null&&t.average_rating?a=parseFloat(t.average_rating):this.dataState.originalAverageRating?a=parseFloat(this.dataState.originalAverageRating):this.dataState.averageRating&&(a=parseFloat(this.dataState.averageRating));const r=a-e+1;let i;return r>=1?i=this.renderFullStar():r>0?i=this.renderHalfStar():i=this.renderEmptyStar(),l`
79            <span class="star"> ${i} </span>
80        `}hasRatingData(){const e=this.dataState.originalSyndicatedStats;return[e==null?void 0:e.average_rating,this.dataState.originalAverageRating,this.dataState.averageRating].some(a=>{if(a==null||a==="")return!1;const r=parseFloat(a.toString());return!isNaN(r)&&r>0})}render(){if(this.dataState.loading&&!this.hasRatingData()){const t=[];for(let a=1;a<=5;a++)t.push(l`<span class="star"
81                        >${this.renderEmptyStar()}</span
82                    >`);return l`<div class="loading-placeholder">
83                ${t}
84            </div>`}if(!this.hasRatingData())return l``;const e=[];for(let t=1;t<=5;t++)e.push(this.renderStar(t));return l`${e}`}};s.styles=g`
85        :host {
86            display: inline-flex;
87            align-items: center;
88            gap: 0.125rem;
89        }
90
91        .star {
92            position: relative;
93            display: inline-block;
94            cursor: default;
95        }
96
97        .star svg {
98            display: block;
99            width: 20px;
100            height: 20px;
101        }
102
103        .star.empty {
104            color: #000000;
105            font-size: 20px;
106            line-height: 1;
107            display: inline-flex;
108            align-items: center;
109            justify-content: center;
110            width: 20px;
111            height: 20px;
112        }
113
114        .loading-placeholder {
115            display: inline-flex;
116            align-items: center;
117            gap: 0.125rem;
118            opacity: 0.3;
119        }
120    `;d([p()],s.prototype,"dataState",2);s=d([c("stars-reviews")],s);export{s as Stars};

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.