freddyaboulton HF staff commited on
Commit
57be732
β€’
1 Parent(s): daca7b6

Upload folder using huggingface_hub

Browse files
src/.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ .mypycache
10
+ .ruff_cache
11
+ node_modules
12
+ backend/**/templates/
src/README.md ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags: [gradio-custom-component, Slider, leaderboards, forms, filtering, slider]
3
+ title: gradio_rangeslider
4
+ short_description: πŸ› Slider component for selecting a range of values
5
+ colorFrom: blue
6
+ colorTo: yellow
7
+ sdk: gradio
8
+ pinned: false
9
+ app_file: app.py
10
+ ---
11
+
12
+ # `gradio_rangeslider`
13
+ <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
14
+
15
+ πŸ› Slider component for selecting a range of values.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install gradio_rangeslider
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ The `RangeSlider` functions similarly to the core Gradio `Slider` except that it shows two draggable thumbtracks. The `value` of the component is a tuple of the two endpoints of the range.
26
+
27
+ ```python
28
+
29
+ import gradio as gr
30
+ from gradio_rangeslider import RangeSlider
31
+
32
+ text = "## The range is: {min} to {max}"
33
+
34
+ with gr.Blocks() as demo:
35
+ gr.Markdown("""## πŸ› RangeSlider
36
+ Drag either end and see the selected endpoints update in real-time.
37
+ """)
38
+ range_slider = RangeSlider(minimum=0, maximum=100, value=(0, 100))
39
+ range_ = gr.Markdown(value=text.format(min=0, max=100))
40
+ range_slider.change(lambda s: text.format(min=s[0], max=s[1]), range_slider, range_,
41
+ show_progress="hide")
42
+
43
+
44
+
45
+ if __name__ == "__main__":
46
+ demo.launch()
47
+
48
+ ```
49
+
50
+ ## `RangeSlider`
51
+
52
+ ### Initialization
53
+
54
+ <table>
55
+ <thead>
56
+ <tr>
57
+ <th align="left">name</th>
58
+ <th align="left" style="width: 25%;">type</th>
59
+ <th align="left">default</th>
60
+ <th align="left">description</th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ <tr>
65
+ <td align="left"><code>minimum</code></td>
66
+ <td align="left" style="width: 25%;">
67
+
68
+ ```python
69
+ float
70
+ ```
71
+
72
+ </td>
73
+ <td align="left"><code>0</code></td>
74
+ <td align="left">minimum value for slider.</td>
75
+ </tr>
76
+
77
+ <tr>
78
+ <td align="left"><code>maximum</code></td>
79
+ <td align="left" style="width: 25%;">
80
+
81
+ ```python
82
+ float
83
+ ```
84
+
85
+ </td>
86
+ <td align="left"><code>100</code></td>
87
+ <td align="left">maximum value for slider.</td>
88
+ </tr>
89
+
90
+ <tr>
91
+ <td align="left"><code>value</code></td>
92
+ <td align="left" style="width: 25%;">
93
+
94
+ ```python
95
+ tuple[float, float] | Callable | None
96
+ ```
97
+
98
+ </td>
99
+ <td align="left"><code>None</code></td>
100
+ <td align="left">default value. If callable, the function will be called whenever the app loads to set the initial value of the component. Ignored if randomized=True.</td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td align="left"><code>step</code></td>
105
+ <td align="left" style="width: 25%;">
106
+
107
+ ```python
108
+ float | None
109
+ ```
110
+
111
+ </td>
112
+ <td align="left"><code>None</code></td>
113
+ <td align="left">increment between slider values.</td>
114
+ </tr>
115
+
116
+ <tr>
117
+ <td align="left"><code>label</code></td>
118
+ <td align="left" style="width: 25%;">
119
+
120
+ ```python
121
+ str | None
122
+ ```
123
+
124
+ </td>
125
+ <td align="left"><code>None</code></td>
126
+ <td align="left">The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.</td>
127
+ </tr>
128
+
129
+ <tr>
130
+ <td align="left"><code>info</code></td>
131
+ <td align="left" style="width: 25%;">
132
+
133
+ ```python
134
+ str | None
135
+ ```
136
+
137
+ </td>
138
+ <td align="left"><code>None</code></td>
139
+ <td align="left">additional component description.</td>
140
+ </tr>
141
+
142
+ <tr>
143
+ <td align="left"><code>every</code></td>
144
+ <td align="left" style="width: 25%;">
145
+
146
+ ```python
147
+ float | None
148
+ ```
149
+
150
+ </td>
151
+ <td align="left"><code>None</code></td>
152
+ <td align="left">If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.</td>
153
+ </tr>
154
+
155
+ <tr>
156
+ <td align="left"><code>show_label</code></td>
157
+ <td align="left" style="width: 25%;">
158
+
159
+ ```python
160
+ bool | None
161
+ ```
162
+
163
+ </td>
164
+ <td align="left"><code>None</code></td>
165
+ <td align="left">if True, will display label.</td>
166
+ </tr>
167
+
168
+ <tr>
169
+ <td align="left"><code>container</code></td>
170
+ <td align="left" style="width: 25%;">
171
+
172
+ ```python
173
+ bool
174
+ ```
175
+
176
+ </td>
177
+ <td align="left"><code>True</code></td>
178
+ <td align="left">If True, will place the component in a container - providing some extra padding around the border.</td>
179
+ </tr>
180
+
181
+ <tr>
182
+ <td align="left"><code>scale</code></td>
183
+ <td align="left" style="width: 25%;">
184
+
185
+ ```python
186
+ int | None
187
+ ```
188
+
189
+ </td>
190
+ <td align="left"><code>None</code></td>
191
+ <td align="left">relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.</td>
192
+ </tr>
193
+
194
+ <tr>
195
+ <td align="left"><code>min_width</code></td>
196
+ <td align="left" style="width: 25%;">
197
+
198
+ ```python
199
+ int
200
+ ```
201
+
202
+ </td>
203
+ <td align="left"><code>160</code></td>
204
+ <td align="left">minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.</td>
205
+ </tr>
206
+
207
+ <tr>
208
+ <td align="left"><code>interactive</code></td>
209
+ <td align="left" style="width: 25%;">
210
+
211
+ ```python
212
+ bool | None
213
+ ```
214
+
215
+ </td>
216
+ <td align="left"><code>None</code></td>
217
+ <td align="left">if True, slider will be adjustable; if False, adjusting will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.</td>
218
+ </tr>
219
+
220
+ <tr>
221
+ <td align="left"><code>visible</code></td>
222
+ <td align="left" style="width: 25%;">
223
+
224
+ ```python
225
+ bool
226
+ ```
227
+
228
+ </td>
229
+ <td align="left"><code>True</code></td>
230
+ <td align="left">If False, component will be hidden.</td>
231
+ </tr>
232
+
233
+ <tr>
234
+ <td align="left"><code>elem_id</code></td>
235
+ <td align="left" style="width: 25%;">
236
+
237
+ ```python
238
+ str | None
239
+ ```
240
+
241
+ </td>
242
+ <td align="left"><code>None</code></td>
243
+ <td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
244
+ </tr>
245
+
246
+ <tr>
247
+ <td align="left"><code>elem_classes</code></td>
248
+ <td align="left" style="width: 25%;">
249
+
250
+ ```python
251
+ list[str] | str | None
252
+ ```
253
+
254
+ </td>
255
+ <td align="left"><code>None</code></td>
256
+ <td align="left">An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
257
+ </tr>
258
+
259
+ <tr>
260
+ <td align="left"><code>render</code></td>
261
+ <td align="left" style="width: 25%;">
262
+
263
+ ```python
264
+ bool
265
+ ```
266
+
267
+ </td>
268
+ <td align="left"><code>True</code></td>
269
+ <td align="left">If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>
270
+ </tr>
271
+ </tbody></table>
272
+
273
+
274
+ ### Events
275
+
276
+ | name | description |
277
+ |:-----|:------------|
278
+ | `change` | Triggered when the value of the RangeSlider changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
279
+ | `input` | This listener is triggered when the user changes the value of the RangeSlider. |
280
+
281
+
282
+
283
+ ### User function
284
+
285
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
286
+
287
+ - When used as an Input, the component only impacts the input signature of the user function.
288
+ - When used as an output, the component only impacts the return signature of the user function.
289
+
290
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
291
+
292
+ - **As output:** Is passed, passes slider value as a {float} into the function.
293
+ - **As input:** Should return, expects an {int} or {float} returned from function and sets slider value to it as long as it is within range (otherwise, sets to minimum value).
294
+
295
+ ```python
296
+ def predict(
297
+ value: tuple[float, float]
298
+ ) -> tuple[float, float] | None:
299
+ return value
300
+ ```
301
+
src/backend/gradio_rangeslider/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ from .rangeslider import RangeSlider
3
+
4
+ __all__ = ['RangeSlider']
src/backend/gradio_rangeslider/rangeslider.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """gr.Slider() component."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+ import random
7
+ from typing import Any, Callable, Tuple
8
+
9
+
10
+ from gradio.components.base import FormComponent
11
+ from gradio.events import Events
12
+
13
+ from gradio.data_classes import GradioRootModel
14
+
15
+ class RangeSliderData(GradioRootModel):
16
+ root: Tuple[float, float]
17
+
18
+
19
+ class RangeSlider(FormComponent):
20
+ """
21
+ A slider component that allows the user to select a range of values.
22
+ """
23
+
24
+ EVENTS = [Events.change, Events.input]
25
+ data_model = RangeSliderData
26
+
27
+ def __init__(
28
+ self,
29
+ minimum: float = 0,
30
+ maximum: float = 100,
31
+ value: Tuple[float, float] | Callable | None = None,
32
+ *,
33
+ step: float | None = None,
34
+ label: str | None = None,
35
+ info: str | None = None,
36
+ every: float | None = None,
37
+ show_label: bool | None = None,
38
+ container: bool = True,
39
+ scale: int | None = None,
40
+ min_width: int = 160,
41
+ interactive: bool | None = None,
42
+ visible: bool = True,
43
+ elem_id: str | None = None,
44
+ elem_classes: list[str] | str | None = None,
45
+ render: bool = True,
46
+ ):
47
+ """
48
+ Parameters:
49
+ minimum: minimum value for slider.
50
+ maximum: maximum value for slider.
51
+ value: default value. If callable, the function will be called whenever the app loads to set the initial value of the component. Ignored if randomized=True.
52
+ step: increment between slider values.
53
+ label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
54
+ info: additional component description.
55
+ every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
56
+ show_label: if True, will display label.
57
+ container: If True, will place the component in a container - providing some extra padding around the border.
58
+ scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
59
+ min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
60
+ interactive: if True, slider will be adjustable; if False, adjusting will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
61
+ visible: If False, component will be hidden.
62
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
63
+ elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
64
+ render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
65
+ """
66
+ self.minimum = minimum
67
+ self.maximum = maximum
68
+ if step is None:
69
+ difference = maximum - minimum
70
+ power = math.floor(math.log10(difference) - 2)
71
+ self.step = 10**power
72
+ else:
73
+ self.step = step
74
+
75
+ super().__init__(
76
+ label=label,
77
+ info=info,
78
+ every=every,
79
+ show_label=show_label,
80
+ container=container,
81
+ scale=scale,
82
+ min_width=min_width,
83
+ interactive=interactive,
84
+ visible=visible,
85
+ elem_id=elem_id,
86
+ elem_classes=elem_classes,
87
+ render=render,
88
+ value=value,
89
+ )
90
+
91
+ def example_payload(self) -> Any:
92
+ return [self.minimum, self.maximum]
93
+
94
+ def example_value(self) -> Any:
95
+ return [self.minimum, self.maximum]
96
+
97
+ def postprocess(self, value: Tuple[float, float] | None) -> RangeSliderData:
98
+ """
99
+ Parameters:
100
+ value: Expects an {int} or {float} returned from function and sets slider value to it as long as it is within range (otherwise, sets to minimum value).
101
+ Returns:
102
+ The value of the slider within the range.
103
+ """
104
+ return [self.minimum, self.maximum] if value is None else RangeSliderData(root=value)
105
+
106
+ def preprocess(self, payload: RangeSliderData) -> Tuple[float, float]:
107
+ """
108
+ Parameters:
109
+ payload: slider value
110
+ Returns:
111
+ Passes slider value as a {float} into the function.
112
+ """
113
+ return payload.model_dump()
src/backend/gradio_rangeslider/templates/component/index.js ADDED
@@ -0,0 +1,2903 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const {
2
+ SvelteComponent: Ot,
3
+ assign: Jt,
4
+ create_slot: Xt,
5
+ detach: Yt,
6
+ element: Gt,
7
+ get_all_dirty_from_scope: Rt,
8
+ get_slot_changes: Ht,
9
+ get_spread_update: Kt,
10
+ init: Qt,
11
+ insert: Ut,
12
+ safe_not_equal: Wt,
13
+ set_dynamic_element_data: Qe,
14
+ set_style: A,
15
+ toggle_class: K,
16
+ transition_in: vt,
17
+ transition_out: yt,
18
+ update_slot_base: xt
19
+ } = window.__gradio__svelte__internal;
20
+ function $t(l) {
21
+ let e, t, n;
22
+ const i = (
23
+ /*#slots*/
24
+ l[18].default
25
+ ), f = Xt(
26
+ i,
27
+ l,
28
+ /*$$scope*/
29
+ l[17],
30
+ null
31
+ );
32
+ let a = [
33
+ { "data-testid": (
34
+ /*test_id*/
35
+ l[7]
36
+ ) },
37
+ { id: (
38
+ /*elem_id*/
39
+ l[2]
40
+ ) },
41
+ {
42
+ class: t = "block " + /*elem_classes*/
43
+ l[3].join(" ") + " svelte-nl1om8"
44
+ }
45
+ ], r = {};
46
+ for (let s = 0; s < a.length; s += 1)
47
+ r = Jt(r, a[s]);
48
+ return {
49
+ c() {
50
+ e = Gt(
51
+ /*tag*/
52
+ l[14]
53
+ ), f && f.c(), Qe(
54
+ /*tag*/
55
+ l[14]
56
+ )(e, r), K(
57
+ e,
58
+ "hidden",
59
+ /*visible*/
60
+ l[10] === !1
61
+ ), K(
62
+ e,
63
+ "padded",
64
+ /*padding*/
65
+ l[6]
66
+ ), K(
67
+ e,
68
+ "border_focus",
69
+ /*border_mode*/
70
+ l[5] === "focus"
71
+ ), K(
72
+ e,
73
+ "border_contrast",
74
+ /*border_mode*/
75
+ l[5] === "contrast"
76
+ ), K(e, "hide-container", !/*explicit_call*/
77
+ l[8] && !/*container*/
78
+ l[9]), A(
79
+ e,
80
+ "height",
81
+ /*get_dimension*/
82
+ l[15](
83
+ /*height*/
84
+ l[0]
85
+ )
86
+ ), A(e, "width", typeof /*width*/
87
+ l[1] == "number" ? `calc(min(${/*width*/
88
+ l[1]}px, 100%))` : (
89
+ /*get_dimension*/
90
+ l[15](
91
+ /*width*/
92
+ l[1]
93
+ )
94
+ )), A(
95
+ e,
96
+ "border-style",
97
+ /*variant*/
98
+ l[4]
99
+ ), A(
100
+ e,
101
+ "overflow",
102
+ /*allow_overflow*/
103
+ l[11] ? "visible" : "hidden"
104
+ ), A(
105
+ e,
106
+ "flex-grow",
107
+ /*scale*/
108
+ l[12]
109
+ ), A(e, "min-width", `calc(min(${/*min_width*/
110
+ l[13]}px, 100%))`), A(e, "border-width", "var(--block-border-width)");
111
+ },
112
+ m(s, o) {
113
+ Ut(s, e, o), f && f.m(e, null), n = !0;
114
+ },
115
+ p(s, o) {
116
+ f && f.p && (!n || o & /*$$scope*/
117
+ 131072) && xt(
118
+ f,
119
+ i,
120
+ s,
121
+ /*$$scope*/
122
+ s[17],
123
+ n ? Ht(
124
+ i,
125
+ /*$$scope*/
126
+ s[17],
127
+ o,
128
+ null
129
+ ) : Rt(
130
+ /*$$scope*/
131
+ s[17]
132
+ ),
133
+ null
134
+ ), Qe(
135
+ /*tag*/
136
+ s[14]
137
+ )(e, r = Kt(a, [
138
+ (!n || o & /*test_id*/
139
+ 128) && { "data-testid": (
140
+ /*test_id*/
141
+ s[7]
142
+ ) },
143
+ (!n || o & /*elem_id*/
144
+ 4) && { id: (
145
+ /*elem_id*/
146
+ s[2]
147
+ ) },
148
+ (!n || o & /*elem_classes*/
149
+ 8 && t !== (t = "block " + /*elem_classes*/
150
+ s[3].join(" ") + " svelte-nl1om8")) && { class: t }
151
+ ])), K(
152
+ e,
153
+ "hidden",
154
+ /*visible*/
155
+ s[10] === !1
156
+ ), K(
157
+ e,
158
+ "padded",
159
+ /*padding*/
160
+ s[6]
161
+ ), K(
162
+ e,
163
+ "border_focus",
164
+ /*border_mode*/
165
+ s[5] === "focus"
166
+ ), K(
167
+ e,
168
+ "border_contrast",
169
+ /*border_mode*/
170
+ s[5] === "contrast"
171
+ ), K(e, "hide-container", !/*explicit_call*/
172
+ s[8] && !/*container*/
173
+ s[9]), o & /*height*/
174
+ 1 && A(
175
+ e,
176
+ "height",
177
+ /*get_dimension*/
178
+ s[15](
179
+ /*height*/
180
+ s[0]
181
+ )
182
+ ), o & /*width*/
183
+ 2 && A(e, "width", typeof /*width*/
184
+ s[1] == "number" ? `calc(min(${/*width*/
185
+ s[1]}px, 100%))` : (
186
+ /*get_dimension*/
187
+ s[15](
188
+ /*width*/
189
+ s[1]
190
+ )
191
+ )), o & /*variant*/
192
+ 16 && A(
193
+ e,
194
+ "border-style",
195
+ /*variant*/
196
+ s[4]
197
+ ), o & /*allow_overflow*/
198
+ 2048 && A(
199
+ e,
200
+ "overflow",
201
+ /*allow_overflow*/
202
+ s[11] ? "visible" : "hidden"
203
+ ), o & /*scale*/
204
+ 4096 && A(
205
+ e,
206
+ "flex-grow",
207
+ /*scale*/
208
+ s[12]
209
+ ), o & /*min_width*/
210
+ 8192 && A(e, "min-width", `calc(min(${/*min_width*/
211
+ s[13]}px, 100%))`);
212
+ },
213
+ i(s) {
214
+ n || (vt(f, s), n = !0);
215
+ },
216
+ o(s) {
217
+ yt(f, s), n = !1;
218
+ },
219
+ d(s) {
220
+ s && Yt(e), f && f.d(s);
221
+ }
222
+ };
223
+ }
224
+ function el(l) {
225
+ let e, t = (
226
+ /*tag*/
227
+ l[14] && $t(l)
228
+ );
229
+ return {
230
+ c() {
231
+ t && t.c();
232
+ },
233
+ m(n, i) {
234
+ t && t.m(n, i), e = !0;
235
+ },
236
+ p(n, [i]) {
237
+ /*tag*/
238
+ n[14] && t.p(n, i);
239
+ },
240
+ i(n) {
241
+ e || (vt(t, n), e = !0);
242
+ },
243
+ o(n) {
244
+ yt(t, n), e = !1;
245
+ },
246
+ d(n) {
247
+ t && t.d(n);
248
+ }
249
+ };
250
+ }
251
+ function tl(l, e, t) {
252
+ let { $$slots: n = {}, $$scope: i } = e, { height: f = void 0 } = e, { width: a = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: s = [] } = e, { variant: o = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: b = "normal" } = e, { test_id: g = void 0 } = e, { explicit_call: v = !1 } = e, { container: V = !0 } = e, { visible: k = !0 } = e, { allow_overflow: N = !0 } = e, { scale: m = null } = e, { min_width: d = 0 } = e, L = b === "fieldset" ? "fieldset" : "div";
253
+ const M = (w) => {
254
+ if (w !== void 0) {
255
+ if (typeof w == "number")
256
+ return w + "px";
257
+ if (typeof w == "string")
258
+ return w;
259
+ }
260
+ };
261
+ return l.$$set = (w) => {
262
+ "height" in w && t(0, f = w.height), "width" in w && t(1, a = w.width), "elem_id" in w && t(2, r = w.elem_id), "elem_classes" in w && t(3, s = w.elem_classes), "variant" in w && t(4, o = w.variant), "border_mode" in w && t(5, u = w.border_mode), "padding" in w && t(6, c = w.padding), "type" in w && t(16, b = w.type), "test_id" in w && t(7, g = w.test_id), "explicit_call" in w && t(8, v = w.explicit_call), "container" in w && t(9, V = w.container), "visible" in w && t(10, k = w.visible), "allow_overflow" in w && t(11, N = w.allow_overflow), "scale" in w && t(12, m = w.scale), "min_width" in w && t(13, d = w.min_width), "$$scope" in w && t(17, i = w.$$scope);
263
+ }, [
264
+ f,
265
+ a,
266
+ r,
267
+ s,
268
+ o,
269
+ u,
270
+ c,
271
+ g,
272
+ v,
273
+ V,
274
+ k,
275
+ N,
276
+ m,
277
+ d,
278
+ L,
279
+ M,
280
+ b,
281
+ i,
282
+ n
283
+ ];
284
+ }
285
+ class ll extends Ot {
286
+ constructor(e) {
287
+ super(), Qt(this, e, tl, el, Wt, {
288
+ height: 0,
289
+ width: 1,
290
+ elem_id: 2,
291
+ elem_classes: 3,
292
+ variant: 4,
293
+ border_mode: 5,
294
+ padding: 6,
295
+ type: 16,
296
+ test_id: 7,
297
+ explicit_call: 8,
298
+ container: 9,
299
+ visible: 10,
300
+ allow_overflow: 11,
301
+ scale: 12,
302
+ min_width: 13
303
+ });
304
+ }
305
+ }
306
+ const {
307
+ SvelteComponent: nl,
308
+ attr: il,
309
+ create_slot: fl,
310
+ detach: sl,
311
+ element: ol,
312
+ get_all_dirty_from_scope: al,
313
+ get_slot_changes: rl,
314
+ init: ul,
315
+ insert: _l,
316
+ safe_not_equal: cl,
317
+ transition_in: dl,
318
+ transition_out: ml,
319
+ update_slot_base: bl
320
+ } = window.__gradio__svelte__internal;
321
+ function gl(l) {
322
+ let e, t;
323
+ const n = (
324
+ /*#slots*/
325
+ l[1].default
326
+ ), i = fl(
327
+ n,
328
+ l,
329
+ /*$$scope*/
330
+ l[0],
331
+ null
332
+ );
333
+ return {
334
+ c() {
335
+ e = ol("div"), i && i.c(), il(e, "class", "svelte-1hnfib2");
336
+ },
337
+ m(f, a) {
338
+ _l(f, e, a), i && i.m(e, null), t = !0;
339
+ },
340
+ p(f, [a]) {
341
+ i && i.p && (!t || a & /*$$scope*/
342
+ 1) && bl(
343
+ i,
344
+ n,
345
+ f,
346
+ /*$$scope*/
347
+ f[0],
348
+ t ? rl(
349
+ n,
350
+ /*$$scope*/
351
+ f[0],
352
+ a,
353
+ null
354
+ ) : al(
355
+ /*$$scope*/
356
+ f[0]
357
+ ),
358
+ null
359
+ );
360
+ },
361
+ i(f) {
362
+ t || (dl(i, f), t = !0);
363
+ },
364
+ o(f) {
365
+ ml(i, f), t = !1;
366
+ },
367
+ d(f) {
368
+ f && sl(e), i && i.d(f);
369
+ }
370
+ };
371
+ }
372
+ function hl(l, e, t) {
373
+ let { $$slots: n = {}, $$scope: i } = e;
374
+ return l.$$set = (f) => {
375
+ "$$scope" in f && t(0, i = f.$$scope);
376
+ }, [i, n];
377
+ }
378
+ class wl extends nl {
379
+ constructor(e) {
380
+ super(), ul(this, e, hl, gl, cl, {});
381
+ }
382
+ }
383
+ const {
384
+ SvelteComponent: pl,
385
+ attr: Ue,
386
+ check_outros: kl,
387
+ create_component: vl,
388
+ create_slot: yl,
389
+ destroy_component: ql,
390
+ detach: ze,
391
+ element: Cl,
392
+ empty: Fl,
393
+ get_all_dirty_from_scope: Ll,
394
+ get_slot_changes: Sl,
395
+ group_outros: zl,
396
+ init: Ml,
397
+ insert: Me,
398
+ mount_component: Vl,
399
+ safe_not_equal: Nl,
400
+ set_data: Il,
401
+ space: Zl,
402
+ text: jl,
403
+ toggle_class: ue,
404
+ transition_in: we,
405
+ transition_out: Ve,
406
+ update_slot_base: Pl
407
+ } = window.__gradio__svelte__internal;
408
+ function We(l) {
409
+ let e, t;
410
+ return e = new wl({
411
+ props: {
412
+ $$slots: { default: [Bl] },
413
+ $$scope: { ctx: l }
414
+ }
415
+ }), {
416
+ c() {
417
+ vl(e.$$.fragment);
418
+ },
419
+ m(n, i) {
420
+ Vl(e, n, i), t = !0;
421
+ },
422
+ p(n, i) {
423
+ const f = {};
424
+ i & /*$$scope, info*/
425
+ 10 && (f.$$scope = { dirty: i, ctx: n }), e.$set(f);
426
+ },
427
+ i(n) {
428
+ t || (we(e.$$.fragment, n), t = !0);
429
+ },
430
+ o(n) {
431
+ Ve(e.$$.fragment, n), t = !1;
432
+ },
433
+ d(n) {
434
+ ql(e, n);
435
+ }
436
+ };
437
+ }
438
+ function Bl(l) {
439
+ let e;
440
+ return {
441
+ c() {
442
+ e = jl(
443
+ /*info*/
444
+ l[1]
445
+ );
446
+ },
447
+ m(t, n) {
448
+ Me(t, e, n);
449
+ },
450
+ p(t, n) {
451
+ n & /*info*/
452
+ 2 && Il(
453
+ e,
454
+ /*info*/
455
+ t[1]
456
+ );
457
+ },
458
+ d(t) {
459
+ t && ze(e);
460
+ }
461
+ };
462
+ }
463
+ function Al(l) {
464
+ let e, t, n, i;
465
+ const f = (
466
+ /*#slots*/
467
+ l[2].default
468
+ ), a = yl(
469
+ f,
470
+ l,
471
+ /*$$scope*/
472
+ l[3],
473
+ null
474
+ );
475
+ let r = (
476
+ /*info*/
477
+ l[1] && We(l)
478
+ );
479
+ return {
480
+ c() {
481
+ e = Cl("span"), a && a.c(), t = Zl(), r && r.c(), n = Fl(), Ue(e, "data-testid", "block-info"), Ue(e, "class", "svelte-22c38v"), ue(e, "sr-only", !/*show_label*/
482
+ l[0]), ue(e, "hide", !/*show_label*/
483
+ l[0]), ue(
484
+ e,
485
+ "has-info",
486
+ /*info*/
487
+ l[1] != null
488
+ );
489
+ },
490
+ m(s, o) {
491
+ Me(s, e, o), a && a.m(e, null), Me(s, t, o), r && r.m(s, o), Me(s, n, o), i = !0;
492
+ },
493
+ p(s, [o]) {
494
+ a && a.p && (!i || o & /*$$scope*/
495
+ 8) && Pl(
496
+ a,
497
+ f,
498
+ s,
499
+ /*$$scope*/
500
+ s[3],
501
+ i ? Sl(
502
+ f,
503
+ /*$$scope*/
504
+ s[3],
505
+ o,
506
+ null
507
+ ) : Ll(
508
+ /*$$scope*/
509
+ s[3]
510
+ ),
511
+ null
512
+ ), (!i || o & /*show_label*/
513
+ 1) && ue(e, "sr-only", !/*show_label*/
514
+ s[0]), (!i || o & /*show_label*/
515
+ 1) && ue(e, "hide", !/*show_label*/
516
+ s[0]), (!i || o & /*info*/
517
+ 2) && ue(
518
+ e,
519
+ "has-info",
520
+ /*info*/
521
+ s[1] != null
522
+ ), /*info*/
523
+ s[1] ? r ? (r.p(s, o), o & /*info*/
524
+ 2 && we(r, 1)) : (r = We(s), r.c(), we(r, 1), r.m(n.parentNode, n)) : r && (zl(), Ve(r, 1, 1, () => {
525
+ r = null;
526
+ }), kl());
527
+ },
528
+ i(s) {
529
+ i || (we(a, s), we(r), i = !0);
530
+ },
531
+ o(s) {
532
+ Ve(a, s), Ve(r), i = !1;
533
+ },
534
+ d(s) {
535
+ s && (ze(e), ze(t), ze(n)), a && a.d(s), r && r.d(s);
536
+ }
537
+ };
538
+ }
539
+ function Dl(l, e, t) {
540
+ let { $$slots: n = {}, $$scope: i } = e, { show_label: f = !0 } = e, { info: a = void 0 } = e;
541
+ return l.$$set = (r) => {
542
+ "show_label" in r && t(0, f = r.show_label), "info" in r && t(1, a = r.info), "$$scope" in r && t(3, i = r.$$scope);
543
+ }, [f, a, n, i];
544
+ }
545
+ class El extends pl {
546
+ constructor(e) {
547
+ super(), Ml(this, e, Dl, Al, Nl, { show_label: 0, info: 1 });
548
+ }
549
+ }
550
+ const {
551
+ SvelteComponent: Tl,
552
+ append: De,
553
+ attr: x,
554
+ bubble: Ol,
555
+ create_component: Jl,
556
+ destroy_component: Xl,
557
+ detach: qt,
558
+ element: Ee,
559
+ init: Yl,
560
+ insert: Ct,
561
+ listen: Gl,
562
+ mount_component: Rl,
563
+ safe_not_equal: Hl,
564
+ set_data: Kl,
565
+ set_style: _e,
566
+ space: Ql,
567
+ text: Ul,
568
+ toggle_class: P,
569
+ transition_in: Wl,
570
+ transition_out: xl
571
+ } = window.__gradio__svelte__internal;
572
+ function xe(l) {
573
+ let e, t;
574
+ return {
575
+ c() {
576
+ e = Ee("span"), t = Ul(
577
+ /*label*/
578
+ l[1]
579
+ ), x(e, "class", "svelte-1lrphxw");
580
+ },
581
+ m(n, i) {
582
+ Ct(n, e, i), De(e, t);
583
+ },
584
+ p(n, i) {
585
+ i & /*label*/
586
+ 2 && Kl(
587
+ t,
588
+ /*label*/
589
+ n[1]
590
+ );
591
+ },
592
+ d(n) {
593
+ n && qt(e);
594
+ }
595
+ };
596
+ }
597
+ function $l(l) {
598
+ let e, t, n, i, f, a, r, s = (
599
+ /*show_label*/
600
+ l[2] && xe(l)
601
+ );
602
+ return i = new /*Icon*/
603
+ l[0]({}), {
604
+ c() {
605
+ e = Ee("button"), s && s.c(), t = Ql(), n = Ee("div"), Jl(i.$$.fragment), x(n, "class", "svelte-1lrphxw"), P(
606
+ n,
607
+ "small",
608
+ /*size*/
609
+ l[4] === "small"
610
+ ), P(
611
+ n,
612
+ "large",
613
+ /*size*/
614
+ l[4] === "large"
615
+ ), P(
616
+ n,
617
+ "medium",
618
+ /*size*/
619
+ l[4] === "medium"
620
+ ), e.disabled = /*disabled*/
621
+ l[7], x(
622
+ e,
623
+ "aria-label",
624
+ /*label*/
625
+ l[1]
626
+ ), x(
627
+ e,
628
+ "aria-haspopup",
629
+ /*hasPopup*/
630
+ l[8]
631
+ ), x(
632
+ e,
633
+ "title",
634
+ /*label*/
635
+ l[1]
636
+ ), x(e, "class", "svelte-1lrphxw"), P(
637
+ e,
638
+ "pending",
639
+ /*pending*/
640
+ l[3]
641
+ ), P(
642
+ e,
643
+ "padded",
644
+ /*padded*/
645
+ l[5]
646
+ ), P(
647
+ e,
648
+ "highlight",
649
+ /*highlight*/
650
+ l[6]
651
+ ), P(
652
+ e,
653
+ "transparent",
654
+ /*transparent*/
655
+ l[9]
656
+ ), _e(e, "color", !/*disabled*/
657
+ l[7] && /*_color*/
658
+ l[12] ? (
659
+ /*_color*/
660
+ l[12]
661
+ ) : "var(--block-label-text-color)"), _e(e, "--bg-color", /*disabled*/
662
+ l[7] ? "auto" : (
663
+ /*background*/
664
+ l[10]
665
+ )), _e(
666
+ e,
667
+ "margin-left",
668
+ /*offset*/
669
+ l[11] + "px"
670
+ );
671
+ },
672
+ m(o, u) {
673
+ Ct(o, e, u), s && s.m(e, null), De(e, t), De(e, n), Rl(i, n, null), f = !0, a || (r = Gl(
674
+ e,
675
+ "click",
676
+ /*click_handler*/
677
+ l[14]
678
+ ), a = !0);
679
+ },
680
+ p(o, [u]) {
681
+ /*show_label*/
682
+ o[2] ? s ? s.p(o, u) : (s = xe(o), s.c(), s.m(e, t)) : s && (s.d(1), s = null), (!f || u & /*size*/
683
+ 16) && P(
684
+ n,
685
+ "small",
686
+ /*size*/
687
+ o[4] === "small"
688
+ ), (!f || u & /*size*/
689
+ 16) && P(
690
+ n,
691
+ "large",
692
+ /*size*/
693
+ o[4] === "large"
694
+ ), (!f || u & /*size*/
695
+ 16) && P(
696
+ n,
697
+ "medium",
698
+ /*size*/
699
+ o[4] === "medium"
700
+ ), (!f || u & /*disabled*/
701
+ 128) && (e.disabled = /*disabled*/
702
+ o[7]), (!f || u & /*label*/
703
+ 2) && x(
704
+ e,
705
+ "aria-label",
706
+ /*label*/
707
+ o[1]
708
+ ), (!f || u & /*hasPopup*/
709
+ 256) && x(
710
+ e,
711
+ "aria-haspopup",
712
+ /*hasPopup*/
713
+ o[8]
714
+ ), (!f || u & /*label*/
715
+ 2) && x(
716
+ e,
717
+ "title",
718
+ /*label*/
719
+ o[1]
720
+ ), (!f || u & /*pending*/
721
+ 8) && P(
722
+ e,
723
+ "pending",
724
+ /*pending*/
725
+ o[3]
726
+ ), (!f || u & /*padded*/
727
+ 32) && P(
728
+ e,
729
+ "padded",
730
+ /*padded*/
731
+ o[5]
732
+ ), (!f || u & /*highlight*/
733
+ 64) && P(
734
+ e,
735
+ "highlight",
736
+ /*highlight*/
737
+ o[6]
738
+ ), (!f || u & /*transparent*/
739
+ 512) && P(
740
+ e,
741
+ "transparent",
742
+ /*transparent*/
743
+ o[9]
744
+ ), u & /*disabled, _color*/
745
+ 4224 && _e(e, "color", !/*disabled*/
746
+ o[7] && /*_color*/
747
+ o[12] ? (
748
+ /*_color*/
749
+ o[12]
750
+ ) : "var(--block-label-text-color)"), u & /*disabled, background*/
751
+ 1152 && _e(e, "--bg-color", /*disabled*/
752
+ o[7] ? "auto" : (
753
+ /*background*/
754
+ o[10]
755
+ )), u & /*offset*/
756
+ 2048 && _e(
757
+ e,
758
+ "margin-left",
759
+ /*offset*/
760
+ o[11] + "px"
761
+ );
762
+ },
763
+ i(o) {
764
+ f || (Wl(i.$$.fragment, o), f = !0);
765
+ },
766
+ o(o) {
767
+ xl(i.$$.fragment, o), f = !1;
768
+ },
769
+ d(o) {
770
+ o && qt(e), s && s.d(), Xl(i), a = !1, r();
771
+ }
772
+ };
773
+ }
774
+ function en(l, e, t) {
775
+ let n, { Icon: i } = e, { label: f = "" } = e, { show_label: a = !1 } = e, { pending: r = !1 } = e, { size: s = "small" } = e, { padded: o = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: b = !1 } = e, { color: g = "var(--block-label-text-color)" } = e, { transparent: v = !1 } = e, { background: V = "var(--background-fill-primary)" } = e, { offset: k = 0 } = e;
776
+ function N(m) {
777
+ Ol.call(this, l, m);
778
+ }
779
+ return l.$$set = (m) => {
780
+ "Icon" in m && t(0, i = m.Icon), "label" in m && t(1, f = m.label), "show_label" in m && t(2, a = m.show_label), "pending" in m && t(3, r = m.pending), "size" in m && t(4, s = m.size), "padded" in m && t(5, o = m.padded), "highlight" in m && t(6, u = m.highlight), "disabled" in m && t(7, c = m.disabled), "hasPopup" in m && t(8, b = m.hasPopup), "color" in m && t(13, g = m.color), "transparent" in m && t(9, v = m.transparent), "background" in m && t(10, V = m.background), "offset" in m && t(11, k = m.offset);
781
+ }, l.$$.update = () => {
782
+ l.$$.dirty & /*highlight, color*/
783
+ 8256 && t(12, n = u ? "var(--color-accent)" : g);
784
+ }, [
785
+ i,
786
+ f,
787
+ a,
788
+ r,
789
+ s,
790
+ o,
791
+ u,
792
+ c,
793
+ b,
794
+ v,
795
+ V,
796
+ k,
797
+ n,
798
+ g,
799
+ N
800
+ ];
801
+ }
802
+ class tn extends Tl {
803
+ constructor(e) {
804
+ super(), Yl(this, e, en, $l, Hl, {
805
+ Icon: 0,
806
+ label: 1,
807
+ show_label: 2,
808
+ pending: 3,
809
+ size: 4,
810
+ padded: 5,
811
+ highlight: 6,
812
+ disabled: 7,
813
+ hasPopup: 8,
814
+ color: 13,
815
+ transparent: 9,
816
+ background: 10,
817
+ offset: 11
818
+ });
819
+ }
820
+ }
821
+ const {
822
+ SvelteComponent: ln,
823
+ append: Pe,
824
+ attr: X,
825
+ detach: nn,
826
+ init: fn,
827
+ insert: sn,
828
+ noop: Be,
829
+ safe_not_equal: on,
830
+ set_style: Q,
831
+ svg_element: Fe
832
+ } = window.__gradio__svelte__internal;
833
+ function an(l) {
834
+ let e, t, n, i;
835
+ return {
836
+ c() {
837
+ e = Fe("svg"), t = Fe("g"), n = Fe("path"), i = Fe("path"), X(n, "d", "M18,6L6.087,17.913"), Q(n, "fill", "none"), Q(n, "fill-rule", "nonzero"), Q(n, "stroke-width", "2px"), X(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), X(i, "d", "M4.364,4.364L19.636,19.636"), Q(i, "fill", "none"), Q(i, "fill-rule", "nonzero"), Q(i, "stroke-width", "2px"), X(e, "width", "100%"), X(e, "height", "100%"), X(e, "viewBox", "0 0 24 24"), X(e, "version", "1.1"), X(e, "xmlns", "http://www.w3.org/2000/svg"), X(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), X(e, "xml:space", "preserve"), X(e, "stroke", "currentColor"), Q(e, "fill-rule", "evenodd"), Q(e, "clip-rule", "evenodd"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round");
838
+ },
839
+ m(f, a) {
840
+ sn(f, e, a), Pe(e, t), Pe(t, n), Pe(e, i);
841
+ },
842
+ p: Be,
843
+ i: Be,
844
+ o: Be,
845
+ d(f) {
846
+ f && nn(e);
847
+ }
848
+ };
849
+ }
850
+ class rn extends ln {
851
+ constructor(e) {
852
+ super(), fn(this, e, null, an, on, {});
853
+ }
854
+ }
855
+ const un = [
856
+ { color: "red", primary: 600, secondary: 100 },
857
+ { color: "green", primary: 600, secondary: 100 },
858
+ { color: "blue", primary: 600, secondary: 100 },
859
+ { color: "yellow", primary: 500, secondary: 100 },
860
+ { color: "purple", primary: 600, secondary: 100 },
861
+ { color: "teal", primary: 600, secondary: 100 },
862
+ { color: "orange", primary: 600, secondary: 100 },
863
+ { color: "cyan", primary: 600, secondary: 100 },
864
+ { color: "lime", primary: 500, secondary: 100 },
865
+ { color: "pink", primary: 600, secondary: 100 }
866
+ ], $e = {
867
+ inherit: "inherit",
868
+ current: "currentColor",
869
+ transparent: "transparent",
870
+ black: "#000",
871
+ white: "#fff",
872
+ slate: {
873
+ 50: "#f8fafc",
874
+ 100: "#f1f5f9",
875
+ 200: "#e2e8f0",
876
+ 300: "#cbd5e1",
877
+ 400: "#94a3b8",
878
+ 500: "#64748b",
879
+ 600: "#475569",
880
+ 700: "#334155",
881
+ 800: "#1e293b",
882
+ 900: "#0f172a",
883
+ 950: "#020617"
884
+ },
885
+ gray: {
886
+ 50: "#f9fafb",
887
+ 100: "#f3f4f6",
888
+ 200: "#e5e7eb",
889
+ 300: "#d1d5db",
890
+ 400: "#9ca3af",
891
+ 500: "#6b7280",
892
+ 600: "#4b5563",
893
+ 700: "#374151",
894
+ 800: "#1f2937",
895
+ 900: "#111827",
896
+ 950: "#030712"
897
+ },
898
+ zinc: {
899
+ 50: "#fafafa",
900
+ 100: "#f4f4f5",
901
+ 200: "#e4e4e7",
902
+ 300: "#d4d4d8",
903
+ 400: "#a1a1aa",
904
+ 500: "#71717a",
905
+ 600: "#52525b",
906
+ 700: "#3f3f46",
907
+ 800: "#27272a",
908
+ 900: "#18181b",
909
+ 950: "#09090b"
910
+ },
911
+ neutral: {
912
+ 50: "#fafafa",
913
+ 100: "#f5f5f5",
914
+ 200: "#e5e5e5",
915
+ 300: "#d4d4d4",
916
+ 400: "#a3a3a3",
917
+ 500: "#737373",
918
+ 600: "#525252",
919
+ 700: "#404040",
920
+ 800: "#262626",
921
+ 900: "#171717",
922
+ 950: "#0a0a0a"
923
+ },
924
+ stone: {
925
+ 50: "#fafaf9",
926
+ 100: "#f5f5f4",
927
+ 200: "#e7e5e4",
928
+ 300: "#d6d3d1",
929
+ 400: "#a8a29e",
930
+ 500: "#78716c",
931
+ 600: "#57534e",
932
+ 700: "#44403c",
933
+ 800: "#292524",
934
+ 900: "#1c1917",
935
+ 950: "#0c0a09"
936
+ },
937
+ red: {
938
+ 50: "#fef2f2",
939
+ 100: "#fee2e2",
940
+ 200: "#fecaca",
941
+ 300: "#fca5a5",
942
+ 400: "#f87171",
943
+ 500: "#ef4444",
944
+ 600: "#dc2626",
945
+ 700: "#b91c1c",
946
+ 800: "#991b1b",
947
+ 900: "#7f1d1d",
948
+ 950: "#450a0a"
949
+ },
950
+ orange: {
951
+ 50: "#fff7ed",
952
+ 100: "#ffedd5",
953
+ 200: "#fed7aa",
954
+ 300: "#fdba74",
955
+ 400: "#fb923c",
956
+ 500: "#f97316",
957
+ 600: "#ea580c",
958
+ 700: "#c2410c",
959
+ 800: "#9a3412",
960
+ 900: "#7c2d12",
961
+ 950: "#431407"
962
+ },
963
+ amber: {
964
+ 50: "#fffbeb",
965
+ 100: "#fef3c7",
966
+ 200: "#fde68a",
967
+ 300: "#fcd34d",
968
+ 400: "#fbbf24",
969
+ 500: "#f59e0b",
970
+ 600: "#d97706",
971
+ 700: "#b45309",
972
+ 800: "#92400e",
973
+ 900: "#78350f",
974
+ 950: "#451a03"
975
+ },
976
+ yellow: {
977
+ 50: "#fefce8",
978
+ 100: "#fef9c3",
979
+ 200: "#fef08a",
980
+ 300: "#fde047",
981
+ 400: "#facc15",
982
+ 500: "#eab308",
983
+ 600: "#ca8a04",
984
+ 700: "#a16207",
985
+ 800: "#854d0e",
986
+ 900: "#713f12",
987
+ 950: "#422006"
988
+ },
989
+ lime: {
990
+ 50: "#f7fee7",
991
+ 100: "#ecfccb",
992
+ 200: "#d9f99d",
993
+ 300: "#bef264",
994
+ 400: "#a3e635",
995
+ 500: "#84cc16",
996
+ 600: "#65a30d",
997
+ 700: "#4d7c0f",
998
+ 800: "#3f6212",
999
+ 900: "#365314",
1000
+ 950: "#1a2e05"
1001
+ },
1002
+ green: {
1003
+ 50: "#f0fdf4",
1004
+ 100: "#dcfce7",
1005
+ 200: "#bbf7d0",
1006
+ 300: "#86efac",
1007
+ 400: "#4ade80",
1008
+ 500: "#22c55e",
1009
+ 600: "#16a34a",
1010
+ 700: "#15803d",
1011
+ 800: "#166534",
1012
+ 900: "#14532d",
1013
+ 950: "#052e16"
1014
+ },
1015
+ emerald: {
1016
+ 50: "#ecfdf5",
1017
+ 100: "#d1fae5",
1018
+ 200: "#a7f3d0",
1019
+ 300: "#6ee7b7",
1020
+ 400: "#34d399",
1021
+ 500: "#10b981",
1022
+ 600: "#059669",
1023
+ 700: "#047857",
1024
+ 800: "#065f46",
1025
+ 900: "#064e3b",
1026
+ 950: "#022c22"
1027
+ },
1028
+ teal: {
1029
+ 50: "#f0fdfa",
1030
+ 100: "#ccfbf1",
1031
+ 200: "#99f6e4",
1032
+ 300: "#5eead4",
1033
+ 400: "#2dd4bf",
1034
+ 500: "#14b8a6",
1035
+ 600: "#0d9488",
1036
+ 700: "#0f766e",
1037
+ 800: "#115e59",
1038
+ 900: "#134e4a",
1039
+ 950: "#042f2e"
1040
+ },
1041
+ cyan: {
1042
+ 50: "#ecfeff",
1043
+ 100: "#cffafe",
1044
+ 200: "#a5f3fc",
1045
+ 300: "#67e8f9",
1046
+ 400: "#22d3ee",
1047
+ 500: "#06b6d4",
1048
+ 600: "#0891b2",
1049
+ 700: "#0e7490",
1050
+ 800: "#155e75",
1051
+ 900: "#164e63",
1052
+ 950: "#083344"
1053
+ },
1054
+ sky: {
1055
+ 50: "#f0f9ff",
1056
+ 100: "#e0f2fe",
1057
+ 200: "#bae6fd",
1058
+ 300: "#7dd3fc",
1059
+ 400: "#38bdf8",
1060
+ 500: "#0ea5e9",
1061
+ 600: "#0284c7",
1062
+ 700: "#0369a1",
1063
+ 800: "#075985",
1064
+ 900: "#0c4a6e",
1065
+ 950: "#082f49"
1066
+ },
1067
+ blue: {
1068
+ 50: "#eff6ff",
1069
+ 100: "#dbeafe",
1070
+ 200: "#bfdbfe",
1071
+ 300: "#93c5fd",
1072
+ 400: "#60a5fa",
1073
+ 500: "#3b82f6",
1074
+ 600: "#2563eb",
1075
+ 700: "#1d4ed8",
1076
+ 800: "#1e40af",
1077
+ 900: "#1e3a8a",
1078
+ 950: "#172554"
1079
+ },
1080
+ indigo: {
1081
+ 50: "#eef2ff",
1082
+ 100: "#e0e7ff",
1083
+ 200: "#c7d2fe",
1084
+ 300: "#a5b4fc",
1085
+ 400: "#818cf8",
1086
+ 500: "#6366f1",
1087
+ 600: "#4f46e5",
1088
+ 700: "#4338ca",
1089
+ 800: "#3730a3",
1090
+ 900: "#312e81",
1091
+ 950: "#1e1b4b"
1092
+ },
1093
+ violet: {
1094
+ 50: "#f5f3ff",
1095
+ 100: "#ede9fe",
1096
+ 200: "#ddd6fe",
1097
+ 300: "#c4b5fd",
1098
+ 400: "#a78bfa",
1099
+ 500: "#8b5cf6",
1100
+ 600: "#7c3aed",
1101
+ 700: "#6d28d9",
1102
+ 800: "#5b21b6",
1103
+ 900: "#4c1d95",
1104
+ 950: "#2e1065"
1105
+ },
1106
+ purple: {
1107
+ 50: "#faf5ff",
1108
+ 100: "#f3e8ff",
1109
+ 200: "#e9d5ff",
1110
+ 300: "#d8b4fe",
1111
+ 400: "#c084fc",
1112
+ 500: "#a855f7",
1113
+ 600: "#9333ea",
1114
+ 700: "#7e22ce",
1115
+ 800: "#6b21a8",
1116
+ 900: "#581c87",
1117
+ 950: "#3b0764"
1118
+ },
1119
+ fuchsia: {
1120
+ 50: "#fdf4ff",
1121
+ 100: "#fae8ff",
1122
+ 200: "#f5d0fe",
1123
+ 300: "#f0abfc",
1124
+ 400: "#e879f9",
1125
+ 500: "#d946ef",
1126
+ 600: "#c026d3",
1127
+ 700: "#a21caf",
1128
+ 800: "#86198f",
1129
+ 900: "#701a75",
1130
+ 950: "#4a044e"
1131
+ },
1132
+ pink: {
1133
+ 50: "#fdf2f8",
1134
+ 100: "#fce7f3",
1135
+ 200: "#fbcfe8",
1136
+ 300: "#f9a8d4",
1137
+ 400: "#f472b6",
1138
+ 500: "#ec4899",
1139
+ 600: "#db2777",
1140
+ 700: "#be185d",
1141
+ 800: "#9d174d",
1142
+ 900: "#831843",
1143
+ 950: "#500724"
1144
+ },
1145
+ rose: {
1146
+ 50: "#fff1f2",
1147
+ 100: "#ffe4e6",
1148
+ 200: "#fecdd3",
1149
+ 300: "#fda4af",
1150
+ 400: "#fb7185",
1151
+ 500: "#f43f5e",
1152
+ 600: "#e11d48",
1153
+ 700: "#be123c",
1154
+ 800: "#9f1239",
1155
+ 900: "#881337",
1156
+ 950: "#4c0519"
1157
+ }
1158
+ };
1159
+ un.reduce(
1160
+ (l, { color: e, primary: t, secondary: n }) => ({
1161
+ ...l,
1162
+ [e]: {
1163
+ primary: $e[e][t],
1164
+ secondary: $e[e][n]
1165
+ }
1166
+ }),
1167
+ {}
1168
+ );
1169
+ function de(l) {
1170
+ let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
1171
+ for (; l > 1e3 && t < e.length - 1; )
1172
+ l /= 1e3, t++;
1173
+ let n = e[t];
1174
+ return (Number.isInteger(l) ? l : l.toFixed(1)) + n;
1175
+ }
1176
+ function Ne() {
1177
+ }
1178
+ function _n(l, e) {
1179
+ return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function";
1180
+ }
1181
+ const Ft = typeof window < "u";
1182
+ let et = Ft ? () => window.performance.now() : () => Date.now(), Lt = Ft ? (l) => requestAnimationFrame(l) : Ne;
1183
+ const be = /* @__PURE__ */ new Set();
1184
+ function St(l) {
1185
+ be.forEach((e) => {
1186
+ e.c(l) || (be.delete(e), e.f());
1187
+ }), be.size !== 0 && Lt(St);
1188
+ }
1189
+ function cn(l) {
1190
+ let e;
1191
+ return be.size === 0 && Lt(St), {
1192
+ promise: new Promise((t) => {
1193
+ be.add(e = { c: l, f: t });
1194
+ }),
1195
+ abort() {
1196
+ be.delete(e);
1197
+ }
1198
+ };
1199
+ }
1200
+ const ce = [];
1201
+ function dn(l, e = Ne) {
1202
+ let t;
1203
+ const n = /* @__PURE__ */ new Set();
1204
+ function i(r) {
1205
+ if (_n(l, r) && (l = r, t)) {
1206
+ const s = !ce.length;
1207
+ for (const o of n)
1208
+ o[1](), ce.push(o, l);
1209
+ if (s) {
1210
+ for (let o = 0; o < ce.length; o += 2)
1211
+ ce[o][0](ce[o + 1]);
1212
+ ce.length = 0;
1213
+ }
1214
+ }
1215
+ }
1216
+ function f(r) {
1217
+ i(r(l));
1218
+ }
1219
+ function a(r, s = Ne) {
1220
+ const o = [r, s];
1221
+ return n.add(o), n.size === 1 && (t = e(i, f) || Ne), r(l), () => {
1222
+ n.delete(o), n.size === 0 && t && (t(), t = null);
1223
+ };
1224
+ }
1225
+ return { set: i, update: f, subscribe: a };
1226
+ }
1227
+ function tt(l) {
1228
+ return Object.prototype.toString.call(l) === "[object Date]";
1229
+ }
1230
+ function Te(l, e, t, n) {
1231
+ if (typeof t == "number" || tt(t)) {
1232
+ const i = n - t, f = (t - e) / (l.dt || 1 / 60), a = l.opts.stiffness * i, r = l.opts.damping * f, s = (a - r) * l.inv_mass, o = (f + s) * l.dt;
1233
+ return Math.abs(o) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, tt(t) ? new Date(t.getTime() + o) : t + o);
1234
+ } else {
1235
+ if (Array.isArray(t))
1236
+ return t.map(
1237
+ (i, f) => Te(l, e[f], t[f], n[f])
1238
+ );
1239
+ if (typeof t == "object") {
1240
+ const i = {};
1241
+ for (const f in t)
1242
+ i[f] = Te(l, e[f], t[f], n[f]);
1243
+ return i;
1244
+ } else
1245
+ throw new Error(`Cannot spring ${typeof t} values`);
1246
+ }
1247
+ }
1248
+ function lt(l, e = {}) {
1249
+ const t = dn(l), { stiffness: n = 0.15, damping: i = 0.8, precision: f = 0.01 } = e;
1250
+ let a, r, s, o = l, u = l, c = 1, b = 0, g = !1;
1251
+ function v(k, N = {}) {
1252
+ u = k;
1253
+ const m = s = {};
1254
+ return l == null || N.hard || V.stiffness >= 1 && V.damping >= 1 ? (g = !0, a = et(), o = k, t.set(l = u), Promise.resolve()) : (N.soft && (b = 1 / ((N.soft === !0 ? 0.5 : +N.soft) * 60), c = 0), r || (a = et(), g = !1, r = cn((d) => {
1255
+ if (g)
1256
+ return g = !1, r = null, !1;
1257
+ c = Math.min(c + b, 1);
1258
+ const L = {
1259
+ inv_mass: c,
1260
+ opts: V,
1261
+ settled: !0,
1262
+ dt: (d - a) * 60 / 1e3
1263
+ }, M = Te(L, o, l, u);
1264
+ return a = d, o = l, t.set(l = M), L.settled && (r = null), !L.settled;
1265
+ })), new Promise((d) => {
1266
+ r.promise.then(() => {
1267
+ m === s && d();
1268
+ });
1269
+ }));
1270
+ }
1271
+ const V = {
1272
+ set: v,
1273
+ update: (k, N) => v(k(u, l), N),
1274
+ subscribe: t.subscribe,
1275
+ stiffness: n,
1276
+ damping: i,
1277
+ precision: f
1278
+ };
1279
+ return V;
1280
+ }
1281
+ const {
1282
+ SvelteComponent: mn,
1283
+ append: Y,
1284
+ attr: z,
1285
+ component_subscribe: nt,
1286
+ detach: bn,
1287
+ element: gn,
1288
+ init: hn,
1289
+ insert: wn,
1290
+ noop: it,
1291
+ safe_not_equal: pn,
1292
+ set_style: Le,
1293
+ svg_element: G,
1294
+ toggle_class: ft
1295
+ } = window.__gradio__svelte__internal, { onMount: kn } = window.__gradio__svelte__internal;
1296
+ function vn(l) {
1297
+ let e, t, n, i, f, a, r, s, o, u, c, b;
1298
+ return {
1299
+ c() {
1300
+ e = gn("div"), t = G("svg"), n = G("g"), i = G("path"), f = G("path"), a = G("path"), r = G("path"), s = G("g"), o = G("path"), u = G("path"), c = G("path"), b = G("path"), z(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), z(i, "fill", "#FF7C00"), z(i, "fill-opacity", "0.4"), z(i, "class", "svelte-43sxxs"), z(f, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), z(f, "fill", "#FF7C00"), z(f, "class", "svelte-43sxxs"), z(a, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), z(a, "fill", "#FF7C00"), z(a, "fill-opacity", "0.4"), z(a, "class", "svelte-43sxxs"), z(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), z(r, "fill", "#FF7C00"), z(r, "class", "svelte-43sxxs"), Le(n, "transform", "translate(" + /*$top*/
1301
+ l[1][0] + "px, " + /*$top*/
1302
+ l[1][1] + "px)"), z(o, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), z(o, "fill", "#FF7C00"), z(o, "fill-opacity", "0.4"), z(o, "class", "svelte-43sxxs"), z(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), z(u, "fill", "#FF7C00"), z(u, "class", "svelte-43sxxs"), z(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), z(c, "fill", "#FF7C00"), z(c, "fill-opacity", "0.4"), z(c, "class", "svelte-43sxxs"), z(b, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), z(b, "fill", "#FF7C00"), z(b, "class", "svelte-43sxxs"), Le(s, "transform", "translate(" + /*$bottom*/
1303
+ l[2][0] + "px, " + /*$bottom*/
1304
+ l[2][1] + "px)"), z(t, "viewBox", "-1200 -1200 3000 3000"), z(t, "fill", "none"), z(t, "xmlns", "http://www.w3.org/2000/svg"), z(t, "class", "svelte-43sxxs"), z(e, "class", "svelte-43sxxs"), ft(
1305
+ e,
1306
+ "margin",
1307
+ /*margin*/
1308
+ l[0]
1309
+ );
1310
+ },
1311
+ m(g, v) {
1312
+ wn(g, e, v), Y(e, t), Y(t, n), Y(n, i), Y(n, f), Y(n, a), Y(n, r), Y(t, s), Y(s, o), Y(s, u), Y(s, c), Y(s, b);
1313
+ },
1314
+ p(g, [v]) {
1315
+ v & /*$top*/
1316
+ 2 && Le(n, "transform", "translate(" + /*$top*/
1317
+ g[1][0] + "px, " + /*$top*/
1318
+ g[1][1] + "px)"), v & /*$bottom*/
1319
+ 4 && Le(s, "transform", "translate(" + /*$bottom*/
1320
+ g[2][0] + "px, " + /*$bottom*/
1321
+ g[2][1] + "px)"), v & /*margin*/
1322
+ 1 && ft(
1323
+ e,
1324
+ "margin",
1325
+ /*margin*/
1326
+ g[0]
1327
+ );
1328
+ },
1329
+ i: it,
1330
+ o: it,
1331
+ d(g) {
1332
+ g && bn(e);
1333
+ }
1334
+ };
1335
+ }
1336
+ function yn(l, e, t) {
1337
+ let n, i;
1338
+ var f = this && this.__awaiter || function(g, v, V, k) {
1339
+ function N(m) {
1340
+ return m instanceof V ? m : new V(function(d) {
1341
+ d(m);
1342
+ });
1343
+ }
1344
+ return new (V || (V = Promise))(function(m, d) {
1345
+ function L(j) {
1346
+ try {
1347
+ w(k.next(j));
1348
+ } catch (S) {
1349
+ d(S);
1350
+ }
1351
+ }
1352
+ function M(j) {
1353
+ try {
1354
+ w(k.throw(j));
1355
+ } catch (S) {
1356
+ d(S);
1357
+ }
1358
+ }
1359
+ function w(j) {
1360
+ j.done ? m(j.value) : N(j.value).then(L, M);
1361
+ }
1362
+ w((k = k.apply(g, v || [])).next());
1363
+ });
1364
+ };
1365
+ let { margin: a = !0 } = e;
1366
+ const r = lt([0, 0]);
1367
+ nt(l, r, (g) => t(1, n = g));
1368
+ const s = lt([0, 0]);
1369
+ nt(l, s, (g) => t(2, i = g));
1370
+ let o;
1371
+ function u() {
1372
+ return f(this, void 0, void 0, function* () {
1373
+ yield Promise.all([r.set([125, 140]), s.set([-125, -140])]), yield Promise.all([r.set([-125, 140]), s.set([125, -140])]), yield Promise.all([r.set([-125, 0]), s.set([125, -0])]), yield Promise.all([r.set([125, 0]), s.set([-125, 0])]);
1374
+ });
1375
+ }
1376
+ function c() {
1377
+ return f(this, void 0, void 0, function* () {
1378
+ yield u(), o || c();
1379
+ });
1380
+ }
1381
+ function b() {
1382
+ return f(this, void 0, void 0, function* () {
1383
+ yield Promise.all([r.set([125, 0]), s.set([-125, 0])]), c();
1384
+ });
1385
+ }
1386
+ return kn(() => (b(), () => o = !0)), l.$$set = (g) => {
1387
+ "margin" in g && t(0, a = g.margin);
1388
+ }, [a, n, i, r, s];
1389
+ }
1390
+ class qn extends mn {
1391
+ constructor(e) {
1392
+ super(), hn(this, e, yn, vn, pn, { margin: 0 });
1393
+ }
1394
+ }
1395
+ const {
1396
+ SvelteComponent: Cn,
1397
+ append: se,
1398
+ attr: R,
1399
+ binding_callbacks: st,
1400
+ check_outros: zt,
1401
+ create_component: Mt,
1402
+ create_slot: Fn,
1403
+ destroy_component: Vt,
1404
+ destroy_each: Nt,
1405
+ detach: q,
1406
+ element: W,
1407
+ empty: ge,
1408
+ ensure_array_like: Ie,
1409
+ get_all_dirty_from_scope: Ln,
1410
+ get_slot_changes: Sn,
1411
+ group_outros: It,
1412
+ init: zn,
1413
+ insert: C,
1414
+ mount_component: Zt,
1415
+ noop: Oe,
1416
+ safe_not_equal: Mn,
1417
+ set_data: O,
1418
+ set_style: ne,
1419
+ space: H,
1420
+ text: Z,
1421
+ toggle_class: T,
1422
+ transition_in: oe,
1423
+ transition_out: ae,
1424
+ update_slot_base: Vn
1425
+ } = window.__gradio__svelte__internal, { tick: Nn } = window.__gradio__svelte__internal, { onDestroy: In } = window.__gradio__svelte__internal, { createEventDispatcher: Zn } = window.__gradio__svelte__internal, jn = (l) => ({}), ot = (l) => ({});
1426
+ function at(l, e, t) {
1427
+ const n = l.slice();
1428
+ return n[41] = e[t], n[43] = t, n;
1429
+ }
1430
+ function rt(l, e, t) {
1431
+ const n = l.slice();
1432
+ return n[41] = e[t], n;
1433
+ }
1434
+ function Pn(l) {
1435
+ let e, t, n, i, f = (
1436
+ /*i18n*/
1437
+ l[1]("common.error") + ""
1438
+ ), a, r, s;
1439
+ t = new tn({
1440
+ props: {
1441
+ Icon: rn,
1442
+ label: (
1443
+ /*i18n*/
1444
+ l[1]("common.clear")
1445
+ ),
1446
+ disabled: !1
1447
+ }
1448
+ }), t.$on(
1449
+ "click",
1450
+ /*click_handler*/
1451
+ l[32]
1452
+ );
1453
+ const o = (
1454
+ /*#slots*/
1455
+ l[30].error
1456
+ ), u = Fn(
1457
+ o,
1458
+ l,
1459
+ /*$$scope*/
1460
+ l[29],
1461
+ ot
1462
+ );
1463
+ return {
1464
+ c() {
1465
+ e = W("div"), Mt(t.$$.fragment), n = H(), i = W("span"), a = Z(f), r = H(), u && u.c(), R(e, "class", "clear-status svelte-1yk38uw"), R(i, "class", "error svelte-1yk38uw");
1466
+ },
1467
+ m(c, b) {
1468
+ C(c, e, b), Zt(t, e, null), C(c, n, b), C(c, i, b), se(i, a), C(c, r, b), u && u.m(c, b), s = !0;
1469
+ },
1470
+ p(c, b) {
1471
+ const g = {};
1472
+ b[0] & /*i18n*/
1473
+ 2 && (g.label = /*i18n*/
1474
+ c[1]("common.clear")), t.$set(g), (!s || b[0] & /*i18n*/
1475
+ 2) && f !== (f = /*i18n*/
1476
+ c[1]("common.error") + "") && O(a, f), u && u.p && (!s || b[0] & /*$$scope*/
1477
+ 536870912) && Vn(
1478
+ u,
1479
+ o,
1480
+ c,
1481
+ /*$$scope*/
1482
+ c[29],
1483
+ s ? Sn(
1484
+ o,
1485
+ /*$$scope*/
1486
+ c[29],
1487
+ b,
1488
+ jn
1489
+ ) : Ln(
1490
+ /*$$scope*/
1491
+ c[29]
1492
+ ),
1493
+ ot
1494
+ );
1495
+ },
1496
+ i(c) {
1497
+ s || (oe(t.$$.fragment, c), oe(u, c), s = !0);
1498
+ },
1499
+ o(c) {
1500
+ ae(t.$$.fragment, c), ae(u, c), s = !1;
1501
+ },
1502
+ d(c) {
1503
+ c && (q(e), q(n), q(i), q(r)), Vt(t), u && u.d(c);
1504
+ }
1505
+ };
1506
+ }
1507
+ function Bn(l) {
1508
+ let e, t, n, i, f, a, r, s, o, u = (
1509
+ /*variant*/
1510
+ l[8] === "default" && /*show_eta_bar*/
1511
+ l[18] && /*show_progress*/
1512
+ l[6] === "full" && ut(l)
1513
+ );
1514
+ function c(d, L) {
1515
+ if (
1516
+ /*progress*/
1517
+ d[7]
1518
+ )
1519
+ return En;
1520
+ if (
1521
+ /*queue_position*/
1522
+ d[2] !== null && /*queue_size*/
1523
+ d[3] !== void 0 && /*queue_position*/
1524
+ d[2] >= 0
1525
+ )
1526
+ return Dn;
1527
+ if (
1528
+ /*queue_position*/
1529
+ d[2] === 0
1530
+ )
1531
+ return An;
1532
+ }
1533
+ let b = c(l), g = b && b(l), v = (
1534
+ /*timer*/
1535
+ l[5] && dt(l)
1536
+ );
1537
+ const V = [Xn, Jn], k = [];
1538
+ function N(d, L) {
1539
+ return (
1540
+ /*last_progress_level*/
1541
+ d[15] != null ? 0 : (
1542
+ /*show_progress*/
1543
+ d[6] === "full" ? 1 : -1
1544
+ )
1545
+ );
1546
+ }
1547
+ ~(f = N(l)) && (a = k[f] = V[f](l));
1548
+ let m = !/*timer*/
1549
+ l[5] && kt(l);
1550
+ return {
1551
+ c() {
1552
+ u && u.c(), e = H(), t = W("div"), g && g.c(), n = H(), v && v.c(), i = H(), a && a.c(), r = H(), m && m.c(), s = ge(), R(t, "class", "progress-text svelte-1yk38uw"), T(
1553
+ t,
1554
+ "meta-text-center",
1555
+ /*variant*/
1556
+ l[8] === "center"
1557
+ ), T(
1558
+ t,
1559
+ "meta-text",
1560
+ /*variant*/
1561
+ l[8] === "default"
1562
+ );
1563
+ },
1564
+ m(d, L) {
1565
+ u && u.m(d, L), C(d, e, L), C(d, t, L), g && g.m(t, null), se(t, n), v && v.m(t, null), C(d, i, L), ~f && k[f].m(d, L), C(d, r, L), m && m.m(d, L), C(d, s, L), o = !0;
1566
+ },
1567
+ p(d, L) {
1568
+ /*variant*/
1569
+ d[8] === "default" && /*show_eta_bar*/
1570
+ d[18] && /*show_progress*/
1571
+ d[6] === "full" ? u ? u.p(d, L) : (u = ut(d), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), b === (b = c(d)) && g ? g.p(d, L) : (g && g.d(1), g = b && b(d), g && (g.c(), g.m(t, n))), /*timer*/
1572
+ d[5] ? v ? v.p(d, L) : (v = dt(d), v.c(), v.m(t, null)) : v && (v.d(1), v = null), (!o || L[0] & /*variant*/
1573
+ 256) && T(
1574
+ t,
1575
+ "meta-text-center",
1576
+ /*variant*/
1577
+ d[8] === "center"
1578
+ ), (!o || L[0] & /*variant*/
1579
+ 256) && T(
1580
+ t,
1581
+ "meta-text",
1582
+ /*variant*/
1583
+ d[8] === "default"
1584
+ );
1585
+ let M = f;
1586
+ f = N(d), f === M ? ~f && k[f].p(d, L) : (a && (It(), ae(k[M], 1, 1, () => {
1587
+ k[M] = null;
1588
+ }), zt()), ~f ? (a = k[f], a ? a.p(d, L) : (a = k[f] = V[f](d), a.c()), oe(a, 1), a.m(r.parentNode, r)) : a = null), /*timer*/
1589
+ d[5] ? m && (m.d(1), m = null) : m ? m.p(d, L) : (m = kt(d), m.c(), m.m(s.parentNode, s));
1590
+ },
1591
+ i(d) {
1592
+ o || (oe(a), o = !0);
1593
+ },
1594
+ o(d) {
1595
+ ae(a), o = !1;
1596
+ },
1597
+ d(d) {
1598
+ d && (q(e), q(t), q(i), q(r), q(s)), u && u.d(d), g && g.d(), v && v.d(), ~f && k[f].d(d), m && m.d(d);
1599
+ }
1600
+ };
1601
+ }
1602
+ function ut(l) {
1603
+ let e, t = `translateX(${/*eta_level*/
1604
+ (l[17] || 0) * 100 - 100}%)`;
1605
+ return {
1606
+ c() {
1607
+ e = W("div"), R(e, "class", "eta-bar svelte-1yk38uw"), ne(e, "transform", t);
1608
+ },
1609
+ m(n, i) {
1610
+ C(n, e, i);
1611
+ },
1612
+ p(n, i) {
1613
+ i[0] & /*eta_level*/
1614
+ 131072 && t !== (t = `translateX(${/*eta_level*/
1615
+ (n[17] || 0) * 100 - 100}%)`) && ne(e, "transform", t);
1616
+ },
1617
+ d(n) {
1618
+ n && q(e);
1619
+ }
1620
+ };
1621
+ }
1622
+ function An(l) {
1623
+ let e;
1624
+ return {
1625
+ c() {
1626
+ e = Z("processing |");
1627
+ },
1628
+ m(t, n) {
1629
+ C(t, e, n);
1630
+ },
1631
+ p: Oe,
1632
+ d(t) {
1633
+ t && q(e);
1634
+ }
1635
+ };
1636
+ }
1637
+ function Dn(l) {
1638
+ let e, t = (
1639
+ /*queue_position*/
1640
+ l[2] + 1 + ""
1641
+ ), n, i, f, a;
1642
+ return {
1643
+ c() {
1644
+ e = Z("queue: "), n = Z(t), i = Z("/"), f = Z(
1645
+ /*queue_size*/
1646
+ l[3]
1647
+ ), a = Z(" |");
1648
+ },
1649
+ m(r, s) {
1650
+ C(r, e, s), C(r, n, s), C(r, i, s), C(r, f, s), C(r, a, s);
1651
+ },
1652
+ p(r, s) {
1653
+ s[0] & /*queue_position*/
1654
+ 4 && t !== (t = /*queue_position*/
1655
+ r[2] + 1 + "") && O(n, t), s[0] & /*queue_size*/
1656
+ 8 && O(
1657
+ f,
1658
+ /*queue_size*/
1659
+ r[3]
1660
+ );
1661
+ },
1662
+ d(r) {
1663
+ r && (q(e), q(n), q(i), q(f), q(a));
1664
+ }
1665
+ };
1666
+ }
1667
+ function En(l) {
1668
+ let e, t = Ie(
1669
+ /*progress*/
1670
+ l[7]
1671
+ ), n = [];
1672
+ for (let i = 0; i < t.length; i += 1)
1673
+ n[i] = ct(rt(l, t, i));
1674
+ return {
1675
+ c() {
1676
+ for (let i = 0; i < n.length; i += 1)
1677
+ n[i].c();
1678
+ e = ge();
1679
+ },
1680
+ m(i, f) {
1681
+ for (let a = 0; a < n.length; a += 1)
1682
+ n[a] && n[a].m(i, f);
1683
+ C(i, e, f);
1684
+ },
1685
+ p(i, f) {
1686
+ if (f[0] & /*progress*/
1687
+ 128) {
1688
+ t = Ie(
1689
+ /*progress*/
1690
+ i[7]
1691
+ );
1692
+ let a;
1693
+ for (a = 0; a < t.length; a += 1) {
1694
+ const r = rt(i, t, a);
1695
+ n[a] ? n[a].p(r, f) : (n[a] = ct(r), n[a].c(), n[a].m(e.parentNode, e));
1696
+ }
1697
+ for (; a < n.length; a += 1)
1698
+ n[a].d(1);
1699
+ n.length = t.length;
1700
+ }
1701
+ },
1702
+ d(i) {
1703
+ i && q(e), Nt(n, i);
1704
+ }
1705
+ };
1706
+ }
1707
+ function _t(l) {
1708
+ let e, t = (
1709
+ /*p*/
1710
+ l[41].unit + ""
1711
+ ), n, i, f = " ", a;
1712
+ function r(u, c) {
1713
+ return (
1714
+ /*p*/
1715
+ u[41].length != null ? On : Tn
1716
+ );
1717
+ }
1718
+ let s = r(l), o = s(l);
1719
+ return {
1720
+ c() {
1721
+ o.c(), e = H(), n = Z(t), i = Z(" | "), a = Z(f);
1722
+ },
1723
+ m(u, c) {
1724
+ o.m(u, c), C(u, e, c), C(u, n, c), C(u, i, c), C(u, a, c);
1725
+ },
1726
+ p(u, c) {
1727
+ s === (s = r(u)) && o ? o.p(u, c) : (o.d(1), o = s(u), o && (o.c(), o.m(e.parentNode, e))), c[0] & /*progress*/
1728
+ 128 && t !== (t = /*p*/
1729
+ u[41].unit + "") && O(n, t);
1730
+ },
1731
+ d(u) {
1732
+ u && (q(e), q(n), q(i), q(a)), o.d(u);
1733
+ }
1734
+ };
1735
+ }
1736
+ function Tn(l) {
1737
+ let e = de(
1738
+ /*p*/
1739
+ l[41].index || 0
1740
+ ) + "", t;
1741
+ return {
1742
+ c() {
1743
+ t = Z(e);
1744
+ },
1745
+ m(n, i) {
1746
+ C(n, t, i);
1747
+ },
1748
+ p(n, i) {
1749
+ i[0] & /*progress*/
1750
+ 128 && e !== (e = de(
1751
+ /*p*/
1752
+ n[41].index || 0
1753
+ ) + "") && O(t, e);
1754
+ },
1755
+ d(n) {
1756
+ n && q(t);
1757
+ }
1758
+ };
1759
+ }
1760
+ function On(l) {
1761
+ let e = de(
1762
+ /*p*/
1763
+ l[41].index || 0
1764
+ ) + "", t, n, i = de(
1765
+ /*p*/
1766
+ l[41].length
1767
+ ) + "", f;
1768
+ return {
1769
+ c() {
1770
+ t = Z(e), n = Z("/"), f = Z(i);
1771
+ },
1772
+ m(a, r) {
1773
+ C(a, t, r), C(a, n, r), C(a, f, r);
1774
+ },
1775
+ p(a, r) {
1776
+ r[0] & /*progress*/
1777
+ 128 && e !== (e = de(
1778
+ /*p*/
1779
+ a[41].index || 0
1780
+ ) + "") && O(t, e), r[0] & /*progress*/
1781
+ 128 && i !== (i = de(
1782
+ /*p*/
1783
+ a[41].length
1784
+ ) + "") && O(f, i);
1785
+ },
1786
+ d(a) {
1787
+ a && (q(t), q(n), q(f));
1788
+ }
1789
+ };
1790
+ }
1791
+ function ct(l) {
1792
+ let e, t = (
1793
+ /*p*/
1794
+ l[41].index != null && _t(l)
1795
+ );
1796
+ return {
1797
+ c() {
1798
+ t && t.c(), e = ge();
1799
+ },
1800
+ m(n, i) {
1801
+ t && t.m(n, i), C(n, e, i);
1802
+ },
1803
+ p(n, i) {
1804
+ /*p*/
1805
+ n[41].index != null ? t ? t.p(n, i) : (t = _t(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
1806
+ },
1807
+ d(n) {
1808
+ n && q(e), t && t.d(n);
1809
+ }
1810
+ };
1811
+ }
1812
+ function dt(l) {
1813
+ let e, t = (
1814
+ /*eta*/
1815
+ l[0] ? `/${/*formatted_eta*/
1816
+ l[19]}` : ""
1817
+ ), n, i;
1818
+ return {
1819
+ c() {
1820
+ e = Z(
1821
+ /*formatted_timer*/
1822
+ l[20]
1823
+ ), n = Z(t), i = Z("s");
1824
+ },
1825
+ m(f, a) {
1826
+ C(f, e, a), C(f, n, a), C(f, i, a);
1827
+ },
1828
+ p(f, a) {
1829
+ a[0] & /*formatted_timer*/
1830
+ 1048576 && O(
1831
+ e,
1832
+ /*formatted_timer*/
1833
+ f[20]
1834
+ ), a[0] & /*eta, formatted_eta*/
1835
+ 524289 && t !== (t = /*eta*/
1836
+ f[0] ? `/${/*formatted_eta*/
1837
+ f[19]}` : "") && O(n, t);
1838
+ },
1839
+ d(f) {
1840
+ f && (q(e), q(n), q(i));
1841
+ }
1842
+ };
1843
+ }
1844
+ function Jn(l) {
1845
+ let e, t;
1846
+ return e = new qn({
1847
+ props: { margin: (
1848
+ /*variant*/
1849
+ l[8] === "default"
1850
+ ) }
1851
+ }), {
1852
+ c() {
1853
+ Mt(e.$$.fragment);
1854
+ },
1855
+ m(n, i) {
1856
+ Zt(e, n, i), t = !0;
1857
+ },
1858
+ p(n, i) {
1859
+ const f = {};
1860
+ i[0] & /*variant*/
1861
+ 256 && (f.margin = /*variant*/
1862
+ n[8] === "default"), e.$set(f);
1863
+ },
1864
+ i(n) {
1865
+ t || (oe(e.$$.fragment, n), t = !0);
1866
+ },
1867
+ o(n) {
1868
+ ae(e.$$.fragment, n), t = !1;
1869
+ },
1870
+ d(n) {
1871
+ Vt(e, n);
1872
+ }
1873
+ };
1874
+ }
1875
+ function Xn(l) {
1876
+ let e, t, n, i, f, a = `${/*last_progress_level*/
1877
+ l[15] * 100}%`, r = (
1878
+ /*progress*/
1879
+ l[7] != null && mt(l)
1880
+ );
1881
+ return {
1882
+ c() {
1883
+ e = W("div"), t = W("div"), r && r.c(), n = H(), i = W("div"), f = W("div"), R(t, "class", "progress-level-inner svelte-1yk38uw"), R(f, "class", "progress-bar svelte-1yk38uw"), ne(f, "width", a), R(i, "class", "progress-bar-wrap svelte-1yk38uw"), R(e, "class", "progress-level svelte-1yk38uw");
1884
+ },
1885
+ m(s, o) {
1886
+ C(s, e, o), se(e, t), r && r.m(t, null), se(e, n), se(e, i), se(i, f), l[31](f);
1887
+ },
1888
+ p(s, o) {
1889
+ /*progress*/
1890
+ s[7] != null ? r ? r.p(s, o) : (r = mt(s), r.c(), r.m(t, null)) : r && (r.d(1), r = null), o[0] & /*last_progress_level*/
1891
+ 32768 && a !== (a = `${/*last_progress_level*/
1892
+ s[15] * 100}%`) && ne(f, "width", a);
1893
+ },
1894
+ i: Oe,
1895
+ o: Oe,
1896
+ d(s) {
1897
+ s && q(e), r && r.d(), l[31](null);
1898
+ }
1899
+ };
1900
+ }
1901
+ function mt(l) {
1902
+ let e, t = Ie(
1903
+ /*progress*/
1904
+ l[7]
1905
+ ), n = [];
1906
+ for (let i = 0; i < t.length; i += 1)
1907
+ n[i] = pt(at(l, t, i));
1908
+ return {
1909
+ c() {
1910
+ for (let i = 0; i < n.length; i += 1)
1911
+ n[i].c();
1912
+ e = ge();
1913
+ },
1914
+ m(i, f) {
1915
+ for (let a = 0; a < n.length; a += 1)
1916
+ n[a] && n[a].m(i, f);
1917
+ C(i, e, f);
1918
+ },
1919
+ p(i, f) {
1920
+ if (f[0] & /*progress_level, progress*/
1921
+ 16512) {
1922
+ t = Ie(
1923
+ /*progress*/
1924
+ i[7]
1925
+ );
1926
+ let a;
1927
+ for (a = 0; a < t.length; a += 1) {
1928
+ const r = at(i, t, a);
1929
+ n[a] ? n[a].p(r, f) : (n[a] = pt(r), n[a].c(), n[a].m(e.parentNode, e));
1930
+ }
1931
+ for (; a < n.length; a += 1)
1932
+ n[a].d(1);
1933
+ n.length = t.length;
1934
+ }
1935
+ },
1936
+ d(i) {
1937
+ i && q(e), Nt(n, i);
1938
+ }
1939
+ };
1940
+ }
1941
+ function bt(l) {
1942
+ let e, t, n, i, f = (
1943
+ /*i*/
1944
+ l[43] !== 0 && Yn()
1945
+ ), a = (
1946
+ /*p*/
1947
+ l[41].desc != null && gt(l)
1948
+ ), r = (
1949
+ /*p*/
1950
+ l[41].desc != null && /*progress_level*/
1951
+ l[14] && /*progress_level*/
1952
+ l[14][
1953
+ /*i*/
1954
+ l[43]
1955
+ ] != null && ht()
1956
+ ), s = (
1957
+ /*progress_level*/
1958
+ l[14] != null && wt(l)
1959
+ );
1960
+ return {
1961
+ c() {
1962
+ f && f.c(), e = H(), a && a.c(), t = H(), r && r.c(), n = H(), s && s.c(), i = ge();
1963
+ },
1964
+ m(o, u) {
1965
+ f && f.m(o, u), C(o, e, u), a && a.m(o, u), C(o, t, u), r && r.m(o, u), C(o, n, u), s && s.m(o, u), C(o, i, u);
1966
+ },
1967
+ p(o, u) {
1968
+ /*p*/
1969
+ o[41].desc != null ? a ? a.p(o, u) : (a = gt(o), a.c(), a.m(t.parentNode, t)) : a && (a.d(1), a = null), /*p*/
1970
+ o[41].desc != null && /*progress_level*/
1971
+ o[14] && /*progress_level*/
1972
+ o[14][
1973
+ /*i*/
1974
+ o[43]
1975
+ ] != null ? r || (r = ht(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/
1976
+ o[14] != null ? s ? s.p(o, u) : (s = wt(o), s.c(), s.m(i.parentNode, i)) : s && (s.d(1), s = null);
1977
+ },
1978
+ d(o) {
1979
+ o && (q(e), q(t), q(n), q(i)), f && f.d(o), a && a.d(o), r && r.d(o), s && s.d(o);
1980
+ }
1981
+ };
1982
+ }
1983
+ function Yn(l) {
1984
+ let e;
1985
+ return {
1986
+ c() {
1987
+ e = Z("Β /");
1988
+ },
1989
+ m(t, n) {
1990
+ C(t, e, n);
1991
+ },
1992
+ d(t) {
1993
+ t && q(e);
1994
+ }
1995
+ };
1996
+ }
1997
+ function gt(l) {
1998
+ let e = (
1999
+ /*p*/
2000
+ l[41].desc + ""
2001
+ ), t;
2002
+ return {
2003
+ c() {
2004
+ t = Z(e);
2005
+ },
2006
+ m(n, i) {
2007
+ C(n, t, i);
2008
+ },
2009
+ p(n, i) {
2010
+ i[0] & /*progress*/
2011
+ 128 && e !== (e = /*p*/
2012
+ n[41].desc + "") && O(t, e);
2013
+ },
2014
+ d(n) {
2015
+ n && q(t);
2016
+ }
2017
+ };
2018
+ }
2019
+ function ht(l) {
2020
+ let e;
2021
+ return {
2022
+ c() {
2023
+ e = Z("-");
2024
+ },
2025
+ m(t, n) {
2026
+ C(t, e, n);
2027
+ },
2028
+ d(t) {
2029
+ t && q(e);
2030
+ }
2031
+ };
2032
+ }
2033
+ function wt(l) {
2034
+ let e = (100 * /*progress_level*/
2035
+ (l[14][
2036
+ /*i*/
2037
+ l[43]
2038
+ ] || 0)).toFixed(1) + "", t, n;
2039
+ return {
2040
+ c() {
2041
+ t = Z(e), n = Z("%");
2042
+ },
2043
+ m(i, f) {
2044
+ C(i, t, f), C(i, n, f);
2045
+ },
2046
+ p(i, f) {
2047
+ f[0] & /*progress_level*/
2048
+ 16384 && e !== (e = (100 * /*progress_level*/
2049
+ (i[14][
2050
+ /*i*/
2051
+ i[43]
2052
+ ] || 0)).toFixed(1) + "") && O(t, e);
2053
+ },
2054
+ d(i) {
2055
+ i && (q(t), q(n));
2056
+ }
2057
+ };
2058
+ }
2059
+ function pt(l) {
2060
+ let e, t = (
2061
+ /*p*/
2062
+ (l[41].desc != null || /*progress_level*/
2063
+ l[14] && /*progress_level*/
2064
+ l[14][
2065
+ /*i*/
2066
+ l[43]
2067
+ ] != null) && bt(l)
2068
+ );
2069
+ return {
2070
+ c() {
2071
+ t && t.c(), e = ge();
2072
+ },
2073
+ m(n, i) {
2074
+ t && t.m(n, i), C(n, e, i);
2075
+ },
2076
+ p(n, i) {
2077
+ /*p*/
2078
+ n[41].desc != null || /*progress_level*/
2079
+ n[14] && /*progress_level*/
2080
+ n[14][
2081
+ /*i*/
2082
+ n[43]
2083
+ ] != null ? t ? t.p(n, i) : (t = bt(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2084
+ },
2085
+ d(n) {
2086
+ n && q(e), t && t.d(n);
2087
+ }
2088
+ };
2089
+ }
2090
+ function kt(l) {
2091
+ let e, t;
2092
+ return {
2093
+ c() {
2094
+ e = W("p"), t = Z(
2095
+ /*loading_text*/
2096
+ l[9]
2097
+ ), R(e, "class", "loading svelte-1yk38uw");
2098
+ },
2099
+ m(n, i) {
2100
+ C(n, e, i), se(e, t);
2101
+ },
2102
+ p(n, i) {
2103
+ i[0] & /*loading_text*/
2104
+ 512 && O(
2105
+ t,
2106
+ /*loading_text*/
2107
+ n[9]
2108
+ );
2109
+ },
2110
+ d(n) {
2111
+ n && q(e);
2112
+ }
2113
+ };
2114
+ }
2115
+ function Gn(l) {
2116
+ let e, t, n, i, f;
2117
+ const a = [Bn, Pn], r = [];
2118
+ function s(o, u) {
2119
+ return (
2120
+ /*status*/
2121
+ o[4] === "pending" ? 0 : (
2122
+ /*status*/
2123
+ o[4] === "error" ? 1 : -1
2124
+ )
2125
+ );
2126
+ }
2127
+ return ~(t = s(l)) && (n = r[t] = a[t](l)), {
2128
+ c() {
2129
+ e = W("div"), n && n.c(), R(e, "class", i = "wrap " + /*variant*/
2130
+ l[8] + " " + /*show_progress*/
2131
+ l[6] + " svelte-1yk38uw"), T(e, "hide", !/*status*/
2132
+ l[4] || /*status*/
2133
+ l[4] === "complete" || /*show_progress*/
2134
+ l[6] === "hidden"), T(
2135
+ e,
2136
+ "translucent",
2137
+ /*variant*/
2138
+ l[8] === "center" && /*status*/
2139
+ (l[4] === "pending" || /*status*/
2140
+ l[4] === "error") || /*translucent*/
2141
+ l[11] || /*show_progress*/
2142
+ l[6] === "minimal"
2143
+ ), T(
2144
+ e,
2145
+ "generating",
2146
+ /*status*/
2147
+ l[4] === "generating"
2148
+ ), T(
2149
+ e,
2150
+ "border",
2151
+ /*border*/
2152
+ l[12]
2153
+ ), ne(
2154
+ e,
2155
+ "position",
2156
+ /*absolute*/
2157
+ l[10] ? "absolute" : "static"
2158
+ ), ne(
2159
+ e,
2160
+ "padding",
2161
+ /*absolute*/
2162
+ l[10] ? "0" : "var(--size-8) 0"
2163
+ );
2164
+ },
2165
+ m(o, u) {
2166
+ C(o, e, u), ~t && r[t].m(e, null), l[33](e), f = !0;
2167
+ },
2168
+ p(o, u) {
2169
+ let c = t;
2170
+ t = s(o), t === c ? ~t && r[t].p(o, u) : (n && (It(), ae(r[c], 1, 1, () => {
2171
+ r[c] = null;
2172
+ }), zt()), ~t ? (n = r[t], n ? n.p(o, u) : (n = r[t] = a[t](o), n.c()), oe(n, 1), n.m(e, null)) : n = null), (!f || u[0] & /*variant, show_progress*/
2173
+ 320 && i !== (i = "wrap " + /*variant*/
2174
+ o[8] + " " + /*show_progress*/
2175
+ o[6] + " svelte-1yk38uw")) && R(e, "class", i), (!f || u[0] & /*variant, show_progress, status, show_progress*/
2176
+ 336) && T(e, "hide", !/*status*/
2177
+ o[4] || /*status*/
2178
+ o[4] === "complete" || /*show_progress*/
2179
+ o[6] === "hidden"), (!f || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
2180
+ 2384) && T(
2181
+ e,
2182
+ "translucent",
2183
+ /*variant*/
2184
+ o[8] === "center" && /*status*/
2185
+ (o[4] === "pending" || /*status*/
2186
+ o[4] === "error") || /*translucent*/
2187
+ o[11] || /*show_progress*/
2188
+ o[6] === "minimal"
2189
+ ), (!f || u[0] & /*variant, show_progress, status*/
2190
+ 336) && T(
2191
+ e,
2192
+ "generating",
2193
+ /*status*/
2194
+ o[4] === "generating"
2195
+ ), (!f || u[0] & /*variant, show_progress, border*/
2196
+ 4416) && T(
2197
+ e,
2198
+ "border",
2199
+ /*border*/
2200
+ o[12]
2201
+ ), u[0] & /*absolute*/
2202
+ 1024 && ne(
2203
+ e,
2204
+ "position",
2205
+ /*absolute*/
2206
+ o[10] ? "absolute" : "static"
2207
+ ), u[0] & /*absolute*/
2208
+ 1024 && ne(
2209
+ e,
2210
+ "padding",
2211
+ /*absolute*/
2212
+ o[10] ? "0" : "var(--size-8) 0"
2213
+ );
2214
+ },
2215
+ i(o) {
2216
+ f || (oe(n), f = !0);
2217
+ },
2218
+ o(o) {
2219
+ ae(n), f = !1;
2220
+ },
2221
+ d(o) {
2222
+ o && q(e), ~t && r[t].d(), l[33](null);
2223
+ }
2224
+ };
2225
+ }
2226
+ var Rn = function(l, e, t, n) {
2227
+ function i(f) {
2228
+ return f instanceof t ? f : new t(function(a) {
2229
+ a(f);
2230
+ });
2231
+ }
2232
+ return new (t || (t = Promise))(function(f, a) {
2233
+ function r(u) {
2234
+ try {
2235
+ o(n.next(u));
2236
+ } catch (c) {
2237
+ a(c);
2238
+ }
2239
+ }
2240
+ function s(u) {
2241
+ try {
2242
+ o(n.throw(u));
2243
+ } catch (c) {
2244
+ a(c);
2245
+ }
2246
+ }
2247
+ function o(u) {
2248
+ u.done ? f(u.value) : i(u.value).then(r, s);
2249
+ }
2250
+ o((n = n.apply(l, e || [])).next());
2251
+ });
2252
+ };
2253
+ let Se = [], Ae = !1;
2254
+ function Hn(l) {
2255
+ return Rn(this, arguments, void 0, function* (e, t = !0) {
2256
+ if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
2257
+ if (Se.push(e), !Ae)
2258
+ Ae = !0;
2259
+ else
2260
+ return;
2261
+ yield Nn(), requestAnimationFrame(() => {
2262
+ let n = [0, 0];
2263
+ for (let i = 0; i < Se.length; i++) {
2264
+ const a = Se[i].getBoundingClientRect();
2265
+ (i === 0 || a.top + window.scrollY <= n[0]) && (n[0] = a.top + window.scrollY, n[1] = i);
2266
+ }
2267
+ window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), Ae = !1, Se = [];
2268
+ });
2269
+ }
2270
+ });
2271
+ }
2272
+ function Kn(l, e, t) {
2273
+ let n, { $$slots: i = {}, $$scope: f } = e;
2274
+ this && this.__awaiter;
2275
+ const a = Zn();
2276
+ let { i18n: r } = e, { eta: s = null } = e, { queue_position: o } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: b = !1 } = e, { timer: g = !0 } = e, { show_progress: v = "full" } = e, { message: V = null } = e, { progress: k = null } = e, { variant: N = "default" } = e, { loading_text: m = "Loading..." } = e, { absolute: d = !0 } = e, { translucent: L = !1 } = e, { border: M = !1 } = e, { autoscroll: w } = e, j, S = !1, I = 0, y = 0, E = null, J = null, $ = 0, B = null, h, _ = null, ee = !0;
2277
+ const re = () => {
2278
+ t(0, s = t(27, E = t(19, ve = null))), t(25, I = performance.now()), t(26, y = 0), S = !0, He();
2279
+ };
2280
+ function He() {
2281
+ requestAnimationFrame(() => {
2282
+ t(26, y = (performance.now() - I) / 1e3), S && He();
2283
+ });
2284
+ }
2285
+ function Ke() {
2286
+ t(26, y = 0), t(0, s = t(27, E = t(19, ve = null))), S && (S = !1);
2287
+ }
2288
+ In(() => {
2289
+ S && Ke();
2290
+ });
2291
+ let ve = null;
2292
+ function jt(p) {
2293
+ st[p ? "unshift" : "push"](() => {
2294
+ _ = p, t(16, _), t(7, k), t(14, B), t(15, h);
2295
+ });
2296
+ }
2297
+ const Pt = () => {
2298
+ a("clear_status");
2299
+ };
2300
+ function Bt(p) {
2301
+ st[p ? "unshift" : "push"](() => {
2302
+ j = p, t(13, j);
2303
+ });
2304
+ }
2305
+ return l.$$set = (p) => {
2306
+ "i18n" in p && t(1, r = p.i18n), "eta" in p && t(0, s = p.eta), "queue_position" in p && t(2, o = p.queue_position), "queue_size" in p && t(3, u = p.queue_size), "status" in p && t(4, c = p.status), "scroll_to_output" in p && t(22, b = p.scroll_to_output), "timer" in p && t(5, g = p.timer), "show_progress" in p && t(6, v = p.show_progress), "message" in p && t(23, V = p.message), "progress" in p && t(7, k = p.progress), "variant" in p && t(8, N = p.variant), "loading_text" in p && t(9, m = p.loading_text), "absolute" in p && t(10, d = p.absolute), "translucent" in p && t(11, L = p.translucent), "border" in p && t(12, M = p.border), "autoscroll" in p && t(24, w = p.autoscroll), "$$scope" in p && t(29, f = p.$$scope);
2307
+ }, l.$$.update = () => {
2308
+ l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
2309
+ 436207617 && (s === null && t(0, s = E), s != null && E !== s && (t(28, J = (performance.now() - I) / 1e3 + s), t(19, ve = J.toFixed(1)), t(27, E = s))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
2310
+ 335544320 && t(17, $ = J === null || J <= 0 || !y ? null : Math.min(y / J, 1)), l.$$.dirty[0] & /*progress*/
2311
+ 128 && k != null && t(18, ee = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
2312
+ 114816 && (k != null ? t(14, B = k.map((p) => {
2313
+ if (p.index != null && p.length != null)
2314
+ return p.index / p.length;
2315
+ if (p.progress != null)
2316
+ return p.progress;
2317
+ })) : t(14, B = null), B ? (t(15, h = B[B.length - 1]), _ && (h === 0 ? t(16, _.style.transition = "0", _) : t(16, _.style.transition = "150ms", _))) : t(15, h = void 0)), l.$$.dirty[0] & /*status*/
2318
+ 16 && (c === "pending" ? re() : Ke()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
2319
+ 20979728 && j && b && (c === "pending" || c === "complete") && Hn(j, w), l.$$.dirty[0] & /*status, message*/
2320
+ 8388624, l.$$.dirty[0] & /*timer_diff*/
2321
+ 67108864 && t(20, n = y.toFixed(1));
2322
+ }, [
2323
+ s,
2324
+ r,
2325
+ o,
2326
+ u,
2327
+ c,
2328
+ g,
2329
+ v,
2330
+ k,
2331
+ N,
2332
+ m,
2333
+ d,
2334
+ L,
2335
+ M,
2336
+ j,
2337
+ B,
2338
+ h,
2339
+ _,
2340
+ $,
2341
+ ee,
2342
+ ve,
2343
+ n,
2344
+ a,
2345
+ b,
2346
+ V,
2347
+ w,
2348
+ I,
2349
+ y,
2350
+ E,
2351
+ J,
2352
+ f,
2353
+ i,
2354
+ jt,
2355
+ Pt,
2356
+ Bt
2357
+ ];
2358
+ }
2359
+ class Qn extends Cn {
2360
+ constructor(e) {
2361
+ super(), zn(
2362
+ this,
2363
+ e,
2364
+ Kn,
2365
+ Gn,
2366
+ Mn,
2367
+ {
2368
+ i18n: 1,
2369
+ eta: 0,
2370
+ queue_position: 2,
2371
+ queue_size: 3,
2372
+ status: 4,
2373
+ scroll_to_output: 22,
2374
+ timer: 5,
2375
+ show_progress: 6,
2376
+ message: 23,
2377
+ progress: 7,
2378
+ variant: 8,
2379
+ loading_text: 9,
2380
+ absolute: 10,
2381
+ translucent: 11,
2382
+ border: 12,
2383
+ autoscroll: 24
2384
+ },
2385
+ null,
2386
+ [-1, -1]
2387
+ );
2388
+ }
2389
+ }
2390
+ const {
2391
+ SvelteComponent: Un,
2392
+ append: D,
2393
+ assign: Wn,
2394
+ attr: F,
2395
+ create_component: Je,
2396
+ destroy_component: Xe,
2397
+ detach: pe,
2398
+ element: U,
2399
+ get_spread_object: xn,
2400
+ get_spread_update: $n,
2401
+ init: ei,
2402
+ insert: ke,
2403
+ listen: te,
2404
+ mount_component: Ye,
2405
+ run_all: ti,
2406
+ safe_not_equal: li,
2407
+ set_data: ni,
2408
+ set_input_value: le,
2409
+ space: fe,
2410
+ text: ii,
2411
+ to_number: me,
2412
+ transition_in: Ge,
2413
+ transition_out: Re
2414
+ } = window.__gradio__svelte__internal;
2415
+ function fi(l) {
2416
+ let e;
2417
+ return {
2418
+ c() {
2419
+ e = ii(
2420
+ /*label*/
2421
+ l[4]
2422
+ );
2423
+ },
2424
+ m(t, n) {
2425
+ ke(t, e, n);
2426
+ },
2427
+ p(t, n) {
2428
+ n & /*label*/
2429
+ 16 && ni(
2430
+ e,
2431
+ /*label*/
2432
+ t[4]
2433
+ );
2434
+ },
2435
+ d(t) {
2436
+ t && pe(e);
2437
+ }
2438
+ };
2439
+ }
2440
+ function si(l) {
2441
+ let e, t, n, i, f, a, r, s, o, u, c, b, g, v, V, k, N, m, d, L, M, w, j, S, I, y, E, J;
2442
+ const $ = [
2443
+ { autoscroll: (
2444
+ /*gradio*/
2445
+ l[0].autoscroll
2446
+ ) },
2447
+ { i18n: (
2448
+ /*gradio*/
2449
+ l[0].i18n
2450
+ ) },
2451
+ /*loading_status*/
2452
+ l[14]
2453
+ ];
2454
+ let B = {};
2455
+ for (let h = 0; h < $.length; h += 1)
2456
+ B = Wn(B, $[h]);
2457
+ return e = new Qn({ props: B }), e.$on(
2458
+ "clear_status",
2459
+ /*clear_status_handler*/
2460
+ l[23]
2461
+ ), f = new El({
2462
+ props: {
2463
+ show_label: (
2464
+ /*show_label*/
2465
+ l[12]
2466
+ ),
2467
+ info: (
2468
+ /*info*/
2469
+ l[5]
2470
+ ),
2471
+ $$slots: { default: [fi] },
2472
+ $$scope: { ctx: l }
2473
+ }
2474
+ }), {
2475
+ c() {
2476
+ Je(e.$$.fragment), t = fe(), n = U("div"), i = U("div"), Je(f.$$.fragment), a = fe(), r = U("div"), s = U("input"), c = fe(), b = U("input"), V = fe(), k = U("div"), N = U("div"), m = fe(), d = U("div"), L = fe(), M = U("input"), j = fe(), S = U("input"), F(s, "aria-label", o = `max input for ${/*label*/
2477
+ l[4]}`), F(s, "data-testid", "max-input"), F(s, "type", "number"), F(
2478
+ s,
2479
+ "min",
2480
+ /*minimum*/
2481
+ l[9]
2482
+ ), F(
2483
+ s,
2484
+ "max",
2485
+ /*maximum*/
2486
+ l[10]
2487
+ ), s.disabled = u = !/*interactive*/
2488
+ l[13], F(s, "class", "svelte-1dsqogo"), F(b, "aria-label", g = `min input for ${/*label*/
2489
+ l[4]}`), F(b, "data-testid", "min-input"), F(b, "type", "number"), F(
2490
+ b,
2491
+ "min",
2492
+ /*minimum*/
2493
+ l[9]
2494
+ ), F(
2495
+ b,
2496
+ "max",
2497
+ /*maximum*/
2498
+ l[10]
2499
+ ), b.disabled = v = !/*interactive*/
2500
+ l[13], F(b, "class", "svelte-1dsqogo"), F(r, "class", "numbers svelte-1dsqogo"), F(i, "class", "head svelte-1dsqogo"), F(n, "class", "wrap svelte-1dsqogo"), F(N, "class", "range-bg svelte-1dsqogo"), F(d, "class", "range-line svelte-1dsqogo"), F(
2501
+ d,
2502
+ "style",
2503
+ /*rangeLine*/
2504
+ l[17]
2505
+ ), F(M, "type", "range"), M.disabled = w = !/*interactive*/
2506
+ l[13], F(
2507
+ M,
2508
+ "min",
2509
+ /*minimum*/
2510
+ l[9]
2511
+ ), F(
2512
+ M,
2513
+ "max",
2514
+ /*maximum*/
2515
+ l[10]
2516
+ ), F(
2517
+ M,
2518
+ "step",
2519
+ /*step*/
2520
+ l[11]
2521
+ ), F(M, "class", "svelte-1dsqogo"), F(S, "type", "range"), S.disabled = I = !/*interactive*/
2522
+ l[13], F(
2523
+ S,
2524
+ "min",
2525
+ /*minimum*/
2526
+ l[9]
2527
+ ), F(
2528
+ S,
2529
+ "max",
2530
+ /*maximum*/
2531
+ l[10]
2532
+ ), F(
2533
+ S,
2534
+ "step",
2535
+ /*step*/
2536
+ l[11]
2537
+ ), F(S, "class", "svelte-1dsqogo"), F(k, "class", "range-slider svelte-1dsqogo");
2538
+ },
2539
+ m(h, _) {
2540
+ Ye(e, h, _), ke(h, t, _), ke(h, n, _), D(n, i), Ye(f, i, null), D(i, a), D(i, r), D(r, s), le(
2541
+ s,
2542
+ /*selected_max*/
2543
+ l[16]
2544
+ ), D(r, c), D(r, b), le(
2545
+ b,
2546
+ /*selected_min*/
2547
+ l[15]
2548
+ ), ke(h, V, _), ke(h, k, _), D(k, N), D(k, m), D(k, d), D(k, L), D(k, M), le(
2549
+ M,
2550
+ /*selected_min*/
2551
+ l[15]
2552
+ ), D(k, j), D(k, S), le(
2553
+ S,
2554
+ /*selected_max*/
2555
+ l[16]
2556
+ ), y = !0, E || (J = [
2557
+ te(
2558
+ s,
2559
+ "input",
2560
+ /*input0_input_handler*/
2561
+ l[24]
2562
+ ),
2563
+ te(
2564
+ b,
2565
+ "input",
2566
+ /*input1_input_handler*/
2567
+ l[25]
2568
+ ),
2569
+ te(
2570
+ M,
2571
+ "change",
2572
+ /*input2_change_input_handler*/
2573
+ l[26]
2574
+ ),
2575
+ te(
2576
+ M,
2577
+ "input",
2578
+ /*input2_change_input_handler*/
2579
+ l[26]
2580
+ ),
2581
+ te(
2582
+ M,
2583
+ "input",
2584
+ /*handle_min_change*/
2585
+ l[18]
2586
+ ),
2587
+ te(
2588
+ S,
2589
+ "change",
2590
+ /*input3_change_input_handler*/
2591
+ l[27]
2592
+ ),
2593
+ te(
2594
+ S,
2595
+ "input",
2596
+ /*input3_change_input_handler*/
2597
+ l[27]
2598
+ ),
2599
+ te(
2600
+ S,
2601
+ "input",
2602
+ /*handle_max_change*/
2603
+ l[19]
2604
+ )
2605
+ ], E = !0);
2606
+ },
2607
+ p(h, _) {
2608
+ const ee = _ & /*gradio, loading_status*/
2609
+ 16385 ? $n($, [
2610
+ _ & /*gradio*/
2611
+ 1 && { autoscroll: (
2612
+ /*gradio*/
2613
+ h[0].autoscroll
2614
+ ) },
2615
+ _ & /*gradio*/
2616
+ 1 && { i18n: (
2617
+ /*gradio*/
2618
+ h[0].i18n
2619
+ ) },
2620
+ _ & /*loading_status*/
2621
+ 16384 && xn(
2622
+ /*loading_status*/
2623
+ h[14]
2624
+ )
2625
+ ]) : {};
2626
+ e.$set(ee);
2627
+ const re = {};
2628
+ _ & /*show_label*/
2629
+ 4096 && (re.show_label = /*show_label*/
2630
+ h[12]), _ & /*info*/
2631
+ 32 && (re.info = /*info*/
2632
+ h[5]), _ & /*$$scope, label*/
2633
+ 536870928 && (re.$$scope = { dirty: _, ctx: h }), f.$set(re), (!y || _ & /*label*/
2634
+ 16 && o !== (o = `max input for ${/*label*/
2635
+ h[4]}`)) && F(s, "aria-label", o), (!y || _ & /*minimum*/
2636
+ 512) && F(
2637
+ s,
2638
+ "min",
2639
+ /*minimum*/
2640
+ h[9]
2641
+ ), (!y || _ & /*maximum*/
2642
+ 1024) && F(
2643
+ s,
2644
+ "max",
2645
+ /*maximum*/
2646
+ h[10]
2647
+ ), (!y || _ & /*interactive*/
2648
+ 8192 && u !== (u = !/*interactive*/
2649
+ h[13])) && (s.disabled = u), _ & /*selected_max*/
2650
+ 65536 && me(s.value) !== /*selected_max*/
2651
+ h[16] && le(
2652
+ s,
2653
+ /*selected_max*/
2654
+ h[16]
2655
+ ), (!y || _ & /*label*/
2656
+ 16 && g !== (g = `min input for ${/*label*/
2657
+ h[4]}`)) && F(b, "aria-label", g), (!y || _ & /*minimum*/
2658
+ 512) && F(
2659
+ b,
2660
+ "min",
2661
+ /*minimum*/
2662
+ h[9]
2663
+ ), (!y || _ & /*maximum*/
2664
+ 1024) && F(
2665
+ b,
2666
+ "max",
2667
+ /*maximum*/
2668
+ h[10]
2669
+ ), (!y || _ & /*interactive*/
2670
+ 8192 && v !== (v = !/*interactive*/
2671
+ h[13])) && (b.disabled = v), _ & /*selected_min*/
2672
+ 32768 && me(b.value) !== /*selected_min*/
2673
+ h[15] && le(
2674
+ b,
2675
+ /*selected_min*/
2676
+ h[15]
2677
+ ), (!y || _ & /*rangeLine*/
2678
+ 131072) && F(
2679
+ d,
2680
+ "style",
2681
+ /*rangeLine*/
2682
+ h[17]
2683
+ ), (!y || _ & /*interactive*/
2684
+ 8192 && w !== (w = !/*interactive*/
2685
+ h[13])) && (M.disabled = w), (!y || _ & /*minimum*/
2686
+ 512) && F(
2687
+ M,
2688
+ "min",
2689
+ /*minimum*/
2690
+ h[9]
2691
+ ), (!y || _ & /*maximum*/
2692
+ 1024) && F(
2693
+ M,
2694
+ "max",
2695
+ /*maximum*/
2696
+ h[10]
2697
+ ), (!y || _ & /*step*/
2698
+ 2048) && F(
2699
+ M,
2700
+ "step",
2701
+ /*step*/
2702
+ h[11]
2703
+ ), _ & /*selected_min*/
2704
+ 32768 && le(
2705
+ M,
2706
+ /*selected_min*/
2707
+ h[15]
2708
+ ), (!y || _ & /*interactive*/
2709
+ 8192 && I !== (I = !/*interactive*/
2710
+ h[13])) && (S.disabled = I), (!y || _ & /*minimum*/
2711
+ 512) && F(
2712
+ S,
2713
+ "min",
2714
+ /*minimum*/
2715
+ h[9]
2716
+ ), (!y || _ & /*maximum*/
2717
+ 1024) && F(
2718
+ S,
2719
+ "max",
2720
+ /*maximum*/
2721
+ h[10]
2722
+ ), (!y || _ & /*step*/
2723
+ 2048) && F(
2724
+ S,
2725
+ "step",
2726
+ /*step*/
2727
+ h[11]
2728
+ ), _ & /*selected_max*/
2729
+ 65536 && le(
2730
+ S,
2731
+ /*selected_max*/
2732
+ h[16]
2733
+ );
2734
+ },
2735
+ i(h) {
2736
+ y || (Ge(e.$$.fragment, h), Ge(f.$$.fragment, h), y = !0);
2737
+ },
2738
+ o(h) {
2739
+ Re(e.$$.fragment, h), Re(f.$$.fragment, h), y = !1;
2740
+ },
2741
+ d(h) {
2742
+ h && (pe(t), pe(n), pe(V), pe(k)), Xe(e, h), Xe(f), E = !1, ti(J);
2743
+ }
2744
+ };
2745
+ }
2746
+ function oi(l) {
2747
+ let e, t;
2748
+ return e = new ll({
2749
+ props: {
2750
+ visible: (
2751
+ /*visible*/
2752
+ l[3]
2753
+ ),
2754
+ elem_id: (
2755
+ /*elem_id*/
2756
+ l[1]
2757
+ ),
2758
+ elem_classes: (
2759
+ /*elem_classes*/
2760
+ l[2]
2761
+ ),
2762
+ container: (
2763
+ /*container*/
2764
+ l[6]
2765
+ ),
2766
+ scale: (
2767
+ /*scale*/
2768
+ l[7]
2769
+ ),
2770
+ min_width: (
2771
+ /*min_width*/
2772
+ l[8]
2773
+ ),
2774
+ $$slots: { default: [si] },
2775
+ $$scope: { ctx: l }
2776
+ }
2777
+ }), {
2778
+ c() {
2779
+ Je(e.$$.fragment);
2780
+ },
2781
+ m(n, i) {
2782
+ Ye(e, n, i), t = !0;
2783
+ },
2784
+ p(n, [i]) {
2785
+ const f = {};
2786
+ i & /*visible*/
2787
+ 8 && (f.visible = /*visible*/
2788
+ n[3]), i & /*elem_id*/
2789
+ 2 && (f.elem_id = /*elem_id*/
2790
+ n[1]), i & /*elem_classes*/
2791
+ 4 && (f.elem_classes = /*elem_classes*/
2792
+ n[2]), i & /*container*/
2793
+ 64 && (f.container = /*container*/
2794
+ n[6]), i & /*scale*/
2795
+ 128 && (f.scale = /*scale*/
2796
+ n[7]), i & /*min_width*/
2797
+ 256 && (f.min_width = /*min_width*/
2798
+ n[8]), i & /*$$scope, interactive, minimum, maximum, step, selected_max, selected_min, rangeLine, label, show_label, info, gradio, loading_status*/
2799
+ 537132593 && (f.$$scope = { dirty: i, ctx: n }), e.$set(f);
2800
+ },
2801
+ i(n) {
2802
+ t || (Ge(e.$$.fragment, n), t = !0);
2803
+ },
2804
+ o(n) {
2805
+ Re(e.$$.fragment, n), t = !1;
2806
+ },
2807
+ d(n) {
2808
+ Xe(e, n);
2809
+ }
2810
+ };
2811
+ }
2812
+ function ai(l, e, t) {
2813
+ let n, { gradio: i } = e, { elem_id: f = "" } = e, { elem_classes: a = [] } = e, { visible: r = !0 } = e, { value: s } = e, { label: o = i.i18n("slider.slider") } = e, { info: u = void 0 } = e, { container: c = !0 } = e, { scale: b = null } = e, { min_width: g = void 0 } = e, { minimum: v = 0 } = e, { maximum: V = 100 } = e, { step: k } = e, { show_label: N } = e, { interactive: m } = e, { loading_status: d } = e, { value_is_output: L = !1 } = e;
2814
+ function M(_, ee) {
2815
+ t(20, s = [_, ee]), i.dispatch("change", [_, ee]), L || i.dispatch("input", [_, ee]);
2816
+ }
2817
+ function w(_) {
2818
+ t(15, I = parseInt(_.target.value)), I > y && t(16, y = I);
2819
+ }
2820
+ function j(_) {
2821
+ t(16, y = parseInt(_.target.value)), y < I && t(15, I = y);
2822
+ }
2823
+ let S = s, [I, y] = s;
2824
+ const E = () => i.dispatch("clear_status", d);
2825
+ function J() {
2826
+ y = me(this.value), t(16, y), t(22, S), t(20, s);
2827
+ }
2828
+ function $() {
2829
+ I = me(this.value), t(15, I), t(22, S), t(20, s);
2830
+ }
2831
+ function B() {
2832
+ I = me(this.value), t(15, I), t(22, S), t(20, s);
2833
+ }
2834
+ function h() {
2835
+ y = me(this.value), t(16, y), t(22, S), t(20, s);
2836
+ }
2837
+ return l.$$set = (_) => {
2838
+ "gradio" in _ && t(0, i = _.gradio), "elem_id" in _ && t(1, f = _.elem_id), "elem_classes" in _ && t(2, a = _.elem_classes), "visible" in _ && t(3, r = _.visible), "value" in _ && t(20, s = _.value), "label" in _ && t(4, o = _.label), "info" in _ && t(5, u = _.info), "container" in _ && t(6, c = _.container), "scale" in _ && t(7, b = _.scale), "min_width" in _ && t(8, g = _.min_width), "minimum" in _ && t(9, v = _.minimum), "maximum" in _ && t(10, V = _.maximum), "step" in _ && t(11, k = _.step), "show_label" in _ && t(12, N = _.show_label), "interactive" in _ && t(13, m = _.interactive), "loading_status" in _ && t(14, d = _.loading_status), "value_is_output" in _ && t(21, L = _.value_is_output);
2839
+ }, l.$$.update = () => {
2840
+ l.$$.dirty & /*old_value, value*/
2841
+ 5242880 && JSON.stringify(S) !== JSON.stringify(s) && (t(15, [I, y] = s, I, (t(16, y), t(22, S), t(20, s))), t(22, S = s)), l.$$.dirty & /*selected_min, selected_max*/
2842
+ 98304 && M(I, y), l.$$.dirty & /*selected_min, minimum, maximum, selected_max*/
2843
+ 99840 && t(17, n = `
2844
+ left: ${(I - v) / (V - v) * 100}%;
2845
+ width: ${(y - I) / (V - v) * 100}%;
2846
+ `);
2847
+ }, [
2848
+ i,
2849
+ f,
2850
+ a,
2851
+ r,
2852
+ o,
2853
+ u,
2854
+ c,
2855
+ b,
2856
+ g,
2857
+ v,
2858
+ V,
2859
+ k,
2860
+ N,
2861
+ m,
2862
+ d,
2863
+ I,
2864
+ y,
2865
+ n,
2866
+ w,
2867
+ j,
2868
+ s,
2869
+ L,
2870
+ S,
2871
+ E,
2872
+ J,
2873
+ $,
2874
+ B,
2875
+ h
2876
+ ];
2877
+ }
2878
+ class ri extends Un {
2879
+ constructor(e) {
2880
+ super(), ei(this, e, ai, oi, li, {
2881
+ gradio: 0,
2882
+ elem_id: 1,
2883
+ elem_classes: 2,
2884
+ visible: 3,
2885
+ value: 20,
2886
+ label: 4,
2887
+ info: 5,
2888
+ container: 6,
2889
+ scale: 7,
2890
+ min_width: 8,
2891
+ minimum: 9,
2892
+ maximum: 10,
2893
+ step: 11,
2894
+ show_label: 12,
2895
+ interactive: 13,
2896
+ loading_status: 14,
2897
+ value_is_output: 21
2898
+ });
2899
+ }
2900
+ }
2901
+ export {
2902
+ ri as default
2903
+ };
src/backend/gradio_rangeslider/templates/component/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .block.svelte-nl1om8{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-nl1om8{border-color:var(--color-accent)}.block.border_contrast.svelte-nl1om8{border-color:var(--body-text-color)}.padded.svelte-nl1om8{padding:var(--block-padding)}.hidden.svelte-nl1om8{display:none}.hide-container.svelte-nl1om8{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-1lrphxw{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-1lrphxw{opacity:.5;box-shadow:none}button[disabled].svelte-1lrphxw:hover{cursor:not-allowed}.padded.svelte-1lrphxw{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrphxw:hover,button.highlight.svelte-1lrphxw{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrphxw:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrphxw{padding:0 1px;font-size:10px}div.svelte-1lrphxw{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrphxw{width:14px;height:14px}.medium.svelte-1lrphxw{width:20px;height:20px}.large.svelte-1lrphxw{width:22px;height:22px}.pending.svelte-1lrphxw{animation:svelte-1lrphxw-flash .5s infinite}@keyframes svelte-1lrphxw-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrphxw{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.dropdown-arrow.svelte-145leq6{fill:currentColor}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-q32hvf{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;align-items:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;color:var(--block-label-text-color);flex-shrink:0}.show_border.svelte-q32hvf{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden}.wrap.center.svelte-1yk38uw.svelte-1yk38uw{top:0;right:0;left:0}.wrap.default.svelte-1yk38uw.svelte-1yk38uw{top:0;right:0;bottom:0;left:0}.hide.svelte-1yk38uw.svelte-1yk38uw{opacity:0;pointer-events:none}.generating.svelte-1yk38uw.svelte-1yk38uw{animation:svelte-1yk38uw-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1)}.translucent.svelte-1yk38uw.svelte-1yk38uw{background:none}@keyframes svelte-1yk38uw-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1yk38uw.svelte-1yk38uw{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1yk38uw.svelte-1yk38uw{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1yk38uw.svelte-1yk38uw{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1yk38uw.svelte-1yk38uw{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1yk38uw.svelte-1yk38uw{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1yk38uw.svelte-1yk38uw{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1yk38uw.svelte-1yk38uw{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1yk38uw .progress-text.svelte-1yk38uw{background:var(--block-background-fill)}.border.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary)}.clear-status.svelte-1yk38uw.svelte-1yk38uw{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.wrap.svelte-1dsqogo.svelte-1dsqogo{display:flex;flex-direction:column;width:100%}.head.svelte-1dsqogo.svelte-1dsqogo{display:flex;justify-content:space-between}.numbers.svelte-1dsqogo.svelte-1dsqogo{display:flex;flex-direction:row-reverse;max-width:var(--size-6)}input[type=number].svelte-1dsqogo.svelte-1dsqogo{display:block;position:relative;outline:none!important;box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius);background:var(--input-background-fill);padding:var(--size-2) var(--size-2);height:var(--size-6);color:var(--body-text-color);font-size:var(--input-text-size);line-height:var(--line-sm);text-align:center}.range-slider.svelte-1dsqogo.svelte-1dsqogo{position:relative;width:100%;height:30px}.range-slider.svelte-1dsqogo input[type=range].svelte-1dsqogo{position:absolute;left:0;bottom:0;width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;background:transparent;pointer-events:none}.range-slider.svelte-1dsqogo input[type=range].svelte-1dsqogo::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:20px;height:20px;background:#fff;border-radius:50%;border:solid .5px #ddd;pointer-events:auto;cursor:pointer}.range-slider.svelte-1dsqogo input[type=range].svelte-1dsqogo::-moz-range-thumb{width:20px;height:20px;background:#fff;border-radius:50%;border:solid .5px #ddd;pointer-events:auto;cursor:pointer}.range-line.svelte-1dsqogo.svelte-1dsqogo{position:absolute;left:0;bottom:8px;height:4px;background:var(--slider-color);pointer-events:none}.range-bg.svelte-1dsqogo.svelte-1dsqogo{position:absolute;left:0;width:100%;bottom:8px;height:4px;z-index:0;background:var(--neutral-200);pointer-events:none}
src/backend/gradio_rangeslider/templates/example/index.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const {
2
+ SvelteComponent: _,
3
+ attr: g,
4
+ detach: o,
5
+ element: r,
6
+ init: m,
7
+ insert: v,
8
+ noop: f,
9
+ safe_not_equal: y,
10
+ toggle_class: i
11
+ } = window.__gradio__svelte__internal;
12
+ function b(n) {
13
+ let e;
14
+ return {
15
+ c() {
16
+ e = r("div"), e.textContent = `[${/*min*/
17
+ n[2]}, ${/*max*/
18
+ n[3]}]`, g(e, "class", "svelte-1gecy8w"), i(
19
+ e,
20
+ "table",
21
+ /*type*/
22
+ n[0] === "table"
23
+ ), i(
24
+ e,
25
+ "gallery",
26
+ /*type*/
27
+ n[0] === "gallery"
28
+ ), i(
29
+ e,
30
+ "selected",
31
+ /*selected*/
32
+ n[1]
33
+ );
34
+ },
35
+ m(t, l) {
36
+ v(t, e, l);
37
+ },
38
+ p(t, [l]) {
39
+ l & /*type*/
40
+ 1 && i(
41
+ e,
42
+ "table",
43
+ /*type*/
44
+ t[0] === "table"
45
+ ), l & /*type*/
46
+ 1 && i(
47
+ e,
48
+ "gallery",
49
+ /*type*/
50
+ t[0] === "gallery"
51
+ ), l & /*selected*/
52
+ 2 && i(
53
+ e,
54
+ "selected",
55
+ /*selected*/
56
+ t[1]
57
+ );
58
+ },
59
+ i: f,
60
+ o: f,
61
+ d(t) {
62
+ t && o(e);
63
+ }
64
+ };
65
+ }
66
+ function w(n, e, t) {
67
+ let { value: l } = e, { type: s } = e, { selected: c = !1 } = e, [u, d] = l;
68
+ return n.$$set = (a) => {
69
+ "value" in a && t(4, l = a.value), "type" in a && t(0, s = a.type), "selected" in a && t(1, c = a.selected);
70
+ }, [s, c, u, d, l];
71
+ }
72
+ class h extends _ {
73
+ constructor(e) {
74
+ super(), m(this, e, w, b, y, { value: 4, type: 0, selected: 1 });
75
+ }
76
+ }
77
+ export {
78
+ h as default
79
+ };
src/backend/gradio_rangeslider/templates/example/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .gallery.svelte-1gecy8w{padding:var(--size-1) var(--size-2)}
src/demo/__init__.py ADDED
File without changes
src/demo/app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_rangeslider import RangeSlider
4
+ from pathlib import Path
5
+
6
+ text = "## The range is: {min} to {max}"
7
+
8
+ docs = Path(__file__).parent / "docs.md"
9
+
10
+ with gr.Blocks() as demo:
11
+ with gr.Tabs():
12
+ with gr.Tab("Demo"):
13
+ gr.Markdown("""## πŸ› RangeSlider
14
+
15
+ ## Drag either end and see the selected endpoints update in real-time.
16
+ """)
17
+ range_slider = RangeSlider(minimum=0, maximum=100, value=(0, 100))
18
+ range_ = gr.Markdown(value=text.format(min=0, max=100))
19
+ range_slider.change(lambda s: text.format(min=s[0], max=s[1]), range_slider, range_,
20
+ show_progress="hide", trigger_mode="always_last")
21
+ gr.Examples([(20, 30), (40, 80)], inputs=[range_slider])
22
+ with gr.Tab("Docs"):
23
+ gr.Markdown(docs.read_text())
24
+
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch()
src/demo/docs.md ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # `gradio_rangeslider`
2
+ <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
3
+
4
+ πŸ› Slider component for selecting a range of values
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install gradio_rangeslider
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ The `RangeSlider` functions similarly to the core Gradio `Slider` except that it shows two draggable thumbtracks. The `value` of the component is a tuple of the two endpoints of the range.
15
+
16
+ ```python
17
+
18
+ import gradio as gr
19
+ from gradio_rangeslider import RangeSlider
20
+
21
+ text = "## The range is: {min} to {max}"
22
+
23
+ with gr.Blocks() as demo:
24
+ gr.Markdown("""## πŸ› RangeSlider
25
+ Drag either end and see the selected endpoints update in real-time.
26
+ """)
27
+ range_slider = RangeSlider(minimum=0, maximum=100, value=(0, 100))
28
+ range_ = gr.Markdown(value=text.format(min=0, max=100))
29
+ range_slider.change(lambda s: text.format(min=s[0], max=s[1]), range_slider, range_,
30
+ show_progress="hide")
31
+
32
+
33
+
34
+ if __name__ == "__main__":
35
+ demo.launch()
36
+
37
+ ```
38
+
39
+ ## `RangeSlider`
40
+
41
+ ### Initialization
42
+
43
+ <table>
44
+ <thead>
45
+ <tr>
46
+ <th align="left">name</th>
47
+ <th align="left" style="width: 25%;">type</th>
48
+ <th align="left">default</th>
49
+ <th align="left">description</th>
50
+ </tr>
51
+ </thead>
52
+ <tbody>
53
+ <tr>
54
+ <td align="left"><code>minimum</code></td>
55
+ <td align="left" style="width: 25%;">
56
+
57
+ ```python
58
+ float
59
+ ```
60
+
61
+ </td>
62
+ <td align="left"><code>0</code></td>
63
+ <td align="left">minimum value for slider.</td>
64
+ </tr>
65
+
66
+ <tr>
67
+ <td align="left"><code>maximum</code></td>
68
+ <td align="left" style="width: 25%;">
69
+
70
+ ```python
71
+ float
72
+ ```
73
+
74
+ </td>
75
+ <td align="left"><code>100</code></td>
76
+ <td align="left">maximum value for slider.</td>
77
+ </tr>
78
+
79
+ <tr>
80
+ <td align="left"><code>value</code></td>
81
+ <td align="left" style="width: 25%;">
82
+
83
+ ```python
84
+ tuple[float, float] | Callable | None
85
+ ```
86
+
87
+ </td>
88
+ <td align="left"><code>None</code></td>
89
+ <td align="left">default value. If callable, the function will be called whenever the app loads to set the initial value of the component. Ignored if randomized=True.</td>
90
+ </tr>
91
+
92
+ <tr>
93
+ <td align="left"><code>step</code></td>
94
+ <td align="left" style="width: 25%;">
95
+
96
+ ```python
97
+ float | None
98
+ ```
99
+
100
+ </td>
101
+ <td align="left"><code>None</code></td>
102
+ <td align="left">increment between slider values.</td>
103
+ </tr>
104
+
105
+ <tr>
106
+ <td align="left"><code>label</code></td>
107
+ <td align="left" style="width: 25%;">
108
+
109
+ ```python
110
+ str | None
111
+ ```
112
+
113
+ </td>
114
+ <td align="left"><code>None</code></td>
115
+ <td align="left">The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.</td>
116
+ </tr>
117
+
118
+ <tr>
119
+ <td align="left"><code>info</code></td>
120
+ <td align="left" style="width: 25%;">
121
+
122
+ ```python
123
+ str | None
124
+ ```
125
+
126
+ </td>
127
+ <td align="left"><code>None</code></td>
128
+ <td align="left">additional component description.</td>
129
+ </tr>
130
+
131
+ <tr>
132
+ <td align="left"><code>every</code></td>
133
+ <td align="left" style="width: 25%;">
134
+
135
+ ```python
136
+ float | None
137
+ ```
138
+
139
+ </td>
140
+ <td align="left"><code>None</code></td>
141
+ <td align="left">If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.</td>
142
+ </tr>
143
+
144
+ <tr>
145
+ <td align="left"><code>show_label</code></td>
146
+ <td align="left" style="width: 25%;">
147
+
148
+ ```python
149
+ bool | None
150
+ ```
151
+
152
+ </td>
153
+ <td align="left"><code>None</code></td>
154
+ <td align="left">if True, will display label.</td>
155
+ </tr>
156
+
157
+ <tr>
158
+ <td align="left"><code>container</code></td>
159
+ <td align="left" style="width: 25%;">
160
+
161
+ ```python
162
+ bool
163
+ ```
164
+
165
+ </td>
166
+ <td align="left"><code>True</code></td>
167
+ <td align="left">If True, will place the component in a container - providing some extra padding around the border.</td>
168
+ </tr>
169
+
170
+ <tr>
171
+ <td align="left"><code>scale</code></td>
172
+ <td align="left" style="width: 25%;">
173
+
174
+ ```python
175
+ int | None
176
+ ```
177
+
178
+ </td>
179
+ <td align="left"><code>None</code></td>
180
+ <td align="left">relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.</td>
181
+ </tr>
182
+
183
+ <tr>
184
+ <td align="left"><code>min_width</code></td>
185
+ <td align="left" style="width: 25%;">
186
+
187
+ ```python
188
+ int
189
+ ```
190
+
191
+ </td>
192
+ <td align="left"><code>160</code></td>
193
+ <td align="left">minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.</td>
194
+ </tr>
195
+
196
+ <tr>
197
+ <td align="left"><code>interactive</code></td>
198
+ <td align="left" style="width: 25%;">
199
+
200
+ ```python
201
+ bool | None
202
+ ```
203
+
204
+ </td>
205
+ <td align="left"><code>None</code></td>
206
+ <td align="left">if True, slider will be adjustable; if False, adjusting will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.</td>
207
+ </tr>
208
+
209
+ <tr>
210
+ <td align="left"><code>visible</code></td>
211
+ <td align="left" style="width: 25%;">
212
+
213
+ ```python
214
+ bool
215
+ ```
216
+
217
+ </td>
218
+ <td align="left"><code>True</code></td>
219
+ <td align="left">If False, component will be hidden.</td>
220
+ </tr>
221
+
222
+ <tr>
223
+ <td align="left"><code>elem_id</code></td>
224
+ <td align="left" style="width: 25%;">
225
+
226
+ ```python
227
+ str | None
228
+ ```
229
+
230
+ </td>
231
+ <td align="left"><code>None</code></td>
232
+ <td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
233
+ </tr>
234
+
235
+ <tr>
236
+ <td align="left"><code>elem_classes</code></td>
237
+ <td align="left" style="width: 25%;">
238
+
239
+ ```python
240
+ list[str] | str | None
241
+ ```
242
+
243
+ </td>
244
+ <td align="left"><code>None</code></td>
245
+ <td align="left">An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
246
+ </tr>
247
+
248
+ <tr>
249
+ <td align="left"><code>render</code></td>
250
+ <td align="left" style="width: 25%;">
251
+
252
+ ```python
253
+ bool
254
+ ```
255
+
256
+ </td>
257
+ <td align="left"><code>True</code></td>
258
+ <td align="left">If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>
259
+ </tr>
260
+ </tbody></table>
261
+
262
+
263
+ ### Events
264
+
265
+ | name | description |
266
+ |:-----|:------------|
267
+ | `change` | Triggered when the value of the RangeSlider changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
268
+ | `input` | This listener is triggered when the user changes the value of the RangeSlider. |
269
+
270
+
271
+
272
+ ### User function
273
+
274
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
275
+
276
+ - When used as an Input, the component only impacts the input signature of the user function.
277
+ - When used as an output, the component only impacts the return signature of the user function.
278
+
279
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
280
+
281
+ - **As output:** Is passed, passes slider value as a {float} into the function.
282
+ - **As input:** Should return, expects an {int} or {float} returned from function and sets slider value to it as long as it is within range (otherwise, sets to minimum value).
283
+
284
+ ```python
285
+ def predict(
286
+ value: tuple[float, float]
287
+ ) -> tuple[float, float] | None:
288
+ return value
289
+ ```
290
+
src/demo/requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_rangeslider
src/frontend/Example.svelte ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: number[];
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+
6
+ let [min, max] = value;
7
+ </script>
8
+
9
+ <div
10
+ class:table={type === "table"}
11
+ class:gallery={type === "gallery"}
12
+ class:selected
13
+ >
14
+ [{min}, {max}]
15
+ </div>
16
+
17
+ <style>
18
+ .gallery {
19
+ padding: var(--size-1) var(--size-2);
20
+ }
21
+ </style>
src/frontend/Index.svelte ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script context="module">
2
+ let _id = 0;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import type { Gradio } from "@gradio/utils";
7
+ import { Block, BlockTitle } from "@gradio/atoms";
8
+ import { StatusTracker } from "@gradio/statustracker";
9
+ import type { LoadingStatus } from "@gradio/statustracker";
10
+ import { afterUpdate } from "svelte";
11
+
12
+ export let gradio: Gradio<{
13
+ change: number[];
14
+ input: number[];
15
+ clear_status: LoadingStatus;
16
+ }>;
17
+ export let elem_id = "";
18
+ export let elem_classes: string[] = [];
19
+ export let visible = true;
20
+ export let value: number[];
21
+ export let label = gradio.i18n("slider.slider");
22
+ export let info: string | undefined = undefined;
23
+ export let container = true;
24
+ export let scale: number | null = null;
25
+ export let min_width: number | undefined = undefined;
26
+ export let minimum = 0;
27
+ export let maximum = 100;
28
+ export let step: number;
29
+ export let show_label: boolean;
30
+ export let interactive: boolean;
31
+ export let loading_status: LoadingStatus;
32
+ export let value_is_output = false;
33
+
34
+ function handle_change(selected_min, selected_max): void {
35
+ value = [selected_min, selected_max];
36
+ gradio.dispatch("change", [selected_min, selected_max]);
37
+ if (!value_is_output) {
38
+ gradio.dispatch("input", [selected_min, selected_max])
39
+ }
40
+ }
41
+
42
+ function handle_min_change(event) {
43
+ selected_min = parseInt(event.target.value);
44
+ if (selected_min > selected_max) {
45
+ selected_max = selected_min;
46
+ }
47
+ }
48
+
49
+ function handle_max_change(event) {
50
+ selected_max = parseInt(event.target.value);
51
+ if (selected_max < selected_min) {
52
+ selected_min = selected_max;
53
+ }
54
+ }
55
+
56
+ let old_value = value;
57
+ let [selected_min, selected_max] = value;
58
+
59
+ $: if (JSON.stringify(old_value) !== JSON.stringify(value)) {
60
+ [selected_min, selected_max] = value;
61
+ old_value = value;
62
+ }
63
+
64
+ $: handle_change(selected_min, selected_max);
65
+
66
+ $: rangeLine = `
67
+ left: ${( (selected_min - minimum) / (maximum - minimum)) * 100}%;
68
+ width: ${ ((selected_max - selected_min) / (maximum - minimum)) * 100}%;
69
+ `;
70
+ </script>
71
+
72
+ <Block {visible} {elem_id} {elem_classes} {container} {scale} {min_width}>
73
+ <StatusTracker
74
+ autoscroll={gradio.autoscroll}
75
+ i18n={gradio.i18n}
76
+ {...loading_status}
77
+ on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
78
+ />
79
+
80
+ <div class="wrap">
81
+ <div class="head">
82
+ <BlockTitle {show_label} {info}>{label}</BlockTitle>
83
+ <div class="numbers">
84
+ <input
85
+ aria-label={`max input for ${label}`}
86
+ data-testid="max-input"
87
+ type="number"
88
+ bind:value={selected_max}
89
+ min={minimum}
90
+ max={maximum}
91
+ disabled={!interactive}
92
+ />
93
+ <input
94
+ aria-label={`min input for ${label}`}
95
+ data-testid="min-input"
96
+ type="number"
97
+ bind:value={selected_min}
98
+ min={minimum}
99
+ max={maximum}
100
+ disabled={!interactive}
101
+ />
102
+ </div>
103
+ </div>
104
+ </div>
105
+ <div class="range-slider">
106
+ <div class="range-bg"></div>
107
+ <div class="range-line" style={rangeLine}></div>
108
+ <input type="range" disabled={!interactive} min={minimum} max={maximum} {step} bind:value={selected_min} on:input={handle_min_change} />
109
+ <input type="range" disabled={!interactive} min={minimum} max={maximum} {step} bind:value={selected_max} on:input={handle_max_change} />
110
+ </div>
111
+ </Block>
112
+
113
+ <style>
114
+ .wrap {
115
+ display: flex;
116
+ flex-direction: column;
117
+ width: 100%;
118
+ }
119
+
120
+ .head {
121
+ display: flex;
122
+ justify-content: space-between;
123
+ }
124
+
125
+ .numbers {
126
+ display: flex;
127
+ flex-direction: row-reverse;
128
+ max-width: var(--size-6);
129
+ }
130
+
131
+ input[type="number"] {
132
+ display: block;
133
+ position: relative;
134
+ outline: none !important;
135
+ box-shadow: var(--input-shadow);
136
+ border: var(--input-border-width) solid var(--input-border-color);
137
+ border-radius: var(--input-radius);
138
+ background: var(--input-background-fill);
139
+ padding: var(--size-2) var(--size-2);
140
+ height: var(--size-6);
141
+ color: var(--body-text-color);
142
+ font-size: var(--input-text-size);
143
+ line-height: var(--line-sm);
144
+ text-align: center;
145
+ }
146
+
147
+ .range-slider {
148
+ position: relative;
149
+ width: 100%;
150
+ height: 30px;
151
+ }
152
+
153
+ .range-slider input[type="range"] {
154
+ position: absolute;
155
+ left: 0;
156
+ bottom: 0;
157
+ width: 100%;
158
+ appearance: none;
159
+ outline: none;
160
+ background: transparent;
161
+ pointer-events: none;
162
+ }
163
+
164
+ .range-slider input[type="range"]::-webkit-slider-thumb {
165
+ appearance: none;
166
+ width: 20px;
167
+ height: 20px;
168
+ background: white;
169
+ border-radius: 50%;
170
+ border: solid 0.5px #ddd;
171
+ pointer-events: auto;
172
+ cursor: pointer;
173
+ }
174
+
175
+ .range-slider input[type="range"]::-moz-range-thumb {
176
+ width: 20px;
177
+ height: 20px;
178
+ background: white;
179
+ border-radius: 50%;
180
+ border: solid 0.5px #ddd;
181
+ pointer-events: auto;
182
+ cursor: pointer;
183
+ }
184
+
185
+ .range-line {
186
+ position: absolute;
187
+ left: 0;
188
+ bottom: 8px;
189
+ height: 4px;
190
+ background: var(--slider-color);
191
+ pointer-events: none;
192
+ }
193
+
194
+ .range-bg {
195
+ position: absolute;
196
+ left: 0;
197
+ width: 100%;
198
+ bottom: 8px;
199
+ height: 4px;
200
+ z-index: 0;
201
+ background: var(--neutral-200);
202
+ pointer-events: none;
203
+ }
204
+
205
+ </style>
206
+
207
+
208
+
src/frontend/gradio.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export default {
2
+ plugins: [],
3
+ svelte: {
4
+ preprocess: [],
5
+ },
6
+ };
src/frontend/package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
src/frontend/package.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_rangeslider",
3
+ "version": "0.4.0",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "exports": {
11
+ ".": "./Index.svelte",
12
+ "./example": "./Example.svelte",
13
+ "./package.json": "./package.json"
14
+ },
15
+ "dependencies": {
16
+ "@gradio/atoms": "0.7.1",
17
+ "@gradio/statustracker": "0.5.0",
18
+ "@gradio/utils": "0.4.0"
19
+ },
20
+ "devDependencies": {
21
+ "@gradio/preview": "0.8.3"
22
+ }
23
+ }
src/pyproject.toml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "hatchling",
4
+ "hatch-requirements-txt",
5
+ "hatch-fancy-pypi-readme>=22.5.0",
6
+ ]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "gradio_rangeslider"
11
+ version = "0.0.1"
12
+ description = "πŸ› Slider component for selecting a range of values"
13
+ readme = "README.md"
14
+ license = "apache-2.0"
15
+ requires-python = ">=3.8"
16
+ authors = [{ name = "YOUR NAME", email = "YOUREMAIL@domain.com" }]
17
+ keywords = ["gradio-custom-component", "gradio-template-Slider", "leaderboards", "forms", "filtering", "slider"]
18
+ # Add dependencies here
19
+ dependencies = ["gradio>=4.0,<5.0"]
20
+ classifiers = [
21
+ 'Development Status :: 3 - Alpha',
22
+ 'Operating System :: OS Independent',
23
+ 'Programming Language :: Python :: 3',
24
+ 'Programming Language :: Python :: 3 :: Only',
25
+ 'Programming Language :: Python :: 3.8',
26
+ 'Programming Language :: Python :: 3.9',
27
+ 'Programming Language :: Python :: 3.10',
28
+ 'Programming Language :: Python :: 3.11',
29
+ 'Topic :: Scientific/Engineering',
30
+ 'Topic :: Scientific/Engineering :: Artificial Intelligence',
31
+ 'Topic :: Scientific/Engineering :: Visualization',
32
+ ]
33
+
34
+ # The repository and space URLs are optional, but recommended.
35
+ # Adding a repository URL will create a badge in the auto-generated README that links to the repository.
36
+ # Adding a space URL will create a badge in the auto-generated README that links to the space.
37
+ # This will make it easy for people to find your deployed demo or source code when they
38
+ # encounter your project in the wild.
39
+
40
+ # [project.urls]
41
+ # repository = "your github repository"
42
+ # space = "your space url"
43
+
44
+ [project.optional-dependencies]
45
+ dev = ["build", "twine"]
46
+
47
+ [tool.hatch.build]
48
+ artifacts = ["/backend/gradio_rangeslider/templates", "*.pyi"]
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["/backend/gradio_rangeslider"]