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,st as x,t as S,x as C}from"../../client.js";import{t as w}from"../../custom-element-forward-events.js";import{F as T,I as E,L as D}from"../../components.js";var O=i(`<span><!></span>`),k=i(`<span class="mc-star-rating__info svelte-17npafv"> </span>`),A=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) {fill:var(--star-rating-color-icon-standard, #000000);}.mc-star-rating--accent.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {fill: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,S){x(S,!0),d(i,j);let w=_(S,`rating`,15),M=_(S,`readonly`,7),N=_(S,`size`,7,`m`),P=_(S,`compact`,7),F=_(S,`appearance`,7,`standard`),I=_(S,`text`,7),L=_(S,`href`,7),R=_(S,`target`,7),z=f(null),B=v(()=>L()?`a`:`div`),V=v(()=>[M(),P(),L(),I()].some(Boolean)),H=v(()=>({"mc-star-rating":!0,"mc-star-rating--link":L(),"mc-star-rating--slider":!c(V),[`mc-star-rating--${N()}`]:N(),[`mc-star-rating--${F()}`]:F()})),U=v(()=>c(z)??w()),W=v(()=>P()?1:5);function G(e){return P()||c(U)>=e+1?T:c(V)&&c(U)>=e+.5?E:D}function K(e){a(z,e+1)}function q(){a(z,null)}function J(e){w(e+1)}function Y(e){let t=e.key,n=Math.floor(w());if(t===`ArrowRight`)n=Math.min(c(W),n+1);else if(t===`ArrowLeft`)n=Math.max(1,n-1);else return;w(n),e.preventDefault()}let X=v(()=>c(V)?{tabindex:-1}:{onkeydown:Y,onmouseleave:q,onblur:q,tabindex:0,"aria-valuemin":0,"aria-valuemax":c(W),"aria-valuenow":w(),"aria-readonly":!1});var Z={get rating(){return w()},set rating(e){w(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()}},Q=r();return C(t(Q),()=>c(B),!1,(r,i)=>{g(r,()=>({href:L(),target:R(),class:c(H)}),void 0,void 0,void 0,`svelte-17npafv`);var a=A(),d=t(a);g(d,()=>({class:`mc-star-rating__wrapper`,role:c(V)?`img`:`slider`,"aria-label":`Note ${c(U)} sur ${c(W)}`,...c(X)}),void 0,void 0,void 0,`svelte-17npafv`),s(d,20,()=>Array.from({length:c(W)}).keys(),e=>e,(e,t)=>{let r=v(()=>G(t));var i=O();g(i,()=>({class:`mc-star-rating__icon`,...c(V)?{}:{onmousemove:()=>K(t),onclick:()=>J(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=k(),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,Q),y(Z)}customElements.define(`m-star-rating`,S(M,{readonly:{attribute:`readonly`,reflect:!0,type:`Boolean`},compact:{attribute:`compact`,reflect:!0,type:`Boolean`},rating:{},size:{},appearance:{},text:{},href:{},target:{}},[],[],{mode:`open`},w));
//# sourceMappingURL=StarRating.js.map