import{g as ae,d as V,i as te,r as se,a as r,t as E}from"./i18n-Dnhn5Rxr.js";import{R as re,u as ie,v as le,y as N,w as u,x as pe,Z as i,S as ne,a7 as oe,t as g,a as x,V as l,X as d,T as ue,M as $,aw as de,W,a0 as w,a5 as y,a8 as me,Y as p}from"./index-DWyDLubb.js";import{b as U}from"./input-DrerMDOL.js";import{G as ve}from"./utils.svelte-CCyS_0CY.js";import{B as ce}from"./Block-J4oodUWp.js";import{B as _e}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as fe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";let he=0;var be=W('<button class="reset-button svelte-8epfm4" aria-label="Reset to default value" data-testid="reset-button">↺</button>'),ge=W('<!> <div class="wrap svelte-8epfm4"><div class="head svelte-8epfm4"><label class="svelte-8epfm4"><!></label> <div class="tab-like-container svelte-8epfm4"><input data-testid="number-input" type="number" class="svelte-8epfm4"/> <!></div></div> <div class="slider_input_container svelte-8epfm4"><span class="min_value svelte-8epfm4" data-testid="min-value"> </span> <input type="range" name="cowbell" data-testid="range-input" class="svelte-8epfm4"/> <span class="max_value svelte-8epfm4" data-testid="max-value"> </span></div></div>',1);function Re(X,k){re(k,!0);let Y=se(k,["$$slots","$$events","$$legacy"]),e=new ve(Y);const Z=e.props.value;let S=ie(le(e.props.value)),m,B;const I=`range_id_${he++}`;let j=y(()=>e.props.minimum??0),q=y(()=>{const n=e.props.minimum,f=e.props.maximum,o=e.props.value;return o>f?100:o<n?0:(o-n)/(f-n)*100});N(()=>{e.props.value==null||!m||(m.style.setProperty("--range_progress",`${u(q)}%`),m.value=e.props.value.toString())});async function C(){await $(),e.dispatch("change")}async function M(n){await $(),e.dispatch("release",e.props.value)}function D(){e.dispatch("release",e.props.value),e.props.value=Math.min(Math.max(e.props.value,e.props.minimum),e.props.maximum)}let _=y(()=>!e.shared.interactive);N(()=>{e.props.value!=u(S)&&(pe(S,e.props.value,!0),C())});function F(){}function H(){e.props.value=Z,e.dispatch("change"),e.dispatch("release",e.props.value)}async function P(){await $(),e.dispatch("input")}i("resize",de,F),ce(X,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(n,f)=>{var o=ge(),T=ne(o);fe(T,ae({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var z=d(T,2),h=l(z),v=l(h),J=l(v);_e(J,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(a,c)=>{me();var R=oe();g(()=>w(R,e.shared.label||"Slider")),x(a,R)},$$slots:{default:!0}}),p(v);var A=d(v,2),t=l(A);E(t),V(t,a=>B=a,()=>B);var K=d(t,2);{var O=a=>{var c=be();g(()=>c.disabled=u(_)),i("click",c,H),x(a,c)};te(K,a=>{(e.props.buttons?.includes("reset")??!0)&&a(O)})}p(A),p(h);var G=d(h,2),b=l(G),Q=l(b,!0);p(b);var s=d(b,2);E(s),V(s,a=>m=a,()=>m);var L=d(s,2),ee=l(L,!0);p(L),p(G),p(z),g(()=>{r(v,"for",I),r(t,"aria-label",`number input for ${e.shared.label}`),r(t,"min",e.props.minimum),r(t,"max",e.props.maximum),r(t,"step",e.props.step),t.disabled=u(_),w(Q,u(j)),r(s,"id",I),r(s,"min",e.props.minimum),r(s,"max",e.props.maximum),r(s,"step",e.props.step),s.disabled=u(_),r(s,"aria-label",`range slider for ${e.shared.label}`),w(ee,e.props.maximum)}),U(t,()=>e.props.value,a=>e.props.value=a),i("input",t,P),i("blur",t,D),i("pointerup",t,M),U(s,()=>e.props.value,a=>e.props.value=a),i("input",s,P),i("pointerup",s,M),x(n,o)},$$slots:{default:!0}}),ue()}export{Re as default};
