import{D as e,J as t,M as n,N as r,P as i,Q as a,S as o,T as s,V as c,W as l,Y as u,b as d,et as f,ft as p,it as m,j as h,l as g,n as _,nt as v,ot as y,q as b,r as x,st as S,t as C,x as w}from"../../client.js";import{t as T}from"../../custom-element-forward-events.js";import{F as E,I as D,L as O}from"../../components.js";var k=i(`<span><!></span>`),A=i(`<span class="mc-star-rating__info svelte-17npafv"> </span>`),ee=i(`<div></div> <!>`,1),j={hash:`svelte-17npafv`,code:`/**
 * Do not edit directly, this file was auto-generated.
 */.mc-star-rating.svelte-17npafv {display:inline-flex;align-items:center;gap:0.5rem;}.mc-star-rating--standard.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {color:var(--star-rating-color-icon-standard, #000000);}.mc-star-rating--accent.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {color:var(--star-rating-color-icon-accent, #ea7315);}.mc-star-rating--slider.svelte-17npafv {cursor:pointer;}.mc-star-rating--link.svelte-17npafv {text-decoration:none;cursor:pointer;}.mc-star-rating--link.svelte-17npafv:not(:hover) .mc-star-rating__info:where(.svelte-17npafv) {text-decoration:underline;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.25rem;height:1.25rem;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-100, 0.875rem);}.mc-star-rating--m.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.5rem;height:1.5rem;}.mc-star-rating--m.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-150, 1rem);}.mc-star-rating--l.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:2rem;height:2rem;}.mc-star-rating--l.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-200, 1.125rem);}.mc-star-rating__wrapper.svelte-17npafv {display:flex;align-items:center;}.mc-star-rating__info.svelte-17npafv {font-weight:var(--font-weight-medium, 600);line-height:var(--line-height-s, 1.3);color:var(--star-rating-color-text, #000000);}.mc-star-rating__icon.svelte-17npafv svg {height:100%;width:100%;}`};function M(i,C){S(C,!0),d(i,j);let T=_(C,`rating`,15),M=_(C,`readonly`,7),N=_(C,`size`,7,`m`),P=_(C,`compact`,7),F=_(C,`appearance`,7,`standard`),I=_(C,`text`,7),L=_(C,`href`,7),R=_(C,`target`,7),z=_(C,`class`,7),B=x(C,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`rating`,`readonly`,`size`,`compact`,`appearance`,`text`,`href`,`target`,`class`]),V=f(null),H=v(()=>L()?`a`:`div`),U=v(()=>[M(),P(),L(),I()].some(Boolean)),W=v(()=>[`mc-star-rating`,L()&&`mc-star-rating--link`,!c(U)&&`mc-star-rating--slider`,N()&&`mc-star-rating--${N()}`,F()&&`mc-star-rating--${F()}`,z()]),G=v(()=>c(V)??T()),K=v(()=>P()?1:5);function q(e){return P()||c(G)>=e+1?E:c(U)&&c(G)>=e+.5?D:O}function J(e,t){e.pointerType===`mouse`&&a(V,t+1)}function Y(){a(V,null)}function X(e){T(e+1)}function Z(e){let t=e.key,n=Math.floor(T());if(t===`ArrowRight`)n=Math.min(c(K),n+1);else if(t===`ArrowLeft`)n=Math.max(1,n-1);else return;T(n),e.preventDefault()}let Q=v(()=>c(U)?{tabindex:-1}:{onkeydown:Z,onmouseleave:Y,onblur:Y,tabindex:0,"aria-valuemin":0,"aria-valuemax":c(K),"aria-valuenow":T(),"aria-readonly":!1});var te={get rating(){return T()},set rating(e){T(e),m()},get readonly(){return M()},set readonly(e){M(e),m()},get size(){return N()},set size(e=`m`){N(e),m()},get compact(){return P()},set compact(e){P(e),m()},get appearance(){return F()},set appearance(e=`standard`){F(e),m()},get text(){return I()},set text(e){I(e),m()},get href(){return L()},set href(e){L(e),m()},get target(){return R()},set target(e){R(e),m()},get class(){return z()},set class(e){z(e),m()}},$=r();return w(t($),()=>c(H),!1,(r,i)=>{g(r,()=>({href:L(),target:R(),class:c(W),...B}),void 0,void 0,void 0,`svelte-17npafv`);var a=ee(),d=t(a);g(d,()=>({class:`mc-star-rating__wrapper`,role:c(U)?`img`:`slider`,"aria-label":`Note ${c(G)} sur ${c(K)}`,...c(Q)}),void 0,void 0,void 0,`svelte-17npafv`),s(d,20,()=>Array.from({length:c(K)}).keys(),e=>e,(e,t)=>{let r=v(()=>q(t));var i=k();g(i,()=>({class:`mc-star-rating__icon`,...c(U)?{}:{onpointermove:e=>J(e,t),onclick:()=>X(t)}}),void 0,void 0,void 0,`svelte-17npafv`),o(b(i),()=>c(r),(e,t)=>{t(e,{})}),p(i),n(e,i)}),p(d);var f=u(d,2),m=e=>{var t=A(),r=b(t,!0);p(t),l(()=>h(r,I()||L())),n(e,t)};e(f,e=>{(I()||L())&&e(m)}),n(i,a)}),n(i,$),y(te)}customElements.define(`m-star-rating`,C(M,{readonly:{attribute:`readonly`,reflect:!0,type:`Boolean`},compact:{attribute:`compact`,reflect:!0,type:`Boolean`},rating:{},size:{},appearance:{},text:{},href:{},target:{},class:{}},[],[],{mode:`open`},T));
//# sourceMappingURL=StarRating.js.map